summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2012-01-21 22:11:27 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2012-01-21 22:11:27 (GMT)
commitb5a69e79c579e6e15e2019ffd34ef0e09aeab586 (patch)
treebc6b0aa0776ca51a9b8a4800a7f464866221821f
parent9e53f62be1a171eaf9620958c225d42cf5142a30 (diff)
parentad7beb2cac1563e87171a4d044a6d526527d81d9 (diff)
downloadffmpeg-b5a69e79c579e6e15e2019ffd34ef0e09aeab586.zip
ffmpeg-b5a69e79c579e6e15e2019ffd34ef0e09aeab586.tar.gz
ffmpeg-b5a69e79c579e6e15e2019ffd34ef0e09aeab586.tar.bz2
Merge remote-tracking branch 'qatar/master'
* qatar/master: rtpdec: Use our own SSRC in the SDES field when sending RRs Finalize changelog for 0.8 Release Prepare for 0.8 Release threads: change the default for threads back to 1 threads: update slice_count and slice_offset from user context aviocat: Remove useless includes doc/APIChanges: fill in missing dates and hashes Revert "avserver: fix build after the next bump." mpegaudiodec: switch error detection check to AV_EF_BUFFER lavf: rename fer option and document resulting (f_)err_detect options lavc: rename err_filter option to err_detect and document it mpegvideo: fix invalid memory access for small video dimensions movenc: Reorder entries in the MOVIentry struct, for tigheter packing rtsp: Remove extern declarations for variables that don't exist aviocat: Flush the output before closing Conflicts: Changelog RELEASE libavcodec/mpegaudiodec.c libavcodec/pthread.c libavformat/options.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--RELEASE1
-rw-r--r--avconv.c4
-rw-r--r--doc/APIchanges10
-rw-r--r--ffplay.c2
-rw-r--r--ffserver.c22
-rw-r--r--libavcodec/mpegaudiodec.c4
-rw-r--r--libavcodec/mpegvideo.c12
-rw-r--r--libavcodec/mpegvideo_common.h28
-rw-r--r--libavcodec/options.c12
-rw-r--r--libavcodec/pthread.c24
-rw-r--r--libavformat/movenc.h4
-rw-r--r--libavformat/options.c11
-rw-r--r--libavformat/rtpdec.c2
-rw-r--r--libavformat/rtsp.h3
-rw-r--r--tools/aviocat.c7
15 files changed, 83 insertions, 63 deletions
diff --git a/RELEASE b/RELEASE
index ba03fc9..4fda45b 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1,2 +1 @@
0.9.1.git
-
diff --git a/avconv.c b/avconv.c
index adb6414..59e12ff 100644
--- a/avconv.c
+++ b/avconv.c
@@ -2284,6 +2284,8 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
ist->st->codec->opaque = ist;
}
+ if (!av_dict_get(ist->opts, "threads", NULL, 0))
+ av_dict_set(&ist->opts, "threads", "auto", 0);
if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) {
snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d",
ist->file_index, ist->st->index);
@@ -2574,6 +2576,8 @@ static int transcode_init(OutputFile *output_files,
memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size);
ost->st->codec->subtitle_header_size = dec->subtitle_header_size;
}
+ if (!av_dict_get(ost->opts, "threads", NULL, 0))
+ av_dict_set(&ost->opts, "threads", "auto", 0);
if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) {
snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",
ost->file_index, ost->index);
diff --git a/doc/APIchanges b/doc/APIchanges
index 4dfd6e0..9359162 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,15 +13,15 @@ libavutil: 2011-04-18
API changes, most recent first:
-2012-xx-xx - lavc 53.34.0
+2012-01-15 - lavc 53.34.0
New audio encoding API:
- xxxxxxx Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
+ b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
encoders.
- xxxxxxx Add avcodec_fill_audio_frame() as a convenience function.
- xxxxxxx Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
+ 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function.
+ b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
Add AVCodec.encode2().
-2012-01-xx - xxxxxxx - lavfi 2.15.0
+2012-01-12 - 3167dc9 - lavfi 2.15.0
Add a new installed header -- libavfilter/version.h -- with version macros.
2011-12-08 - a502939 - lavfi 2.52.0
diff --git a/ffplay.c b/ffplay.c
index 4fd8b36..babdcb9 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2266,6 +2266,8 @@ static int stream_component_open(VideoState *is, int stream_index)
}
}
+ if (!av_dict_get(opts, "threads", NULL, 0))
+ av_dict_set(&opts, "threads", "auto", 0);
if (!codec ||
avcodec_open2(avctx, codec, &opts) < 0)
return -1;
diff --git a/ffserver.c b/ffserver.c
index 79463c0..c225a94 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -30,16 +30,13 @@
#include <string.h>
#include <stdlib.h>
#include "libavformat/avformat.h"
-// FIXME those are internal headers, avserver _really_ shouldn't use them
#include "libavformat/ffm.h"
#include "libavformat/network.h"
#include "libavformat/os_support.h"
#include "libavformat/rtpdec.h"
#include "libavformat/rtsp.h"
+// XXX for ffio_open_dyn_packet_buffer, to be removed
#include "libavformat/avio_internal.h"
-#include "libavformat/internal.h"
-#include "libavformat/url.h"
-
#include "libavutil/avstring.h"
#include "libavutil/lfg.h"
#include "libavutil/dict.h"
@@ -877,7 +874,7 @@ static void close_connection(HTTPContext *c)
}
h = c->rtp_handles[i];
if (h)
- ffurl_close(h);
+ url_close(h);
}
ctx = &c->fmt_ctx;
@@ -2258,6 +2255,7 @@ static int http_prepare_data(HTTPContext *c)
* Default value from FFmpeg
* Try to set it use configuration option
*/
+ c->fmt_ctx.preload = (int)(0.5*AV_TIME_BASE);
c->fmt_ctx.max_delay = (int)(0.7*AV_TIME_BASE);
if (avformat_write_header(&c->fmt_ctx, NULL) < 0) {
@@ -2376,7 +2374,7 @@ static int http_prepare_data(HTTPContext *c)
if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP)
max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
else
- max_packet_size = c->rtp_handles[c->packet_stream_index]->max_packet_size;
+ max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
ret = ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size);
} else {
ret = avio_open_dyn_buf(&ctx->pb);
@@ -2529,8 +2527,8 @@ static int http_send_data(HTTPContext *c)
} else {
/* send RTP packet directly in UDP */
c->buffer_ptr += 4;
- ffurl_write(c->rtp_handles[c->packet_stream_index],
- c->buffer_ptr, len);
+ url_write(c->rtp_handles[c->packet_stream_index],
+ c->buffer_ptr, len);
c->buffer_ptr += len;
/* here we continue as we can send several packets per 10 ms slot */
}
@@ -3413,10 +3411,10 @@ static int rtp_new_av_stream(HTTPContext *c,
"rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
}
- if (ffurl_open(&h, ctx->filename, AVIO_FLAG_WRITE, NULL, NULL) < 0)
+ if (url_open(&h, ctx->filename, AVIO_FLAG_WRITE) < 0)
goto fail;
c->rtp_handles[stream_index] = h;
- max_packet_size = h->max_packet_size;
+ max_packet_size = url_get_max_packet_size(h);
break;
case RTSP_LOWER_TRANSPORT_TCP:
/* RTP/TCP case */
@@ -3439,7 +3437,7 @@ static int rtp_new_av_stream(HTTPContext *c,
if (avformat_write_header(ctx, NULL) < 0) {
fail:
if (h)
- ffurl_close(h);
+ url_close(h);
av_free(ctx);
return -1;
}
@@ -3476,7 +3474,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
}
fst->priv_data = av_mallocz(sizeof(FeedData));
fst->index = stream->nb_streams;
- avpriv_set_pts_info(fst, 33, 1, 90000);
+ av_set_pts_info(fst, 33, 1, 90000);
fst->sample_aspect_ratio = codec->sample_aspect_ratio;
stream->streams[stream->nb_streams++] = fst;
return fst;
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 18ef40e..51b1970 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -987,10 +987,10 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
/* skip extension bits */
bits_left = end_pos2 - get_bits_count(&s->gb);
//av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
- if (bits_left < 0 && (s->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT))) {
+ if (bits_left < 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_COMPLIANT))) {
av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
s_index=0;
- } else if (bits_left > 0 && (s->err_recognition & (AV_EF_BITSTREAM|AV_EF_AGGRESSIVE))) {
+ } else if (bits_left > 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_AGGRESSIVE))) {
av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
s_index = 0;
}
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index d97c6a4..74c7c6e 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1805,8 +1805,8 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
src += src_y * stride + src_x;
- if ((unsigned)src_x > h_edge_pos - (!!sx) - w ||
- (unsigned)src_y > (v_edge_pos >> field_based) - (!!sy) - h) {
+ if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w, 0) ||
+ (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1,
(h + 1) << field_based, src_x,
src_y << field_based,
@@ -1907,8 +1907,8 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
- if ((unsigned) src_x > h_edge_pos - (!!sx) - 2 * block_s ||
- (unsigned) src_y > (v_edge_pos >> field_based) - (!!sy) - h) {
+ if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) ||
+ (unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y,
s->linesize, 17, 17 + field_based,
src_x, src_y << field_based, h_edge_pos,
@@ -1990,8 +1990,8 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
offset = src_y * s->uvlinesize + src_x;
ptr = ref_picture[1] + offset;
if (s->flags & CODEC_FLAG_EMU_EDGE) {
- if ((unsigned) src_x > h_edge_pos - (!!sx) - block_s ||
- (unsigned) src_y > v_edge_pos - (!!sy) - block_s) {
+ if ((unsigned) src_x > FFMAX(h_edge_pos - (!!sx) - block_s, 0) ||
+ (unsigned) src_y > FFMAX(v_edge_pos - (!!sy) - block_s, 0)) {
s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
ptr = s->edge_emu_buffer;
diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_common.h
index 93ce265..2b2e34f 100644
--- a/libavcodec/mpegvideo_common.h
+++ b/libavcodec/mpegvideo_common.h
@@ -81,8 +81,8 @@ static inline void gmc1_motion(MpegEncContext *s,
ptr = ref_picture[0] + (src_y * linesize) + src_x;
if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x >= s->h_edge_pos - 17
- || (unsigned)src_y >= s->v_edge_pos - 17){
+ if( (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0)
+ || (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
ptr= s->edge_emu_buffer;
}
@@ -120,8 +120,8 @@ static inline void gmc1_motion(MpegEncContext *s,
offset = (src_y * uvlinesize) + src_x;
ptr = ref_picture[1] + offset;
if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x >= (s->h_edge_pos>>1) - 9
- || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){
+ if( (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0)
+ || (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr= s->edge_emu_buffer;
emu=1;
@@ -221,8 +221,8 @@ static inline int hpel_motion(MpegEncContext *s,
src += src_y * stride + src_x;
if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
- if( (unsigned)src_x > h_edge_pos - (motion_x&1) - w
- || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
+ if( (unsigned)src_x > FFMAX(h_edge_pos - (motion_x&1) - w, 0)
+ || (unsigned)src_y > FFMAX(v_edge_pos - (motion_y&1) - h, 0)){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
src_x, src_y<<field_based, h_edge_pos, s->v_edge_pos);
src= s->edge_emu_buffer;
@@ -307,8 +307,8 @@ if(s->quarter_sample)
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
- if( (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16
- || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
+ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&1) - 16, 0)
+ || (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&1) - h , 0)){
if(is_mpeg12 || s->codec_id == CODEC_ID_MPEG2VIDEO ||
s->codec_id == CODEC_ID_MPEG1VIDEO){
av_log(s->avctx,AV_LOG_DEBUG,
@@ -510,8 +510,8 @@ static inline void qpel_motion(MpegEncContext *s,
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
- if( (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 16
- || (unsigned)src_y > v_edge_pos - (motion_y&3) - h ){
+ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 16, 0)
+ || (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&3) - h , 0)){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
17, 17+field_based, src_x, src_y<<field_based,
s->h_edge_pos, s->v_edge_pos);
@@ -588,8 +588,8 @@ static inline void chroma_4mv_motion(MpegEncContext *s,
offset = src_y * s->uvlinesize + src_x;
ptr = ref_picture[1] + offset;
if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8
- || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){
+ if( (unsigned)src_x > FFMAX((s->h_edge_pos>>1) - (dxy &1) - 8, 0)
+ || (unsigned)src_y > FFMAX((s->v_edge_pos>>1) - (dxy>>1) - 8, 0)){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
9, 9, src_x, src_y,
s->h_edge_pos>>1, s->v_edge_pos>>1);
@@ -760,8 +760,8 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
ptr = ref_picture[0] + (src_y * s->linesize) + (src_x);
if(s->flags&CODEC_FLAG_EMU_EDGE){
- if( (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8
- || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){
+ if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 8, 0)
+ || (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&3) - 8, 0)){
s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr,
s->linesize, 9, 9,
src_x, src_y,
diff --git a/libavcodec/options.c b/libavcodec/options.c
index b1efc86..c780625 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -209,11 +209,11 @@ static const AVOption options[]={
{"very_aggressive", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_VERY_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"},
{"explode", "abort decoding on error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"},
#endif /* FF_API_ER */
-{"err_filter", "set error detection filter flags", OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, "err_filter"},
-{"crccheck", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, "err_filter"},
-{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, "err_filter"},
-{"buffer", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, "err_filter"},
-{"explode", "abort decoding on minor error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, V|D, "err_filter"},
+{"err_detect", "set error detection flags", OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, "err_detect"},
+{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, "err_detect"},
+{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, "err_detect"},
+{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, V|D, "err_detect"},
{"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
{"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
#if FF_API_PARSE_FRAME
@@ -373,7 +373,7 @@ static const AVOption options[]={
{"float", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_AA_FLOAT }, INT_MIN, INT_MAX, V|D, "aa"},
#endif
{"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
-{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|E|D, "threads"},
+{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 1 }, 0, INT_MAX, V|E|D, "threads"},
{"auto", "detect a good number of threads", 0, AV_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"},
{"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
index fe3dbda..e0921e4 100644
--- a/libavcodec/pthread.c
+++ b/libavcodec/pthread.c
@@ -420,7 +420,6 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
dst->has_b_frames = src->has_b_frames;
dst->idct_algo = src->idct_algo;
- dst->slice_count = src->slice_count;
dst->bits_per_coded_sample = src->bits_per_coded_sample;
dst->sample_aspect_ratio = src->sample_aspect_ratio;
@@ -455,8 +454,9 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
*
* @param dst The destination context.
* @param src The source context.
+ * @return 0 on success, negative error code on failure
*/
-static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
+static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
{
#define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s);
dst->flags = src->flags;
@@ -478,6 +478,22 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
dst->frame_number = src->frame_number;
dst->reordered_opaque = src->reordered_opaque;
dst->thread_safe_callbacks = src->thread_safe_callbacks;
+
+ if (src->slice_count && src->slice_offset) {
+ if (dst->slice_count < src->slice_count) {
+ int *tmp = av_realloc(dst->slice_offset, src->slice_count *
+ sizeof(*dst->slice_offset));
+ if (!tmp) {
+ av_free(dst->slice_offset);
+ return AVERROR(ENOMEM);
+ }
+ dst->slice_offset = tmp;
+ }
+ memcpy(dst->slice_offset, src->slice_offset,
+ src->slice_count * sizeof(*dst->slice_offset));
+ }
+ dst->slice_count = src->slice_count;
+ return 0;
#undef copy_fields
}
@@ -588,7 +604,8 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
*/
p = &fctx->threads[fctx->next_decoding];
- update_context_from_user(p->avctx, avctx);
+ err = update_context_from_user(p->avctx, avctx);
+ if (err) return err;
err = submit_packet(p, avpkt);
if (err) return err;
@@ -764,6 +781,7 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count)
if (i) {
av_freep(&p->avctx->priv_data);
av_freep(&p->avctx->internal);
+ av_freep(&p->avctx->slice_offset);
}
av_freep(&p->avctx);
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index f6c95ad..ac6573b 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -40,13 +40,13 @@
#define MODE_IPOD 0x20
typedef struct MOVIentry {
- unsigned int size;
uint64_t pos;
+ int64_t dts;
+ unsigned int size;
unsigned int samplesInChunk;
unsigned int chunkNum; ///< Chunk number if the current entry is a chunk start otherwise 0
unsigned int entries;
int cts;
- int64_t dts;
#define MOV_SYNC_SAMPLE 0x0001
#define MOV_PARTIAL_SYNC_SAMPLE 0x0002
uint32_t flags;
diff --git a/libavformat/options.c b/libavformat/options.c
index 2584153..3e6dccf 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -112,13 +112,18 @@ static const AVOption options[]={
{"fdebug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
{"ts", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"},
{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
-{"fer", "set error detection aggressivity", OFFSET(error_recognition), AV_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
-{"careful", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
-{"explode", "abort decoding on error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"},
{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
{"audio_preload", "microseconds by which audio packets should be interleaved earlier", OFFSET(audio_preload), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX-1, E},
{"chunk_duration", "microseconds for each chunk", OFFSET(max_chunk_duration), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX-1, E},
{"chunk_size", "size in bytes for each chunk", OFFSET(max_chunk_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX-1, E},
+/* this is a crutch for avconv, since it cannot deal with identically named options in different contexts.
+ * to be removed when avconv is fixed */
+{"f_err_detect", "set error detection flags (deprecated; use err_detect, save via avconv)", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
+{"err_detect", "set error detection flags", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
+{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
+{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, D, "err_detect"},
+{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, D, "err_detect"},
+{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, D, "err_detect"},
{NULL},
};
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 95a1eda..7170e97 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -299,7 +299,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
avio_w8(pb, RTCP_SDES);
len = strlen(s->hostname);
avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */
- avio_wb32(pb, s->ssrc);
+ avio_wb32(pb, s->ssrc + 1);
avio_w8(pb, 0x01);
avio_w8(pb, len);
avio_write(pb, s->hostname, len);
diff --git a/libavformat/rtsp.h b/libavformat/rtsp.h
index e11dec9..dd96a41 100644
--- a/libavformat/rtsp.h
+++ b/libavformat/rtsp.h
@@ -405,9 +405,6 @@ typedef struct RTSPStream {
void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
RTSPState *rt, const char *method);
-extern int rtsp_rtp_port_min;
-extern int rtsp_rtp_port_max;
-
/**
* Send a command to the RTSP server without waiting for the reply.
*
diff --git a/tools/aviocat.c b/tools/aviocat.c
index c43c69d..92483c3 100644
--- a/tools/aviocat.c
+++ b/tools/aviocat.c
@@ -19,13 +19,9 @@
*/
#include <stdio.h>
-#include <string.h>
+#include <stdlib.h>
#include <unistd.h>
-#include <sys/stat.h>
#include "libavformat/avformat.h"
-#include "libavformat/riff.h"
-#include "libavutil/intreadwrite.h"
-#include "libavutil/mathematics.h"
static int usage(const char *argv0, int ret)
{
@@ -89,6 +85,7 @@ int main(int argc, char **argv)
}
}
+ avio_flush(output);
avio_close(output);
fail:
avio_close(input);