Browse code

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>

Michael Niedermayer authored on 2012/01/22 07:11:27
Showing 15 changed files
... ...
@@ -1,2 +1 @@
1 1
 0.9.1.git
2
-
... ...
@@ -2284,6 +2284,8 @@ static int init_input_stream(int ist_index, OutputStream *output_streams, int nb
2284 2284
             ist->st->codec->opaque         = ist;
2285 2285
         }
2286 2286
 
2287
+        if (!av_dict_get(ist->opts, "threads", NULL, 0))
2288
+            av_dict_set(&ist->opts, "threads", "auto", 0);
2287 2289
         if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) {
2288 2290
             snprintf(error, error_len, "Error while opening decoder for input stream #%d:%d",
2289 2291
                     ist->file_index, ist->st->index);
... ...
@@ -2574,6 +2576,8 @@ static int transcode_init(OutputFile *output_files,
2574 2574
                 memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size);
2575 2575
                 ost->st->codec->subtitle_header_size = dec->subtitle_header_size;
2576 2576
             }
2577
+            if (!av_dict_get(ost->opts, "threads", NULL, 0))
2578
+                av_dict_set(&ost->opts, "threads", "auto", 0);
2577 2579
             if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) {
2578 2580
                 snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",
2579 2581
                         ost->file_index, ost->index);
... ...
@@ -13,15 +13,15 @@ libavutil:   2011-04-18
13 13
 
14 14
 API changes, most recent first:
15 15
 
16
-2012-xx-xx - lavc 53.34.0
16
+2012-01-15 - lavc 53.34.0
17 17
   New audio encoding API:
18
-  xxxxxxx Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
18
+  b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
19 19
           encoders.
20
-  xxxxxxx Add avcodec_fill_audio_frame() as a convenience function.
21
-  xxxxxxx Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
20
+  5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function.
21
+  b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio().
22 22
           Add AVCodec.encode2().
23 23
 
24
-2012-01-xx - xxxxxxx - lavfi 2.15.0
24
+2012-01-12 - 3167dc9 - lavfi 2.15.0
25 25
   Add a new installed header -- libavfilter/version.h -- with version macros.
26 26
 
27 27
 2011-12-08 - a502939 - lavfi 2.52.0
... ...
@@ -2266,6 +2266,8 @@ static int stream_component_open(VideoState *is, int stream_index)
2266 2266
         }
2267 2267
     }
2268 2268
 
2269
+    if (!av_dict_get(opts, "threads", NULL, 0))
2270
+        av_dict_set(&opts, "threads", "auto", 0);
2269 2271
     if (!codec ||
2270 2272
         avcodec_open2(avctx, codec, &opts) < 0)
2271 2273
         return -1;
... ...
@@ -30,16 +30,13 @@
30 30
 #include <string.h>
31 31
 #include <stdlib.h>
32 32
 #include "libavformat/avformat.h"
33
-// FIXME those are internal headers, avserver _really_ shouldn't use them
34 33
 #include "libavformat/ffm.h"
35 34
 #include "libavformat/network.h"
36 35
 #include "libavformat/os_support.h"
37 36
 #include "libavformat/rtpdec.h"
38 37
 #include "libavformat/rtsp.h"
38
+// XXX for ffio_open_dyn_packet_buffer, to be removed
39 39
 #include "libavformat/avio_internal.h"
40
-#include "libavformat/internal.h"
41
-#include "libavformat/url.h"
42
-
43 40
 #include "libavutil/avstring.h"
44 41
 #include "libavutil/lfg.h"
45 42
 #include "libavutil/dict.h"
... ...
@@ -877,7 +874,7 @@ static void close_connection(HTTPContext *c)
877 877
         }
878 878
         h = c->rtp_handles[i];
879 879
         if (h)
880
-            ffurl_close(h);
880
+            url_close(h);
881 881
     }
882 882
 
883 883
     ctx = &c->fmt_ctx;
... ...
@@ -2258,6 +2255,7 @@ static int http_prepare_data(HTTPContext *c)
2258 2258
          * Default value from FFmpeg
2259 2259
          * Try to set it use configuration option
2260 2260
          */
2261
+        c->fmt_ctx.preload   = (int)(0.5*AV_TIME_BASE);
2261 2262
         c->fmt_ctx.max_delay = (int)(0.7*AV_TIME_BASE);
2262 2263
 
2263 2264
         if (avformat_write_header(&c->fmt_ctx, NULL) < 0) {
... ...
@@ -2376,7 +2374,7 @@ static int http_prepare_data(HTTPContext *c)
2376 2376
                         if (c->rtp_protocol == RTSP_LOWER_TRANSPORT_TCP)
2377 2377
                             max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
2378 2378
                         else
2379
-                            max_packet_size = c->rtp_handles[c->packet_stream_index]->max_packet_size;
2379
+                            max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
2380 2380
                         ret = ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size);
2381 2381
                     } else {
2382 2382
                         ret = avio_open_dyn_buf(&ctx->pb);
... ...
@@ -2529,8 +2527,8 @@ static int http_send_data(HTTPContext *c)
2529 2529
                 } else {
2530 2530
                     /* send RTP packet directly in UDP */
2531 2531
                     c->buffer_ptr += 4;
2532
-                    ffurl_write(c->rtp_handles[c->packet_stream_index],
2533
-                                c->buffer_ptr, len);
2532
+                    url_write(c->rtp_handles[c->packet_stream_index],
2533
+                              c->buffer_ptr, len);
2534 2534
                     c->buffer_ptr += len;
2535 2535
                     /* here we continue as we can send several packets per 10 ms slot */
2536 2536
                 }
... ...
@@ -3413,10 +3411,10 @@ static int rtp_new_av_stream(HTTPContext *c,
3413 3413
                      "rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
3414 3414
         }
3415 3415
 
3416
-        if (ffurl_open(&h, ctx->filename, AVIO_FLAG_WRITE, NULL, NULL) < 0)
3416
+        if (url_open(&h, ctx->filename, AVIO_FLAG_WRITE) < 0)
3417 3417
             goto fail;
3418 3418
         c->rtp_handles[stream_index] = h;
3419
-        max_packet_size = h->max_packet_size;
3419
+        max_packet_size = url_get_max_packet_size(h);
3420 3420
         break;
3421 3421
     case RTSP_LOWER_TRANSPORT_TCP:
3422 3422
         /* RTP/TCP case */
... ...
@@ -3439,7 +3437,7 @@ static int rtp_new_av_stream(HTTPContext *c,
3439 3439
     if (avformat_write_header(ctx, NULL) < 0) {
3440 3440
     fail:
3441 3441
         if (h)
3442
-            ffurl_close(h);
3442
+            url_close(h);
3443 3443
         av_free(ctx);
3444 3444
         return -1;
3445 3445
     }
... ...
@@ -3476,7 +3474,7 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
3476 3476
     }
3477 3477
     fst->priv_data = av_mallocz(sizeof(FeedData));
3478 3478
     fst->index = stream->nb_streams;
3479
-    avpriv_set_pts_info(fst, 33, 1, 90000);
3479
+    av_set_pts_info(fst, 33, 1, 90000);
3480 3480
     fst->sample_aspect_ratio = codec->sample_aspect_ratio;
3481 3481
     stream->streams[stream->nb_streams++] = fst;
3482 3482
     return fst;
... ...
@@ -987,10 +987,10 @@ static int huffman_decode(MPADecodeContext *s, GranuleDef *g,
987 987
     /* skip extension bits */
988 988
     bits_left = end_pos2 - get_bits_count(&s->gb);
989 989
 //av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
990
-    if (bits_left < 0 && (s->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT))) {
990
+    if (bits_left < 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_COMPLIANT))) {
991 991
         av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
992 992
         s_index=0;
993
-    } else if (bits_left > 0 && (s->err_recognition & (AV_EF_BITSTREAM|AV_EF_AGGRESSIVE))) {
993
+    } else if (bits_left > 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_AGGRESSIVE))) {
994 994
         av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
995 995
         s_index = 0;
996 996
     }
... ...
@@ -1805,8 +1805,8 @@ static inline int hpel_motion_lowres(MpegEncContext *s,
1805 1805
 
1806 1806
     src   += src_y * stride + src_x;
1807 1807
 
1808
-    if ((unsigned)src_x >  h_edge_pos - (!!sx) - w ||
1809
-        (unsigned)src_y > (v_edge_pos >> field_based) - (!!sy) - h) {
1808
+    if ((unsigned)src_x > FFMAX( h_edge_pos - (!!sx) - w,                 0) ||
1809
+        (unsigned)src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
1810 1810
         s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w + 1,
1811 1811
                                 (h + 1) << field_based, src_x,
1812 1812
                                 src_y   << field_based,
... ...
@@ -1907,8 +1907,8 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
1907 1907
     ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
1908 1908
     ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
1909 1909
 
1910
-    if ((unsigned) src_x >  h_edge_pos - (!!sx) - 2 * block_s ||
1911
-        (unsigned) src_y > (v_edge_pos >> field_based) - (!!sy) - h) {
1910
+    if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s,       0) ||
1911
+        (unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
1912 1912
         s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y,
1913 1913
                                 s->linesize, 17, 17 + field_based,
1914 1914
                                 src_x, src_y << field_based, h_edge_pos,
... ...
@@ -1990,8 +1990,8 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s,
1990 1990
     offset = src_y * s->uvlinesize + src_x;
1991 1991
     ptr = ref_picture[1] + offset;
1992 1992
     if (s->flags & CODEC_FLAG_EMU_EDGE) {
1993
-        if ((unsigned) src_x > h_edge_pos - (!!sx) - block_s ||
1994
-            (unsigned) src_y > v_edge_pos - (!!sy) - block_s) {
1993
+        if ((unsigned) src_x > FFMAX(h_edge_pos - (!!sx) - block_s, 0) ||
1994
+            (unsigned) src_y > FFMAX(v_edge_pos - (!!sy) - block_s, 0)) {
1995 1995
             s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
1996 1996
                                     9, 9, src_x, src_y, h_edge_pos, v_edge_pos);
1997 1997
             ptr = s->edge_emu_buffer;
... ...
@@ -81,8 +81,8 @@ static inline void gmc1_motion(MpegEncContext *s,
81 81
     ptr = ref_picture[0] + (src_y * linesize) + src_x;
82 82
 
83 83
     if(s->flags&CODEC_FLAG_EMU_EDGE){
84
-        if(   (unsigned)src_x >= s->h_edge_pos - 17
85
-           || (unsigned)src_y >= s->v_edge_pos - 17){
84
+        if(   (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0)
85
+           || (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){
86 86
             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);
87 87
             ptr= s->edge_emu_buffer;
88 88
         }
... ...
@@ -120,8 +120,8 @@ static inline void gmc1_motion(MpegEncContext *s,
120 120
     offset = (src_y * uvlinesize) + src_x;
121 121
     ptr = ref_picture[1] + offset;
122 122
     if(s->flags&CODEC_FLAG_EMU_EDGE){
123
-        if(   (unsigned)src_x >= (s->h_edge_pos>>1) - 9
124
-           || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){
123
+        if(   (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0)
124
+           || (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){
125 125
             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);
126 126
             ptr= s->edge_emu_buffer;
127 127
             emu=1;
... ...
@@ -221,8 +221,8 @@ static inline int hpel_motion(MpegEncContext *s,
221 221
     src += src_y * stride + src_x;
222 222
 
223 223
     if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
224
-        if(   (unsigned)src_x > h_edge_pos - (motion_x&1) - w
225
-           || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){
224
+        if(   (unsigned)src_x > FFMAX(h_edge_pos - (motion_x&1) - w, 0)
225
+           || (unsigned)src_y > FFMAX(v_edge_pos - (motion_y&1) - h, 0)){
226 226
             s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<<field_based,
227 227
                              src_x, src_y<<field_based, h_edge_pos, s->v_edge_pos);
228 228
             src= s->edge_emu_buffer;
... ...
@@ -307,8 +307,8 @@ if(s->quarter_sample)
307 307
     ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
308 308
     ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
309 309
 
310
-    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16
311
-       || (unsigned)src_y >    v_edge_pos - (motion_y&1) - h){
310
+    if(   (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&1) - 16, 0)
311
+       || (unsigned)src_y > FFMAX(   v_edge_pos - (motion_y&1) - h , 0)){
312 312
             if(is_mpeg12 || s->codec_id == CODEC_ID_MPEG2VIDEO ||
313 313
                s->codec_id == CODEC_ID_MPEG1VIDEO){
314 314
                 av_log(s->avctx,AV_LOG_DEBUG,
... ...
@@ -510,8 +510,8 @@ static inline void qpel_motion(MpegEncContext *s,
510 510
     ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
511 511
     ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
512 512
 
513
-    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 16
514
-       || (unsigned)src_y >    v_edge_pos - (motion_y&3) - h  ){
513
+    if(   (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 16, 0)
514
+       || (unsigned)src_y > FFMAX(   v_edge_pos - (motion_y&3) - h , 0)){
515 515
         s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
516 516
                             17, 17+field_based, src_x, src_y<<field_based,
517 517
                             s->h_edge_pos, s->v_edge_pos);
... ...
@@ -588,8 +588,8 @@ static inline void chroma_4mv_motion(MpegEncContext *s,
588 588
     offset = src_y * s->uvlinesize + src_x;
589 589
     ptr = ref_picture[1] + offset;
590 590
     if(s->flags&CODEC_FLAG_EMU_EDGE){
591
-        if(   (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8
592
-           || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){
591
+        if(   (unsigned)src_x > FFMAX((s->h_edge_pos>>1) - (dxy &1) - 8, 0)
592
+           || (unsigned)src_y > FFMAX((s->v_edge_pos>>1) - (dxy>>1) - 8, 0)){
593 593
             s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
594 594
                                 9, 9, src_x, src_y,
595 595
                                 s->h_edge_pos>>1, s->v_edge_pos>>1);
... ...
@@ -760,8 +760,8 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
760 760
 
761 761
                 ptr = ref_picture[0] + (src_y * s->linesize) + (src_x);
762 762
                 if(s->flags&CODEC_FLAG_EMU_EDGE){
763
-                    if(   (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8
764
-                       || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){
763
+                    if(   (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 8, 0)
764
+                       || (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&3) - 8, 0)){
765 765
                         s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr,
766 766
                                             s->linesize, 9, 9,
767 767
                                             src_x, src_y,
... ...
@@ -209,11 +209,11 @@ static const AVOption options[]={
209 209
 {"very_aggressive", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_VERY_AGGRESSIVE }, INT_MIN, INT_MAX, V|D, "er"},
210 210
 {"explode", "abort decoding on error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"},
211 211
 #endif /* FF_API_ER */
212
-{"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"},
213
-{"crccheck", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, "err_filter"},
214
-{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, "err_filter"},
215
-{"buffer", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, "err_filter"},
216
-{"explode", "abort decoding on minor error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, V|D, "err_filter"},
212
+{"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"},
213
+{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, V|D, "err_detect"},
214
+{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, V|D, "err_detect"},
215
+{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, V|D, "err_detect"},
216
+{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, V|D, "err_detect"},
217 217
 {"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
218 218
 {"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
219 219
 #if FF_API_PARSE_FRAME
... ...
@@ -373,7 +373,7 @@ static const AVOption options[]={
373 373
 {"float", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_AA_FLOAT }, INT_MIN, INT_MAX, V|D, "aa"},
374 374
 #endif
375 375
 {"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
376
-{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|E|D, "threads"},
376
+{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.dbl = 1 }, 0, INT_MAX, V|E|D, "threads"},
377 377
 {"auto", "detect a good number of threads", 0, AV_OPT_TYPE_CONST, {.dbl = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"},
378 378
 {"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
379 379
 {"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
... ...
@@ -420,7 +420,6 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
420 420
 
421 421
         dst->has_b_frames = src->has_b_frames;
422 422
         dst->idct_algo    = src->idct_algo;
423
-        dst->slice_count  = src->slice_count;
424 423
 
425 424
         dst->bits_per_coded_sample = src->bits_per_coded_sample;
426 425
         dst->sample_aspect_ratio   = src->sample_aspect_ratio;
... ...
@@ -455,8 +454,9 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
455 455
  *
456 456
  * @param dst The destination context.
457 457
  * @param src The source context.
458
+ * @return 0 on success, negative error code on failure
458 459
  */
459
-static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
460
+static int update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
460 461
 {
461 462
 #define copy_fields(s, e) memcpy(&dst->s, &src->s, (char*)&dst->e - (char*)&dst->s);
462 463
     dst->flags          = src->flags;
... ...
@@ -478,6 +478,22 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
478 478
     dst->frame_number     = src->frame_number;
479 479
     dst->reordered_opaque = src->reordered_opaque;
480 480
     dst->thread_safe_callbacks = src->thread_safe_callbacks;
481
+
482
+    if (src->slice_count && src->slice_offset) {
483
+        if (dst->slice_count < src->slice_count) {
484
+            int *tmp = av_realloc(dst->slice_offset, src->slice_count *
485
+                                  sizeof(*dst->slice_offset));
486
+            if (!tmp) {
487
+                av_free(dst->slice_offset);
488
+                return AVERROR(ENOMEM);
489
+            }
490
+            dst->slice_offset = tmp;
491
+        }
492
+        memcpy(dst->slice_offset, src->slice_offset,
493
+               src->slice_count * sizeof(*dst->slice_offset));
494
+    }
495
+    dst->slice_count = src->slice_count;
496
+    return 0;
481 497
 #undef copy_fields
482 498
 }
483 499
 
... ...
@@ -588,7 +604,8 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
588 588
      */
589 589
 
590 590
     p = &fctx->threads[fctx->next_decoding];
591
-    update_context_from_user(p->avctx, avctx);
591
+    err = update_context_from_user(p->avctx, avctx);
592
+    if (err) return err;
592 593
     err = submit_packet(p, avpkt);
593 594
     if (err) return err;
594 595
 
... ...
@@ -764,6 +781,7 @@ static void frame_thread_free(AVCodecContext *avctx, int thread_count)
764 764
         if (i) {
765 765
             av_freep(&p->avctx->priv_data);
766 766
             av_freep(&p->avctx->internal);
767
+            av_freep(&p->avctx->slice_offset);
767 768
         }
768 769
 
769 770
         av_freep(&p->avctx);
... ...
@@ -40,13 +40,13 @@
40 40
 #define MODE_IPOD 0x20
41 41
 
42 42
 typedef struct MOVIentry {
43
-    unsigned int size;
44 43
     uint64_t     pos;
44
+    int64_t      dts;
45
+    unsigned int size;
45 46
     unsigned int samplesInChunk;
46 47
     unsigned int chunkNum;              ///< Chunk number if the current entry is a chunk start otherwise 0
47 48
     unsigned int entries;
48 49
     int          cts;
49
-    int64_t      dts;
50 50
 #define MOV_SYNC_SAMPLE         0x0001
51 51
 #define MOV_PARTIAL_SYNC_SAMPLE 0x0002
52 52
     uint32_t     flags;
... ...
@@ -112,13 +112,18 @@ static const AVOption options[]={
112 112
 {"fdebug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
113 113
 {"ts", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"},
114 114
 {"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
115
-{"fer", "set error detection aggressivity", OFFSET(error_recognition), AV_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
116
-{"careful", NULL, 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
117
-{"explode", "abort decoding on error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = FF_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"},
118 115
 {"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
119 116
 {"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},
120 117
 {"chunk_duration", "microseconds for each chunk", OFFSET(max_chunk_duration), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX-1, E},
121 118
 {"chunk_size", "size in bytes for each chunk", OFFSET(max_chunk_size), AV_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX-1, E},
119
+/* this is a crutch for avconv, since it cannot deal with identically named options in different contexts.
120
+ * to be removed when avconv is fixed */
121
+{"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"},
122
+{"err_detect", "set error detection flags", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
123
+{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"},
124
+{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, D, "err_detect"},
125
+{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_BUFFER }, INT_MIN, INT_MAX, D, "err_detect"},
126
+{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, D, "err_detect"},
122 127
 {NULL},
123 128
 };
124 129
 
... ...
@@ -299,7 +299,7 @@ int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
299 299
     avio_w8(pb, RTCP_SDES);
300 300
     len = strlen(s->hostname);
301 301
     avio_wb16(pb, (6 + len + 3) / 4); /* length in words - 1 */
302
-    avio_wb32(pb, s->ssrc);
302
+    avio_wb32(pb, s->ssrc + 1);
303 303
     avio_w8(pb, 0x01);
304 304
     avio_w8(pb, len);
305 305
     avio_write(pb, s->hostname, len);
... ...
@@ -405,9 +405,6 @@ typedef struct RTSPStream {
405 405
 void ff_rtsp_parse_line(RTSPMessageHeader *reply, const char *buf,
406 406
                         RTSPState *rt, const char *method);
407 407
 
408
-extern int rtsp_rtp_port_min;
409
-extern int rtsp_rtp_port_max;
410
-
411 408
 /**
412 409
  * Send a command to the RTSP server without waiting for the reply.
413 410
  *
... ...
@@ -19,13 +19,9 @@
19 19
  */
20 20
 
21 21
 #include <stdio.h>
22
-#include <string.h>
22
+#include <stdlib.h>
23 23
 #include <unistd.h>
24
-#include <sys/stat.h>
25 24
 #include "libavformat/avformat.h"
26
-#include "libavformat/riff.h"
27
-#include "libavutil/intreadwrite.h"
28
-#include "libavutil/mathematics.h"
29 25
 
30 26
 static int usage(const char *argv0, int ret)
31 27
 {
... ...
@@ -89,6 +85,7 @@ int main(int argc, char **argv)
89 89
         }
90 90
     }
91 91
 
92
+    avio_flush(output);
92 93
     avio_close(output);
93 94
 fail:
94 95
     avio_close(input);