From 734cfa8e8bb66d7a5ae69066fdd219e0a517027d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 25 May 2012 18:20:00 +0200 Subject: [PATCH 001/257] Update for 0.11 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 1 + doc/RELEASE_NOTES | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 VERSION diff --git a/Doxyfile b/Doxyfile index 97896aa071..3841d23602 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = +PROJECT_NUMBER = 0.11 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 8d74bcbc23..51176c7c89 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.10.2.git +0.11 diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..51176c7c89 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.11 diff --git a/doc/RELEASE_NOTES b/doc/RELEASE_NOTES index 135165afa1..782e921f4d 100644 --- a/doc/RELEASE_NOTES +++ b/doc/RELEASE_NOTES @@ -1,7 +1,7 @@ Release Notes ============= -* 0.10 "Freedom" January, 2012 +* 0.11 "Happiness" May, 2012 General notes From 484302d183877bf0dbba616d5e3d3526be00653d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 May 2012 02:28:40 +0200 Subject: [PATCH 002/257] af_aresample: fix request_frame() Fixes part of Ticket1341 Signed-off-by: Michael Niedermayer (cherry picked from commit 411689b5e1189e325f12060e52e7c5cb29f87b21) Signed-off-by: Michael Niedermayer --- libavfilter/af_aresample.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c index 30d6f6ad40..aab118b778 100644 --- a/libavfilter/af_aresample.c +++ b/libavfilter/af_aresample.c @@ -37,6 +37,7 @@ typedef struct { double ratio; struct SwrContext *swr; int64_t next_pts; + int req_fullfilled; } AResampleContext; static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) @@ -208,6 +209,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref } #endif ff_filter_samples(outlink, outsamplesref); + aresample->req_fullfilled= 1; avfilter_unref_buffer(insamplesref); } @@ -216,7 +218,12 @@ static int request_frame(AVFilterLink *outlink) AVFilterContext *ctx = outlink->src; AResampleContext *aresample = ctx->priv; AVFilterLink *const inlink = outlink->src->inputs[0]; - int ret = avfilter_request_frame(ctx->inputs[0]); + int ret; + + aresample->req_fullfilled = 0; + do{ + ret = avfilter_request_frame(ctx->inputs[0]); + }while(!aresample->req_fullfilled && ret>=0); if (ret == AVERROR_EOF) { AVFilterBufferRef *outsamplesref; From 072e7fad8733b7462f74de707b1cf5d06f85aa31 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 May 2012 02:33:38 +0200 Subject: [PATCH 003/257] swr: fix swr_drop_output() Fixes part of Ticket1341 Signed-off-by: Michael Niedermayer (cherry picked from commit 72261fa8675ca6e118efe202fcb13fd0866d4a54) Signed-off-by: Michael Niedermayer --- libswresample/swresample.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libswresample/swresample.c b/libswresample/swresample.c index a0560a19da..27f3581d5f 100644 --- a/libswresample/swresample.c +++ b/libswresample/swresample.c @@ -629,6 +629,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun av_freep(&tmp.data); if(s->drop_output || !out_arg) return 0; + in_count = 0; } if(!in_arg){ From d108d0804a7d9f9a76f59358323ff38196bf4fce Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 May 2012 03:08:44 +0200 Subject: [PATCH 004/257] Changelog, spell out the CVEs that where fixed. there are some holes in the list as some things have been fixed in previous releases already. Signed-off-by: Michael Niedermayer (cherry picked from commit aeb2dea80256379e38cdd5f5e86ae70de8ef5346) Signed-off-by: Michael Niedermayer --- Changelog | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 645449f5d2..18b5d49f6f 100644 --- a/Changelog +++ b/Changelog @@ -4,7 +4,12 @@ releases are sorted from youngest to oldest. version next: version 0.11: -- Fixes CVE-2012-2771 ... 2805 +Fixes:CVE-2012-2772, CVE-2012-2774, CVE-2012-2775, CVE-2012-2776, CVE-2012-2777, + CVE-2012-2779, CVE-2012-2782, CVE-2012-2783, CVE-2012-2784, CVE-2012-2785, + CVE-2012-2786, CVE-2012-2787, CVE-2012-2788, CVE-2012-2789, CVE-2012-2790, + CVE-2012-2791, CVE-2012-2792, CVE-2012-2793, CVE-2012-2794, CVE-2012-2795, + CVE-2012-2796, CVE-2012-2797, CVE-2012-2798, CVE-2012-2799, CVE-2012-2800, + CVE-2012-2801, CVE-2012-2802, CVE-2012-2803, CVE-2012-2804, - v408 Quicktime and Microsoft AYUV Uncompressed 4:4:4:4 encoder and decoder - setfield filter - CDXL demuxer and decoder From 982caeac3eb32e2a31724aaf7164b06c50264d94 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 May 2012 16:17:47 +0200 Subject: [PATCH 005/257] af_aresample: fix pts, they where off by a packet in the -async >0 case. Signed-off-by: Michael Niedermayer (cherry picked from commit be97675e6cf686900ea4ff39251cec94cfe4109c) Signed-off-by: Michael Niedermayer --- libavfilter/af_aresample.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c index aab118b778..8ead3147a9 100644 --- a/libavfilter/af_aresample.c +++ b/libavfilter/af_aresample.c @@ -174,31 +174,9 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref AVFilterLink *const outlink = inlink->dst->outputs[0]; AVFilterBufferRef *outsamplesref = ff_get_audio_buffer(outlink, AV_PERM_WRITE, n_out); - n_out = swr_convert(aresample->swr, outsamplesref->extended_data, n_out, - (void *)insamplesref->extended_data, n_in); - if (n_out <= 0) { - avfilter_unref_buffer(outsamplesref); - avfilter_unref_buffer(insamplesref); - return; - } avfilter_copy_buffer_ref_props(outsamplesref, insamplesref); - outsamplesref->audio->sample_rate = outlink->sample_rate; - outsamplesref->audio->nb_samples = n_out; - -#if 0 - if(insamplesref->pts != AV_NOPTS_VALUE) { - aresample->next_pts = - outsamplesref->pts = av_rescale_q(insamplesref->pts, inlink->time_base, outlink->time_base) - - swr_get_delay(aresample->swr, outlink->time_base.den); - av_assert0(outlink->time_base.num == 1); - } else{ - outsamplesref->pts = AV_NOPTS_VALUE; //aresample->next_pts; - } - if(aresample->next_pts != AV_NOPTS_VALUE) - aresample->next_pts += av_rescale_q(n_out, (AVRational){1 ,outlink->sample_rate}, outlink->time_base); -#else if(insamplesref->pts != AV_NOPTS_VALUE) { int64_t inpts = av_rescale(insamplesref->pts, inlink->time_base.num * (int64_t)outlink->sample_rate * inlink->sample_rate, inlink->time_base.den); int64_t outpts= swr_next_pts(aresample->swr, inpts); @@ -207,7 +185,18 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref } else { outsamplesref->pts = AV_NOPTS_VALUE; } -#endif + + n_out = swr_convert(aresample->swr, outsamplesref->extended_data, n_out, + (void *)insamplesref->extended_data, n_in); + if (n_out <= 0) { + avfilter_unref_buffer(outsamplesref); + avfilter_unref_buffer(insamplesref); + return; + } + + outsamplesref->audio->sample_rate = outlink->sample_rate; + outsamplesref->audio->nb_samples = n_out; + ff_filter_samples(outlink, outsamplesref); aresample->req_fullfilled= 1; avfilter_unref_buffer(insamplesref); From 51157dab374dfc0ec9ac0b4516bfbd18bce19727 Mon Sep 17 00:00:00 2001 From: Alexis Ballier Date: Sat, 26 May 2012 14:06:12 -0400 Subject: [PATCH 006/257] Fix tests without fate samples. Signed-off-by: Michael Niedermayer (cherry picked from commit 0bf90ceb84a0e09cde5a020cd46ed45558b2be58) Signed-off-by: Michael Niedermayer --- tests/fate/video.mak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate/video.mak b/tests/fate/video.mak index 8c42332156..0e043dc97f 100644 --- a/tests/fate/video.mak +++ b/tests/fate/video.mak @@ -97,7 +97,7 @@ fate-dxa-scummvm: CMD = framecrc -i $(SAMPLES)/dxa/scummvm.dxa -pix_fmt rgb24 FATE_VIDEO += $(FATE_DXA) fate-dxa: $(FATE_DXA) -FATE_PCM += fate-film-cvid +FATE_SAMPLES_PCM += fate-film-cvid fate-film-cvid: CMD = framecrc -i $(SAMPLES)/film/logo-capcom.cpk -an FATE_FLIC += fate-flic-af11-palette-change From f8f5db3b700edefdd3a04b05592ab1dde4757ee2 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Thu, 24 May 2012 01:56:28 +0200 Subject: [PATCH 007/257] ffplay: dont destroy packet queues on stream change This fixes occasional segfaults caused by lock request of the packet queue from the reader thread. Also don't allow to put frames into the queue when it's aborted, and don't try to fill the queue with frames when it is aborted. Signed-off-by: Marton Balint (cherry picked from commit a687acbbf0869def24f516b0147e9ff93695c347) Signed-off-by: Michael Niedermayer --- ffplay.c | 68 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 21 deletions(-) diff --git a/ffplay.c b/ffplay.c index b57909b854..40647ac977 100644 --- a/ffplay.c +++ b/ffplay.c @@ -303,13 +303,12 @@ void av_noreturn exit_program(int ret) exit(ret); } -static int packet_queue_put(PacketQueue *q, AVPacket *pkt) +static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt) { AVPacketList *pkt1; - /* duplicate the packet */ - if (pkt != &flush_pkt && av_dup_packet(pkt) < 0) - return -1; + if (q->abort_request) + return -1; pkt1 = av_malloc(sizeof(AVPacketList)); if (!pkt1) @@ -317,11 +316,7 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt) pkt1->pkt = *pkt; pkt1->next = NULL; - - SDL_LockMutex(q->mutex); - if (!q->last_pkt) - q->first_pkt = pkt1; else q->last_pkt->next = pkt1; @@ -330,18 +325,34 @@ static int packet_queue_put(PacketQueue *q, AVPacket *pkt) q->size += pkt1->pkt.size + sizeof(*pkt1); /* XXX: should duplicate packet data in DV case */ SDL_CondSignal(q->cond); - - SDL_UnlockMutex(q->mutex); return 0; } +static int packet_queue_put(PacketQueue *q, AVPacket *pkt) +{ + int ret; + + /* duplicate the packet */ + if (pkt != &flush_pkt && av_dup_packet(pkt) < 0) + return -1; + + SDL_LockMutex(q->mutex); + ret = packet_queue_put_private(q, pkt); + SDL_UnlockMutex(q->mutex); + + if (pkt != &flush_pkt && ret < 0) + av_free_packet(pkt); + + return ret; +} + /* packet queue handling */ static void packet_queue_init(PacketQueue *q) { memset(q, 0, sizeof(PacketQueue)); q->mutex = SDL_CreateMutex(); q->cond = SDL_CreateCond(); - packet_queue_put(q, &flush_pkt); + q->abort_request = 1; } static void packet_queue_flush(PacketQueue *q) @@ -361,7 +372,7 @@ static void packet_queue_flush(PacketQueue *q) SDL_UnlockMutex(q->mutex); } -static void packet_queue_end(PacketQueue *q) +static void packet_queue_destroy(PacketQueue *q) { packet_queue_flush(q); SDL_DestroyMutex(q->mutex); @@ -379,6 +390,14 @@ static void packet_queue_abort(PacketQueue *q) SDL_UnlockMutex(q->mutex); } +static void packet_queue_start(PacketQueue *q) +{ + SDL_LockMutex(q->mutex); + q->abort_request = 0; + packet_queue_put_private(q, &flush_pkt); + SDL_UnlockMutex(q->mutex); +} + /* return < 0 if aborted, 0 if no packet and > 0 if packet. */ static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) { @@ -877,6 +896,9 @@ static void stream_close(VideoState *is) is->abort_request = 1; SDL_WaitThread(is->read_tid, NULL); SDL_WaitThread(is->refresh_tid, NULL); + packet_queue_destroy(&is->videoq); + packet_queue_destroy(&is->audioq); + packet_queue_destroy(&is->subtitleq); /* free all pictures */ for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) { @@ -2343,20 +2365,20 @@ static int stream_component_open(VideoState *is, int stream_index) is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / wanted_spec.freq; memset(&is->audio_pkt, 0, sizeof(is->audio_pkt)); - packet_queue_init(&is->audioq); + packet_queue_start(&is->audioq); SDL_PauseAudio(0); break; case AVMEDIA_TYPE_VIDEO: is->video_stream = stream_index; is->video_st = ic->streams[stream_index]; - packet_queue_init(&is->videoq); + packet_queue_start(&is->videoq); is->video_tid = SDL_CreateThread(video_thread, is); break; case AVMEDIA_TYPE_SUBTITLE: is->subtitle_stream = stream_index; is->subtitle_st = ic->streams[stream_index]; - packet_queue_init(&is->subtitleq); + packet_queue_start(&is->subtitleq); is->subtitle_tid = SDL_CreateThread(subtitle_thread, is); break; @@ -2381,7 +2403,7 @@ static void stream_component_close(VideoState *is, int stream_index) SDL_CloseAudio(); - packet_queue_end(&is->audioq); + packet_queue_flush(&is->audioq); av_free_packet(&is->audio_pkt); if (is->swr_ctx) swr_free(&is->swr_ctx); @@ -2407,7 +2429,7 @@ static void stream_component_close(VideoState *is, int stream_index) SDL_WaitThread(is->video_tid, NULL); - packet_queue_end(&is->videoq); + packet_queue_flush(&is->videoq); break; case AVMEDIA_TYPE_SUBTITLE: packet_queue_abort(&is->subtitleq); @@ -2422,7 +2444,7 @@ static void stream_component_close(VideoState *is, int stream_index) SDL_WaitThread(is->subtitle_tid, NULL); - packet_queue_end(&is->subtitleq); + packet_queue_flush(&is->subtitleq); break; default: break; @@ -2625,9 +2647,9 @@ static int read_thread(void *arg) /* if the queue are full, no need to read more */ if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE - || ( (is->audioq .nb_packets > MIN_FRAMES || is->audio_stream < 0) - && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream < 0) - && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream < 0))) { + || ( (is->audioq .nb_packets > MIN_FRAMES || is->audio_stream < 0 || is->audioq.abort_request) + && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream < 0 || is->videoq.abort_request) + && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream < 0 || is->subtitleq.abort_request))) { /* wait 10 ms */ SDL_Delay(10); continue; @@ -2732,6 +2754,10 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat) is->subpq_mutex = SDL_CreateMutex(); is->subpq_cond = SDL_CreateCond(); + packet_queue_init(&is->videoq); + packet_queue_init(&is->audioq); + packet_queue_init(&is->subtitleq); + is->av_sync_type = av_sync_type; is->read_tid = SDL_CreateThread(read_thread, is); if (!is->read_tid) { From c7c82acf96e2908d375ed433e096c894faf87aac Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Tue, 22 May 2012 00:10:03 +0200 Subject: [PATCH 008/257] ffplay: force exit when filter configuration fails Switching to visualization instead of exiting ffplay is a bit more tricky, so just exit for now. Fixes ticket 38. Signed-off-by: Marton Balint (cherry picked from commit 7315e40a24e85e7f141db77951a4b14375fde55a) Signed-off-by: Michael Niedermayer --- ffplay.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ffplay.c b/ffplay.c index 40647ac977..6352f83bf1 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1838,8 +1838,13 @@ static int video_thread(void *arg) int last_w = is->video_st->codec->width; int last_h = is->video_st->codec->height; - if ((ret = configure_video_filters(graph, is, vfilters)) < 0) + if ((ret = configure_video_filters(graph, is, vfilters)) < 0) { + SDL_Event event; + event.type = FF_QUIT_EVENT; + event.user.data1 = is; + SDL_PushEvent(&event); goto the_end; + } filt_out = is->out_video_filter; #endif From 727749d30f1ddf1f6ca241f3b0e7c5b93433c96f Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Mon, 21 May 2012 23:33:41 +0200 Subject: [PATCH 009/257] ffplay: fix stream cycling if audio decoding fails Fixes ticket 1161. Signed-off-by: Marton Balint (cherry picked from commit 8c9971c35ee8fd01978a592f8f364755494f9a9a) Signed-off-by: Michael Niedermayer --- ffplay.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/ffplay.c b/ffplay.c index 6352f83bf1..7fb28bacee 100644 --- a/ffplay.c +++ b/ffplay.c @@ -232,6 +232,7 @@ typedef struct VideoState { #endif int refresh; + int last_video_stream, last_audio_stream, last_subtitle_stream; } VideoState; typedef struct AllocEventProps { @@ -2267,9 +2268,9 @@ static int stream_component_open(VideoState *is, int stream_index) opts = filter_codec_opts(codec_opts, codec, ic, ic->streams[stream_index]); switch(avctx->codec_type){ - case AVMEDIA_TYPE_AUDIO : if(audio_codec_name ) codec= avcodec_find_decoder_by_name( audio_codec_name); break; - case AVMEDIA_TYPE_SUBTITLE: if(subtitle_codec_name) codec= avcodec_find_decoder_by_name(subtitle_codec_name); break; - case AVMEDIA_TYPE_VIDEO : if(video_codec_name ) codec= avcodec_find_decoder_by_name( video_codec_name); break; + case AVMEDIA_TYPE_AUDIO : is->last_audio_stream = stream_index; if(audio_codec_name ) codec= avcodec_find_decoder_by_name( audio_codec_name); break; + case AVMEDIA_TYPE_SUBTITLE: is->last_subtitle_stream = stream_index; if(subtitle_codec_name) codec= avcodec_find_decoder_by_name(subtitle_codec_name); break; + case AVMEDIA_TYPE_VIDEO : is->last_video_stream = stream_index; if(video_codec_name ) codec= avcodec_find_decoder_by_name( video_codec_name); break; } if (!codec) return -1; @@ -2496,9 +2497,9 @@ static int read_thread(void *arg) int orig_nb_streams; memset(st_index, -1, sizeof(st_index)); - is->video_stream = -1; - is->audio_stream = -1; - is->subtitle_stream = -1; + is->last_video_stream = is->video_stream = -1; + is->last_audio_stream = is->audio_stream = -1; + is->last_subtitle_stream = is->subtitle_stream = -1; ic = avformat_alloc_context(); ic->interrupt_callback.callback = decode_interrupt_cb; @@ -2776,16 +2777,19 @@ static void stream_cycle_channel(VideoState *is, int codec_type) { AVFormatContext *ic = is->ic; int start_index, stream_index; + int old_index; AVStream *st; - if (codec_type == AVMEDIA_TYPE_VIDEO) - start_index = is->video_stream; - else if (codec_type == AVMEDIA_TYPE_AUDIO) - start_index = is->audio_stream; - else - start_index = is->subtitle_stream; - if (start_index < (codec_type == AVMEDIA_TYPE_SUBTITLE ? -1 : 0)) - return; + if (codec_type == AVMEDIA_TYPE_VIDEO) { + start_index = is->last_video_stream; + old_index = is->video_stream; + } else if (codec_type == AVMEDIA_TYPE_AUDIO) { + start_index = is->last_audio_stream; + old_index = is->audio_stream; + } else { + start_index = is->last_subtitle_stream; + old_index = is->subtitle_stream; + } stream_index = start_index; for (;;) { if (++stream_index >= is->ic->nb_streams) @@ -2793,9 +2797,12 @@ static void stream_cycle_channel(VideoState *is, int codec_type) if (codec_type == AVMEDIA_TYPE_SUBTITLE) { stream_index = -1; + is->last_subtitle_stream = -1; goto the_end; - } else - stream_index = 0; + } + if (start_index == -1) + return; + stream_index = 0; } if (stream_index == start_index) return; @@ -2817,7 +2824,7 @@ static void stream_cycle_channel(VideoState *is, int codec_type) } } the_end: - stream_component_close(is, start_index); + stream_component_close(is, old_index); stream_component_open(is, stream_index); } From f6c3fe94daa41aa24a839432d87e857242a343a5 Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Thu, 24 May 2012 23:22:59 +0200 Subject: [PATCH 010/257] ffplay: flush codec buffers before freeing filters We do this to ensure that input_get_buffer is not called from a frame_worker_thread of a multithreaded decoder when we already freed the filters. Fixes occasional segfaults on video stream change. Signed-off-by: Marton Balint (cherry picked from commit c2e8691c07ca52de7b6b00ba8f2b30c56fd786d7) Signed-off-by: Michael Niedermayer --- ffplay.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ffplay.c b/ffplay.c index 7fb28bacee..779c87967a 100644 --- a/ffplay.c +++ b/ffplay.c @@ -1921,6 +1921,7 @@ static int video_thread(void *arg) stream_toggle_pause(is); } the_end: + avcodec_flush_buffers(is->video_st->codec); #if CONFIG_AVFILTER av_freep(&vfilters); avfilter_graph_free(&graph); From 9f2905d299093698305e50b1fc825e6ca5d28c47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 27 May 2012 00:34:09 +0200 Subject: [PATCH 011/257] lavfi/deshake: add libavcodec dependency (dsputil). (cherry picked from commit 5c3f79198c016980b8bd5e876761eb42341c3cec) Signed-off-by: Michael Niedermayer --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 4bd5d89613..f324d8ca09 100755 --- a/configure +++ b/configure @@ -1681,6 +1681,7 @@ boxblur_filter_deps="gpl" colormatrix_filter_deps="gpl" cropdetect_filter_deps="gpl" delogo_filter_deps="gpl" +deshake_filter_deps="avcodec" drawtext_filter_deps="libfreetype" frei0r_filter_deps="frei0r dlopen" frei0r_filter_extralibs='$ldl' From 1ed0a61ea8486b554ca780efa91e560851645e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 27 May 2012 15:28:15 +0200 Subject: [PATCH 012/257] Changelog: fix wrong/inaccurate entries. (cherry picked from commit 80bf2b6e841e51ed1cb073dc0e460749ac19284f) Conflicts: Changelog --- Changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Changelog b/Changelog index 18b5d49f6f..8a37412c26 100644 --- a/Changelog +++ b/Changelog @@ -38,7 +38,7 @@ Fixes:CVE-2012-2772, CVE-2012-2774, CVE-2012-2775, CVE-2012-2776, CVE-2012-2777, - MicroDVD decoder - Avid Meridien (AVUI) encoder and decoder - accept + prefix to -pix_fmt option to disable automatic conversions. -- audio filters support in libavfilter and avconv +- complete audio filtering in libavfilter and ffmpeg - add fps filter - audio split filter - vorbis parser From 88a145738bc3cced72e65faf2a5433bc4eb5fd43 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 May 2012 22:45:52 +0200 Subject: [PATCH 013/257] avienc: create xsub in avi files that are closer to whats in the wild Fixes ticket1332 Signed-off-by: Michael Niedermayer (cherry picked from commit 875851294f7dc3ce5945c6d43b76c5dd1e0ec03d) Signed-off-by: Michael Niedermayer --- libavformat/avienc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 3fb64e97f5..a4795e9ca0 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -255,9 +255,12 @@ static int avi_write_header(AVFormatContext *s) ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); + avpriv_set_pts_info(s->streams[i], 64, au_scale, au_byterate); + if(stream->codec_id == CODEC_ID_XSUB) + au_scale = au_byterate = 0; + avio_wl32(pb, au_scale); /* scale */ avio_wl32(pb, au_byterate); /* rate */ - avpriv_set_pts_info(s->streams[i], 64, au_scale, au_byterate); avio_wl32(pb, 0); /* start */ avist->frames_hdr_strm = avio_tell(pb); /* remember this offset to fill later */ @@ -521,7 +524,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) int size= pkt->size; // av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avist->packet_count, stream_index); - while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count){ + while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != CODEC_ID_XSUB){ AVPacket empty_packet; if(pkt->dts - avist->packet_count > 60000){ From c4e3dd06e8fa12582ec459181fcbd047687f2861 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 28 May 2012 15:58:46 +0200 Subject: [PATCH 014/257] Test extradata size before reading from extradata when decoding avui. (cherry picked from commit 83de4f5fc92b1424c7d77f3411572a9a00eff672) Signed-off-by: Michael Niedermayer --- libavcodec/avuidec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/avuidec.c b/libavcodec/avuidec.c index a1beb37e80..32fd819ea7 100644 --- a/libavcodec/avuidec.c +++ b/libavcodec/avuidec.c @@ -48,8 +48,8 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data, if (pic->data[0]) avctx->release_buffer(avctx, pic); - if (!memcmp(&avctx->extradata[4], "APRGAPRG0001", 12) && - avctx->extradata_size >= 24) + if (avctx->extradata_size >= 24 && + !memcmp(&avctx->extradata[4], "APRGAPRG0001", 12)) interlaced = avctx->extradata[19] != 1; if (avctx->height == 486) { skip = 10; From 0f9098cb187dd080f4aa58d608de1515dca95134 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 16:50:15 +0200 Subject: [PATCH 015/257] cdgraphics: Fix out of array write Fixes Ticket1359 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 1e5c7376c4ed733910845c9a09e272ac7696b1f4) Signed-off-by: Michael Niedermayer --- libavcodec/cdgraphics.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index d0cc2126ef..d7b85100ae 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -280,6 +280,10 @@ static int cdg_decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "buffer too small for decoder\n"); return AVERROR(EINVAL); } + if (buf_size > CDG_HEADER_SIZE + CDG_DATA_SIZE) { + av_log(avctx, AV_LOG_ERROR, "buffer too big for decoder\n"); + return AVERROR(EINVAL); + } ret = avctx->reget_buffer(avctx, &cc->frame); if (ret) { From 7f8059bdfe9cdc00ccd8f8aa3bb0b4a32b6fb5bc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 17:04:38 +0200 Subject: [PATCH 016/257] xan: fix out of array read Fixes ticket1360 Signed-off-by: Michael Niedermayer (cherry picked from commit 01900fcc45e99ee4556e0a5d87ff57b2f150dad4) Signed-off-by: Michael Niedermayer --- libavcodec/xan.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 155dee9595..b39290aedf 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -517,6 +517,10 @@ static int xan_decode_frame(AVCodecContext *avctx, int i; tag = bytestream_get_le32(&buf); size = bytestream_get_be32(&buf); + if(size < 0) { + av_log(avctx, AV_LOG_ERROR, "Invalid tag size %d\n", size); + return AVERROR_INVALIDDATA; + } size = FFMIN(size, buf_end - buf); switch (tag) { case PALT_TAG: From 03f82b5668aa7b7e535ef41cb792cdab37a81d5a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 17:08:06 +0200 Subject: [PATCH 017/257] yop: check for missing extradata Fixes null ptr deref Fixes Ticket1361 Signed-off-by: Michael Niedermayer (cherry picked from commit 77a4c8b959fa9bc6bcaa42b40a0b046cdf3fec38) Signed-off-by: Michael Niedermayer --- libavcodec/yop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/yop.c b/libavcodec/yop.c index 05abb24553..ac17297915 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -89,6 +89,11 @@ static av_cold int yop_decode_init(AVCodecContext *avctx) return -1; } + if (!avctx->extradata) { + av_log(avctx, AV_LOG_ERROR, "extradata missing\n"); + return AVERROR_INVALIDDATA; + } + avctx->pix_fmt = PIX_FMT_PAL8; avcodec_get_frame_defaults(&s->frame); From 59417897bee880be334b0a891f333cb537b01337 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 17:13:10 +0200 Subject: [PATCH 018/257] iff_ilbm: fix null ptr deref Fixes Ticket1362 Signed-off-by: Michael Niedermayer (cherry picked from commit 849d4b041351ef8d77c4231cf417f997e79f9ab7) Signed-off-by: Michael Niedermayer --- libavcodec/iff.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 0a4a983955..8946bf9858 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -191,7 +191,13 @@ static int extract_header(AVCodecContext *const avctx, const uint8_t *buf; unsigned buf_size; IffContext *s = avctx->priv_data; - int palette_size = avctx->extradata_size - AV_RB16(avctx->extradata); + int palette_size; + + if (avctx->extradata_size < 2) { + av_log(avctx, AV_LOG_ERROR, "not enough extradata\n"); + return AVERROR_INVALIDDATA; + } + palette_size = avctx->extradata_size - AV_RB16(avctx->extradata); if (avpkt) { int image_size; @@ -207,8 +213,6 @@ static int extract_header(AVCodecContext *const avctx, return AVERROR_INVALIDDATA; } } else { - if (avctx->extradata_size < 2) - return AVERROR_INVALIDDATA; buf = avctx->extradata; buf_size = bytestream_get_be16(&buf); if (buf_size <= 1 || palette_size < 0) { From c254214ea3a69f021e2f3ce3088ba7e73833013c Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 17:17:49 +0200 Subject: [PATCH 019/257] motionpixels: check extradata size Fixes null ptr derefernce Fixes Ticket1363 Signed-off-by: Michael Niedermayer (cherry picked from commit 50122084a6b3be06781a2b3d8ec036f2d67c32e3) Signed-off-by: Michael Niedermayer --- libavcodec/motionpixels.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 0ff8f3a54f..fc8d440973 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -55,6 +55,11 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) int w4 = (avctx->width + 3) & ~3; int h4 = (avctx->height + 3) & ~3; + if(avctx->extradata_size < 2){ + av_log(avctx, AV_LOG_ERROR, "extradata too small\n"); + return AVERROR_INVALIDDATA; + } + motionpixels_tableinit(); mp->avctx = avctx; ff_dsputil_init(&mp->dsp, avctx); From 61a72fd9c862a5e4260c92687c1ad1d39b84f07b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 17:21:29 +0200 Subject: [PATCH 020/257] jvdec: check videosize Fixes null ptr dereference fixes Ticket1364 Signed-off-by: Michael Niedermayer (cherry picked from commit b4904e804d3b1c56ac4f5d3386b15daae98fca2d) Signed-off-by: Michael Niedermayer --- libavcodec/jvdec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c index d371950b6e..4031fadf15 100644 --- a/libavcodec/jvdec.c +++ b/libavcodec/jvdec.c @@ -143,6 +143,10 @@ static int decode_frame(AVCodecContext *avctx, buf += 5; if (video_size) { + if(video_size < 0) { + av_log(avctx, AV_LOG_ERROR, "video size %d invalid\n", video_size); + return AVERROR_INVALIDDATA; + } if (avctx->reget_buffer(avctx, &s->frame) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; From 3a68e989ec467b5258781325efd2eb6c280c8b8d Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 28 May 2012 18:20:39 +0200 Subject: [PATCH 021/257] Mark avui encoder experimental. Some decoders require the AVID atom that we currently do not write when encoding avui. (cherry picked from commit 77cea13f0521d4c481ab163220017404c1a13f19) Signed-off-by: Michael Niedermayer --- libavcodec/avuienc.c | 1 + tests/codec-regression.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/avuienc.c b/libavcodec/avuienc.c index 51650739b8..30f94b2dea 100644 --- a/libavcodec/avuienc.c +++ b/libavcodec/avuienc.c @@ -107,6 +107,7 @@ AVCodec ff_avui_encoder = { .init = avui_encode_init, .encode2 = avui_encode_frame, .close = avui_encode_close, + .capabilities = CODEC_CAP_EXPERIMENTAL, .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_UYVY422, PIX_FMT_NONE }, .long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"), }; diff --git a/tests/codec-regression.sh b/tests/codec-regression.sh index d1e22becc1..ee99614af7 100755 --- a/tests/codec-regression.sh +++ b/tests/codec-regression.sh @@ -351,7 +351,7 @@ do_video_decoding "" "-sws_flags neighbor+bitexact -pix_fmt yuv420p" fi if [ -n "$do_avui" ] ; then -do_video_encoding avui.mov "-s pal -an -c:v avui -sws_flags neighbor+bitexact" +do_video_encoding avui.mov "-s pal -an -c:v avui -strict experimental -sws_flags neighbor+bitexact" do_video_decoding "" "-s cif -sws_flags neighbor+bitexact -pix_fmt yuv420p" fi From ee50ec19c75476fd97fb5756390cbb05cc38d558 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 28 May 2012 19:05:15 +0200 Subject: [PATCH 022/257] Fix r10k codec for widths that are not multiples of 64. Fixes ticket #1358 (cherry picked from commit 5cd947d81b3b6dcfbb1f42e800270a4da5dbbcac) Signed-off-by: Michael Niedermayer --- libavcodec/r210dec.c | 3 ++- libavcodec/r210enc.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/r210dec.c b/libavcodec/r210dec.c index b81a4f22c7..07dc5886b8 100644 --- a/libavcodec/r210dec.c +++ b/libavcodec/r210dec.c @@ -41,7 +41,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, int h, w; AVFrame *pic = avctx->coded_frame; const uint32_t *src = (const uint32_t *)avpkt->data; - int aligned_width = FFALIGN(avctx->width, 64); + int aligned_width = FFALIGN(avctx->width, + avctx->codec_id == CODEC_ID_R10K ? 1 : 64); uint8_t *dst_line; if (pic->data[0]) diff --git a/libavcodec/r210enc.c b/libavcodec/r210enc.c index 92c9ce31f6..0a7dd332ba 100644 --- a/libavcodec/r210enc.c +++ b/libavcodec/r210enc.c @@ -38,7 +38,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pic, int *got_packet) { int i, j, ret; - int aligned_width = FFALIGN(avctx->width, 64); + int aligned_width = FFALIGN(avctx->width, + avctx->codec_id == CODEC_ID_R10K ? 1 : 64); int pad = (aligned_width - avctx->width) * 4; uint8_t *src_line; uint8_t *dst; From 68efb539e38269c151e684f5a8e455a3ce808b4e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 19:43:34 +0200 Subject: [PATCH 023/257] configure: add asyncts->avresample dependancy Signed-off-by: Michael Niedermayer (cherry picked from commit f0e39889ad4f418655e0b1bd89dade0d7143a9e3) Signed-off-by: Michael Niedermayer --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index f324d8ca09..f90adb6eff 100755 --- a/configure +++ b/configure @@ -1676,6 +1676,7 @@ aconvert_filter_deps="swresample" amovie_filter_deps="avcodec avformat" aresample_filter_deps="swresample" ass_filter_deps="libass" +asyncts_filter_deps="avresample" blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" colormatrix_filter_deps="gpl" From 91fdba3d79c94f9ee187b602e0f7e9522e996bd9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 19:43:57 +0200 Subject: [PATCH 024/257] configure: disable avresample by default avresample is redundant and unneeded Signed-off-by: Michael Niedermayer (cherry picked from commit f2bc2e89548706beee056f40036fc571ea817b80) Signed-off-by: Michael Niedermayer --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/configure b/configure index f90adb6eff..89098fdd5a 100755 --- a/configure +++ b/configure @@ -112,7 +112,7 @@ Component options: --disable-swscale disable libswscale build --disable-postproc disable libpostproc build --disable-avfilter disable video filter support [no] - --disable-avresample disable libavresample build [no] + --enable-avresample enable libavresample build [no] --disable-pthreads disable pthreads [auto] --disable-w32threads disable Win32 threads [auto] --disable-os2threads disable OS/2 threads [auto] @@ -1880,7 +1880,6 @@ enable avcodec enable avdevice enable avfilter enable avformat -enable avresample enable avutil enable postproc enable stripping From 1e78d75d6a73aa0a75859fb7ba48778e360785a8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 15:36:35 +0200 Subject: [PATCH 025/257] configure: openssl is compatible with the LGPL. looking at the license i cannot see why they would be incompatible and researching this matter a bit also turned up no reasons. If i missed something, please dont hesitate to flame me and or revert Signed-off-by: Michael Niedermayer (cherry picked from commit f997ac1c8bc2124c4c6bf33ad17bc6f6cca0f84e) Signed-off-by: Michael Niedermayer --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 89098fdd5a..8718ff6f14 100755 --- a/configure +++ b/configure @@ -2862,7 +2862,7 @@ die_license_disabled gpl x11grab die_license_disabled nonfree libaacplus die_license_disabled nonfree libfaac -die_license_disabled nonfree openssl +enabled gpl && die_license_disabled nonfree openssl die_license_disabled version3 libopencore_amrnb die_license_disabled version3 libopencore_amrwb From 63040dcdddda982726ef16aa728f1148847c8ac4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 15:44:11 +0200 Subject: [PATCH 026/257] configure: fix the wording for gpl incompatible licenses warnings calling the 4 clause BSD license non free is quite a stretch ;) Signed-off-by: Michael Niedermayer (cherry picked from commit d5a17d7f4d03d174c0cc6111fed07ebded0ac6f3) Signed-off-by: Michael Niedermayer --- configure | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 8718ff6f14..4e1a61196a 100755 --- a/configure +++ b/configure @@ -2853,6 +2853,10 @@ die_license_disabled() { enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; } } +die_license_disabled_gpl() { + enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; } +} + die_license_disabled gpl libcdio die_license_disabled gpl libutvideo die_license_disabled gpl libx264 @@ -2862,7 +2866,7 @@ die_license_disabled gpl x11grab die_license_disabled nonfree libaacplus die_license_disabled nonfree libfaac -enabled gpl && die_license_disabled nonfree openssl +enabled gpl && die_license_disabled_gpl nonfree openssl die_license_disabled version3 libopencore_amrnb die_license_disabled version3 libopencore_amrwb From 0e2b69b4e618733e322b4c0c039eeee5150c4504 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Mon, 28 May 2012 21:45:36 +0200 Subject: [PATCH 027/257] lavfi: Fill linesize, sample_rate and channel_layout fields in avfilter_fill_frame_from_audio_buffer_ref. Signed-off-by: Michael Niedermayer (cherry picked from commit c2eae4bae7f5799c0f3cafb0cb189c420782f06c) Signed-off-by: Michael Niedermayer --- libavfilter/avcodec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c index 0ccdc5c0cb..3f79c20dff 100644 --- a/libavfilter/avcodec.c +++ b/libavfilter/avcodec.c @@ -59,10 +59,13 @@ int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame, return AVERROR(EINVAL); memcpy(frame->data, samplesref->data, sizeof(frame->data)); - frame->pkt_pos = samplesref->pos; - frame->format = samplesref->format; - frame->nb_samples = samplesref->audio->nb_samples; - frame->pts = samplesref->pts; + memcpy(frame->linesize, samplesref->linesize, sizeof(frame->linesize)); + frame->pkt_pos = samplesref->pos; + frame->format = samplesref->format; + frame->nb_samples = samplesref->audio->nb_samples; + frame->pts = samplesref->pts; + frame->sample_rate = samplesref->audio->sample_rate; + frame->channel_layout = samplesref->audio->channel_layout; return 0; } From c64bfd7c3d231348b228d4d7260ffeee02995996 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 28 May 2012 23:43:51 +0200 Subject: [PATCH 028/257] lavfi: use getter/setter functions for AVFrame.pkt_pos Signed-off-by: Michael Niedermayer (cherry picked from commit 59a78290b6fee4b52a28a43440dff6880d3102c2) Signed-off-by: Michael Niedermayer --- libavfilter/avcodec.c | 4 ++-- libavfilter/buffer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c index 3f79c20dff..0d87808e6c 100644 --- a/libavfilter/avcodec.c +++ b/libavfilter/avcodec.c @@ -60,7 +60,7 @@ int avfilter_fill_frame_from_audio_buffer_ref(AVFrame *frame, memcpy(frame->data, samplesref->data, sizeof(frame->data)); memcpy(frame->linesize, samplesref->linesize, sizeof(frame->linesize)); - frame->pkt_pos = samplesref->pos; + av_frame_set_pkt_pos(frame, samplesref->pos); frame->format = samplesref->format; frame->nb_samples = samplesref->audio->nb_samples; frame->pts = samplesref->pts; @@ -78,7 +78,7 @@ int avfilter_fill_frame_from_video_buffer_ref(AVFrame *frame, memcpy(frame->data, picref->data, sizeof(frame->data)); memcpy(frame->linesize, picref->linesize, sizeof(frame->linesize)); - frame->pkt_pos = picref->pos; + av_frame_set_pkt_pos(frame, picref->pos); frame->interlaced_frame = picref->video->interlaced; frame->top_field_first = picref->video->top_field_first; frame->key_frame = picref->video->key_frame; diff --git a/libavfilter/buffer.c b/libavfilter/buffer.c index b878be518b..9600f6dddd 100644 --- a/libavfilter/buffer.c +++ b/libavfilter/buffer.c @@ -166,7 +166,7 @@ void avfilter_unref_bufferp(AVFilterBufferRef **ref) int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) { dst->pts = src->pts; - dst->pos = src->pkt_pos; + dst->pos = av_frame_get_pkt_pos(src); dst->format = src->format; switch (dst->type) { From 56e987d2cd75f9e2ca77c08bb59449a11e58a53a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 May 2012 19:16:22 +0200 Subject: [PATCH 029/257] 4xm: fix division by zero caused by bps<8 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 1b8741a6843f3f4667c81c2d63d3182858aa534f) Signed-off-by: Michael Niedermayer --- libavformat/4xm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 19ebffda1a..a794e88916 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -200,6 +200,11 @@ static int fourxm_read_header(AVFormatContext *s) ret = AVERROR_INVALIDDATA; goto fail; } + if(!fourxm->tracks[current_track].adpcm && fourxm->tracks[current_track].bits<8){ + av_log(s, AV_LOG_ERROR, "bits unspecified for non ADPCM\n"); + ret = AVERROR_INVALIDDATA; + goto fail; + } i += 8 + size; /* allocate a new AVStream */ From e0f0486c7fb1ebca86c1cfc3f24d78a62907f630 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 May 2012 19:28:09 +0200 Subject: [PATCH 030/257] movdec: Check count of stts/ctts elements instead of just the pointer. Fixes overreading the array Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 5880d788734d9c4e2dc53c6cdec343ee978d3a3f) Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 222166eb72..a7bb0762c2 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1874,7 +1874,7 @@ static void mov_build_index(MOVContext *mov, AVStream *st) sc->empty_duration = av_rescale(sc->empty_duration, sc->time_scale, mov->time_scale); sc->time_offset = sc->start_time - sc->empty_duration; current_dts = -sc->time_offset; - if (sc->ctts_data && sc->stts_data && + if (sc->ctts_count>0 && sc->stts_count>0 && sc->ctts_data[0].duration / FFMAX(sc->stts_data[0].duration, 1) > 16) { /* more than 16 frames delay, dts are likely wrong this happens with files created by iMovie */ From 3768afd5a56add05fd5eddc6ea551a9cc9799756 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 May 2012 19:50:15 +0200 Subject: [PATCH 031/257] ape: Fix null ptr dereference with files missing a seekatable. Such files are currently not supported as the table is used at several points Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit e7cb161515fc9fb6d30d1681d64d9ba7ad737a4e) Signed-off-by: Michael Niedermayer --- libavformat/ape.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/ape.c b/libavformat/ape.c index 640a7f699b..fff85c4edb 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -278,6 +278,9 @@ static int ape_read_header(AVFormatContext * s) return AVERROR(ENOMEM); for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++) ape->seektable[i] = avio_rl32(pb); + }else{ + av_log(s, AV_LOG_ERROR, "Missing seektable\n"); + return -1; } ape->frames[0].pos = ape->firstframe; From b395bac383a435a111bea237f87e897b7e0111a8 Mon Sep 17 00:00:00 2001 From: Lou Logan Date: Tue, 29 May 2012 17:43:23 -0800 Subject: [PATCH 032/257] lavc: clarify experimental codec message Should be easier for new users to get a working output. Signed-off-by: Michael Niedermayer (cherry picked from commit 73f3f6baffa5386552dbe9a94d56f36286bc26f6) Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 15dd05ac34..2cfe8491fa 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -789,7 +789,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD if (codec->capabilities & CODEC_CAP_EXPERIMENTAL) if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { - av_log(avctx, AV_LOG_ERROR, "Codec is experimental but experimental codecs are not enabled, see -strict -2\n"); + av_log(avctx, AV_LOG_ERROR, "Codec is experimental but experimental codecs are not enabled, try -strict -2\n"); ret = -1; goto free_and_end; } From ba2d20b44984654c565130094a4a55bddbccd2a7 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 29 May 2012 10:37:01 +0000 Subject: [PATCH 033/257] exr: alpha support Signed-off-by: Paul B Mahol (cherry picked from commit d66b0cd5c55c66964df6225ebbc8eb7cd3cc91ad) Signed-off-by: Michael Niedermayer --- libavcodec/exr.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 0ef8db50f4..a9dad21131 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -47,7 +47,7 @@ typedef struct EXRContext { AVFrame picture; int compr; int bits_per_color_id; - int8_t channel_offsets[3]; // 0 = red, 1 = green and 2 = blue + int8_t channel_offsets[4]; // 0 = red, 1 = green, 2 = blue and 3 = alpha } EXRContext; /** @@ -170,6 +170,7 @@ static int decode_frame(AVCodecContext *avctx, s->channel_offsets[0] = -1; s->channel_offsets[1] = -1; s->channel_offsets[2] = -1; + s->channel_offsets[3] = -1; s->bits_per_color_id = -1; if (buf_end - buf < 10) { @@ -209,6 +210,8 @@ static int decode_frame(AVCodecContext *avctx, channel_index = 1; if (!strcmp(buf, "B")) channel_index = 2; + if (!strcmp(buf, "A")) + channel_index = 3; while (bytestream_get_byte(&buf) && buf < channel_list_end) continue; /* skip */ @@ -354,7 +357,10 @@ static int decode_frame(AVCodecContext *avctx, switch (s->bits_per_color_id) { case 2: // 32-bit case 1: // 16-bit - avctx->pix_fmt = PIX_FMT_RGB48; + if (s->channel_offsets[3] >= 0) + avctx->pix_fmt = PIX_FMT_RGBA64; + else + avctx->pix_fmt = PIX_FMT_RGB48; break; // 8-bit case 0: @@ -390,7 +396,7 @@ static int decode_frame(AVCodecContext *avctx, // Zero out the start if ymin is not 0 for (y = 0; y < ymin; y++) { - memset(ptr, 0, avctx->width * 6); + memset(ptr, 0, avctx->width * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components); ptr += stride; } @@ -405,21 +411,27 @@ static int decode_frame(AVCodecContext *avctx, if (line_offset > avpkt->size - xdelta * current_channel_offset) { // Line offset is probably wrong and not inside the buffer av_log(avctx, AV_LOG_WARNING, "Line offset for line %d is out of reach setting it to black\n", y); - memset(ptr_x, 0, avctx->width * 6); + memset(ptr_x, 0, avctx->width * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components); } else { const uint8_t *red_channel_buffer = avpkt->data + line_offset + xdelta * s->channel_offsets[0]; const uint8_t *green_channel_buffer = avpkt->data + line_offset + xdelta * s->channel_offsets[1]; const uint8_t *blue_channel_buffer = avpkt->data + line_offset + xdelta * s->channel_offsets[2]; + const uint8_t *alpha_channel_buffer = 0; + + if (s->channel_offsets[3] >= 0) + alpha_channel_buffer = avpkt->data + line_offset + xdelta * s->channel_offsets[3]; // Zero out the start if xmin is not 0 - memset(ptr_x, 0, xmin * 6); - ptr_x += xmin * 3; + memset(ptr_x, 0, xmin * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components); + ptr_x += xmin * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components; if (s->bits_per_color_id == 2) { // 32-bit for (x = 0; x < xdelta; x++) { *ptr_x++ = exr_flt2uint(bytestream_get_le32(&red_channel_buffer)); *ptr_x++ = exr_flt2uint(bytestream_get_le32(&green_channel_buffer)); *ptr_x++ = exr_flt2uint(bytestream_get_le32(&blue_channel_buffer)); + if (alpha_channel_buffer) + *ptr_x++ = exr_flt2uint(bytestream_get_le32(&alpha_channel_buffer)); } } else { // 16-bit @@ -427,12 +439,14 @@ static int decode_frame(AVCodecContext *avctx, *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&red_channel_buffer)); *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&green_channel_buffer)); *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&blue_channel_buffer)); + if (alpha_channel_buffer) + *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&alpha_channel_buffer)); } } // Zero out the end if xmax+1 is not w - memset(ptr_x, 0, (avctx->width - (xmax + 1)) * 6); - ptr_x += (avctx->width - (xmax + 1)) * 3; + memset(ptr_x, 0, (avctx->width - (xmax + 1)) * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components); + ptr_x += (avctx->width - (xmax + 1)) * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components; } // Move to next line @@ -442,7 +456,7 @@ static int decode_frame(AVCodecContext *avctx, // Zero out the end if ymax+1 is not h for (y = ymax + 1; y < avctx->height; y++) { - memset(ptr, 0, avctx->width * 6); + memset(ptr, 0, avctx->width * 2 * av_pix_fmt_descriptors[avctx->pix_fmt].nb_components); ptr += stride; } From 9dc14fd3f029c2598e69ada1936345ae314f315f Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 30 May 2012 07:50:32 +0000 Subject: [PATCH 034/257] iff: check if there is extradata Fixes #1368. Signed-off-by: Paul B Mahol (cherry picked from commit 8f61526978697e51d3b9e61ea84daf13c42717af) Signed-off-by: Michael Niedermayer --- libavcodec/iff.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/iff.c b/libavcodec/iff.c index 8946bf9858..90cafbd370 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -316,7 +316,12 @@ static av_cold int decode_init(AVCodecContext *avctx) int err; if (avctx->bits_per_coded_sample <= 8) { - int palette_size = avctx->extradata_size - AV_RB16(avctx->extradata); + int palette_size; + + if (avctx->extradata_size >= 2) + palette_size = avctx->extradata_size - AV_RB16(avctx->extradata); + else + palette_size = 0; avctx->pix_fmt = (avctx->bits_per_coded_sample < 8) || (avctx->extradata_size >= 2 && palette_size) ? PIX_FMT_PAL8 : PIX_FMT_GRAY8; } else if (avctx->bits_per_coded_sample <= 32) { From cdcd99eecc220079284a1477fabbbc8455e4a7df Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 30 May 2012 12:07:41 +0000 Subject: [PATCH 035/257] exr: make message about missing feature more useful Signed-off-by: Paul B Mahol (cherry picked from commit f5af8d5e76a5726cbeba905363293c4ac5750c8d) Signed-off-by: Michael Niedermayer --- libavcodec/exr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/exr.c b/libavcodec/exr.c index a9dad21131..a95423f1df 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -305,9 +305,9 @@ static int decode_frame(AVCodecContext *avctx, if (!variable_buffer_data_size) return -1; - switch (*buf) { + s->compr = *buf; + switch (s->compr) { case EXR_RAW: - s->compr = *buf; break; case EXR_RLE: case EXR_ZIP1: @@ -315,7 +315,7 @@ static int decode_frame(AVCodecContext *avctx, case EXR_PIZ: case EXR_B44: default: - av_log(avctx, AV_LOG_ERROR, "This type of compression is not supported\n"); + av_log(avctx, AV_LOG_ERROR, "Compression type %d is not supported\n", s->compr); return -1; } From 8ad71e276c9b2abd8fa4edfe5ba24492b7c6b56f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 May 2012 16:19:36 +0200 Subject: [PATCH 036/257] truemotion1: Check index, fix out of array read Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit fd4c1c0b70b5a06dd572d7e27799a2f4c3d9b984) Signed-off-by: Michael Niedermayer --- libavcodec/truemotion1.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index 3cea70fd28..b4687f193a 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -512,6 +512,10 @@ hres,vres,i,i%vres (0 < i < 4) } #define APPLY_C_PREDICTOR() \ + if(index > 1023){\ + av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \ + return; \ + }\ predictor_pair = s->c_predictor_table[index]; \ horiz_pred += (predictor_pair >> 1); \ if (predictor_pair & 1) { \ @@ -529,6 +533,10 @@ hres,vres,i,i%vres (0 < i < 4) index++; #define APPLY_C_PREDICTOR_24() \ + if(index > 1023){\ + av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \ + return; \ + }\ predictor_pair = s->c_predictor_table[index]; \ horiz_pred += (predictor_pair >> 1); \ if (predictor_pair & 1) { \ @@ -547,6 +555,10 @@ hres,vres,i,i%vres (0 < i < 4) #define APPLY_Y_PREDICTOR() \ + if(index > 1023){\ + av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \ + return; \ + }\ predictor_pair = s->y_predictor_table[index]; \ horiz_pred += (predictor_pair >> 1); \ if (predictor_pair & 1) { \ @@ -564,6 +576,10 @@ hres,vres,i,i%vres (0 < i < 4) index++; #define APPLY_Y_PREDICTOR_24() \ + if(index > 1023){\ + av_log(s->avctx, AV_LOG_ERROR, " index %d went out of bounds\n", index); \ + return; \ + }\ predictor_pair = s->y_predictor_table[index]; \ horiz_pred += (predictor_pair >> 1); \ if (predictor_pair & 1) { \ From 622e926e9cdfa620acced831efaea74b7a290e3d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 May 2012 16:40:33 +0200 Subject: [PATCH 037/257] h264: increase scantable sizes to avoid overread We could also check the index but this would slow speed critical code down. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 32e60b6bfed709a7d84fd35942baee12a6080595) Signed-off-by: Michael Niedermayer --- libavcodec/h264data.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/h264data.h b/libavcodec/h264data.h index 60df532658..b665bca8c5 100644 --- a/libavcodec/h264data.h +++ b/libavcodec/h264data.h @@ -52,18 +52,20 @@ static const uint8_t golomb_to_inter_cbp[48] = { 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41 }; -static const uint8_t zigzag_scan[16] = { +static const uint8_t zigzag_scan[16+1] = { 0 + 0 * 4, 1 + 0 * 4, 0 + 1 * 4, 0 + 2 * 4, 1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4, 1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4, 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4, + 0, }; -static const uint8_t field_scan[16] = { +static const uint8_t field_scan[16+1] = { 0 + 0 * 4, 0 + 1 * 4, 1 + 0 * 4, 0 + 2 * 4, 0 + 3 * 4, 1 + 1 * 4, 1 + 2 * 4, 1 + 3 * 4, 2 + 0 * 4, 2 + 1 * 4, 2 + 2 * 4, 2 + 3 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4, + 0, }; static const uint8_t luma_dc_zigzag_scan[16] = { @@ -93,7 +95,7 @@ static const uint8_t chroma422_dc_scan[8] = { }; // zigzag_scan8x8_cavlc[i] = zigzag_scan8x8[(i/4) + 16*(i%4)] -static const uint8_t zigzag_scan8x8_cavlc[64] = { +static const uint8_t zigzag_scan8x8_cavlc[64+1] = { 0 + 0 * 8, 1 + 1 * 8, 1 + 2 * 8, 2 + 2 * 8, 4 + 1 * 8, 0 + 5 * 8, 3 + 3 * 8, 7 + 0 * 8, 3 + 4 * 8, 1 + 7 * 8, 5 + 3 * 8, 6 + 3 * 8, @@ -110,9 +112,10 @@ static const uint8_t zigzag_scan8x8_cavlc[64] = { 1 + 4 * 8, 2 + 4 * 8, 6 + 0 * 8, 4 + 3 * 8, 0 + 7 * 8, 4 + 4 * 8, 7 + 2 * 8, 3 + 6 * 8, 5 + 5 * 8, 6 + 5 * 8, 6 + 6 * 8, 7 + 7 * 8, + 0, }; -static const uint8_t field_scan8x8[64] = { +static const uint8_t field_scan8x8[64+1] = { 0 + 0 * 8, 0 + 1 * 8, 0 + 2 * 8, 1 + 0 * 8, 1 + 1 * 8, 0 + 3 * 8, 0 + 4 * 8, 1 + 2 * 8, 2 + 0 * 8, 1 + 3 * 8, 0 + 5 * 8, 0 + 6 * 8, @@ -129,9 +132,10 @@ static const uint8_t field_scan8x8[64] = { 7 + 0 * 8, 7 + 1 * 8, 6 + 4 * 8, 6 + 5 * 8, 6 + 6 * 8, 6 + 7 * 8, 7 + 2 * 8, 7 + 3 * 8, 7 + 4 * 8, 7 + 5 * 8, 7 + 6 * 8, 7 + 7 * 8, + 0, }; -static const uint8_t field_scan8x8_cavlc[64] = { +static const uint8_t field_scan8x8_cavlc[64+1] = { 0 + 0 * 8, 1 + 1 * 8, 2 + 0 * 8, 0 + 7 * 8, 2 + 2 * 8, 2 + 3 * 8, 2 + 4 * 8, 3 + 3 * 8, 3 + 4 * 8, 4 + 3 * 8, 4 + 4 * 8, 5 + 3 * 8, @@ -148,6 +152,7 @@ static const uint8_t field_scan8x8_cavlc[64] = { 1 + 7 * 8, 3 + 2 * 8, 2 + 7 * 8, 4 + 2 * 8, 3 + 7 * 8, 5 + 2 * 8, 4 + 7 * 8, 5 + 4 * 8, 6 + 3 * 8, 6 + 5 * 8, 7 + 3 * 8, 7 + 7 * 8, + 0, }; typedef struct IMbInfo { From dff4dbdf6035db4dfb0432f1fef44bb1afdef5c4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 May 2012 16:42:01 +0200 Subject: [PATCH 038/257] h264_cavlc: check prefix before using it. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 39f0a45a1a087e5bbef84fa3366942384ec32155) Signed-off-by: Michael Niedermayer --- libavcodec/h264_cavlc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index a4debade2e..2d62baa13c 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -513,7 +513,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in else level_code= prefix + get_bits(gb, 4); //part }else{ - level_code= 30 + get_bits(gb, prefix-3); //part + level_code= 30; if(prefix>=16){ if(prefix > 25+3){ av_log(h->s.avctx, AV_LOG_ERROR, "Invalid level prefix\n"); @@ -521,6 +521,7 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in } level_code += (1<<(prefix-3))-4096; } + level_code += get_bits(gb, prefix-3); //part } if(trailing_ones < 3) level_code += 2; From a441a96eb26bdaa038781f8b5dca5733584d73dc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 00:46:02 +0200 Subject: [PATCH 039/257] libavformat: ff_get_bmp_header: return esize too Signed-off-by: Michael Niedermayer (cherry picked from commit 76853a3e0ce4d4ef09ffcca7307991b8db832cd4) Signed-off-by: Michael Niedermayer --- libavformat/avidec.c | 3 ++- libavformat/riff.c | 5 +++-- libavformat/riff.h | 2 +- libavformat/wtvdec.c | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 7057a91111..1638e28674 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -578,6 +578,7 @@ static int avi_read_header(AVFormatContext *s) avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); + unsigned esize; if (cur_pos < list_end) size = FFMIN(size, list_end - cur_pos); st = s->streams[stream_index]; @@ -591,7 +592,7 @@ static int avi_read_header(AVFormatContext *s) avio_skip(pb, size); break; } - tag1 = ff_get_bmp_header(pb, st); + tag1 = ff_get_bmp_header(pb, st, &esize); if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D','X','S','A')) { st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; diff --git a/libavformat/riff.c b/libavformat/riff.c index fb3e8ac9dd..c787ec3060 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -652,10 +652,11 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps) return id; } -int ff_get_bmp_header(AVIOContext *pb, AVStream *st) +int ff_get_bmp_header(AVIOContext *pb, AVStream *st, unsigned *esize) { int tag1; - avio_rl32(pb); /* size */ + if(esize) *esize = avio_rl32(pb); + else avio_rl32(pb); st->codec->width = avio_rl32(pb); st->codec->height = (int32_t)avio_rl32(pb); avio_rl16(pb); /* planes */ diff --git a/libavformat/riff.h b/libavformat/riff.h index 67521e25cc..78516df273 100644 --- a/libavformat/riff.h +++ b/libavformat/riff.h @@ -44,7 +44,7 @@ void ff_end_tag(AVIOContext *pb, int64_t start); * bits_per_encoded_sample fields. Does not read extradata. * @return codec tag */ -int ff_get_bmp_header(AVIOContext *pb, AVStream *st); +int ff_get_bmp_header(AVIOContext *pb, AVStream *st, unsigned *esize); void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf); int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc); diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index e25bb5ff54..9157042d08 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -522,7 +522,7 @@ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) AVIOContext *pb = wtv->pb; avio_skip(pb, 72); // picture aspect ratio is unreliable - ff_get_bmp_header(pb, st); + ff_get_bmp_header(pb, st, NULL); return 72 + 40; } From eecbd9a78f38b3eaa04b9e0158b9c65559c3cba9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 00:46:47 +0200 Subject: [PATCH 040/257] avidec: fix odd extradata size case. Signed-off-by: Michael Niedermayer (cherry picked from commit 57778f61d0ae2059ed95567f8e5b568fa817d33e) Signed-off-by: Michael Niedermayer --- libavformat/avidec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 1638e28674..24aacd04fd 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -602,7 +602,8 @@ static int avi_read_header(AVFormatContext *s) } if(size > 10*4 && size<(1<<30) && size < avi->fsize){ - st->codec->extradata_size= size - 10*4; + if(esize == size-1 && (esize&1)) st->codec->extradata_size= esize - 10*4; + else st->codec->extradata_size= size - 10*4; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) { st->codec->extradata_size= 0; From 55a97399bcbcc571d4ca53fcadeb47add21c0283 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 00:47:36 +0200 Subject: [PATCH 041/257] ffv1: fix reading global header with CRC Signed-off-by: Michael Niedermayer (cherry picked from commit 21fdf1ccf0a17410943454a48764ee2b05d4b1ac) Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 901e79e669..bffd744937 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1697,8 +1697,10 @@ static int read_extra_header(FFV1Context *f){ ff_build_rac_states(c, 0.05*(1LL<<32), 256-8); f->version= get_symbol(c, state, 0); - if(f->version > 2) + if(f->version > 2) { + c->bytestream_end -= 4; f->minor_version= get_symbol(c, state, 0); + } f->ac= f->avctx->coder_type= get_symbol(c, state, 0); if(f->ac>1){ for(i=1; i<256; i++){ From ddb92c6df12748154e218a12c0aef6096341ad76 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 05:01:28 +0200 Subject: [PATCH 042/257] indeo5: check quant_mat prevents out of array read Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 8aaa00c3012d425ce50efffadb813ad62d1ff3d5) Signed-off-by: Michael Niedermayer --- libavcodec/indeo5.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/indeo5.c b/libavcodec/indeo5.c index 3c7242a824..e989690644 100644 --- a/libavcodec/indeo5.c +++ b/libavcodec/indeo5.c @@ -199,6 +199,10 @@ static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx) } if (band->blk_size == 8) { + if(quant_mat >= 5){ + av_log(avctx, AV_LOG_ERROR, "quant_mat %d too large!\n", quant_mat); + return -1; + } band->intra_base = &ivi5_base_quant_8x8_intra[quant_mat][0]; band->inter_base = &ivi5_base_quant_8x8_inter[quant_mat][0]; band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0]; From d3d6849d1797ddf25ed3e337c9c79a242669d583 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Thu, 31 May 2012 08:58:31 +0000 Subject: [PATCH 043/257] binkaudio: check number of channels Fixes #1380. Signed-off-by: Paul B Mahol (cherry picked from commit 824a6975ee066e944b7a20d1e220fd8974fb6174) Signed-off-by: Michael Niedermayer --- libavcodec/binkaudio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index eb182d14b3..ee66b8b51e 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -91,9 +91,9 @@ static av_cold int decode_init(AVCodecContext *avctx) frame_len_bits = 11; } - if (avctx->channels > MAX_CHANNELS) { - av_log(avctx, AV_LOG_ERROR, "too many channels: %d\n", avctx->channels); - return -1; + if (avctx->channels < 1 || avctx->channels > MAX_CHANNELS) { + av_log(avctx, AV_LOG_ERROR, "invalid number of channels: %d\n", avctx->channels); + return AVERROR_INVALIDDATA; } s->version_b = avctx->extradata && avctx->extradata[3] == 'b'; From 48094cb23a8222f7e31ddd60a59f84a825837426 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 16:14:27 +0200 Subject: [PATCH 044/257] ac3_probe: speedup by checking for header earlier Signed-off-by: Michael Niedermayer (cherry picked from commit ebfe0c6eb800222955d480b943b646e7a6ee2a1c) Signed-off-by: Michael Niedermayer --- libavformat/ac3dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/ac3dec.c b/libavformat/ac3dec.c index ba05f740fd..3741ee44fc 100644 --- a/libavformat/ac3dec.c +++ b/libavformat/ac3dec.c @@ -37,6 +37,8 @@ static int ac3_eac3_probe(AVProbeData *p, enum CodecID expected_codec_id) end = buf + p->buf_size; for(; buf < end; buf++) { + if(buf > p->buf && (buf[0] != 0x0B || buf[1] != 0x77) ) + continue; buf2 = buf; for(frames = 0; buf2 < end; frames++) { From 0a311df6d96e5155bbfb1824be50f2e2b3f7a30e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 16:19:26 +0200 Subject: [PATCH 045/257] ipmovie_probe: speedup by avoiding memcmp() call Signed-off-by: Michael Niedermayer (cherry picked from commit cc4d80c99ff3169b71c62691d5c7602ef673c3dc) Signed-off-by: Michael Niedermayer --- libavformat/ipmovie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index a60b961573..30ed16dd78 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -529,8 +529,9 @@ static int ipmovie_probe(AVProbeData *p) uint8_t *b = p->buf; uint8_t *b_end = p->buf + p->buf_size - sizeof(signature); do { - if (memcmp(b++, signature, sizeof(signature)) == 0) + if (b[0] == signature[0] && memcmp(b, signature, sizeof(signature)) == 0) return AVPROBE_SCORE_MAX; + b++; } while (b < b_end); return 0; From 91ac6d9902b0550e82c6dc4081b12eb7ba145b68 Mon Sep 17 00:00:00 2001 From: Piotr Bandurski Date: Thu, 31 May 2012 15:17:59 +0200 Subject: [PATCH 046/257] gifenc: support resolutions up to 65535x65535 Maybe someone can add a check in the second gif encoder (rgb24), because I'm not sure where it should be added. Signed-off-by: Michael Niedermayer (cherry picked from commit e03ddbcd919b11a289c2de8a47c83efe7fab32fb) Signed-off-by: Michael Niedermayer --- libavcodec/gif.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/gif.c b/libavcodec/gif.c index ec4be2749b..5cb635df1f 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -145,6 +145,11 @@ static av_cold int gif_encode_init(AVCodecContext *avctx) { GIFContext *s = avctx->priv_data; + if (avctx->width > 65535 || avctx->height > 65535) { + av_log(avctx, AV_LOG_ERROR, "GIF does not support resolutions above 65535x65535\n"); + return -1; + } + avctx->coded_frame = &s->picture; s->lzw = av_mallocz(ff_lzw_encode_state_size); if (!s->lzw) From d5d5f960688717a4dede2fbbde35003d8ec9b493 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 18:54:00 +0200 Subject: [PATCH 047/257] mpeg4videodec: Check that cplx_estimation_* fits in the available space Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit b02cc2ddc610cd84bbee5923a642a8324988b28c) Signed-off-by: Michael Niedermayer --- libavcodec/mpeg4videodec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index bd1910b3ad..263ac991d8 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -2050,6 +2050,10 @@ static int decode_vop_header(MpegEncContext *s, GetBitContext *gb){ if(s->pict_type == AV_PICTURE_TYPE_B) skip_bits_long(gb, s->cplx_estimation_trash_b); + if(get_bits_left(gb) < 3) { + av_log(s->avctx, AV_LOG_ERROR, "Header truncated\n"); + return -1; + } s->intra_dc_threshold= ff_mpeg4_dc_threshold[ get_bits(gb, 3) ]; if(!s->progressive_sequence){ s->top_field_first= get_bits1(gb); From 7f0f6602cb3219c9d0e6bd5df33d2b891ac0089b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 19:06:14 +0200 Subject: [PATCH 048/257] oggparsevorbis: fix null ptr dereference Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 18b46a494ef3592d69f4638dac1ebb613c0f548d) Signed-off-by: Michael Niedermayer --- libavformat/oggparsevorbis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 78defd703d..74f44995b8 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -203,12 +203,12 @@ vorbis_header (AVFormatContext * s, int idx) int pkt_type = os->buf[os->pstart]; if (!(pkt_type & 1)) - return 0; + return os->private ? 0 : -1; if (!os->private) { os->private = av_mallocz(sizeof(struct oggvorbis_private)); if (!os->private) - return 0; + return -1; } if (os->psize < 1 || pkt_type > 5) From cc0a6844973da4c855c399322bc6c6ee8ca8c204 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 20:19:56 +0200 Subject: [PATCH 049/257] h264: move q0 scan tables into context This fixes out of global array reads. The alternative solutions of checking the index or modifying the VLC tables to prevent the index going outside are each about 1-2 cpu cyclces slower per coded 4x4 block. The alternative of padding the global tables directly is more ugly and moving them to the context should benefit cache locality. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit b7d14883939e756cbda376c66552be9d843910a0) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 24 ++++++++++++------------ libavcodec/h264.h | 12 ++++++------ libavcodec/h264data.h | 5 ----- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 85787f40d1..7ebe3521b0 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2719,19 +2719,19 @@ static void init_scan_tables(H264Context *h) #undef T } if (h->sps.transform_bypass) { // FIXME same ugly - h->zigzag_scan_q0 = zigzag_scan; - h->zigzag_scan8x8_q0 = ff_zigzag_direct; - h->zigzag_scan8x8_cavlc_q0 = zigzag_scan8x8_cavlc; - h->field_scan_q0 = field_scan; - h->field_scan8x8_q0 = field_scan8x8; - h->field_scan8x8_cavlc_q0 = field_scan8x8_cavlc; + memcpy(h->zigzag_scan_q0 , zigzag_scan , sizeof(h->zigzag_scan_q0 )); + memcpy(h->zigzag_scan8x8_q0 , ff_zigzag_direct , sizeof(h->zigzag_scan8x8_q0 )); + memcpy(h->zigzag_scan8x8_cavlc_q0 , zigzag_scan8x8_cavlc , sizeof(h->zigzag_scan8x8_cavlc_q0)); + memcpy(h->field_scan_q0 , field_scan , sizeof(h->field_scan_q0 )); + memcpy(h->field_scan8x8_q0 , field_scan8x8 , sizeof(h->field_scan8x8_q0 )); + memcpy(h->field_scan8x8_cavlc_q0 , field_scan8x8_cavlc , sizeof(h->field_scan8x8_cavlc_q0 )); } else { - h->zigzag_scan_q0 = h->zigzag_scan; - h->zigzag_scan8x8_q0 = h->zigzag_scan8x8; - h->zigzag_scan8x8_cavlc_q0 = h->zigzag_scan8x8_cavlc; - h->field_scan_q0 = h->field_scan; - h->field_scan8x8_q0 = h->field_scan8x8; - h->field_scan8x8_cavlc_q0 = h->field_scan8x8_cavlc; + memcpy(h->zigzag_scan_q0 , h->zigzag_scan , sizeof(h->zigzag_scan_q0 )); + memcpy(h->zigzag_scan8x8_q0 , h->zigzag_scan8x8 , sizeof(h->zigzag_scan8x8_q0 )); + memcpy(h->zigzag_scan8x8_cavlc_q0 , h->zigzag_scan8x8_cavlc , sizeof(h->zigzag_scan8x8_cavlc_q0)); + memcpy(h->field_scan_q0 , h->field_scan , sizeof(h->field_scan_q0 )); + memcpy(h->field_scan8x8_q0 , h->field_scan8x8 , sizeof(h->field_scan8x8_q0 )); + memcpy(h->field_scan8x8_cavlc_q0 , h->field_scan8x8_cavlc , sizeof(h->field_scan8x8_cavlc_q0 )); } } diff --git a/libavcodec/h264.h b/libavcodec/h264.h index 0e11e304ee..a27f82f494 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -421,12 +421,12 @@ typedef struct H264Context { uint8_t field_scan[16]; uint8_t field_scan8x8[64]; uint8_t field_scan8x8_cavlc[64]; - const uint8_t *zigzag_scan_q0; - const uint8_t *zigzag_scan8x8_q0; - const uint8_t *zigzag_scan8x8_cavlc_q0; - const uint8_t *field_scan_q0; - const uint8_t *field_scan8x8_q0; - const uint8_t *field_scan8x8_cavlc_q0; + uint8_t zigzag_scan_q0[16]; + uint8_t zigzag_scan8x8_q0[64]; + uint8_t zigzag_scan8x8_cavlc_q0[64]; + uint8_t field_scan_q0[16]; + uint8_t field_scan8x8_q0[64]; + uint8_t field_scan8x8_cavlc_q0[64]; int x264_build; diff --git a/libavcodec/h264data.h b/libavcodec/h264data.h index b665bca8c5..f3fc7f9425 100644 --- a/libavcodec/h264data.h +++ b/libavcodec/h264data.h @@ -57,7 +57,6 @@ static const uint8_t zigzag_scan[16+1] = { 1 + 1 * 4, 2 + 0 * 4, 3 + 0 * 4, 2 + 1 * 4, 1 + 2 * 4, 0 + 3 * 4, 1 + 3 * 4, 2 + 2 * 4, 3 + 1 * 4, 3 + 2 * 4, 2 + 3 * 4, 3 + 3 * 4, - 0, }; static const uint8_t field_scan[16+1] = { @@ -65,7 +64,6 @@ static const uint8_t field_scan[16+1] = { 0 + 3 * 4, 1 + 1 * 4, 1 + 2 * 4, 1 + 3 * 4, 2 + 0 * 4, 2 + 1 * 4, 2 + 2 * 4, 2 + 3 * 4, 3 + 0 * 4, 3 + 1 * 4, 3 + 2 * 4, 3 + 3 * 4, - 0, }; static const uint8_t luma_dc_zigzag_scan[16] = { @@ -112,7 +110,6 @@ static const uint8_t zigzag_scan8x8_cavlc[64+1] = { 1 + 4 * 8, 2 + 4 * 8, 6 + 0 * 8, 4 + 3 * 8, 0 + 7 * 8, 4 + 4 * 8, 7 + 2 * 8, 3 + 6 * 8, 5 + 5 * 8, 6 + 5 * 8, 6 + 6 * 8, 7 + 7 * 8, - 0, }; static const uint8_t field_scan8x8[64+1] = { @@ -132,7 +129,6 @@ static const uint8_t field_scan8x8[64+1] = { 7 + 0 * 8, 7 + 1 * 8, 6 + 4 * 8, 6 + 5 * 8, 6 + 6 * 8, 6 + 7 * 8, 7 + 2 * 8, 7 + 3 * 8, 7 + 4 * 8, 7 + 5 * 8, 7 + 6 * 8, 7 + 7 * 8, - 0, }; static const uint8_t field_scan8x8_cavlc[64+1] = { @@ -152,7 +148,6 @@ static const uint8_t field_scan8x8_cavlc[64+1] = { 1 + 7 * 8, 3 + 2 * 8, 2 + 7 * 8, 4 + 2 * 8, 3 + 7 * 8, 5 + 2 * 8, 4 + 7 * 8, 5 + 4 * 8, 6 + 3 * 8, 6 + 5 * 8, 7 + 3 * 8, 7 + 7 * 8, - 0, }; typedef struct IMbInfo { From 662ab44c2de55b674f6b596890a9ab1afdce1aca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 31 May 2012 21:12:25 +0200 Subject: [PATCH 050/257] jacosub_probe: speedup by making only one call to sscanf (cherry picked from commit 908293d1bcaa0e059561bec8ae0b3ad1fde2d196) Signed-off-by: Michael Niedermayer --- libavformat/jacosubdec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 30c4f636bd..615191ee3f 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -63,10 +63,13 @@ static int jacosub_probe(AVProbeData *p) ptr += 3; /* skip UTF-8 BOM */ while (ptr < ptr_end) { - if (timed_line(ptr)) - return AVPROBE_SCORE_MAX / 2; while (jss_whitespace(*ptr)) ptr++; + if (*ptr != '#' && *ptr != '\n') { + if (timed_line(ptr)) + return AVPROBE_SCORE_MAX / 2; + return 0; + } ptr += strcspn(ptr, "\n") + 1; } return 0; From f46b57657b791b4536633a17fb139cccf5c57b0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Thu, 31 May 2012 22:12:46 +0200 Subject: [PATCH 051/257] jacosub_probe: slightly increase the score to limit misdetection. (cherry picked from commit 303619d3ca9efa0031f6fede7dedeb27fcfb1756) Signed-off-by: Michael Niedermayer --- libavformat/jacosubdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 615191ee3f..67f4c37b92 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -67,7 +67,7 @@ static int jacosub_probe(AVProbeData *p) ptr++; if (*ptr != '#' && *ptr != '\n') { if (timed_line(ptr)) - return AVPROBE_SCORE_MAX / 2; + return AVPROBE_SCORE_MAX/2 + 1; return 0; } ptr += strcspn(ptr, "\n") + 1; From f1150e0c7d5ad7c5139cfb0d0c16fcfd8cd6649d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 23:50:08 +0200 Subject: [PATCH 052/257] dv-demux: dont mess with codec values Fixes part of Ticket1369 Found-by: ami_stuff Signed-off-by: Michael Niedermayer (cherry picked from commit 3c276ac0f8936745543d14674842647c502bdd2e) Signed-off-by: Michael Niedermayer --- libavformat/dv.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavformat/dv.c b/libavformat/dv.c index 2ce928fa26..75b42b01ab 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -273,9 +273,6 @@ static int dv_extract_video_info(DVDemuxContext *c, uint8_t* frame) avpriv_set_pts_info(c->vst, 64, c->sys->time_base.num, c->sys->time_base.den); avctx->time_base= c->sys->time_base; - if (!avctx->width) - avcodec_set_dimensions(avctx, c->sys->width, c->sys->height); - avctx->pix_fmt = c->sys->pix_fmt; /* finding out SAR is a little bit messy */ vsc_pack = dv_extract_pack(frame, dv_video_control); From 617d91b76a42092fcbcff3ee5cc54a8780754537 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 23:52:08 +0200 Subject: [PATCH 053/257] h264: Fail on DPC its not fully implemented Fixes part of Ticket1369 Found-by: ami_stuff Signed-off-by: Michael Niedermayer (cherry picked from commit 7cb86633622de22c8b6e43c9d608361e5adda740) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 7ebe3521b0..4e6d6a5684 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4399,6 +4399,9 @@ again: init_get_bits(&hx->inter_gb, ptr, bit_length); hx->inter_gb_ptr = &hx->inter_gb; + av_log(h->s.avctx, AV_LOG_ERROR, "Partitioned H.264 support is incomplete\n"); + return AVERROR_PATCHWELCOME; + if (hx->redundant_pic_count == 0 && hx->intra_gb_ptr && hx->s.data_partitioning && From eea82203ba050a24f34af63040f3b843b18dd0e2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 00:07:36 +0200 Subject: [PATCH 054/257] libmp3lame: add missing layout terminator Signed-off-by: Michael Niedermayer (cherry picked from commit e47e23698b4ba4388c00379e2b2443b2cfd0aa67) Signed-off-by: Michael Niedermayer --- libavcodec/libmp3lame.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libmp3lame.c b/libavcodec/libmp3lame.c index 1e50e0a48b..905d9a0d4c 100644 --- a/libavcodec/libmp3lame.c +++ b/libavcodec/libmp3lame.c @@ -304,7 +304,8 @@ AVCodec ff_libmp3lame_encoder = { AV_SAMPLE_FMT_NONE }, .supported_samplerates = libmp3lame_sample_rates, .channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO, - AV_CH_LAYOUT_STEREO }, + AV_CH_LAYOUT_STEREO, + 0}, .long_name = NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"), .priv_class = &libmp3lame_class, .defaults = libmp3lame_defaults, From d838c408232472556d1b767e78bc93cbb6239106 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 00:35:06 +0200 Subject: [PATCH 055/257] qdm2: fix incorrect error spam Fixes Ticket1375 Signed-off-by: Michael Niedermayer (cherry picked from commit 8a0efa9cc075523b09b4a0585389df865996c214) Signed-off-by: Michael Niedermayer --- libavcodec/qdm2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 7a5d0726f9..aa180fdbd1 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1363,7 +1363,8 @@ static void qdm2_fft_decode_tones (QDM2Context *q, int duration, GetBitContext * if (q->superblocktype_2_3) { while ((n = qdm2_get_vlc(gb, &vlc_tab_fft_tone_offset[local_int_8], 1, 2)) < 2) { if (get_bits_left(gb)<0) { - av_log(0, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n"); + if(local_int_4 < q->group_size) + av_log(0, AV_LOG_ERROR, "overread in qdm2_fft_decode_tones()\n"); return; } offset = 1; From ac3fc94eb0f79685a3e10363032d68142b15e368 Mon Sep 17 00:00:00 2001 From: Piotr Bandurski Date: Thu, 31 May 2012 20:10:04 +0200 Subject: [PATCH 056/257] sgienc: add a limit for maximum supported resolution Signed-off-by: Michael Niedermayer (cherry picked from commit 59352cc219c4f933c9a83b45043ec4810c2a51ee) Signed-off-by: Michael Niedermayer --- libavcodec/sgienc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/sgienc.c b/libavcodec/sgienc.c index d35c7ac5d1..8bb0aba1af 100644 --- a/libavcodec/sgienc.c +++ b/libavcodec/sgienc.c @@ -36,6 +36,11 @@ static av_cold int encode_init(AVCodecContext *avctx) { SgiContext *s = avctx->priv_data; + if (avctx->width > 65535 || avctx->height > 65535) { + av_log(avctx, AV_LOG_ERROR, "SGI does not support resolutions above 65535x65535\n"); + return -1; + } + avcodec_get_frame_defaults(&s->picture); avctx->coded_frame = &s->picture; From 33a3f1fe9db206e1e01dd86f4a4f0c723a2e6080 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 01:33:00 +0200 Subject: [PATCH 057/257] 8svx: fix crash Fixes Ticket1377 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 03ce421c1361e4ce79468de8269ad51ba2ae4c16) Signed-off-by: Michael Niedermayer --- libavcodec/8svx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index f42a35b20b..e220ad13cc 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -47,7 +47,7 @@ typedef struct EightSvxContext { /* buffer used to store the whole audio decoded/interleaved chunk, * which is sent with the first packet */ uint8_t *samples; - size_t samples_size; + int64_t samples_size; int samples_idx; } EightSvxContext; From bb5314daba6572dee5e3fefa602de9b5b0df40d1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 15:51:50 +0200 Subject: [PATCH 058/257] yopdec: check that palette fits in the packet Signed-off-by: Michael Niedermayer (cherry picked from commit b6fdf8dea7aaf3cb9a979dce91f752c2ce3086a3) Signed-off-by: Michael Niedermayer --- libavcodec/yop.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/yop.c b/libavcodec/yop.c index ac17297915..df61426dfe 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -204,6 +204,11 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size, if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); + if (avpkt->size < 4 + 3*s->num_pal_colors) { + av_log(avctx, AV_LOG_ERROR, "packet of size %d too small\n", avpkt->size); + return AVERROR_INVALIDDATA; + } + ret = avctx->get_buffer(avctx, &s->frame); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); From d3c564b784147ea294c137ba939c80aaa016c99e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 15:52:20 +0200 Subject: [PATCH 059/257] yopdec: check frame oddness to be within supported limits Fixes Ticket1365 Signed-off-by: Michael Niedermayer (cherry picked from commit febc013dc5d6db1535a4f91cf02fa8089038937c) Signed-off-by: Michael Niedermayer --- libavcodec/yop.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/yop.c b/libavcodec/yop.c index df61426dfe..42059e1c5a 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -224,6 +224,10 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *data_size, s->low_nibble = NULL; is_odd_frame = avpkt->data[0]; + if(is_odd_frame>1){ + av_log(avctx, AV_LOG_ERROR, "frame is too odd %d\n", is_odd_frame); + return AVERROR_INVALIDDATA; + } firstcolor = s->first_color[is_odd_frame]; palette = (uint32_t *)s->frame.data[1]; From af67af59382f0ea76abc5327af0fe44bae4c4323 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 17:07:07 +0200 Subject: [PATCH 060/257] rv20: fix lowres out of array read Fixes Ticket1239 Signed-off-by: Michael Niedermayer (cherry picked from commit 0766b6e3ec6b7f51af5787421290284050e32a91) Signed-off-by: Michael Niedermayer --- libavcodec/rv10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/rv10.c b/libavcodec/rv10.c index f4ce1a38c9..5e9e01627a 100644 --- a/libavcodec/rv10.c +++ b/libavcodec/rv10.c @@ -349,7 +349,7 @@ static int rv20_decode_picture_header(RVDecContext *rv) } if(RV_GET_MINOR_VER(rv->sub_id) >= 2) - s->loop_filter = get_bits1(&s->gb); + s->loop_filter = get_bits1(&s->gb) && !s->avctx->lowres; if(RV_GET_MINOR_VER(rv->sub_id) <= 1) seq = get_bits(&s->gb, 8) << 7; From 7883efbbb28f7295a6861d9b6c0a650c5b00eeed Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 21:42:29 +0200 Subject: [PATCH 061/257] wmv1: check that the input buffer is large enough Fixes null ptr deref Fixes Ticket1367 Signed-off-by: Michael Niedermayer (cherry picked from commit f23a2418fb0ccc56fdae4dbf83a5994cc917c475) Signed-off-by: Michael Niedermayer --- libavcodec/wnv1.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index 21ff361f1e..62e9b992a4 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -70,6 +70,11 @@ static int decode_frame(AVCodecContext *avctx, int prev_y = 0, prev_u = 0, prev_v = 0; uint8_t *rbuf; + if(buf_size<=8) { + av_log(avctx, AV_LOG_ERROR, "buf_size %d is too small\n", buf_size); + return AVERROR_INVALIDDATA; + } + rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if(!rbuf){ av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); From 0964e189dafc382d06dfc78ffba55d028f7df6d5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 1 Jun 2012 23:21:03 +0200 Subject: [PATCH 062/257] fraps: fix version 0/1 input data size check. Fixes array overread. Fixes Ticket1371 Signed-off-by: Michael Niedermayer (cherry picked from commit 0bae6661cd171abf55cfa4b8970b08c470d65dee) Signed-off-by: Michael Niedermayer --- libavcodec/fraps.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 30c23d8f3c..1cf4062a21 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -161,17 +161,17 @@ static int decode_frame(AVCodecContext *avctx, unsigned needed_size = avctx->width*avctx->height*3; if (version == 0) needed_size /= 2; needed_size += header_size; - if (buf_size != needed_size && buf_size != header_size) { - av_log(avctx, AV_LOG_ERROR, - "Invalid frame length %d (should be %d)\n", - buf_size, needed_size); - return -1; - } /* bit 31 means same as previous pic */ if (header & (1U<<31)) { *data_size = 0; return buf_size; } + if (buf_size != needed_size) { + av_log(avctx, AV_LOG_ERROR, + "Invalid frame length %d (should be %d)\n", + buf_size, needed_size); + return -1; + } } else { /* skip frame */ if (buf_size == 8) { From 70af4f209f552263f8ec7b72d309588e81823ca3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 02:21:30 +0200 Subject: [PATCH 063/257] ffv1: fix crash caused by version becoming inconsistent Fixes part of Ticket1372 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 97c281d5b7d1c4850a8ba7d9921137634224b2f3) Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index bffd744937..79409e2a16 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1769,7 +1769,12 @@ static int read_header(FFV1Context *f){ memset(state, 128, sizeof(state)); if(f->version < 2){ - f->version= get_symbol(c, state, 0); + unsigned v= get_symbol(c, state, 0); + if(v >= 2){ + av_log(f->avctx, AV_LOG_ERROR, "invalid version %d in ver01 header\n", v); + return AVERROR_INVALIDDATA; + } + f->version = v; f->ac= f->avctx->coder_type= get_symbol(c, state, 0); if(f->ac>1){ for(i=1; i<256; i++){ From dc72a59fe53b0003c254b3f17bf0385eeca7e43d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 02:37:36 +0200 Subject: [PATCH 064/257] ffv1: fix integer overflow in quant table initialization Fixes part of Ticket1372 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 9ebe6e391071690dbee79a645c51b14bd55c2ff4) Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 79409e2a16..21f17611a1 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1651,9 +1651,9 @@ static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ memset(state, 128, sizeof(state)); for(v=0; i<128 ; v++){ - int len= get_symbol(c, state, 0) + 1; + unsigned len= get_symbol(c, state, 0) + 1; - if(len + i > 128) return -1; + if(len > 128 - i) return -1; while(len--){ quant_table[i] = scale*v; From ae5f69a98fbdd6cba967ec117b3617e1a348fa42 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 04:04:29 +0200 Subject: [PATCH 065/257] bmv: fix integer overflows in vlc decoder. Fixes part of Ticket1373 Found-by: Piotr Bandurski Based-on-patch-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit 679c578cb8e82df6fdee977e3137a26a680ad346) Signed-off-by: Michael Niedermayer --- libavcodec/bmv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 37c844858f..9740b11f15 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -21,6 +21,7 @@ #include "avcodec.h" #include "bytestream.h" +#include "libavutil/avassert.h" enum BMVFlags{ BMV_NOP = 0, @@ -52,7 +53,7 @@ typedef struct BMVDecContext { static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int frame_off) { - int val, saved_val = 0; + unsigned val, saved_val = 0; int tmplen = src_len; const uint8_t *src, *source_end = source + src_len; uint8_t *frame_end = frame + SCREEN_WIDE * SCREEN_HIGH; @@ -98,6 +99,8 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, } if (!(val & 0xC)) { for (;;) { + if(shift>22) + return -1; if (!read_two_nibbles) { if (src < source || src >= source_end) return -1; @@ -131,6 +134,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, } advance_mode = val & 1; len = (val >> 1) - 1; + av_assert0(len>0); mode += 1 + advance_mode; if (mode >= 4) mode -= 3; From 03275ed219614764e208c3771b231bcd9b67bd1f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 04:06:16 +0200 Subject: [PATCH 066/257] bmv: fix apparent sign error in the frame_off check Fixes part of Ticket1373 Signed-off-by: Michael Niedermayer (cherry picked from commit debbcfae6010f027a0334d70d0dbb7ddd912ad5a) Signed-off-by: Michael Niedermayer --- libavcodec/bmv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 9740b11f15..35923a28d6 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -143,7 +143,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, switch (mode) { case 1: if (forward) { - if (dst - frame + SCREEN_WIDE < frame_off || + if (dst - frame + SCREEN_WIDE < -frame_off || frame_end - dst < frame_off + len) return -1; for (i = 0; i < len; i++) @@ -151,7 +151,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, dst += len; } else { dst -= len; - if (dst - frame + SCREEN_WIDE < frame_off || + if (dst - frame + SCREEN_WIDE < -frame_off || frame_end - dst < frame_off + len) return -1; for (i = len - 1; i >= 0; i--) From 46b99bb70c194106402169e7e36005c5f589c4e4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 13:58:28 +0200 Subject: [PATCH 067/257] h264: try to better handle h264 streams that are slightly truncated Signed-off-by: Michael Niedermayer (cherry picked from commit cd0f9f00a2471891b692729d8e62c8979396a2ee) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 4e6d6a5684..702d4062c2 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4032,7 +4032,7 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg) loop_filter(h, lf_x_start, s->mb_x + 1); return 0; } - if (ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 2) { + if (ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 4) { av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", s->mb_x, s->mb_y, From 177fc2438a226d10ed70389099c0a26da1eef62a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 15:37:20 +0200 Subject: [PATCH 068/257] h264: log debug output for slightly truncated streams Signed-off-by: Michael Niedermayer (cherry picked from commit fb4e434cfb5bf5510bf9ade40a9b63e3a579247e) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 702d4062c2..af7946888c 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4032,6 +4032,8 @@ static int decode_slice(struct AVCodecContext *avctx, void *arg) loop_filter(h, lf_x_start, s->mb_x + 1); return 0; } + if (h->cabac.bytestream > h->cabac.bytestream_end + 2 ) + av_log(h->s.avctx, AV_LOG_DEBUG, "bytestream overread %td\n", h->cabac.bytestream_end - h->cabac.bytestream); if (ret < 0 || h->cabac.bytestream > h->cabac.bytestream_end + 4) { av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d, bytestream (%td)\n", From 95b1cbc4cb86d839cc827f083af9491cec1703c1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 19:56:10 +0200 Subject: [PATCH 069/257] bink: fix out of reference frame read Fixes Ticket1374 Signed-off-by: Michael Niedermayer (cherry picked from commit b3675f890abee0bc446495711223a5c790234672) Signed-off-by: Michael Niedermayer --- libavcodec/bink.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 8a9367d07d..4ad2e6fd76 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1128,6 +1128,11 @@ static int bink_decode_plane(BinkContext *c, GetBitContext *gb, int plane_idx, xoff = get_value(c, BINK_SRC_X_OFF); yoff = get_value(c, BINK_SRC_Y_OFF); ref = prev + xoff + yoff * stride; + if (ref < ref_start || ref > ref_end) { + av_log(c->avctx, AV_LOG_ERROR, "Copy out of bounds @%d, %d\n", + bx*8 + xoff, by*8 + yoff); + return -1; + } c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8); memset(dctblock, 0, sizeof(*dctblock) * 64); dctblock[0] = get_value(c, BINK_SRC_INTER_DC); From d0cb4dc471aee0d0325659755cece19db593b450 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 21:11:43 +0200 Subject: [PATCH 070/257] lavf: use input keyframe flag when muxer does not provide keyframe flags. Signed-off-by: Michael Niedermayer (cherry picked from commit 5665674b55a45df757ed4fcd076a5cdf9ab484b6) Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index e7fd04abe8..ca97b91511 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1207,6 +1207,9 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index) st->parser->pict_type == AV_PICTURE_TYPE_I)) out_pkt.flags |= AV_PKT_FLAG_KEY; + if(st->parser->key_frame == -1 && st->parser->pict_type==AV_PICTURE_TYPE_NONE && (pkt->flags&AV_PKT_FLAG_KEY)) + out_pkt.flags |= AV_PKT_FLAG_KEY; + compute_pkt_fields(s, st, st->parser, &out_pkt); if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && From 433ec3afa3c8faaa8efb6de099b01b4d7d1e8053 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 21:12:20 +0200 Subject: [PATCH 071/257] png_parser: dont falsely mark frames as keyframes Fixes Ticket1381 Signed-off-by: Michael Niedermayer (cherry picked from commit 82570d2f09e76d262f4eb57b591b08c4aa64729a) Signed-off-by: Michael Niedermayer --- libavcodec/png_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/png_parser.c b/libavcodec/png_parser.c index 7f6fabb0a2..47056fa251 100644 --- a/libavcodec/png_parser.c +++ b/libavcodec/png_parser.c @@ -45,6 +45,8 @@ static int png_parse(AVCodecParserContext *s, AVCodecContext *avctx, int next = END_NOT_FOUND; int i = 0; + s->pict_type = AV_PICTURE_TYPE_NONE; + *poutbuf_size = 0; if (buf_size == 0) return 0; From e863d3306f369c002c24dfda874a18173c5f5889 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 22:50:40 +0200 Subject: [PATCH 072/257] oggdec: fix regression that caused reading the whole file during open Signed-off-by: Michael Niedermayer (cherry picked from commit e0eaf1004910e451cbb8dbcb5c54ac63721adb61) Signed-off-by: Michael Niedermayer --- libavformat/oggdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 6f3a5657d1..d30c17cc2a 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -530,6 +530,9 @@ static int ogg_get_length(AVFormatContext *s) s->streams[i]->duration -= pts; ogg->streams[i].got_start= 1; streams_left--; + }else if(s->streams[i]->start_time != AV_NOPTS_VALUE && !ogg->streams[i].got_start){ + ogg->streams[i].got_start= 1; + streams_left--; } if(streams_left<=0) break; From 3bb942e6f08a081ce3bace7f5e9aa765e3e88b8e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Jun 2012 23:43:31 +0200 Subject: [PATCH 073/257] mpc7: fix handling of last frame Fixes heap buffer overflow Fixes ticket1393 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit e95233789c08f55c0b2d0657bada609629a59294) Signed-off-by: Michael Niedermayer --- libavcodec/mpc7.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 14abff470d..0a4582635f 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -228,7 +228,7 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, buf_size -= 4; /* get output buffer */ - c->frame.nb_samples = last_frame ? c->lastframelen : MPC_FRAME_SIZE; + c->frame.nb_samples = MPC_FRAME_SIZE; if ((ret = avctx->get_buffer(avctx, &c->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; @@ -298,6 +298,8 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off); ff_mpc_dequantize_and_synth(c, mb, c->frame.data[0], 2); + if(last_frame) + c->frame.nb_samples = c->lastframelen; bits_used = get_bits_count(&gb); bits_avail = buf_size * 8; From bbc4d287c9b927dbb475e3e0408a238ec3546128 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 3 Jun 2012 14:41:21 +0200 Subject: [PATCH 074/257] h263: disable loop filter with lowres Fixes ticket1212 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit cc229d4e83889d1298f1a0863b55feec6c5c339a) Signed-off-by: Michael Niedermayer --- libavcodec/intelh263dec.c | 2 +- libavcodec/ituh263dec.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/intelh263dec.c b/libavcodec/intelh263dec.c index 179f609de6..ffe91dbd5d 100644 --- a/libavcodec/intelh263dec.c +++ b/libavcodec/intelh263dec.c @@ -77,7 +77,7 @@ int ff_intel_h263_decode_picture_header(MpegEncContext *s) } if(get_bits(&s->gb, 2)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); - s->loop_filter = get_bits1(&s->gb); + s->loop_filter = get_bits1(&s->gb) * !s->avctx->lowres; if(get_bits1(&s->gb)) av_log(s->avctx, AV_LOG_ERROR, "Bad value for reserved field\n"); if(get_bits1(&s->gb)) diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c index 34a9e816ae..58375becc9 100644 --- a/libavcodec/ituh263dec.c +++ b/libavcodec/ituh263dec.c @@ -963,6 +963,8 @@ int ff_h263_decode_picture_header(MpegEncContext *s) s->h263_aic = get_bits1(&s->gb); /* Advanced Intra Coding (AIC) */ s->loop_filter= get_bits1(&s->gb); s->unrestricted_mv = s->umvplus || s->obmc || s->loop_filter; + if(s->avctx->lowres) + s->loop_filter = 0; s->h263_slice_structured= get_bits1(&s->gb); if (get_bits1(&s->gb) != 0) { From be1d65031fecdce619de8831b7802bfba1932869 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 3 Jun 2012 14:53:43 +0200 Subject: [PATCH 075/257] mace: check channel count, fixes FPE Fixes ticket1391 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 6df1cfa7e4d488051d7b5033c0c69df970db9f82) Signed-off-by: Michael Niedermayer --- libavcodec/mace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mace.c b/libavcodec/mace.c index bf9ea08fcf..dd721d24b5 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -231,7 +231,7 @@ static av_cold int mace_decode_init(AVCodecContext * avctx) { MACEContext *ctx = avctx->priv_data; - if (avctx->channels > 2) + if (avctx->channels > 2 || avctx->channels <= 0) return -1; avctx->sample_fmt = AV_SAMPLE_FMT_S16; From 320704f739e831b13f5c4e9a7770d46fa9d24bde Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 3 Jun 2012 17:12:26 +0200 Subject: [PATCH 076/257] av_get_audio_frame_duration: fix FPE Fixes ticket1392 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit a5ad3c2382ac27cf712aaba6a222ec12f5eb88da) Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 2cfe8491fa..dc3a30abbe 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2194,8 +2194,12 @@ int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) /* calc from frame_bytes, channels, and bits_per_coded_sample */ switch (avctx->codec_id) { case CODEC_ID_PCM_DVD: + if(bps<4) + return 0; return 2 * (frame_bytes / ((bps * 2 / 8) * ch)); case CODEC_ID_PCM_BLURAY: + if(bps<4) + return 0; return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8); case CODEC_ID_S302M: return 2 * (frame_bytes / ((bps + 4) / 4)) / ch; From d0d9182d3e816f40ebf7dcfab9176050faa9b529 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 3 Jun 2012 17:40:30 +0200 Subject: [PATCH 077/257] mpc8: fix channel checks fix heap array overflow Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 44c10168cff41c200825448b77cb8feff0d316c9) Signed-off-by: Michael Niedermayer --- libavcodec/mpc8.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index c37cd50497..652e824843 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -140,7 +140,8 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx) c->frames = 1 << (get_bits(&gb, 3) * 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; + avctx->channel_layout = (channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; + avctx->channels = channels; if(vlc_initialized) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); From 381a91402469131f2f5650fb065e6b4180e2a6bc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 4 Jun 2012 00:55:02 +0200 Subject: [PATCH 078/257] ffv1: fix log level of FF_DEBUG_PICT_INFO Signed-off-by: Michael Niedermayer (cherry picked from commit 730d079bf756c40f4a3c4624388db11d1be3475f) Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 21f17611a1..8eb20fe07b 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1991,7 +1991,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac } if(avctx->debug&FF_DEBUG_PICT_INFO) - av_log(avctx, AV_LOG_ERROR, "keyframe:%d coder:%d\n", p->key_frame, f->ac); + av_log(avctx, AV_LOG_DEBUG, "keyframe:%d coder:%d\n", p->key_frame, f->ac); buf_p= buf + buf_size; for(i=f->slice_count-1; i>=0; i--){ From 0e74b21427630f2ef095a95f4a78423b11c8d945 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 4 Jun 2012 01:00:26 +0200 Subject: [PATCH 079/257] ffv1dec: print more information for -debug 1 Signed-off-by: Michael Niedermayer (cherry picked from commit 38c9ebd2a97a1298e4c5cc9d01d88d69c55be695) Signed-off-by: Michael Niedermayer --- libavcodec/ffv1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 8eb20fe07b..46293524fb 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -1991,7 +1991,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac } if(avctx->debug&FF_DEBUG_PICT_INFO) - av_log(avctx, AV_LOG_DEBUG, "keyframe:%d coder:%d\n", p->key_frame, f->ac); + av_log(avctx, AV_LOG_DEBUG, "ver:%d keyframe:%d coder:%d ec:%d slices:%d\n", + f->version, p->key_frame, f->ac, f->ec, f->slice_count); buf_p= buf + buf_size; for(i=f->slice_count-1; i>=0; i--){ From 530ce76a058c77766c91d268e979722e2b235513 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 4 Jun 2012 12:06:48 +0200 Subject: [PATCH 080/257] Fix G.723.1 encoder Makefile dependencies. (cherry picked from commit c02ef0788178d859f829c9703325e247b60e1895) Signed-off-by: Michael Niedermayer --- libavcodec/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index da22704ca8..573ec03d07 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -188,7 +188,7 @@ OBJS-$(CONFIG_FRAPS_DECODER) += fraps.o OBJS-$(CONFIG_FRWU_DECODER) += frwu.o OBJS-$(CONFIG_G723_1_DECODER) += g723_1.o acelp_vectors.o \ celp_filters.o celp_math.o -OBJS-$(CONFIG_G723_1_ENCODER) += g723_1.o +OBJS-$(CONFIG_G723_1_ENCODER) += g723_1.o acelp_vectors.o celp_math.o OBJS-$(CONFIG_G729_DECODER) += g729dec.o lsp.o celp_math.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o From 4e66ca5f375fe4cd9f2307e059a9d95318a60b72 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 4 Jun 2012 12:07:30 +0200 Subject: [PATCH 081/257] Fix ProRes decoder Makefile dependencies. Found, analysed and tested by trac user Jamal. Fixes part of Ticket #1404. (cherry picked from commit a4b885d55ee061fa8df089f356ddbabf0282da5f) Signed-off-by: Michael Niedermayer --- libavcodec/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 573ec03d07..5a3131bc11 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -347,7 +347,7 @@ OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o -OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o +OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o proresdsp.o OBJS-$(CONFIG_PRORES_LGPL_DECODER) += proresdec_lgpl.o proresdsp.o proresdata.o OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o OBJS-$(CONFIG_PRORES_ANATOLIY_ENCODER) += proresenc_anatoliy.o From 706809adb23ef29592c7b087ca6205e6872012e7 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 4 Jun 2012 12:15:41 +0200 Subject: [PATCH 082/257] Fix compilation condition for some ProRes dsp decoder functions. Found, analysed and tested by trac user Jamal. Fixes part of Ticket #1404. (cherry picked from commit 84986b4e61994c64ef2ea6161c473f82a2672cbc) Signed-off-by: Michael Niedermayer --- libavcodec/proresdsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index 68c6f3e44f..ad1effcae4 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -29,7 +29,7 @@ #define CLIP_AND_BIAS(x) (av_clip((x) + BIAS, CLIP_MIN, CLIP_MAX)) -#if CONFIG_PRORES_DECODER +#if CONFIG_PRORES_DECODER | CONFIG_PRORES_LGPL_DECODER /** * Add bias value, clamp and output pixels of a slice */ @@ -70,7 +70,7 @@ static void prores_fdct_c(const uint16_t *src, int linesize, DCTELEM *block) void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx) { -#if CONFIG_PRORES_DECODER +#if CONFIG_PRORES_DECODER | CONFIG_PRORES_LGPL_DECODER dsp->idct_put = prores_idct_put_c; dsp->idct_permutation_type = FF_NO_IDCT_PERM; From 31d3b3b5d5f48c48ba96b6565b6bcc59e9272879 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 4 Jun 2012 12:18:56 +0200 Subject: [PATCH 083/257] Fix compilation condition for some ProRes dsp encoder functions. Found, analysed and tested by trac user Jamal. Fixes part of Ticket #1404. (cherry picked from commit 568a5924180b0ce43e2706bf2491b70c455eb36a) Signed-off-by: Michael Niedermayer --- libavcodec/proresdsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/proresdsp.c b/libavcodec/proresdsp.c index ad1effcae4..a21003cc22 100644 --- a/libavcodec/proresdsp.c +++ b/libavcodec/proresdsp.c @@ -53,7 +53,7 @@ static void prores_idct_put_c(uint16_t *out, int linesize, DCTELEM *block, const } #endif -#if CONFIG_PRORES_ENCODER +#if CONFIG_PRORES_KOSTYA_ENCODER static void prores_fdct_c(const uint16_t *src, int linesize, DCTELEM *block) { int x, y; @@ -79,7 +79,7 @@ void ff_proresdsp_init(ProresDSPContext *dsp, AVCodecContext *avctx) ff_init_scantable_permutation(dsp->idct_permutation, dsp->idct_permutation_type); #endif -#if CONFIG_PRORES_ENCODER +#if CONFIG_PRORES_KOSTYA_ENCODER dsp->fdct = prores_fdct_c; dsp->dct_permutation_type = FF_NO_IDCT_PERM; ff_init_scantable_permutation(dsp->dct_permutation, From f9fc08de658bd06278a77636a1a5d2c9fbe7d277 Mon Sep 17 00:00:00 2001 From: Alex Converse Date: Tue, 22 May 2012 14:43:28 -0700 Subject: [PATCH 084/257] aacdec: Turn PS off when switching to stereo and turn it to implicit when switching to mono. (cherry picked from commit 79c8e29a7e404dbcf670df599fad6894f98ccab2) Signed-off-by: Michael Niedermayer --- libavcodec/aacdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index d4f48bb791..3118ee7a0e 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -487,6 +487,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) return NULL; ac->oc[1].m4ac.chan_config = 2; + ac->oc[1].m4ac.ps = 0; } // And vice-versa if (!ac->tags_mapped && type == TYPE_SCE && ac->oc[1].m4ac.chan_config == 2) { @@ -504,6 +505,8 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id) return NULL; ac->oc[1].m4ac.chan_config = 1; + if (ac->oc[1].m4ac.sbr) + ac->oc[1].m4ac.ps = -1; } // For indexed channel configurations map the channels solely based on position. switch (ac->oc[1].m4ac.chan_config) { From 7d979364953c7c8b2db5083627f6111cbaaf4ac0 Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Mon, 4 Jun 2012 08:01:34 +0200 Subject: [PATCH 085/257] mpc8: fix maximum bands handling In Musepack SV8 codec property tell the maximum nonzero band, but every frame codes maximum band as a limit (i.e. strictly less than given value). Synthesis also expects maximum nonzero band, so there's a need to convert frame maximum band limit value. (cherry picked from commit b56825c40ee1329b33aed34ff8a639fa18d263a0) Conflicts: libavcodec/mpc8.c Signed-off-by: Michael Niedermayer --- libavcodec/mpc8.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index 652e824843..3970761195 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -275,7 +275,7 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, maxband = c->last_max_band + get_vlc2(gb, band_vlc.table, MPC8_BANDS_BITS, 2); if(maxband > 32) maxband -= 33; } - if(maxband >= BANDS) { + if(maxband > c->maxbands + 1) { av_log(avctx, AV_LOG_ERROR, "maxband %d too large\n",maxband); return AVERROR_INVALIDDATA; } @@ -412,7 +412,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, } } - ff_mpc_dequantize_and_synth(c, maxband, c->frame.data[0], avctx->channels); + ff_mpc_dequantize_and_synth(c, maxband - 1, c->frame.data[0], + avctx->channels); c->cur_frame++; From b4294e231912f0a29828610952b82a8afebeea4d Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 5 Jun 2012 09:54:03 +0200 Subject: [PATCH 086/257] Fix MP2 muxer Makefile dependencies. Found, analysed and tested by trac user Jamal. Fixes ticket #1411 (cherry picked from commit 757d5b9bfda45e45d9ab28ad4d5a9205119fe549) Signed-off-by: Michael Niedermayer --- libavcodec/Makefile | 1 + libavformat/Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 5a3131bc11..4d5193282c 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -626,6 +626,7 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \ flacdec.o flacdata.o flac.o \ mpegaudiodata.o vorbis_data.o +OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o timecode.o OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o diff --git a/libavformat/Makefile b/libavformat/Makefile index 18a0e19b3f..a8f9a9a183 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -163,7 +163,7 @@ OBJS-$(CONFIG_MOV_DEMUXER) += mov.o isom.o mov_chan.o OBJS-$(CONFIG_MOV_MUXER) += movenc.o isom.o avc.o \ movenchint.o rtpenc_chain.o \ mov_chan.o -OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o +OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o OBJS-$(CONFIG_MP3_DEMUXER) += mp3dec.o OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o id3v2enc.o OBJS-$(CONFIG_MPC_DEMUXER) += mpc.o apetag.o From af3f7c88f2a17c1115939713eedf9779c8650a70 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 5 Jun 2012 11:13:30 +0200 Subject: [PATCH 087/257] Add missing CRLFs to avisynth error messages. (cherry picked from commit 1faf0d6a7a70cb0bcfbbff0421fb00bb6da658f9) Signed-off-by: Michael Niedermayer --- libavformat/avisynth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 13b5f4309c..4ebca5ecba 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -55,7 +55,7 @@ static int avisynth_read_header(AVFormatContext *s) res = AVIFileOpen(&avs->file, s->filename, OF_READ|OF_SHARE_DENY_WRITE, NULL); if (res != S_OK) { - av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld", res); + av_log(s, AV_LOG_ERROR, "AVIFileOpen failed with error %ld\n", res); AVIFileExit(); return -1; } @@ -63,7 +63,7 @@ static int avisynth_read_header(AVFormatContext *s) res = AVIFileInfo(avs->file, &info, sizeof(info)); if (res != S_OK) { - av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %ld", res); + av_log(s, AV_LOG_ERROR, "AVIFileInfo failed with error %ld\n", res); AVIFileExit(); return -1; } From e1c9434424e2ecff077028a435ea6ef36abbec27 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 5 Jun 2012 12:52:07 +0200 Subject: [PATCH 088/257] Make H264 reorder buffer size message less verbose. (cherry picked from commit a3bc7f916dcc69cfa439b424352d5951b4eaf9b8) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index af7946888c..22f5527f6f 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -1615,7 +1615,7 @@ static void decode_postinit(H264Context *h, int setup_finished) || (h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > INT_MIN && h->last_pocs[MAX_DELAYED_PIC_COUNT-1] - h->last_pocs[MAX_DELAYED_PIC_COUNT-2] > 2)) out_of_order = FFMAX(out_of_order, 1); if(s->avctx->has_b_frames < out_of_order && !h->sps.bitstream_restriction_flag){ - av_log(s->avctx, AV_LOG_WARNING, "Increasing reorder buffer to %d\n", out_of_order); + av_log(s->avctx, AV_LOG_VERBOSE, "Increasing reorder buffer to %d\n", out_of_order); s->avctx->has_b_frames = out_of_order; s->low_delay = 0; } From 92e5e6215668f463c209cf53254770e9651012cd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Jun 2012 17:06:19 +0200 Subject: [PATCH 089/257] buildsys: fix rules for swresample-test Signed-off-by: Michael Niedermayer (cherry picked from commit 63b1c08073adefb93c9fe8e3a6fd9c1b99772b7e) Signed-off-by: Michael Niedermayer --- libswresample/Makefile | 2 +- libswresample/{swresample_test.c => swresample-test.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename libswresample/{swresample_test.c => swresample-test.c} (100%) diff --git a/libswresample/Makefile b/libswresample/Makefile index 6e4e468495..0a13412163 100644 --- a/libswresample/Makefile +++ b/libswresample/Makefile @@ -7,4 +7,4 @@ HEADERS = swresample.h OBJS = swresample.o audioconvert.o resample.o rematrix.o dither.o -TESTPROGS = swresample_test +TESTPROGS = swresample diff --git a/libswresample/swresample_test.c b/libswresample/swresample-test.c similarity index 100% rename from libswresample/swresample_test.c rename to libswresample/swresample-test.c From a53ca16ae95f30173d1ad6d085045de0f6db0672 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Jun 2012 17:12:50 +0200 Subject: [PATCH 090/257] swr-test: support "--help" Signed-off-by: Michael Niedermayer (cherry picked from commit 787c395a30ecc87bd6dadf2ec1ccab8648653880) Signed-off-by: Michael Niedermayer --- libswresample/swresample-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswresample/swresample-test.c b/libswresample/swresample-test.c index 7af55b8389..8a88b3945b 100644 --- a/libswresample/swresample-test.c +++ b/libswresample/swresample-test.c @@ -243,7 +243,7 @@ int main(int argc, char **argv){ struct SwrContext *backw_ctx= NULL; if (argc > 1) { - if (!strcmp(argv[1], "-h")) { + if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) { av_log(NULL, AV_LOG_INFO, "Usage: swresample-test [[ ]] \n" "num_tests Default is %d\n", num_tests); return 0; From dc85ca0945c902695815fe9a32aeb383236a19b6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 5 Jun 2012 19:58:03 +0200 Subject: [PATCH 091/257] ffmpeg: use isatty() before messing with the terminal state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes terminal messup in case of crashes (like in make fate) Reviewed-by: François Revol Signed-off-by: Michael Niedermayer (cherry picked from commit c8a11014b673ebc6946db6fcd20009d330c57c48) Signed-off-by: Michael Niedermayer --- ffmpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index fad21c0b61..99ecb7830e 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1456,7 +1456,9 @@ static void term_init(void) #if HAVE_TERMIOS_H if(!run_as_daemon){ struct termios tty; - +#if HAVE_ISATTY + if(isatty(0) && isatty(2)) +#endif if (tcgetattr (0, &tty) == 0) { oldtty = tty; restore_tty = 1; From 565581b0a4e89e2633bef868d9db52bd999122d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Wed, 6 Jun 2012 12:39:07 +0200 Subject: [PATCH 092/257] ffmpeg: avoid a confusing and easy to break if(). Signed-off-by: Michael Niedermayer (cherry picked from commit 93147daf59b096f3d6ad6d9e8d8c11c293e425d2) Signed-off-by: Michael Niedermayer --- ffmpeg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ffmpeg.c b/ffmpeg.c index 99ecb7830e..6b204a176f 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1456,10 +1456,11 @@ static void term_init(void) #if HAVE_TERMIOS_H if(!run_as_daemon){ struct termios tty; + int istty = 1; #if HAVE_ISATTY - if(isatty(0) && isatty(2)) + istty = isatty(0) && isatty(2); #endif - if (tcgetattr (0, &tty) == 0) { + if (istty && tcgetattr (0, &tty) == 0) { oldtty = tty; restore_tty = 1; atexit(term_exit); From 6be8e44c00dcd6d38e697ae6c9f175bae028e468 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 6 Jun 2012 18:35:05 +0200 Subject: [PATCH 093/257] search_for_quantizers_faac: fix curband Signed-off-by: Michael Niedermayer (cherry picked from commit 33775c3507f4e0977d8ef1d8c5cbd167d0429319) Signed-off-by: Michael Niedermayer --- libavcodec/aaccoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index b6fefd3e62..b48da99ef1 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -878,7 +878,7 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s, } else { for (w = 0; w < 8; w++) { const float *coeffs = sce->coeffs + w*128; - start = 0; + curband = start = 0; for (i = 0; i < 128; i++) { if (i - start >= sce->ics.swb_sizes[curband]) { start += sce->ics.swb_sizes[curband]; From 5c2ffa2ce7304bba7bd19187d8e8479bf652c826 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 6 Jun 2012 19:26:21 +0200 Subject: [PATCH 094/257] mpegvideo: fix out of heap array accesses Signed-off-by: Michael Niedermayer (cherry picked from commit 317ca0d3f735fad354c404e8bbac3e1ce9f09b12) Signed-off-by: Michael Niedermayer --- libavcodec/mpegvideo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 4f6868df9c..705951af34 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1436,7 +1436,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, y = (x * f) >> 16; fr = (x * f) & 0xFFFF; buf[y * stride + x] += (color * (0x10000 - fr)) >> 16; - buf[(y + 1) * stride + x] += (color * fr ) >> 16; + if(fr) buf[(y + 1) * stride + x] += (color * fr ) >> 16; } } else { if (sy > ey) { @@ -1453,7 +1453,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, x = (y*f) >> 16; fr = (y*f) & 0xFFFF; buf[y * stride + x] += (color * (0x10000 - fr)) >> 16; - buf[y * stride + x + 1] += (color * fr ) >> 16; + if(fr) buf[y * stride + x + 1] += (color * fr ) >> 16; } } } From 964f8419ddb13714c3dffa582e61bde49c0226f4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 31 May 2012 15:53:58 +0200 Subject: [PATCH 095/257] probetest: allow specifying parameters on the command line Signed-off-by: Michael Niedermayer (cherry picked from commit 6cfaccabc4edc3321c9a47e349236815b9d649e2) Signed-off-by: Michael Niedermayer --- tools/probetest.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/probetest.c b/tools/probetest.c index 36a05a3de1..f8a617ddea 100644 --- a/tools/probetest.c +++ b/tools/probetest.c @@ -49,12 +49,19 @@ static void probe(AVProbeData *pd, int type, int p, int size) } } -int main(void) +int main(int argc, char **argv) { unsigned int p, i, type, size, retry; AVProbeData pd; AVLFG state; PutBitContext pb; + int retry_count= 4097; + int max_size = 65537; + + if(argc >= 2) + retry_count = atoi(argv[1]); + if(argc >= 3) + max_size = atoi(argv[2]); avcodec_register_all(); av_register_all(); @@ -62,14 +69,14 @@ int main(void) av_lfg_init(&state, 0xdeadbeef); pd.buf = NULL; - for (size = 1; size < 65537; size *= 2) { + for (size = 1; size < max_size; size *= 2) { pd.buf_size = size; pd.buf = av_realloc(pd.buf, size + AVPROBE_PADDING_SIZE); pd.filename = ""; fprintf(stderr, "testing size=%d\n", size); - for (retry = 0; retry < 4097; retry += FFMAX(size, 32)) { + for (retry = 0; retry < retry_count; retry += FFMAX(size, 32)) { for (type = 0; type < 4; type++) { for (p = 0; p < 4096; p++) { unsigned hist = 0; From 39fe8033bbf94cac7935d749849fdf67ba8fc16a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 7 Jun 2012 22:53:09 +0200 Subject: [PATCH 096/257] Update for 0.11.1 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index 3841d23602..4e103beb28 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.11 +PROJECT_NUMBER = 0.11.1 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 51176c7c89..af88ba8248 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.11 +0.11.1 diff --git a/VERSION b/VERSION index 51176c7c89..af88ba8248 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11 +0.11.1 From a19010f7a6bc9e37b22e5b19d5eaba84d404b2f4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 2 Jul 2012 12:47:08 +0200 Subject: [PATCH 097/257] wmaenc: dont mess with the bitrate. The bitrate is not writeable by an encoder. Fixes generation of invalid wma Signed-off-by: Michael Niedermayer --- libavcodec/wmaenc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c index 71446e1ce1..dab7103fb0 100644 --- a/libavcodec/wmaenc.c +++ b/libavcodec/wmaenc.c @@ -85,8 +85,6 @@ static int encode_init(AVCodecContext * avctx){ (avctx->sample_rate * 8); s->block_align = FFMIN(s->block_align, MAX_CODED_SUPERFRAME_SIZE); avctx->block_align = s->block_align; - avctx->bit_rate = avctx->block_align * 8LL * avctx->sample_rate / - s->frame_len; //av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", s->block_align, avctx->bit_rate, s->frame_len, avctx->sample_rate); avctx->frame_size = avctx->delay = s->frame_len; From 606538df6c05df51aa811cef0c0bccb7499cc4a1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 5 Aug 2012 04:41:34 +0200 Subject: [PATCH 098/257] oggdec: check stream index before using it in ogg_get_length() Fixes crash based on a uninitialized array index read. If the read does not crash then out of array writes based on the same index might have been triggered afterwards. Found-by: inferno@chromium.org Signed-off-by: Michael Niedermayer (cherry picked from commit 9e1c55cfdec1e1e46fa39b92ea5c425ba9499c68) Signed-off-by: Michael Niedermayer --- libavformat/oggdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index d30c17cc2a..6df48315d6 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -524,7 +524,9 @@ static int ogg_get_length(AVFormatContext *s) ogg_save (s); avio_seek (s->pb, s->data_offset, SEEK_SET); ogg_reset(s); + i = -1; while (!ogg_packet(s, &i, NULL, NULL, NULL)) { + if(i>=0) { int64_t pts = ogg_calc_pts(s, i, NULL); if (pts != AV_NOPTS_VALUE && s->streams[i]->start_time == AV_NOPTS_VALUE && !ogg->streams[i].got_start){ s->streams[i]->duration -= pts; @@ -533,6 +535,7 @@ static int ogg_get_length(AVFormatContext *s) }else if(s->streams[i]->start_time != AV_NOPTS_VALUE && !ogg->streams[i].got_start){ ogg->streams[i].got_start= 1; streams_left--; + } } if(streams_left<=0) break; From 5231a35559c8c791716fea67db936b7456314f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 5 Aug 2012 09:41:20 +0200 Subject: [PATCH 099/257] oggdec: simplify start time calculation code. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also slightly more correct behaviour in case streams_left for some reason is 0 from the start. Signed-off-by: Reimar Döffinger (cherry picked from commit a4163b2d6583396845e06b1b976c3a981eb8cb1c) Signed-off-by: Michael Niedermayer --- libavformat/oggdec.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 6df48315d6..5fb13addb2 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -525,9 +525,10 @@ static int ogg_get_length(AVFormatContext *s) avio_seek (s->pb, s->data_offset, SEEK_SET); ogg_reset(s); i = -1; - while (!ogg_packet(s, &i, NULL, NULL, NULL)) { - if(i>=0) { - int64_t pts = ogg_calc_pts(s, i, NULL); + while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) { + int64_t pts; + if (i < 0) continue; + pts = ogg_calc_pts(s, i, NULL); if (pts != AV_NOPTS_VALUE && s->streams[i]->start_time == AV_NOPTS_VALUE && !ogg->streams[i].got_start){ s->streams[i]->duration -= pts; ogg->streams[i].got_start= 1; @@ -536,9 +537,6 @@ static int ogg_get_length(AVFormatContext *s) ogg->streams[i].got_start= 1; streams_left--; } - } - if(streams_left<=0) - break; } ogg_restore (s, 0); From fb52da522c0e71b17056e4e3b06af80b88ef8b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 5 Aug 2012 09:45:04 +0200 Subject: [PATCH 100/257] oggdec: Initialize stream index to -1 in ogg_packet. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous method of having to initialize it outside lead to incorrect code: even if it was initialized, it usually was only initialized once, thus a packet that could not be matched to any stream would just be processed with the return values from the previous call. Signed-off-by: Reimar Döffinger (cherry picked from commit 69aeba1396d5a13e79cbc3cc9f49fd6896addb82) Signed-off-by: Michael Niedermayer --- libavformat/oggdec.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index 5fb13addb2..798106a4bf 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -336,6 +336,13 @@ static int ogg_read_page(AVFormatContext *s, int *str) return 0; } +/** + * @brief find the next Ogg packet + * @param *str is set to the stream for the packet or -1 if there is + * no matching stream, in that case assume all other return + * values to be uninitialized. + * @return negative value on error or EOF. + */ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize, int64_t *fpos) { @@ -346,6 +353,8 @@ static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize, int segp = 0, psize = 0; av_dlog(s, "ogg_packet: curidx=%i\n", ogg->curidx); + if (str) + *str = -1; do{ idx = ogg->curidx; @@ -524,7 +533,6 @@ static int ogg_get_length(AVFormatContext *s) ogg_save (s); avio_seek (s->pb, s->data_offset, SEEK_SET); ogg_reset(s); - i = -1; while (streams_left > 0 && !ogg_packet(s, &i, NULL, NULL, NULL)) { int64_t pts; if (i < 0) continue; @@ -611,7 +619,7 @@ static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt) { struct ogg *ogg; struct ogg_stream *os; - int idx = -1, ret; + int idx, ret; int pstart, psize; int64_t fpos, pts, dts; @@ -670,7 +678,7 @@ static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index, AVIOContext *bc = s->pb; int64_t pts = AV_NOPTS_VALUE; int64_t keypos = -1; - int i = -1; + int i; int pstart, psize; avio_seek(bc, *pos_arg, SEEK_SET); ogg_reset(s); From 3f78fe1d5681b1275e48796dd9ede5ab7bf56f87 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 31 Aug 2012 14:16:36 +0200 Subject: [PATCH 101/257] Clarify that -passlogfile has a different syntax when used with -vcodec libx264. --- doc/ffmpeg.texi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi index 44c2ad42ed..1599b0c6c5 100644 --- a/doc/ffmpeg.texi +++ b/doc/ffmpeg.texi @@ -340,6 +340,10 @@ prefix is ``ffmpeg2pass''. The complete file name will be @file{PREFIX-N.log}, where N is a number specific to the output stream +Note that this option is overwritten by a local option of the same name +when using @code{-vcodec libx264}. That option maps to the x264 option stats +which has a different syntax. + @item -vlang @var{code} Set the ISO 639 language code (3 letters) of the current video stream. From ae8491ce33cfe5a9e33764579c9e55e785107e98 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 8 Aug 2012 16:01:01 +0200 Subject: [PATCH 102/257] configure: fix sctp check. This fixes build failures on debian/kfreebsd Signed-off-by: Michael Niedermayer (cherry picked from commit bed63a5e98b1ba1f3bca6c81ea819666c2d81fde) Conflicts: configure Signed-off-by: Michael Niedermayer --- configure | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 4e1a61196a..0b6e0ac022 100755 --- a/configure +++ b/configure @@ -1217,7 +1217,6 @@ HAVE_LIST=" memalign mkstemp mmap - netinet_sctp_h PeekNamedPipe poll_h posix_memalign @@ -1237,6 +1236,7 @@ HAVE_LIST=" struct_addrinfo struct_ipv6_mreq struct_rusage_ru_maxrss + struct_sctp_event_subscribe struct_sockaddr_in6 struct_sockaddr_sa_len struct_sockaddr_storage @@ -1665,7 +1665,7 @@ mmst_protocol_deps="network" rtmp_protocol_deps="!librtmp_protocol" rtmp_protocol_select="tcp_protocol" rtp_protocol_select="udp_protocol" -sctp_protocol_deps="network netinet_sctp_h" +sctp_protocol_deps="network struct_sctp_event_subscribe" tcp_protocol_deps="network" tls_protocol_deps_any="openssl gnutls" tls_protocol_select="tcp_protocol" @@ -3070,7 +3070,7 @@ if enabled network; then check_type netinet/in.h "struct sockaddr_in6" check_type "sys/types.h sys/socket.h" "struct sockaddr_storage" check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len - check_header netinet/sctp.h + check_type netinet/sctp.h "struct sctp_event_subscribe" # Prefer arpa/inet.h over winsock2 if check_header arpa/inet.h ; then check_func closesocket From b45a8f6d249d20572cb4f37c86eb4432a0cff16f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 24 Jun 2012 11:17:13 +0100 Subject: [PATCH 103/257] dxva2: include dxva.h if found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Apparently, some build environments require dxva.h even for dxva2, while others lack this header entirely. Including it conditionally allows building in both cases. Signed-off-by: Martin Storsjö (cherry picked from commit fa84506177f0246b30d4ea6a99ee5d419f3e4550) Conflicts: configure Signed-off-by: Michael Niedermayer --- configure | 2 ++ libavcodec/dxva2_internal.h | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/configure b/configure index 0b6e0ac022..bbdc6001da 100755 --- a/configure +++ b/configure @@ -1173,6 +1173,7 @@ HAVE_LIST=" dlfcn_h dlopen dos_paths + dxva_h ebp_available ebx_available exp2 @@ -3125,6 +3126,7 @@ check_func_headers windows.h VirtualAlloc check_func_headers glob.h glob check_header dlfcn.h +check_header dxva.h check_header dxva2api.h -D_WIN32_WINNT=0x0600 check_header libcrystalhd/libcrystalhd_if.h check_header malloc.h diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index 23d4d87522..fcf45bc664 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -25,7 +25,14 @@ #define _WIN32_WINNT 0x0600 #define COBJMACROS + +#include "config.h" + #include "dxva2.h" +#if HAVE_DXVA_H +#include +#endif + #include "avcodec.h" #include "mpegvideo.h" From d14ce698697c1fe0ade462191ef9ae69f03ce6ac Mon Sep 17 00:00:00 2001 From: jamal Date: Wed, 11 Jul 2012 22:45:00 -0300 Subject: [PATCH 104/257] doc/Makefile: Add missing $(HOSTEXESUF) to print_options (cherry picked from commit d48f014ff1db985fa3f74eddfb30bf513f99ff7a) Signed-off-by: Michael Niedermayer --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 16f6a0d43e..8c829efa77 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -35,7 +35,7 @@ GENTEXI = format codec GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi) $(GENTEXI): TAG = GENTEXI -$(GENTEXI): doc/avoptions_%.texi: doc/print_options +$(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF) $(M)doc/print_options $* > $@ doc/%.html: TAG = HTML From 4155968fc6eb28f8e2275b462468b83bea25bfc5 Mon Sep 17 00:00:00 2001 From: jamal Date: Fri, 3 Aug 2012 17:13:27 -0300 Subject: [PATCH 105/257] build: Fix some paths in uninstall-libs Folder and file names weren't being separated with a slash. This resulted in .dll.a, .lib and .def files not being removed on uninstall. Signed-off-by: Alexander Strasser (cherry picked from commit 49440853d0c1e740daee0e2df1e65d5e67b1ad6b) Signed-off-by: Michael Niedermayer --- library.mak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.mak b/library.mak index 53f1ee7741..82d1a09582 100644 --- a/library.mak +++ b/library.mak @@ -82,8 +82,8 @@ uninstall-libs:: -$(RM) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \ "$(SHLIBDIR)/$(SLIBNAME)" \ "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)" - -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)"%) - -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)"%) + -$(RM) $(SLIB_INSTALL_EXTRA_SHLIB:%="$(SHLIBDIR)/%") + -$(RM) $(SLIB_INSTALL_EXTRA_LIB:%="$(LIBDIR)/%") -$(RM) "$(LIBDIR)/$(LIBNAME)" uninstall-headers:: From 72791e41d40b30b76a86b56aa6bc1c300ecc6677 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 12 Sep 2012 13:08:27 +0200 Subject: [PATCH 106/257] Fix muxing mjpeg in swf. (cherry picked from commit 7680d99b4302e476076cc1b8f2567f47c2aaef4d) --- libavformat/swfenc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 6a3cdad09e..8177ffabf1 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -494,8 +494,10 @@ static int swf_write_trailer(AVFormatContext *s) avio_wl32(pb, file_size); avio_seek(pb, swf->duration_pos, SEEK_SET); avio_wl16(pb, swf->video_frame_number); + if (swf->vframes_pos) { avio_seek(pb, swf->vframes_pos, SEEK_SET); avio_wl16(pb, swf->video_frame_number); + } avio_seek(pb, file_size, SEEK_SET); } return 0; From 3593f577b0ac9dd77e3fa83f6dde6280e67fa2ab Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 12 Sep 2012 19:33:42 +0200 Subject: [PATCH 107/257] lavfi/audio: fix an invalid boundary check. --- libavfilter/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/audio.c b/libavfilter/audio.c index 0616f97551..2e625068c4 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -204,7 +204,7 @@ void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate; /* Copy actual data into new samples buffer */ - for (i = 0; samplesref->data[i] && i < 8; i++) + for (i = 0; i < 8 && samplesref->data[i]; i++) memcpy(link->cur_buf->data[i], samplesref->data[i], samplesref->linesize[0]); for (i = 0; i < planes; i++) memcpy(link->cur_buf->extended_data[i], samplesref->extended_data[i], samplesref->linesize[0]); From 05e64b51bba71ee821adaa7f75a5161455bb972f Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 12 Sep 2012 19:34:21 +0200 Subject: [PATCH 108/257] lavfi/aresample: set buffer properties after copy. The aresample filter changes the format, layout and/or sample rate, it can not copy them blindly from its input. Fix trac ticket 1671 because af_volume uses the properties from the buffer and not from the link. --- libavfilter/af_aresample.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c index 8ead3147a9..90e87813df 100644 --- a/libavfilter/af_aresample.c +++ b/libavfilter/af_aresample.c @@ -176,6 +176,9 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *insamplesref avfilter_copy_buffer_ref_props(outsamplesref, insamplesref); + outsamplesref->format = outlink->format; + outsamplesref->audio->channel_layout = outlink->channel_layout; + outsamplesref->audio->sample_rate = outlink->sample_rate; if(insamplesref->pts != AV_NOPTS_VALUE) { int64_t inpts = av_rescale(insamplesref->pts, inlink->time_base.num * (int64_t)outlink->sample_rate * inlink->sample_rate, inlink->time_base.den); From f1ec792ae3011531d47070144b8c91d58bb3e76f Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Thu, 13 Sep 2012 21:26:43 -0700 Subject: [PATCH 109/257] pthread: Avoid crashes/odd behavior caused by spurious wakeups pthread_wait_cond can wake up for no reason (Wikipedia: Spurious_wakeup). The FF_THREAD_SLICE thread mechanism could spontaneously execute jobs or allow the caller of avctx->execute to return before all jobs were complete. This adds tests to both cases to ensure the wakeup is real. Signed-off-by: Ben Jackson Signed-off-by: Michael Niedermayer (cherry picked from commit e3329474a366de066b25e86f35f5abf9c5a4b7b2) Signed-off-by: Michael Niedermayer --- libavcodec/pthread.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index 482c8456af..d0d1343ea6 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -79,6 +79,7 @@ typedef struct ThreadContext { pthread_cond_t current_job_cond; pthread_mutex_t current_job_lock; int current_job; + unsigned int current_execute; int done; } ThreadContext; @@ -203,6 +204,7 @@ static void* attribute_align_arg worker(void *v) AVCodecContext *avctx = v; ThreadContext *c = avctx->thread_opaque; int our_job = c->job_count; + int last_execute = 0; int thread_count = avctx->thread_count; int self_id; @@ -213,7 +215,9 @@ static void* attribute_align_arg worker(void *v) if (c->current_job == thread_count + c->job_count) pthread_cond_signal(&c->last_job_cond); - pthread_cond_wait(&c->current_job_cond, &c->current_job_lock); + while (last_execute == c->current_execute && !c->done) + pthread_cond_wait(&c->current_job_cond, &c->current_job_lock); + last_execute = c->current_execute; our_job = self_id; if (c->done) { @@ -233,7 +237,8 @@ static void* attribute_align_arg worker(void *v) static av_always_inline void avcodec_thread_park_workers(ThreadContext *c, int thread_count) { - pthread_cond_wait(&c->last_job_cond, &c->current_job_lock); + while (c->current_job != thread_count + c->job_count) + pthread_cond_wait(&c->last_job_cond, &c->current_job_lock); pthread_mutex_unlock(&c->current_job_lock); } @@ -282,6 +287,7 @@ static int avcodec_thread_execute(AVCodecContext *avctx, action_func* func, void c->rets = &dummy_ret; c->rets_count = 1; } + c->current_execute++; pthread_cond_broadcast(&c->current_job_cond); avcodec_thread_park_workers(c, avctx->thread_count); From 3581ab6ce0754544b06f34f7875b731a5ca2e061 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 14 Sep 2012 05:55:11 +0200 Subject: [PATCH 110/257] mpegaudio_parser: reset state to prevent it to be random Fixes Ticket1718 Signed-off-by: Michael Niedermayer (cherry picked from commit 93b240f4a59348c07d3d7e4862227f6949c51e14) Signed-off-by: Michael Niedermayer --- libavcodec/mpegaudio_parser.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index 18c224f76c..6ceca83e04 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -53,6 +53,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, int inc= FFMIN(buf_size - i, s->frame_size); i += inc; s->frame_size -= inc; + state = 0; if(!s->frame_size){ next= i; From 450e4b1a60721d25f306d97062f35c9c3d7989f8 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 16 Aug 2012 03:15:14 +0200 Subject: [PATCH 111/257] sp5xdec: fix off by 1 error causing a crash Fixes Ticket1633 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit f0896a6bd94e5b45447c7d640c8e8aa95d860d7a) Signed-off-by: Michael Niedermayer --- libavcodec/sp5xdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/sp5xdec.c b/libavcodec/sp5xdec.c index 4aca0ccbd6..9a3b3f25ea 100644 --- a/libavcodec/sp5xdec.c +++ b/libavcodec/sp5xdec.c @@ -72,7 +72,7 @@ static int sp5x_decode_frame(AVCodecContext *avctx, for (i = 2; i < buf_size-2 && j < buf_size+1024-2; i++) recoded[j++] = buf[i]; else - for (i = 14; i < buf_size && j < buf_size+1024-2; i++) + for (i = 14; i < buf_size && j < buf_size+1024-3; i++) { recoded[j++] = buf[i]; if (buf[i] == 0xff) From 9f1e01c9915fe0c86ad2b8f50e11fee9e1b00c62 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 16 Aug 2012 22:28:29 +0200 Subject: [PATCH 112/257] escape124: fix integer overflow leading to excessive memory allocation Fixes Ticket1629 Signed-off-by: Michael Niedermayer (cherry picked from commit 3d7817048cb387de87600f2152075f78b37b60a6) Signed-off-by: Michael Niedermayer --- libavcodec/escape124.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index 283a5d644a..8548ea08a4 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -48,7 +48,7 @@ typedef struct Escape124Context { CodeBook codebooks[3]; } Escape124Context; -static int can_safely_read(GetBitContext* gb, int bits) { +static int can_safely_read(GetBitContext* gb, uint64_t bits) { return get_bits_left(gb) >= bits; } @@ -90,7 +90,7 @@ static CodeBook unpack_codebook(GetBitContext* gb, unsigned depth, unsigned i, j; CodeBook cb = { 0 }; - if (!can_safely_read(gb, size * 34)) + if (!can_safely_read(gb, size * 34L)) return cb; if (size >= INT_MAX / sizeof(MacroBlock)) From 55b3e408fa18b918bd0cabb1b27f1f0c4ce57a64 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 7 Sep 2012 12:35:41 +0200 Subject: [PATCH 113/257] faxcompr: fix out of array read Signed-off-by: Michael Niedermayer (cherry picked from commit 5891e454a667e42ef71a06bfd9661540ea3f3ebd) Signed-off-by: Michael Niedermayer --- libavcodec/faxcompr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/faxcompr.c b/libavcodec/faxcompr.c index e93926f455..8215115054 100644 --- a/libavcodec/faxcompr.c +++ b/libavcodec/faxcompr.c @@ -228,7 +228,7 @@ static int decode_group3_2d_line(AVCodecContext *avctx, GetBitContext *gb, mode = !mode; } //sync line pointers - while(run_off <= offs){ + while(offs < width && run_off <= offs){ run_off += *ref++; run_off += *ref++; } From d721cb009d73662f35c629bdc678e25786e79301 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 14 Aug 2012 18:58:49 +0200 Subject: [PATCH 114/257] bmv_videodec: fix out of array read Fixes Ticket1373 Signed-off-by: Michael Niedermayer (cherry picked from commit 70f0ffa1ed456fd0b560d0dd1d0d93f1ba3a6d93) Signed-off-by: Michael Niedermayer --- libavcodec/bmv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 35923a28d6..d2f4e9f86c 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -268,6 +268,11 @@ static av_cold int decode_init(AVCodecContext *avctx) c->avctx = avctx; avctx->pix_fmt = PIX_FMT_PAL8; + if (avctx->width != SCREEN_WIDE || avctx->height != SCREEN_HIGH) { + av_log(avctx, AV_LOG_ERROR, "Invalid dimension %dx%d\n", avctx->width, avctx->height); + return AVERROR_INVALIDDATA; + } + c->pic.reference = 1; if (avctx->get_buffer(avctx, &c->pic) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); From 99dbda30085c04236332ce0cca9f9bfd241ac4cd Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 8 Aug 2012 14:10:06 +0000 Subject: [PATCH 115/257] aasc: fix out of array write Closes #1619. Signed-off-by: Paul B Mahol (cherry picked from commit 8a57ca5c6a1c0ad28afa7ea6f824981e6761cce1) Signed-off-by: Michael Niedermayer --- libavcodec/aasc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c index db33eff5eb..a7944c2767 100644 --- a/libavcodec/aasc.c +++ b/libavcodec/aasc.c @@ -66,7 +66,7 @@ static int aasc_decode_frame(AVCodecContext *avctx, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AascContext *s = avctx->priv_data; - int compr, i, stride; + int compr, i, stride, psize; s->frame.reference = 3; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; @@ -78,6 +78,7 @@ static int aasc_decode_frame(AVCodecContext *avctx, compr = AV_RL32(buf); buf += 4; buf_size -= 4; + psize = avctx->bits_per_coded_sample / 8; switch (avctx->codec_tag) { case MKTAG('A', 'A', 'S', '4'): bytestream2_init(&s->gb, buf - 4, buf_size + 4); @@ -86,13 +87,13 @@ static int aasc_decode_frame(AVCodecContext *avctx, case MKTAG('A', 'A', 'S', 'C'): switch(compr){ case 0: - stride = (avctx->width * 3 + 3) & ~3; + stride = (avctx->width * psize + psize) & ~psize; for(i = avctx->height - 1; i >= 0; i--){ - if(avctx->width*3 > buf_size){ + if(avctx->width * psize > buf_size){ av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n"); break; } - memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width*3); + memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width * psize); buf += stride; buf_size -= stride; } From b5e72345a63e04ba45c01fa5c9284ef7c03bc4cf Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 15 Sep 2012 00:27:17 +0200 Subject: [PATCH 116/257] Update for 0.11.2 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index 4e103beb28..27e40e82f3 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.11.1 +PROJECT_NUMBER = 0.11.2 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index af88ba8248..bc859cbd6d 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.11.1 +0.11.2 diff --git a/VERSION b/VERSION index af88ba8248..bc859cbd6d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.1 +0.11.2 From a5069caecdc5a58930f9021a0b4f89ecffb320f5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 12 Jun 2012 23:04:16 +0200 Subject: [PATCH 117/257] arm/intmath: disable av_clip_uintp2_arm with config_small The code otherwise breaks compilation (gcc 4.5 tested but probably any compiler) Signed-off-by: Michael Niedermayer (cherry picked from commit 2942431a0f94ecb77744a772c164ab71711ffe19) Signed-off-by: Michael Niedermayer --- libavutil/arm/intmath.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/arm/intmath.h b/libavutil/arm/intmath.h index 52af66e722..f5a59a6928 100644 --- a/libavutil/arm/intmath.h +++ b/libavutil/arm/intmath.h @@ -75,6 +75,7 @@ static av_always_inline av_const int16_t av_clip_int16_arm(int a) return x; } +#if !CONFIG_SMALL //the code below cannot be compiled without always_inline #define av_clip_uintp2 av_clip_uintp2_arm static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) { @@ -82,7 +83,7 @@ static av_always_inline av_const unsigned av_clip_uintp2_arm(int a, int p) __asm__ ("usat %0, %2, %1" : "=r"(x) : "r"(a), "i"(p)); return x; } - +#endif //!CONFIG_SMALL #else /* HAVE_ARMV6 */ From b06903e6c56d2e08c3b79f67a1e81e24e90c60ac Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 19 Sep 2012 03:11:27 +0200 Subject: [PATCH 118/257] Changelog for 0.11.2 Signed-off-by: Michael Niedermayer --- Changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Changelog b/Changelog index 8a37412c26..cf890b397e 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,12 @@ releases are sorted from youngest to oldest. version next: +version 0.11.2: + +- Several bugs and crashes have been fixed as well as build problems + with recent mingw64 + + version 0.11: Fixes:CVE-2012-2772, CVE-2012-2774, CVE-2012-2775, CVE-2012-2776, CVE-2012-2777, CVE-2012-2779, CVE-2012-2782, CVE-2012-2783, CVE-2012-2784, CVE-2012-2785, From d3835cb87714bece30e6ce748c9f11ca640859da Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Tue, 4 Dec 2012 19:49:51 +0100 Subject: [PATCH 119/257] lavf: compute probe buffer size more reliably. The previous code computes the offset by reversing the growth of the allocated buffer size: it is complex and did lead to inconsistencies when the size limit is reached. Fix trac ticket #1991. (cherry picked from commit 03847eb8259291b4ff1bd840bd779d0699d71f96) Conflicts: libavformat/utils.c (cherry picked from commit e74cd2f4706f71da5e9205003c1d8263b54ed3fb) --- libavformat/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index ca97b91511..fd0b10b917 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -460,7 +460,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, { AVProbeData pd = { filename ? filename : "", NULL, -offset }; unsigned char *buf = NULL; - int ret = 0, probe_size; + int ret = 0, probe_size, buf_offset = 0; if (!max_probe_size) { max_probe_size = PROBE_BUF_MAX; @@ -500,7 +500,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, score = 0; ret = 0; /* error was end of file, nothing read */ } - pd.buf_size += ret; + pd.buf_size = buf_offset += ret; pd.buf = &buf[offset]; memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); From 54ac3d10d158923ead4750d36e1c9773349a5e74 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 28 Sep 2012 01:38:44 +0200 Subject: [PATCH 120/257] mp3dec: Fix possibly exploitable crash I was sadly unable to find a non fuzzed mp3 that uses the feature that contained the bug (and i searched hard ...), thus while this fixes the security issue. It may or may not fix mixed blocks in 8khz mp3s, i cant say due to lack of samples to test. Security issue exists since: b37d945dd4213cb8e92146571b0374cd45d52286 Reported-by: Dale Curtis (Probably) Found-by: inferno@chromium.org Signed-off-by: Michael Niedermayer (cherry picked from commit 94041febc53a6da10e34c2bfff9ff1d580fdce60) Signed-off-by: Michael Niedermayer --- libavcodec/mpegaudiodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 553398acb7..ce19ae3bd2 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -211,7 +211,7 @@ static void ff_compute_band_indexes(MPADecodeContext *s, GranuleDef *g) else g->long_end = 6; - g->short_start = 2 + (s->sample_rate_index != 8); + g->short_start = 3; } else { g->long_end = 0; g->short_start = 0; From 69cc119d64e1071dba25c6cf3d03998f8c22959d Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Wed, 5 Dec 2012 19:56:36 +0100 Subject: [PATCH 121/257] h264: slice-mt: get last_pic_dropable from master context Fixes fate-h264-conformance-cvnlfi2_sony_h and smllwebdl.mkv from https://github.com/OpenELEC/OpenELEC.tv/issues/1557 . (cherry picked from commit 24c62ea7a5df44804be88150aa0c45e6796b5da9) Signed-off-by: Michael Niedermayer --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 22f5527f6f..94c4399c3c 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3133,7 +3133,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) h->mb_mbaff = 0; h->mb_aff_frame = 0; last_pic_structure = s0->picture_structure; - last_pic_dropable = s->dropable; + last_pic_dropable = s0->dropable; s->dropable = h->nal_ref_idc == 0; if (h->sps.frame_mbs_only_flag) { s->picture_structure = PICT_FRAME; From c6850d38625b731cdf9186f79bc38417736a7572 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 18 Oct 2012 04:58:20 +0200 Subject: [PATCH 122/257] riff: retry reading metadata without padding if it fails with Fixes Ticket1821 Reviewed-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit d0c27e88d2bb495d61bd32f41769f767a0c2a802) --- libavformat/riff.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/riff.c b/libavformat/riff.c index c787ec3060..0e63472c86 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -735,8 +735,13 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size) chunk_code = avio_rl32(pb); chunk_size = avio_rl32(pb); if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) { - av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n"); - return AVERROR_INVALIDDATA; + avio_seek(pb, -9, SEEK_CUR); + chunk_code = avio_rl32(pb); + chunk_size = avio_rl32(pb); + if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) { + av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n"); + return AVERROR_INVALIDDATA; + } } chunk_size += (chunk_size & 1); From 28e609a84fc9a46074874a17c5f1b411bf3434d5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 23 Nov 2012 23:35:16 +0100 Subject: [PATCH 123/257] riff: ignore ff_read_riff_info() failure. Some files simply contain invalid info tags. Fixes unrelated bug posted into Ticket1821 Signed-off-by: Michael Niedermayer (cherry picked from commit 09456d0df13404f004ab3a341d9ac21b7e5e6d6d) --- libavformat/wav.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/wav.c b/libavformat/wav.c index c408623f36..5bd76a95bc 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -513,8 +513,7 @@ static int wav_read_header(AVFormatContext *s) } switch (list_type) { case MKTAG('I', 'N', 'F', 'O'): - if ((ret = ff_read_riff_info(s, size - 4)) < 0) - return ret; + ff_read_riff_info(s, size - 4); } break; } From 6d16f5c3f90934017e77a1a57a406126364aa042 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 22 Nov 2012 23:08:01 +0100 Subject: [PATCH 124/257] avidec: try to support oddly muxed MMES stream Fixes ticket1804 Signed-off-by: Michael Niedermayer (cherry picked from commit be89693ddc5a8cdeaf3edf48fb584d6adca54de0) --- libavformat/avidec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 24aacd04fd..1ad126308e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1262,6 +1262,11 @@ static int avi_read_idx1(AVFormatContext *s, int size) avi->stream_index = -1; avio_seek(pb, idx1_pos, SEEK_SET); + if (s->nb_streams == 1 && s->streams[0]->codec->codec_tag == AV_RL32("MMES")){ + first_packet_pos = 0; + data_offset = avi->movi_list; + } + /* Read the entries and sort them in each stream component. */ for(i = 0; i < nb_index_entries; i++) { if(url_feof(pb)) From e9ded2e1a9b567d679d8f9ff1fc958c71d54a803 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Dec 2012 19:29:32 +0100 Subject: [PATCH 125/257] mpeg1video: support multi threaded slice encoding. Signed-off-by: Michael Niedermayer (cherry picked from commit 03df9720168335482f00898fc16b56ff4878d0e7) Conflicts: libavcodec/mpeg12enc.c --- libavcodec/mpeg12enc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index 169f15553e..97ae22a591 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -459,7 +459,7 @@ static av_always_inline void mpeg1_encode_mb_internal(MpegEncContext *s, } if (cbp == 0 && !first_mb && s->mv_type == MV_TYPE_16X16 && - (mb_x != s->mb_width - 1 || (mb_y != s->mb_height - 1 && s->codec_id == CODEC_ID_MPEG1VIDEO)) && + (mb_x != s->mb_width - 1 || (mb_y != s->end_mb_y - 1 && s->codec_id == CODEC_ID_MPEG1VIDEO)) && ((s->pict_type == AV_PICTURE_TYPE_P && (motion_x | motion_y) == 0) || (s->pict_type == AV_PICTURE_TYPE_B && s->mv_dir == s->last_mv_dir && (((s->mv_dir & MV_DIR_FORWARD) ? ((s->mv[0][0][0] - s->last_mv[0][0][0])|(s->mv[0][0][1] - s->last_mv[0][0][1])) : 0) | ((s->mv_dir & MV_DIR_BACKWARD) ? ((s->mv[1][0][0] - s->last_mv[1][0][0])|(s->mv[1][0][1] - s->last_mv[1][0][1])) : 0)) == 0))) { @@ -973,7 +973,7 @@ AVCodec ff_mpeg1video_encoder = { .supported_framerates = avpriv_frame_rate_tab+1, .pix_fmts = (const enum PixelFormat[]){ PIX_FMT_YUV420P, PIX_FMT_NONE }, - .capabilities = CODEC_CAP_DELAY, + .capabilities = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS, .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), .priv_class = &mpeg1_class, }; From 5f0e5b4048f5f67856a1b46499c4207ebcc42717 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Dec 2012 19:52:46 +0100 Subject: [PATCH 126/257] mpeg1video: fix regression with slices != threads Signed-off-by: Michael Niedermayer (cherry picked from commit a01679586cd9ac8470b81c0299fc7e13fd980d64) --- libavcodec/mpegvideo_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 12c507ab4f..56dd2d8134 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -591,7 +591,7 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx) return -1; } - if (s->avctx->thread_count > 1) + if (s->avctx->slices > 1 || s->avctx->thread_count > 1) s->rtp_mode = 1; if (!avctx->time_base.den || !avctx->time_base.num) { From 8bc0127b3d591a06da4ba2e349324c2ee2f3153a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= Date: Sun, 30 Dec 2012 06:53:48 +0100 Subject: [PATCH 127/257] lavc/ass_split: check for NULL pointer in ff_ass_split_override_codes(). This is consistent with the other ff_ass_split_* functions. It also fixes a crash when trying to split a dialog with text=NULL (which seems to happen when the text of the dialog is empty); basically, this commit fixes crashes when trying to encode an empty text subtitle dialog (see subrip and mov_text encoders). Fixes Ticket2048. (cherry picked from commit c83002a4f8042ccfa0688a9a18e8fa0369c1fda8) --- libavcodec/ass_split.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ass_split.c b/libavcodec/ass_split.c index a0b72542c7..4cad9e64cb 100644 --- a/libavcodec/ass_split.c +++ b/libavcodec/ass_split.c @@ -366,7 +366,7 @@ int ff_ass_split_override_codes(const ASSCodesCallbacks *callbacks, void *priv, char new_line[2]; int text_len = 0; - while (*buf) { + while (buf && *buf) { if (text && callbacks->text && (sscanf(buf, "\\%1[nN]", new_line) == 1 || !strncmp(buf, "{\\", 2))) { From 5502b073ec2996b61275aa1ea1c8f3ac24a3d88e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 7 Sep 2012 13:16:04 +0200 Subject: [PATCH 128/257] lavf: factor codec id forcing out Signed-off-by: Michael Niedermayer (cherry picked from commit a7fbc7d7b7eabc74ceb1970a995c56043315e433) Conflicts: libavformat/utils.c --- libavformat/utils.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index fd0b10b917..1e0b344b5c 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -673,6 +673,21 @@ fail: /*******************************************************/ +static void force_codec_ids(AVFormatContext *s, AVStream *st) +{ + switch(st->codec->codec_type){ + case AVMEDIA_TYPE_VIDEO: + if(s->video_codec_id) st->codec->codec_id= s->video_codec_id; + break; + case AVMEDIA_TYPE_AUDIO: + if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id; + break; + case AVMEDIA_TYPE_SUBTITLE: + if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id; + break; + } +} + int ff_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, i; @@ -721,17 +736,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) st= s->streams[pkt->stream_index]; - switch(st->codec->codec_type){ - case AVMEDIA_TYPE_VIDEO: - if(s->video_codec_id) st->codec->codec_id= s->video_codec_id; - break; - case AVMEDIA_TYPE_AUDIO: - if(s->audio_codec_id) st->codec->codec_id= s->audio_codec_id; - break; - case AVMEDIA_TYPE_SUBTITLE: - if(s->subtitle_codec_id)st->codec->codec_id= s->subtitle_codec_id; - break; - } + force_codec_ids(s, st); if(!pktl && st->request_probe <= 0) return ret; From bf19d4c6fa12c482cd460065104856bb8b19e519 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 2 Jan 2013 02:38:11 +0100 Subject: [PATCH 129/257] lavf: Fix codec id forcing with probed codecs Fixes Ticket2088 (cherry picked from commit 341e40f1e1eeba1a2952c26363630596193e887b) --- libavformat/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 1e0b344b5c..7c30fdf061 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -770,6 +770,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt) }else av_log(s, AV_LOG_WARNING, "probed stream %d failed\n", st->index); } + force_codec_ids(s, st); } } } From d338632e9f8a255e8fc4b6efec1e7f7b65255fd8 Mon Sep 17 00:00:00 2001 From: Piotr Bandurski Date: Sun, 6 Jan 2013 01:56:23 +0100 Subject: [PATCH 130/257] tiffdec: Use the correct height field. Fixes Ticket913 Signed-off-by: Michael Niedermayer (cherry picked from commit 4784a135b2b0fe4d1b4c6256bd37265fc45aed3d) --- libavcodec/tiff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index a30e1a948a..256e096b7b 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -501,7 +501,7 @@ static int tiff_decode_tag(TiffContext *s, const uint8_t *start, break; case TIFF_ROWSPERSTRIP: if (type == TIFF_LONG && value == UINT_MAX) - value = s->avctx->height; + value = s->height; if (value < 1) { av_log(s->avctx, AV_LOG_ERROR, "Incorrect value of rows per strip\n"); From 16b0b75327088ce26bb52931f0c25359b0c65c09 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 6 Jan 2013 19:15:16 +0100 Subject: [PATCH 131/257] ff_get_audio_frame_size: try to fix wma in wav Fixes Ticket1905, Ticket2114 Signed-off-by: Michael Niedermayer (cherry picked from commit 2713e43ac85245805db95048493dde121a20aee7) --- libavformat/utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 7c30fdf061..28ffaaa223 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -815,6 +815,13 @@ static int get_audio_frame_size(AVCodecContext *enc, int size, int mux) if (enc->frame_size > 1) return enc->frame_size; + //For WMA we currently have no other means to calculate duration thus we + //do it here by assuming CBR, which is true for all known cases. + if(!mux && enc->bit_rate>0 && size>0 && enc->sample_rate>0 && enc->block_align>1) { + if (enc->codec_id == CODEC_ID_WMAV1 || enc->codec_id == CODEC_ID_WMAV2) + return ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate; + } + return -1; } From 91e016865cccc192f86d40ea93eb06cf0e7ba4a0 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 17 Jan 2013 02:42:17 +0100 Subject: [PATCH 132/257] Fix detection of struct v4l2_frmsize_discrete. It was always detected successfully. --- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index bbdc6001da..6673a45efa 100755 --- a/configure +++ b/configure @@ -3291,7 +3291,14 @@ makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo check_header linux/fb.h check_header linux/videodev.h check_header linux/videodev2.h -check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete +check_cc < +int main(void) { +struct v4l2_frmsizeenum vfse; +vfse.discrete.width = 0; +return 0; +} +EOF check_header sys/videoio.h From ebb3a5974fe399b43271d5ed91d69dcafc448b01 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 24 Jan 2013 02:30:40 +0100 Subject: [PATCH 133/257] matroskaenc: add codec_tag lists back. This reverts 312645e : "Do not set codec_tag property for matroska muxers." Also adds dummy codec_tag lists with codecs supported in mkv but not in wav / avi. Fixes ticket #2169. (cherry picked from commit df39c3ce385c02cbd8046298578ea7454c0a0f81) Conflicts: libavformat/matroskaenc.c --- libavformat/matroska.c | 3 +++ libavformat/matroskaenc.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/libavformat/matroska.c b/libavformat/matroska.c index 52481d7556..a5a4363cc0 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -21,6 +21,9 @@ #include "matroska.h" +/* If you add a tag here that is not in ff_codec_bmp_tags[] + or ff_codec_wav_tags[], add it also to additional_audio_tags[] + or additional_video_tags[] in matroskaenc.c */ const CodecTags ff_mkv_codec_tags[]={ {"A_AAC" , CODEC_ID_AAC}, {"A_AC3" , CODEC_ID_AC3}, diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index a08071f083..178c3f6763 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1304,6 +1304,32 @@ static int mkv_query_codec(enum CodecID codec_id, int std_compliance) return 0; } +const AVCodecTag additional_audio_tags[] = { + { CODEC_ID_ALAC, 0XFFFFFFFF }, + { CODEC_ID_EAC3, 0XFFFFFFFF }, + { CODEC_ID_MLP, 0xFFFFFFFF }, + { CODEC_ID_PCM_S16BE, 0xFFFFFFFF }, + { CODEC_ID_PCM_S24BE, 0xFFFFFFFF }, + { CODEC_ID_PCM_S32BE, 0xFFFFFFFF }, + { CODEC_ID_QDM2, 0xFFFFFFFF }, + { CODEC_ID_RA_144, 0xFFFFFFFF }, + { CODEC_ID_RA_288, 0xFFFFFFFF }, + { CODEC_ID_COOK, 0xFFFFFFFF }, + { CODEC_ID_TRUEHD, 0xFFFFFFFF }, + { CODEC_ID_TTA, 0xFFFFFFFF }, + { CODEC_ID_WAVPACK, 0xFFFFFFFF }, + { CODEC_ID_NONE, 0xFFFFFFFF } +}; + +const AVCodecTag additional_video_tags[] = { + { CODEC_ID_PRORES, 0xFFFFFFFF }, + { CODEC_ID_RV10, 0xFFFFFFFF }, + { CODEC_ID_RV20, 0xFFFFFFFF }, + { CODEC_ID_RV30, 0xFFFFFFFF }, + { CODEC_ID_RV40, 0xFFFFFFFF }, + { CODEC_ID_NONE, 0xFFFFFFFF } +}; + #if CONFIG_MATROSKA_MUXER AVOutputFormat ff_matroska_muxer = { .name = "matroska", @@ -1326,6 +1352,10 @@ AVOutputFormat ff_matroska_muxer = { .write_trailer = mkv_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS | AVFMT_TS_NONSTRICT, + .codec_tag = (const AVCodecTag* const []){ + ff_codec_bmp_tags, ff_codec_wav_tags, + additional_audio_tags, additional_video_tags, 0 + }, .subtitle_codec = CODEC_ID_SSA, .query_codec = mkv_query_codec, }; @@ -1365,5 +1395,8 @@ AVOutputFormat ff_matroska_audio_muxer = { .write_packet = mkv_write_packet, .write_trailer = mkv_write_trailer, .flags = AVFMT_GLOBALHEADER | AVFMT_TS_NONSTRICT, + .codec_tag = (const AVCodecTag* const []){ + ff_codec_wav_tags, additional_audio_tags, 0 + }, }; #endif From 155a0bed972248226b9044f2b72e3695459f1ff9 Mon Sep 17 00:00:00 2001 From: Peter Ross Date: Sun, 6 Jan 2013 14:15:24 +1100 Subject: [PATCH 134/257] wtvdec: demux thumbnail picture to AVStream.attached_pic Fixes ticket #2133. (cherry picked from commit 508836932fcbc3c109fcc4df7a2f2b0bf21bbece) Conflicts: libavformat/wtvdec.c --- libavformat/wtvdec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index 9157042d08..45c930f9bd 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -404,6 +404,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) char description[1024]; unsigned int filesize; AVStream *st; + int ret; int64_t pos = avio_tell(pb); avio_get_str16le(pb, INT_MAX, mime, sizeof(mime)); @@ -420,13 +421,14 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) if (!st) goto done; av_dict_set(&st->metadata, "title", description, 0); + st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_MJPEG; - st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; - st->codec->extradata = av_mallocz(filesize); - if (!st->codec->extradata) + ret = av_get_packet(pb, &st->attached_pic, filesize); + if (ret < 0) goto done; - st->codec->extradata_size = filesize; - avio_read(pb, st->codec->extradata, filesize); + st->attached_pic.stream_index = st->index; + st->attached_pic.flags |= AV_PKT_FLAG_KEY; + st->disposition |= AV_DISPOSITION_ATTACHED_PIC; done: avio_seek(pb, pos + length, SEEK_SET); } From 3cecef5b0389bdd34f05f14498e5252475240258 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 6 Feb 2013 01:25:52 +0100 Subject: [PATCH 135/257] ffmpeg: dont allow -flags to override -pass Fixes Ticket2154 Signed-off-by: Michael Niedermayer (cherry picked from commit ccf9dd00da055e94117b56cead4af80ff331b00e) Conflicts: ffmpeg_opt.c --- ffmpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ffmpeg.c b/ffmpeg.c index 6b204a176f..069ba601ef 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -4703,9 +4703,11 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in if (do_pass) { if (do_pass & 1) { video_enc->flags |= CODEC_FLAG_PASS1; + av_dict_set(&ost->opts, "flags", "+pass1", AV_DICT_APPEND); } if (do_pass & 2) { video_enc->flags |= CODEC_FLAG_PASS2; + av_dict_set(&ost->opts, "flags", "+pass2", AV_DICT_APPEND); } } From 470ee0c660eda5f3fa135da0fb506b3e57872079 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 11 Nov 2012 02:47:38 +0100 Subject: [PATCH 136/257] h264_refs: Print default in case we are missing a reference. Signed-off-by: Michael Niedermayer (cherry picked from commit a39d36146a40cb52b3560fd02c73eccf72603b8f) --- libavcodec/h264_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 926a6cc40d..d2b1fb9ea5 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -287,7 +287,7 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h){ for(list=0; listlist_count; list++){ for(index= 0; index < h->ref_count[list]; index++){ if (!h->ref_list[list][index].f.data[0]) { - av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture\n"); + av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref_list[list][0].poc); if (h->default_ref_list[list][0].f.data[0]) h->ref_list[list][index]= h->default_ref_list[list][0]; else From ebe645f02b3fbb8f1d9a03f9fcd496ebb59f4d05 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 Feb 2013 22:36:07 +0100 Subject: [PATCH 137/257] h264: Reset last_pocs in case of reference or frame number inconsistencies This prevents faulty increasing of has_b_frames Should fix Ticket 2062 Signed-off-by: Michael Niedermayer (cherry picked from commit c230af9bccc3cadb373f9007ba14fffb6c2acc75) --- libavcodec/h264.c | 3 +++ libavcodec/h264_refs.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 94c4399c3c..6e62c0dc26 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3251,6 +3251,9 @@ static int decode_slice_header(H264Context *h, H264Context *h0) Picture *prev = h->short_ref_count ? h->short_ref[0] : NULL; av_log(h->s.avctx, AV_LOG_DEBUG, "Frame num gap %d %d\n", h->frame_num, h->prev_frame_num); + if (!h->sps.gaps_in_frame_num_allowed_flag) + for(i=0; ilast_pocs); i++) + h->last_pocs[i] = INT_MIN; if (ff_h264_frame_start(h) < 0) return -1; h->prev_frame_num++; diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index d2b1fb9ea5..a94ef1a536 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -287,7 +287,10 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h){ for(list=0; listlist_count; list++){ for(index= 0; index < h->ref_count[list]; index++){ if (!h->ref_list[list][index].f.data[0]) { + int i; av_log(h->s.avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref_list[list][0].poc); + for (i=0; ilast_pocs); i++) + h->last_pocs[i] = INT_MIN; if (h->default_ref_list[list][0].f.data[0]) h->ref_list[list][index]= h->default_ref_list[list][0]; else From 2f98537ea0749665b8dd70c31b7dc68b8a685cd1 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 14 Feb 2013 14:40:26 +0100 Subject: [PATCH 138/257] sws: dont write out of array on bigendian Fixes Ticket2229 Signed-off-by: Michael Niedermayer (cherry picked from commit 4e2c63685e031e28d2296cff76473b963ee62ba1) --- libswscale/swscale_unscaled.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c index 754edaf0e8..52951e0b43 100644 --- a/libswscale/swscale_unscaled.c +++ b/libswscale/swscale_unscaled.c @@ -595,6 +595,9 @@ static rgbConvFn findRgbConvFn(SwsContext *c) } } + if ((dstFormat == PIX_FMT_RGB32_1 || dstFormat == PIX_FMT_BGR32_1) && !isRGBA32(srcFormat) && ALT32_CORR<0) + return NULL; + return conv; } From ec18baadfa17855987144115df4d0324f36ac8ad Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 14 Feb 2013 15:08:37 +0100 Subject: [PATCH 139/257] Write the fiel atom to mov files independently of the used video coded. The QuickTime specification does not contain any hint that the atom must not be written in some cases and both the QuickTime and the AVID decoders do not fail if the atom is present. This change allows to signal (visually) interlaced streams with a codec different from uncompressed video. As a side-effect, this fixes ticket #2202 (cherry picked from commit 7d0e3b197c817b307d599a23704a44763ed0bbdd) Conflicts: libavformat/movenc.c tests/ref/lavf/mov tests/ref/seek/lavf_mov tests/ref/vsynth/vsynth1-avui tests/ref/vsynth/vsynth1-dnxhd-1080i tests/ref/vsynth/vsynth1-mpeg4 tests/ref/vsynth/vsynth2-avui tests/ref/vsynth/vsynth2-dnxhd-1080i tests/ref/vsynth/vsynth2-mpeg4 --- libavformat/movenc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 752d52713a..9e345d5e40 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1078,13 +1078,14 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) mov_write_avcc_tag(pb, track); if(track->mode == MODE_IPOD) mov_write_uuid_tag_ipod(pb); - } else if (track->enc->field_order != AV_FIELD_UNKNOWN) - mov_write_fiel_tag(pb, track); - else if (track->enc->codec_id == CODEC_ID_VC1 && track->vos_len > 0) + } else if (track->enc->codec_id == CODEC_ID_VC1 && track->vos_len > 0) mov_write_dvc1_tag(pb, track); else if (track->vos_len > 0) mov_write_glbl_tag(pb, track); + if (track->enc->field_order != AV_FIELD_UNKNOWN) + mov_write_fiel_tag(pb, track); + if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { mov_write_pasp_tag(pb, track); From 381e3e7e44f9ca9726b5c8ae8ab731daec67e6fd Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 17 Feb 2013 20:55:37 +0100 Subject: [PATCH 140/257] Revert "swfenc: use av_get_audio_frame_duration() instead of AVCodecContext.frame_size" This reverts commit 620b88a302d522f71a6a95aff500cf7bd8520043. Fixes ticket #2272. --- libavformat/swfenc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 8177ffabf1..b165b4601e 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -187,6 +187,10 @@ static int swf_write_header(AVFormatContext *s) AVCodecContext *enc = s->streams[i]->codec; if (enc->codec_type == AVMEDIA_TYPE_AUDIO) { if (enc->codec_id == CODEC_ID_MP3) { + if (!enc->frame_size) { + av_log(s, AV_LOG_ERROR, "audio frame size not set\n"); + return -1; + } swf->audio_enc = enc; swf->audio_fifo= av_fifo_alloc(AUDIO_FIFO_SIZE); if (!swf->audio_fifo) @@ -448,7 +452,7 @@ static int swf_write_audio(AVFormatContext *s, } av_fifo_generic_write(swf->audio_fifo, buf, size, NULL); - swf->sound_samples += av_get_audio_frame_duration(enc, size); + swf->sound_samples += enc->frame_size; /* if audio only stream make sure we add swf frames */ if (!swf->video_enc) From a8b92c4b3ccb04a546eb93cc656b091d58414686 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Wed, 27 Feb 2013 19:19:15 +0100 Subject: [PATCH 141/257] lavf/avio: check for : in filenames for protocols. If the first "special" character in a filename is a comma, it can introduce protocol options, but only if there is a colon at the end. Otherwise, it is just a filename with a comma. Fix trac ticket #2303. (cherry picked from commit d9fad53f4b447db1e436dcf3fc4a57e604616e6c) --- libavformat/avio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avio.c b/libavformat/avio.c index c7b7bc67d5..2e652f3208 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -210,7 +210,9 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags, "Missing call to av_register_all()?\n"); } - if (filename[proto_len] != ':' && filename[proto_len] != ',' || is_dos_path(filename)) + if (filename[proto_len] != ':' && + (filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) || + is_dos_path(filename)) strcpy(proto_str, "file"); else av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str))); From 4b03f2c522e4eaf86528cc60684cd44a7f9adcbd Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 2 Feb 2013 22:36:25 +0100 Subject: [PATCH 142/257] Require at least three frames to autodetect loas. (cherry picked from commit a60530e3ee1d9532c026a52b03661f88e163d647) --- libavformat/loasdec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/loasdec.c b/libavformat/loasdec.c index 4b4e04fff9..814234ffd6 100644 --- a/libavformat/loasdec.c +++ b/libavformat/loasdec.c @@ -55,7 +55,6 @@ static int loas_probe(AVProbeData *p) if (first_frames>=3) return AVPROBE_SCORE_MAX/2+1; else if(max_frames>100)return AVPROBE_SCORE_MAX/2; else if(max_frames>=3) return AVPROBE_SCORE_MAX/4; - else if(max_frames>=1) return 1; else return 0; } From 5df2dc0f945f8a885e3fb1ea0588d659025a8cc6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 8 Mar 2013 14:00:22 +0100 Subject: [PATCH 143/257] aacsbr: Check for envelope scalefactors overflowing This prevents various values from becoming stuck at NAN and output to become silent If someone knows a cleaner solution, thats welcome! Fixes Ticket2335 Signed-off-by: Michael Niedermayer (cherry picked from commit 8978c743fb1d1f5a0d6dbdd83ff05817f8a41230) --- libavcodec/aacsbr.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 40ee8f5127..efb3f10fd0 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -1124,7 +1124,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) { float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f); float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha); - float fac = temp1 / (1.0f + temp2); + float fac; + if (temp1 > 1E20) { + av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); + temp1 = 1; + } + fac = temp1 / (1.0f + temp2); sbr->data[0].env_facs[e][k] = fac; sbr->data[1].env_facs[e][k] = fac * temp2; } @@ -1133,7 +1138,12 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (k = 0; k < sbr->n_q; k++) { float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1); float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]); - float fac = temp1 / (1.0f + temp2); + float fac; + if (temp1 > 1E20) { + av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); + temp1 = 1; + } + fac = temp1 / (1.0f + temp2); sbr->data[0].noise_facs[e][k] = fac; sbr->data[1].noise_facs[e][k] = fac * temp2; } @@ -1142,9 +1152,15 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) { float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f; for (e = 1; e <= sbr->data[ch].bs_num_env; e++) - for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++) + for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){ sbr->data[ch].env_facs[e][k] = exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f); + if (sbr->data[ch].env_facs[e][k] > 1E20) { + av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); + sbr->data[ch].env_facs[e][k] = 1; + } + } + for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (k = 0; k < sbr->n_q; k++) sbr->data[ch].noise_facs[e][k] = From b63dbe2220211fc8e9c0dc230dd024d34e5f3c6f Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 16 Mar 2013 20:13:44 +0100 Subject: [PATCH 144/257] Do not (re-)set libx264 parameter b_tff if interlaced encoding was not requested. Reconfiguring can break x264 lossless encoding. Fixes ticket #2165. (cherry picked from commit 75c7e4583f4fd727d236a12763a265502fe00988) --- libavcodec/libx264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c index d56dfe76fd..9d563c8913 100644 --- a/libavcodec/libx264.c +++ b/libavcodec/libx264.c @@ -171,7 +171,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P : frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B : X264_TYPE_AUTO; - if (x4->params.b_tff != frame->top_field_first) { + if (x4->params.b_interlaced && x4->params.b_tff != frame->top_field_first) { x4->params.b_tff = frame->top_field_first; x264_encoder_reconfig(x4->enc, &x4->params); } From c095137d1b02ba6812ca9a035fa53e8a3ff7dfec Mon Sep 17 00:00:00 2001 From: James Almer Date: Tue, 5 Feb 2013 22:34:29 -0300 Subject: [PATCH 145/257] lavc/bink: Chech for malloc failure Based on commit 8ab2173ed141aa2c3336be7f9880340dfb8dcf5e --- libavcodec/bink.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 4ad2e6fd76..359c7572fb 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -169,7 +169,7 @@ static void init_lengths(BinkContext *c, int width, int bw) * * @param c decoder context */ -static av_cold void init_bundles(BinkContext *c) +static av_cold int init_bundles(BinkContext *c) { int bw, bh, blocks; int i; @@ -180,8 +180,12 @@ static av_cold void init_bundles(BinkContext *c) for (i = 0; i < BINKB_NB_SRC; i++) { c->bundle[i].data = av_malloc(blocks * 64); + if (!c->bundle[i].data) + return AVERROR(ENOMEM); c->bundle[i].data_end = c->bundle[i].data + blocks * 64; } + + return 0; } /** @@ -1272,7 +1276,7 @@ static av_cold int decode_init(AVCodecContext *avctx) BinkContext * const c = avctx->priv_data; static VLC_TYPE table[16 * 128][2]; static int binkb_initialised = 0; - int i; + int i, ret; int flags; c->version = avctx->codec_tag >> 24; @@ -1307,7 +1311,10 @@ static av_cold int decode_init(AVCodecContext *avctx) ff_dsputil_init(&c->dsp, avctx); ff_binkdsp_init(&c->bdsp); - init_bundles(c); + if ((ret = init_bundles(c)) < 0) { + free_bundles(c); + return ret; + } if (c->version == 'b') { if (!binkb_initialised) { From a31be9dd065bc294c214dfaad9abd08fe3919569 Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Tue, 22 Jan 2013 20:58:07 -0500 Subject: [PATCH 146/257] rtpenc: fix overflow checking in avc_mp4_find_startcode() The check `start + res < start' is broken since pointer overflow is undefined behavior in C. Many compilers such as gcc/clang optimize away this check. Use `res > end - start' instead. Also change `res' to unsigned int to avoid signed left-shift overflow. Signed-off-by: Xi Wang Signed-off-by: Michael Niedermayer (cherry picked from commit 2f014567cfd63e58156f60666f1a61ba147276ab) Signed-off-by: Michael Niedermayer --- libavformat/rtpenc_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/rtpenc_h264.c b/libavformat/rtpenc_h264.c index 86930bbac1..5447edcc30 100644 --- a/libavformat/rtpenc_h264.c +++ b/libavformat/rtpenc_h264.c @@ -31,14 +31,14 @@ static const uint8_t *avc_mp4_find_startcode(const uint8_t *start, const uint8_t *end, int nal_length_size) { - int res = 0; + unsigned int res = 0; if (end - start < nal_length_size) return NULL; while (nal_length_size--) res = (res << 8) | *start++; - if (start + res > end || res < 0 || start + res < start) + if (res > end - start) return NULL; return start + res; From dd646260228350f3292cc06357111b4a3863c6e5 Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Tue, 22 Jan 2013 17:49:29 -0500 Subject: [PATCH 147/257] rtmp: fix multiple broken overflow checks Sanity checks like `data + size >= data_end || data + size < data' are broken, because `data + size < data' assumes pointer overflow, which is undefined behavior in C. Many compilers such as gcc/clang optimize such checks away. Use `size < 0 || size >= data_end - data' instead. Signed-off-by: Xi Wang Signed-off-by: Michael Niedermayer (cherry picked from commit 902cfe2f74d777a7dc20ac68f2393b9f84b790c1) Signed-off-by: Michael Niedermayer --- libavformat/rtmppkt.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index bca4a9dab6..85c3354280 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -281,11 +281,11 @@ int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end) data++; break; } - if (data + size >= data_end || data + size < data) + if (size < 0 || size >= data_end - data) return -1; data += size; t = ff_amf_tag_size(data, data_end); - if (t < 0 || data + t >= data_end) + if (t < 0 || t >= data_end - data) return -1; data += t; } @@ -314,7 +314,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end, int size = bytestream_get_be16(&data); if (!size) break; - if (data + size >= data_end || data + size < data) + if (size < 0 || size >= data_end - data) return -1; data += size; if (size == namelen && !memcmp(data-size, name, namelen)) { @@ -335,7 +335,7 @@ int ff_amf_get_field_value(const uint8_t *data, const uint8_t *data_end, return 0; } len = ff_amf_tag_size(data, data_end); - if (len < 0 || data + len >= data_end || data + len < data) + if (len < 0 || len >= data_end - data) return -1; data += len; } @@ -406,13 +406,13 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d data++; break; } - if (data + size >= data_end || data + size < data) + if (size < 0 || size >= data_end - data) return; data += size; av_log(ctx, AV_LOG_DEBUG, " %s: ", buf); ff_amf_tag_contents(ctx, data, data_end); t = ff_amf_tag_size(data, data_end); - if (t < 0 || data + t >= data_end) + if (t < 0 || t >= data_end - data) return; data += t; } From 3fb1a6c7025312ae745e0e9970a72c37a77c7a40 Mon Sep 17 00:00:00 2001 From: Xi Wang Date: Tue, 22 Jan 2013 21:40:05 -0500 Subject: [PATCH 148/257] rtmp: fix buffer overflows in ff_amf_tag_contents() A negative `size' will bypass FFMIN(). In the subsequent memcpy() call, `size' will be considered as a large positive value, leading to a buffer overflow. Change the type of `size' to unsigned int to avoid buffer overflow, and simplify overflow checks accordingly. Signed-off-by: Xi Wang Signed-off-by: Michael Niedermayer (cherry picked from commit 4e692374f7962ea358c329de38c380103f8991b6) Signed-off-by: Michael Niedermayer --- libavformat/rtmppkt.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c index 85c3354280..c2a9967ebe 100644 --- a/libavformat/rtmppkt.c +++ b/libavformat/rtmppkt.c @@ -365,7 +365,7 @@ static const char* rtmp_packet_type(int type) static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *data_end) { - int size; + unsigned int size; char buf[1024]; if (data >= data_end) @@ -384,7 +384,7 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d } else { size = bytestream_get_be32(&data); } - size = FFMIN(size, 1023); + size = FFMIN(size, sizeof(buf) - 1); memcpy(buf, data, size); buf[size] = 0; av_log(ctx, AV_LOG_DEBUG, " string '%s'\n", buf); @@ -397,16 +397,15 @@ static void ff_amf_tag_contents(void *ctx, const uint8_t *data, const uint8_t *d case AMF_DATA_TYPE_OBJECT: av_log(ctx, AV_LOG_DEBUG, " {\n"); for (;;) { - int size = bytestream_get_be16(&data); int t; - memcpy(buf, data, size); - buf[size] = 0; + size = bytestream_get_be16(&data); + av_strlcpy(buf, data, FFMIN(sizeof(buf), size + 1)); if (!size) { av_log(ctx, AV_LOG_DEBUG, " }\n"); data++; break; } - if (size < 0 || size >= data_end - data) + if (size >= data_end - data) return; data += size; av_log(ctx, AV_LOG_DEBUG, " %s: ", buf); From 562aa82d2a22cba39caede1d7b1243fdb6311ce5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 Jan 2013 18:29:41 +0100 Subject: [PATCH 149/257] huffyuvdec: Check init_vlc() return codes. Prevents out of array writes Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit f67a0d115254461649470452058fa3c28c0df294) Signed-off-by: Michael Niedermayer (cherry picked from commit 95ab8d33e1a680f30a5a9605175112008ab81afc) Conflicts: libavcodec/huffyuv.c --- libavcodec/huffyuv.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index cb7929b9a9..80203eccb1 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -320,6 +320,7 @@ static void generate_joint_tables(HYuvContext *s){ int len1 = s->len[p][u]; if(len1 > limit) continue; + av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1; bits[i] = (s->bits[0][y] << len1) + s->bits[p][u]; symbols[i] = (y<<8) + u; @@ -353,6 +354,7 @@ static void generate_joint_tables(HYuvContext *s){ int len2 = s->len[2][r&255]; if(len2 > limit1) continue; + av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1 + len2; bits[i] = (code << len2) + s->bits[2][r&255]; if(s->decorrelate){ @@ -376,6 +378,7 @@ static void generate_joint_tables(HYuvContext *s){ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){ GetBitContext gb; int i; + int ret; init_get_bits(&gb, src, length*8); @@ -386,7 +389,8 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){ return -1; } ff_free_vlc(&s->vlc[i]); - init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); + if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0)) < 0) + return ret; } generate_joint_tables(s); @@ -397,6 +401,7 @@ static int read_huffman_tables(HYuvContext *s, const uint8_t *src, int length){ static int read_old_huffman_tables(HYuvContext *s){ GetBitContext gb; int i; + int ret; init_get_bits(&gb, classic_shift_luma, classic_shift_luma_table_size*8); if(read_len_table(s->len[0], &gb)<0) @@ -417,7 +422,8 @@ static int read_old_huffman_tables(HYuvContext *s){ for(i=0; i<3; i++){ ff_free_vlc(&s->vlc[i]); - init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0); + if ((ret = init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0)) < 0) + return ret; } generate_joint_tables(s); From 864a7e73b9604f3db1dd58f4580a1c8f05219ea4 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 29 Jan 2013 19:22:33 +0100 Subject: [PATCH 150/257] huffyuvdec: Skip len==0 cases Fixes vlc decoding for hypothetical files that would contain such cases. Signed-off-by: Michael Niedermayer (cherry picked from commit 0dfc01c2bbf4b71bb56201bc4a393321e15d1b31) Signed-off-by: Michael Niedermayer (cherry picked from commit 5ff41ffeb4cb9ea6df49757dc859619dc3d3ab4f) Conflicts: libavcodec/huffyuv.c --- libavcodec/huffyuv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c index 80203eccb1..0afd2ab5f4 100644 --- a/libavcodec/huffyuv.c +++ b/libavcodec/huffyuv.c @@ -314,11 +314,11 @@ static void generate_joint_tables(HYuvContext *s){ for(i=y=0; y<256; y++){ int len0 = s->len[0][y]; int limit = VLC_BITS - len0; - if(limit <= 0) + if(limit <= 0 || !len0) continue; for(u=0; u<256; u++){ int len1 = s->len[p][u]; - if(len1 > limit) + if (len1 > limit || !len1) continue; av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1; @@ -342,17 +342,17 @@ static void generate_joint_tables(HYuvContext *s){ for(i=0, g=-16; g<16; g++){ int len0 = s->len[p0][g&255]; int limit0 = VLC_BITS - len0; - if(limit0 < 2) + if (limit0 < 2 || !len0) continue; for(b=-16; b<16; b++){ int len1 = s->len[p1][b&255]; int limit1 = limit0 - len1; - if(limit1 < 1) + if (limit1 < 1 || !len1) continue; code = (s->bits[p0][g&255] << len1) + s->bits[p1][b&255]; for(r=-16; r<16; r++){ int len2 = s->len[2][r&255]; - if(len2 > limit1) + if (len2 > limit1 || !len2) continue; av_assert0(i < (1 << VLC_BITS)); len[i] = len0 + len1 + len2; From b5469fec6a2114b3a73d71fd50a033da7005d7d6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 17:11:34 +0100 Subject: [PATCH 151/257] movenc: hotfix, dont store fiel for h264 / mpeg4-asp / dnxhd Other software does not store it in this case, and the information is provided by the codec stream Signed-off-by: Michael Niedermayer (cherry picked from commit 405cc0d9052079307b2b4188c396ae30c8e9108b) Conflicts: tests/ref/lavf/mov tests/ref/seek/lavf_mov tests/ref/vsynth/vsynth1-dnxhd-1080i tests/ref/vsynth/vsynth1-mpeg4 tests/ref/vsynth/vsynth2-dnxhd-1080i tests/ref/vsynth/vsynth2-mpeg4 --- libavformat/movenc.c | 7 +++++-- tests/ref/vsynth/vsynth1-dnxhd-1080i | 4 ++++ tests/ref/vsynth/vsynth1-mpeg4 | 4 ++++ tests/ref/vsynth/vsynth2-dnxhd-1080i | 4 ++++ tests/ref/vsynth/vsynth2-mpeg4 | 4 ++++ 5 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/ref/vsynth/vsynth1-dnxhd-1080i create mode 100644 tests/ref/vsynth/vsynth1-mpeg4 create mode 100644 tests/ref/vsynth/vsynth2-dnxhd-1080i create mode 100644 tests/ref/vsynth/vsynth2-mpeg4 diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 9e345d5e40..d59580db91 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -1083,8 +1083,11 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track) else if (track->vos_len > 0) mov_write_glbl_tag(pb, track); - if (track->enc->field_order != AV_FIELD_UNKNOWN) - mov_write_fiel_tag(pb, track); + if (track->enc->codec_id != CODEC_ID_H264 && + track->enc->codec_id != CODEC_ID_MPEG4 && + track->enc->codec_id != CODEC_ID_DNXHD) + if (track->enc->field_order != AV_FIELD_UNKNOWN) + mov_write_fiel_tag(pb, track); if (track->enc->sample_aspect_ratio.den && track->enc->sample_aspect_ratio.num && track->enc->sample_aspect_ratio.den != track->enc->sample_aspect_ratio.num) { diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i b/tests/ref/vsynth/vsynth1-dnxhd-1080i new file mode 100644 index 0000000000..dbe2c371e0 --- /dev/null +++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i @@ -0,0 +1,4 @@ +124c991ee3ac0caef39a58a45287a762 *tests/data/fate/vsynth1-dnxhd-1080i.mov +3031911 tests/data/fate/vsynth1-dnxhd-1080i.mov +a09132c6db44f415e831dcaa630a351b *tests/data/fate/vsynth1-dnxhd-1080i.out.rawvideo +stddev: 6.29 PSNR: 32.15 MAXDIFF: 64 bytes: 7603200/ 760320 diff --git a/tests/ref/vsynth/vsynth1-mpeg4 b/tests/ref/vsynth/vsynth1-mpeg4 new file mode 100644 index 0000000000..b6da11cef1 --- /dev/null +++ b/tests/ref/vsynth/vsynth1-mpeg4 @@ -0,0 +1,4 @@ +a2acdf772bf7b7641079d8a03ea03ccf *tests/data/fate/vsynth1-mpeg4.mp4 +540024 tests/data/fate/vsynth1-mpeg4.mp4 +f80ec173d37f2f91add031e95579a220 *tests/data/fate/vsynth1-mpeg4.out.rawvideo +stddev: 7.97 PSNR: 30.10 MAXDIFF: 105 bytes: 7603200/ 7603200 diff --git a/tests/ref/vsynth/vsynth2-dnxhd-1080i b/tests/ref/vsynth/vsynth2-dnxhd-1080i new file mode 100644 index 0000000000..f657eb4c95 --- /dev/null +++ b/tests/ref/vsynth/vsynth2-dnxhd-1080i @@ -0,0 +1,4 @@ +5d7ab75ce6e547ed63a7a0eacf18f078 *tests/data/fate/vsynth2-dnxhd-1080i.mov +3031911 tests/data/fate/vsynth2-dnxhd-1080i.mov +744ba46da5d4c19a28562ea31061d170 *tests/data/fate/vsynth2-dnxhd-1080i.out.rawvideo +stddev: 1.31 PSNR: 45.77 MAXDIFF: 23 bytes: 7603200/ 760320 diff --git a/tests/ref/vsynth/vsynth2-mpeg4 b/tests/ref/vsynth/vsynth2-mpeg4 new file mode 100644 index 0000000000..399ef58e3f --- /dev/null +++ b/tests/ref/vsynth/vsynth2-mpeg4 @@ -0,0 +1,4 @@ +04f74c54f4db25e1d454ede9216632c1 *tests/data/fate/vsynth2-mpeg4.mp4 +119661 tests/data/fate/vsynth2-mpeg4.mp4 +9a1e085d9e488c5ead0c940c9612a37a *tests/data/fate/vsynth2-mpeg4.out.rawvideo +stddev: 5.34 PSNR: 33.57 MAXDIFF: 83 bytes: 7603200/ 7603200 From 8e2c8aaba4ec3135d29b232bc0fb3f422d6e485a Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Mon, 14 Jan 2013 20:38:33 +0100 Subject: [PATCH 152/257] configure: Make warnings from -Wreturn-type fatal errors These warnings have no false positives and point to serious bugs. (cherry picked from commit 99853cb8d4237b810b2fffb4a34f66fd0064ef72) Conflicts: configure Signed-off-by: Michael Niedermayer --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 6673a45efa..6585e46134 100755 --- a/configure +++ b/configure @@ -3459,11 +3459,13 @@ elif enabled gcc; then check_cflags -fno-tree-vectorize check_cflags -Werror=implicit-function-declaration check_cflags -Werror=missing-prototypes + check_cflags -Werror=return-type elif enabled llvm_gcc; then check_cflags -mllvm -stack-alignment=16 elif enabled clang; then check_cflags -mllvm -stack-alignment=16 check_cflags -Qunused-arguments + check_cflags -Werror=return-type elif enabled armcc; then # 2523: use of inline assembler is deprecated add_cflags -W${armcc_opt},--diag_suppress=2523 From ad352157505f6f13e336c4b3e84b492a5670b1ba Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 03:31:31 +0100 Subject: [PATCH 153/257] doc/APIchanges: fix odd .01 versions Signed-off-by: Michael Niedermayer (cherry picked from commit 9f16cb9e50a5a196af9244dc7d33ed193227528a) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index b6b78b5237..aabf2d9001 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -133,19 +133,19 @@ API changes, most recent first: 2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h Add PIX_FMT_PSEUDOPAL flag. -2012-02-08 - 52f82a1 - lavc 54.01.0 +2012-02-08 - 52f82a1 - lavc 54.1.0 Add avcodec_encode_video2() and deprecate avcodec_encode_video(). -2012-02-01 - 316fc74 - lavc 54.01.0 +2012-02-01 - 316fc74 - lavc 54.1.0 Add av_fast_padded_malloc() as alternative for av_realloc() when aligned memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE zero-padded bytes at the end. -2012-01-31 - dd6d3b0 - lavf 54.01.0 +2012-01-31 - dd6d3b0 - lavf 54.1.0 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). NOTE: this was backported to 0.8 -2012-01-31 - af08d9a - lavc 54.01.0 +2012-01-31 - af08d9a - lavc 54.1.0 Add avcodec_is_open() function. NOTE: this was backported to 0.8 From c3a5e7be84c843f9f7e72ef9c066a899a1b69e32 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 20:32:24 +0100 Subject: [PATCH 154/257] apichanges: fix date Signed-off-by: Michael Niedermayer (cherry picked from commit ad6802f975a91bf6757fe3729ef8c6f10e6796b7) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index aabf2d9001..d5caf99802 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -189,7 +189,7 @@ API changes, most recent first: 2011-10-20 - b35e9e1 - lavu 51.22.0 Add av_strtok() to avstring.h. -2011-01-03 - b73ec05 - lavu 51.21.0 +2012-01-03 - b73ec05 - lavu 51.21.0 Add av_popcount64 2011-12-18 - 8400b12 - lavc 53.28.1 From 753c6377d3b2860e7827dd712eda7e42964851af Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 20:34:10 +0100 Subject: [PATCH 155/257] apichanges: Use , instead of / to seperate multiple hashes Signed-off-by: Michael Niedermayer (cherry picked from commit 33d6330652c088dadde163da569b1a2f6c7603c0) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index d5caf99802..d858f7bdb0 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -33,7 +33,7 @@ API changes, most recent first: 2012-05-15 - lavfi 2.17.0 Add support for audio filters - ac71230/a2cd9be - add video/audio buffer sink in a new installed + ac71230, a2cd9be - add video/audio buffer sink in a new installed header buffersink.h 720c6b7 - add av_buffersrc_write_frame(), deprecate av_vsrc_buffer_add_frame() From 78317ad8b927847458772e2638a79b0bdce214cf Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Feb 2013 21:13:32 +0100 Subject: [PATCH 156/257] apichanges: fix 2 wrong hashes Signed-off-by: Michael Niedermayer (cherry picked from commit 2f3bc5122822687dc388f7352c92cf6db456cf7c) Signed-off-by: Michael Niedermayer --- doc/APIchanges | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index d858f7bdb0..0d4cc6ad74 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -643,11 +643,11 @@ API changes, most recent first: 2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED. -2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() +2011-02-09 - c0b102c - lavc 52.112.0 - avcodec_thread_init() Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead set thread_count before calling avcodec_open. -2011-02-09 - 778b08a - lavc 52.111.0 - threading API +2011-02-09 - 37b00b4 - lavc 52.111.0 - threading API Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ release_buffer()/draw_horiz_band() callbacks for appropriate codecs. Add thread_type and active_thread_type fields to AVCodecContext. From 9faf323d7ed177d19005b66debba39b10930042a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 13 Feb 2013 03:32:23 +0100 Subject: [PATCH 157/257] doc/APIchanges: List merge commit hashes and version numbers Signed-off-by: Michael Niedermayer --- doc/APIchanges | 272 ++++++++++++++++++++++++------------------------- 1 file changed, 136 insertions(+), 136 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 0d4cc6ad74..10e071d215 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -31,39 +31,39 @@ API changes, most recent first: 2012-03-26 - a67d9cf - lavfi 2.66.100 Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. -2012-05-15 - lavfi 2.17.0 +2012-05-15 - lavfi 2.74.100 / 2.17.0 Add support for audio filters - ac71230, a2cd9be - add video/audio buffer sink in a new installed + 61930bd / ac71230, 1cbf7fb / a2cd9be - add video/audio buffer sink in a new installed header buffersink.h - 720c6b7 - add av_buffersrc_write_frame(), deprecate + 1cbf7fb / 720c6b7 - add av_buffersrc_write_frame(), deprecate av_vsrc_buffer_add_frame() - ab16504 - add avfilter_copy_buf_props() - 9453c9e - add extended_data to AVFilterBuffer - 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays() + 61930bd / ab16504 - add avfilter_copy_buf_props() + 61930bd / 9453c9e - add extended_data to AVFilterBuffer + 61930bd / 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays() -2012-05-09 - lavu 51.30.0 - samplefmt.h - 142e740 - add av_samples_copy() - 6d7f617 - add av_samples_set_silence() +2012-05-09 - lavu 51.53.100 / 51.30.0 - samplefmt.h + 61930bd / 142e740 - add av_samples_copy() + 61930bd / 6d7f617 - add av_samples_set_silence() -2012-05-09 - a5117a2 - lavc 54.13.1 +2012-05-09 - 61930bd / a5117a2 - lavc 54.21.101 / 54.13.1 For audio formats with fixed frame size, the last frame no longer needs to be padded with silence, libavcodec will handle this internally (effectively all encoders behave as if they had CODEC_CAP_SMALL_LAST_FRAME set). -2012-05-07 - 828bd08 - lavc 54.13.0 - avcodec.h +2012-05-07 - 653d117 / 828bd08 - lavc 54.20.100 / 54.13.0 - avcodec.h Add sample_rate and channel_layout fields to AVFrame. -2012-05-01 - 4010d72 - lavr 0.0.1 +2012-05-01 - 2330eb1 / 4010d72 - lavr 0.0.1 Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8. -2012-04-25 - 3527a73 - lavu 51.29.0 - cpu.h +2012-04-25 - e890b68 / 3527a73 - lavu 51.48.100 / 51.29.0 - cpu.h Add av_parse_cpu_flags() -2012-04-24 - c8af852 - lavr 0.0.0 +2012-04-24 - 3ead79e / c8af852 - lavr 0.0.0 Add libavresample audio conversion library -2012-04-20 - 0c0d1bc - lavu 51.28.0 - audio_fifo.h +2012-04-20 - 3194ab7 / 0c0d1bc - lavu 51.47.100 / 51.28.0 - audio_fifo.h Add audio FIFO functions: av_audio_fifo_free() av_audio_fifo_alloc() @@ -75,10 +75,10 @@ API changes, most recent first: av_audio_fifo_size() av_audio_fifo_space() -2012-04-14 - lavfi 2.16.0 - avfiltergraph.h - d7bcc71 Add avfilter_graph_parse2(). +2012-04-14 - lavfi 2.70.100 / 2.16.0 - avfiltergraph.h + 7432bcf / d7bcc71 Add avfilter_graph_parse2(). -2012-04-08 - 4d693b0 - lavu 51.27.0 - samplefmt.h +2012-04-08 - 6bfb304 / 4d693b0 - lavu 51.46.100 / 51.27.0 - samplefmt.h Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt() 2012-03-21 - b75c67d - lavu 51.43.100 @@ -106,69 +106,69 @@ API changes, most recent first: 2012-01-24 - 0c3577b - lavfi 2.60.100 Add avfilter_graph_dump. -2012-03-05 - lavc 54.8.0 - 6699d07 Add av_get_exact_bits_per_sample() - 9524cf7 Add av_get_audio_frame_duration() +2012-03-05 - lavc 54.10.100 / 54.8.0 + f095391 / 6699d07 Add av_get_exact_bits_per_sample() + f095391 / 9524cf7 Add av_get_audio_frame_duration() -2012-03-04 - 44fe77b - lavc 54.7.0 - avcodec.h +2012-03-04 - 2af8f2c / 44fe77b - lavc 54.8.100 / 54.7.0 - avcodec.h Add av_codec_is_encoder/decoder(). -2012-03-01 - 442c132 - lavc 54.3.0 - avcodec.h +2012-03-01 - 1eb7f39 / 442c132 - lavc 54.5.100 / 54.3.0 - avcodec.h Add av_packet_shrink_side_data. -2012-02-29 - dd2a4bc - lavf 54.2.0 - avformat.h +2012-02-29 - 79ae084 / dd2a4bc - lavf 54.2.100 / 54.2.0 - avformat.h Add AVStream.attached_pic and AV_DISPOSITION_ATTACHED_PIC, used for dealing with attached pictures/cover art. -2012-02-25 - c9bca80 - lavu 51.24.0 - error.h +2012-02-25 - 305e4b3 / c9bca80 - lavu 51.41.100 / 51.24.0 - error.h Add AVERROR_UNKNOWN NOTE: this was backported to 0.8 -2012-02-20 - e9cda85 - lavc 54.2.0 +2012-02-20 - eadd426 / e9cda85 - lavc 54.2.100 / 54.2.0 Add duration field to AVCodecParserContext -2012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h +2012-02-20 - eadd426 / 0b42a93 - lavu 51.40.100 / 51.23.1 - mathematics.h Add av_rescale_q_rnd() -2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h +2012-02-08 - f2b20b7 / 38d5533 - lavu 51.38.101 / 51.22.1 - pixdesc.h Add PIX_FMT_PSEUDOPAL flag. -2012-02-08 - 52f82a1 - lavc 54.1.0 +2012-02-08 - f2b20b7 / 52f82a1 - lavc 54.2.100 / 54.1.0 Add avcodec_encode_video2() and deprecate avcodec_encode_video(). -2012-02-01 - 316fc74 - lavc 54.1.0 +2012-02-01 - 4c677df / 316fc74 - lavc 54.1.0 Add av_fast_padded_malloc() as alternative for av_realloc() when aligned memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE zero-padded bytes at the end. -2012-01-31 - dd6d3b0 - lavf 54.1.0 +2012-01-31 - a369a6b / dd6d3b0 - lavf 54.1.0 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). NOTE: this was backported to 0.8 -2012-01-31 - af08d9a - lavc 54.1.0 +2012-01-31 - a369a6b / af08d9a - lavc 54.1.0 Add avcodec_is_open() function. NOTE: this was backported to 0.8 -2012-01-30 - 8b93312 - lavu 51.22.0 - intfloat.h +2012-01-30 - 151ecc2 / 8b93312 - lavu 51.36.100 / 51.22.0 - intfloat.h Add a new installed header libavutil/intfloat.h with int/float punning functions. NOTE: this was backported to 0.8 -2012-01-25 - lavf 53.22.0 - f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible +2012-01-25 - lavf 53.31.100 / 53.22.0 + 3c5fe5b / f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for muxers supporting it (av_write_frame makes sure it is called only for muxers with this flag). -2012-01-15 - lavc 53.34.0 +2012-01-15 - lavc 53.56.105 / 53.34.0 New audio encoding API: - b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio + 67f5650 / b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio encoders. - 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function. - b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio(). + 67f5650 / 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function. + 67f5650 / b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio(). Add AVCodec.encode2(). -2012-01-12 - 3167dc9 - lavfi 2.15.0 +2012-01-12 - b18e17e / 3167dc9 - lavfi 2.59.100 / 2.15.0 Add a new installed header -- libavfilter/version.h -- with version macros. 2011-12-08 - a502939 - lavfi 2.52.0 @@ -189,37 +189,37 @@ API changes, most recent first: 2011-10-20 - b35e9e1 - lavu 51.22.0 Add av_strtok() to avstring.h. -2012-01-03 - b73ec05 - lavu 51.21.0 +2012-01-03 - ad1c8dd / b73ec05 - lavu 51.34.100 / 51.21.0 Add av_popcount64 -2011-12-18 - 8400b12 - lavc 53.28.1 +2011-12-18 - 7c29313 / 8400b12 - lavc 53.46.1 / 53.28.1 Deprecate AVFrame.age. The field is unused. -2011-12-12 - 5266045 - lavf 53.17.0 +2011-12-12 - 8bc7fe4 / 5266045 - lavf 53.25.0 / 53.17.0 Add avformat_close_input(). Deprecate av_close_input_file() and av_close_input_stream(). -2011-12-02 - 0eea212 - lavc 53.25.0 +2011-12-02 - e4de716 / 0eea212 - lavc 53.40.0 / 53.25.0 Add nb_samples and extended_data fields to AVFrame. Deprecate AVCODEC_MAX_AUDIO_FRAME_SIZE. Deprecate avcodec_decode_audio3() in favor of avcodec_decode_audio4(). avcodec_decode_audio4() writes output samples to an AVFrame, which allows audio decoders to use get_buffer(). -2011-12-04 - 560f773 - lavc 53.24.0 +2011-12-04 - e4de716 / 560f773 - lavc 53.40.0 / 53.24.0 Change AVFrame.data[4]/base[4]/linesize[4]/error[4] to [8] at next major bump. Change AVPicture.data[4]/linesize[4] to [8] at next major bump. Change AVCodecContext.error[4] to [8] at next major bump. Add AV_NUM_DATA_POINTERS to simplify the bump transition. -2011-11-23 - bbb46f3 - lavu 51.18.0 +2011-11-23 - 8e576d5 / bbb46f3 - lavu 51.27.0 / 51.18.0 Add av_samples_get_buffer_size(), av_samples_fill_arrays(), and av_samples_alloc(), to samplefmt.h. -2011-11-23 - 8889cc4 - lavu 51.17.0 +2011-11-23 - 8e576d5 / 8889cc4 - lavu 51.27.0 / 51.17.0 Add planar sample formats and av_sample_fmt_is_planar() to samplefmt.h. -2011-11-19 - f3a29b7 - lavc 53.21.0 +2011-11-19 - dbb38bc / f3a29b7 - lavc 53.36.0 / 53.21.0 Move some AVCodecContext fields to a new private struct, AVCodecInternal, which is accessed from a new field, AVCodecContext.internal. - fields moved: @@ -227,55 +227,55 @@ API changes, most recent first: AVCodecContext.internal_buffer_count --> AVCodecInternal.buffer_count AVCodecContext.is_copy --> AVCodecInternal.is_copy -2011-11-16 - 6270671 - lavu 51.16.0 +2011-11-16 - 8709ba9 / 6270671 - lavu 51.26.0 / 51.16.0 Add av_timegm() -2011-11-13 - lavf 53.15.0 +2011-11-13 - lavf 53.21.0 / 53.15.0 New interrupt callback API, allowing per-AVFormatContext/AVIOContext interrupt callbacks. - 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to + 5f268ca / 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to AVFormatContext. - 1dee0ac Add avio_open2() with additional parameters. Those are + 5f268ca / 1dee0ac Add avio_open2() with additional parameters. Those are an interrupt callback and an options AVDictionary. This will allow passing AVOptions to protocols after lavf 54.0. -2011-11-06 - ba04ecf - lavu 51.14.0 +2011-11-06 - 13b7781 / ba04ecf - lavu 51.24.0 / 51.14.0 Add av_strcasecmp() and av_strncasecmp() to avstring.h. -2011-11-06 - 07b172f - lavu 51.13.0 +2011-11-06 - 13b7781 / 07b172f - lavu 51.24.0 / 51.13.0 Add av_toupper()/av_tolower() -2011-11-05 - b6d08f4 - lavf 53.13.0 +2011-11-05 - d8cab5c / b6d08f4 - lavf 53.19.0 / 53.13.0 Add avformat_network_init()/avformat_network_deinit() -2011-10-27 - 512557b - lavc 53.15.0 +2011-10-27 - 6faf0a2 / 512557b - lavc 53.24.0 / 53.15.0 Remove avcodec_parse_frame. Deprecate AVCodecContext.parse_only and CODEC_CAP_PARSE_ONLY. -2011-10-19 - 569129a - lavf 53.10.0 +2011-10-19 - d049257 / 569129a - lavf 53.17.0 / 53.10.0 Add avformat_new_stream(). Deprecate av_new_stream(). -2011-10-13 - b631fba - lavf 53.9.0 +2011-10-13 - 91eb1b1 / b631fba - lavf 53.16.0 / 53.9.0 Add AVFMT_NO_BYTE_SEEK AVInputFormat flag. -2011-10-12 - lavu 51.12.0 +2011-10-12 - lavu 51.21.0 / 51.12.0 AVOptions API rewrite. - - 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* + - f884ef0 / 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* - new setting/getting functions with slightly different semantics: - dac66da av_set_string3 -> av_opt_set + f884ef0 / dac66da av_set_string3 -> av_opt_set av_set_double -> av_opt_set_double av_set_q -> av_opt_set_q av_set_int -> av_opt_set_int - 41d9d51 av_get_string -> av_opt_get + f884ef0 / 41d9d51 av_get_string -> av_opt_get av_get_double -> av_opt_get_double av_get_q -> av_opt_get_q av_get_int -> av_opt_get_int - - 8c5dcaa trivial rename av_next_option -> av_opt_next - - 641c7af new functions - av_opt_child_next, av_opt_child_class_next + - f884ef0 / 8c5dcaa trivial rename av_next_option -> av_opt_next + - f884ef0 / 641c7af new functions - av_opt_child_next, av_opt_child_class_next and av_opt_find2() 2011-09-22 - a70e787 - lavu 51.17.0 @@ -321,31 +321,31 @@ API changes, most recent first: 2011-08-20 - 69e2c1a - lavu 51.13.0 Add av_get_media_type_string(). -2011-09-03 - fb4ca26 - lavc 53.13.0 +2011-09-03 - 1889c67 / fb4ca26 - lavc 53.13.0 lavf 53.11.0 lsws 2.1.0 Add {avcodec,avformat,sws}_get_class(). -2011-08-03 - c11fb82 - lavu 51.15.0 +2011-08-03 - 1889c67 / c11fb82 - lavu 51.15.0 Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function. 2011-08-14 - 323b930 - lavu 51.12.0 Add av_fifo_peek2(), deprecate av_fifo_peek(). -2011-08-26 - lavu 51.9.0 - - add41de..abc78a5 Do not include intfloat_readwrite.h, +2011-08-26 - lavu 51.14.0 / 51.9.0 + - 976a8b2 / add41de..976a8b2 / abc78a5 Do not include intfloat_readwrite.h, mathematics.h, rational.h, pixfmt.h, or log.h from avutil.h. -2011-08-16 - 48f9e45 - lavf 53.8.0 +2011-08-16 - 27fbe31 / 48f9e45 - lavf 53.11.0 / 53.8.0 Add avformat_query_codec(). -2011-08-16 - bca06e7 - lavc 53.11.0 +2011-08-16 - 27fbe31 / bca06e7 - lavc 53.11.0 Add avcodec_get_type(). -2011-08-06 - 2f63440 - lavf 53.7.0 +2011-08-06 - 0cb233c / 2f63440 - lavf 53.7.0 Add error_recognition to AVFormatContext. -2011-08-02 - 9d39cbf - lavc 53.9.1 +2011-08-02 - 1d186e9 / 9d39cbf - lavc 53.9.1 Add AV_PKT_FLAG_CORRUPT AVPacket flag. 2011-07-16 - b57df29 - lavfi 2.27.0 @@ -356,11 +356,11 @@ API changes, most recent first: avfilter_set_common_packing_formats() avfilter_all_packing_formats() -2011-07-10 - a67c061 - lavf 53.6.0 +2011-07-10 - 3602ad7 / a67c061 - lavf 53.6.0 Add avformat_find_stream_info(), deprecate av_find_stream_info(). NOTE: this was backported to 0.7 -2011-07-10 - 0b950fe - lavc 53.8.0 +2011-07-10 - 3602ad7 / 0b950fe - lavc 53.8.0 Add avcodec_open2(), deprecate avcodec_open(). NOTE: this was backported to 0.7 @@ -403,35 +403,35 @@ API changes, most recent first: 2011-06-12 - 6119b23 - lavfi 2.16.0 - avfilter_graph_parse() Change avfilter_graph_parse() signature. -2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h +2011-06-23 - 686959e / 67e9ae1 - lavu 51.10.0 / 51.8.0 - attributes.h Add av_printf_format(). -2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h +2011-06-16 - 2905e3f / 05e84c9, 2905e3f / 25de595 - lavf 53.4.0 / 53.2.0 - avformat.h Add avformat_open_input and avformat_write_header(). Deprecate av_open_input_stream, av_open_input_file, AVFormatParameters and av_write_header. -2011-06-16 - 7e83e1c, dc59ec5 - lavu 51.7.0 - opt.h +2011-06-16 - 2905e3f / 7e83e1c, 2905e3f / dc59ec5 - lavu 51.9.0 / 51.7.0 - opt.h Add av_opt_set_dict() and av_opt_find(). Deprecate av_find_opt(). Add AV_DICT_APPEND flag. -2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h +2011-06-10 - 45fb647 / cb7c11c - lavu 51.6.0 - opt.h Add av_opt_flag_is_set(). 2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h. -2011-06-09 - d9f80ea - lavu 51.8.0 - AVMetadata +2011-06-09 - f9ecb84 / d9f80ea - lavu 51.8.0 - AVMetadata Move AVMetadata from lavf to lavu and rename it to AVDictionary -- new installed header dict.h. All av_metadata_* functions renamed to av_dict_*. -2011-06-07 - a6703fa - lavu 51.8.0 - av_get_bytes_per_sample() +2011-06-07 - d552f61 / a6703fa - lavu 51.8.0 - av_get_bytes_per_sample() Add av_get_bytes_per_sample() in libavutil/samplefmt.h. Deprecate av_get_bits_per_sample_fmt(). -2011-06-05 - b39b062 - lavu 51.8.0 - opt.h +2011-06-05 - f956924 / b39b062 - lavu 51.8.0 - opt.h Add av_opt_free convenience function. 2011-06-06 - 95a0242 - lavfi 2.14.0 - AVFilterBufferRefAudioProps @@ -461,7 +461,7 @@ API changes, most recent first: Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor. -2011-05-25 - 30315a8 - lavf 53.3.0 - avformat.h +2011-05-25 - 39e4206 / 30315a8 - lavf 53.3.0 - avformat.h Add fps_probe_size to AVFormatContext. 2011-05-22 - 5ecdfd0 - lavf 53.2.0 - avformat.h @@ -477,10 +477,10 @@ API changes, most recent first: 2011-05-14 - 9fdf772 - lavfi 2.6.0 - avcodec.h Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h. -2011-05-18 - 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt +2011-05-18 - 75a37b5 / 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt Add request_sample_fmt field to AVCodecContext. -2011-05-10 - 188dea1 - lavc 53.6.0 - avcodec.h +2011-05-10 - 59eb12f / 188dea1 - lavc 53.6.0 - avcodec.h Deprecate AVLPCType and the following fields in AVCodecContext: lpc_coeff_precision, prediction_order_method, min_partition_order, max_partition_order, lpc_type, lpc_passes. @@ -510,81 +510,81 @@ API changes, most recent first: Add av_dynarray_add function for adding an element to a dynamic array. -2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h +2011-04-26 - d7e5aeb / bebe72f - lavu 51.1.0 - avutil.h Add AVPictureType enum and av_get_picture_type_char(), deprecate FF_*_TYPE defines and av_get_pict_type_char() defined in libavcodec/avcodec.h. -2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h +2011-04-26 - d7e5aeb / 10d3940 - lavfi 2.3.0 - avfilter.h Add pict_type and key_frame fields to AVFilterBufferRefVideo. -2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer +2011-04-26 - d7e5aeb / 7a11c82 - lavfi 2.2.0 - vsrc_buffer Add sample_aspect_ratio fields to vsrc_buffer arguments -2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h +2011-04-21 - 8772156 / 94f7451 - lavc 53.1.0 - avcodec.h Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading. 2011-04-15 - lavc 52.120.0 - avcodec.h AVPacket structure got additional members for passing side information: - 4de339e introduce side information for AVPacket - 2d8591c make containers pass palette change in AVPacket + c407984 / 4de339e introduce side information for AVPacket + c407984 / 2d8591c make containers pass palette change in AVPacket 2011-04-12 - lavf 52.107.0 - avio.h Avio cleanup, part II - deprecate the entire URLContext API: - 175389c add avio_check as a replacement for url_exist - ff1ec0c add avio_pause and avio_seek_time as replacements + c55780d / 175389c add avio_check as a replacement for url_exist + 9891004 / ff1ec0c add avio_pause and avio_seek_time as replacements for _av_url_read_fseek/fpause - cdc6a87 deprecate av_protocol_next(), avio_enum_protocols + d4d0932 / cdc6a87 deprecate av_protocol_next(), avio_enum_protocols should be used instead. - 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. - f87b1b3 rename open flags: URL_* -> AVIO_* - f8270bb add avio_enum_protocols. - 5593f03 deprecate URLProtocol. - c486dad deprecate URLContext. - 026e175 deprecate the typedef for URLInterruptCB - 8e76a19 deprecate av_register_protocol2. - b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME - 1305d93 deprecate av_url_read_seek - fa104e1 deprecate av_url_read_pause - 727c7aa deprecate url_get_filename(). - 5958df3 deprecate url_max_packet_size(). - 1869ea0 deprecate url_get_file_handle(). - 32a97d4 deprecate url_filesize(). - e52a914 deprecate url_close(). - 58a48c6 deprecate url_seek(). - 925e908 deprecate url_write(). - dce3756 deprecate url_read_complete(). - bc371ac deprecate url_read(). - 0589da0 deprecate url_open(). - 62eaaea deprecate url_connect. - 5652bb9 deprecate url_alloc. - 333e894 deprecate url_open_protocol - e230705 deprecate url_poll and URLPollEntry + c88caa5 / 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. + c88caa5 / f87b1b3 rename open flags: URL_* -> AVIO_* + d4d0932 / f8270bb add avio_enum_protocols. + d4d0932 / 5593f03 deprecate URLProtocol. + d4d0932 / c486dad deprecate URLContext. + d4d0932 / 026e175 deprecate the typedef for URLInterruptCB + c88caa5 / 8e76a19 deprecate av_register_protocol2. + 11d7841 / b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME + 11d7841 / 1305d93 deprecate av_url_read_seek + 11d7841 / fa104e1 deprecate av_url_read_pause + 434f248 / 727c7aa deprecate url_get_filename(). + 434f248 / 5958df3 deprecate url_max_packet_size(). + 434f248 / 1869ea0 deprecate url_get_file_handle(). + 434f248 / 32a97d4 deprecate url_filesize(). + 434f248 / e52a914 deprecate url_close(). + 434f248 / 58a48c6 deprecate url_seek(). + 434f248 / 925e908 deprecate url_write(). + 434f248 / dce3756 deprecate url_read_complete(). + 434f248 / bc371ac deprecate url_read(). + 434f248 / 0589da0 deprecate url_open(). + 434f248 / 62eaaea deprecate url_connect. + 434f248 / 5652bb9 deprecate url_alloc. + 434f248 / 333e894 deprecate url_open_protocol + 434f248 / e230705 deprecate url_poll and URLPollEntry 2011-04-08 - lavf 52.106.0 - avformat.h Minor avformat.h cleanup: - a9bf9d8 deprecate av_guess_image2_codec - c3675df rename avf_sdp_create->av_sdp_create + d4d0932 / a9bf9d8 deprecate av_guess_image2_codec + d4d0932 / c3675df rename avf_sdp_create->av_sdp_create 2011-04-03 - lavf 52.105.0 - avio.h Large-scale renaming/deprecating of AVIOContext-related functions: - 724f6a0 deprecate url_fdopen - 403ee83 deprecate url_open_dyn_packet_buf - 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf - b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf - 8978fed introduce an AVIOContext.seekable field as a replacement for + 2cae980 / 724f6a0 deprecate url_fdopen + 2cae980 / 403ee83 deprecate url_open_dyn_packet_buf + 2cae980 / 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf + 2cae980 / b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf + 2cae980 / 8978fed introduce an AVIOContext.seekable field as a replacement for AVIOContext.is_streamed and url_is_streamed() - b64030f deprecate get_checksum() - 4c4427a deprecate init_checksum() - 4ec153b deprecate udp_set_remote_url/get_local_port - 933e90a deprecate av_url_read_fseek/fpause - 8d9769a deprecate url_fileno - b7f2fdd rename put_flush_packet -> avio_flush - 35f1023 deprecate url_close_buf - 83fddae deprecate url_open_buf - d9d86e0 rename url_fprintf -> avio_printf - 59f65d9 deprecate url_setbufsize - 3e68b3b deprecate url_ferror + 1caa412 / b64030f deprecate get_checksum() + 1caa412 / 4c4427a deprecate init_checksum() + 2fd41c9 / 4ec153b deprecate udp_set_remote_url/get_local_port + 4fa0e24 / 933e90a deprecate av_url_read_fseek/fpause + 4fa0e24 / 8d9769a deprecate url_fileno + 0fecf26 / b7f2fdd rename put_flush_packet -> avio_flush + 0fecf26 / 35f1023 deprecate url_close_buf + 0fecf26 / 83fddae deprecate url_open_buf + 0fecf26 / d9d86e0 rename url_fprintf -> avio_printf + 0fecf26 / 59f65d9 deprecate url_setbufsize + 6947b0c / 3e68b3b deprecate url_ferror e8bb2e2 deprecate url_fget_max_packet_size 76aa876 rename url_fsize -> avio_size e519753 deprecate url_fgetc @@ -605,7 +605,7 @@ API changes, most recent first: b3db9ce deprecate get_partial_buffer 8d9ac96 rename av_alloc_put_byte -> avio_alloc_context -2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type +2011-03-25 - 27ef7b1 / 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type Add audio_service_type field to AVCodecContext. 2011-03-17 - e309fdc - lavu 50.40.0 - pixfmt.h From 7cb24ecd4c41d3e31dd5d5f56e0f5bfa081ac5a7 Mon Sep 17 00:00:00 2001 From: Alexander Kojevnikov Date: Tue, 26 Feb 2013 21:47:11 -0800 Subject: [PATCH 158/257] mp3dec: Fix VBR bit rate parsing When parsing the Xing/Info tag, don't set the bit rate if it's an Info tag. When parsing the stream, don't override the bit rate if it's already set, otherwise calculate the mean bit rate from parsed frames. This way, the bit rate will be set correctly both for CBR and VBR streams. Signed-off-by: Alexander Kojevnikov Signed-off-by: Michael Niedermayer (cherry picked from commit 29d8cd265a536063420afe78375b2176a9e1abc5) Conflicts: tests/ref/lavf-fate/mp3 Signed-off-by: Michael Niedermayer --- libavcodec/mpegaudio_parser.c | 10 +++++++--- libavformat/mp3dec.c | 6 ++++-- tests/ref/lavf-fate/mp3 | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegaudio_parser.c b/libavcodec/mpegaudio_parser.c index 6ceca83e04..83dbca0e04 100644 --- a/libavcodec/mpegaudio_parser.c +++ b/libavcodec/mpegaudio_parser.c @@ -29,6 +29,7 @@ typedef struct MpegAudioParseContext { int frame_size; uint32_t header; int header_count; + int no_bitrate; } MpegAudioParseContext; #define MPA_HEADER_SIZE 4 @@ -73,15 +74,18 @@ static int mpegaudio_parse(AVCodecParserContext *s1, if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header) s->header_count= -3; s->header= state; - s->header_count++; s->frame_size = ret-4; - if (s->header_count > 1) { + if (s->header_count > 0) { avctx->sample_rate= sr; avctx->channels = channels; s1->duration = frame_size; - avctx->bit_rate = bit_rate; + if (s->no_bitrate || !avctx->bit_rate) { + s->no_bitrate = 1; + avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count; + } } + s->header_count++; break; } } diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 61405f71b7..87b3bb62ca 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -88,6 +88,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; MPADecodeHeader c; int vbrtag_size = 0; + int is_cbr; v = avio_rb32(s->pb); if(ff_mpa_check_header(v) < 0) @@ -101,7 +102,8 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) /* Check for Xing / Info tag */ avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]); v = avio_rb32(s->pb); - if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { + is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); + if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) { v = avio_rb32(s->pb); if(v & 0x1) frames = avio_rb32(s->pb); @@ -132,7 +134,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) if(frames) st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate}, st->time_base); - if(size && frames) + if (size && frames && !is_cbr) st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf); return 0; diff --git a/tests/ref/lavf-fate/mp3 b/tests/ref/lavf-fate/mp3 index 48a5476f8a..1af3652d3a 100644 --- a/tests/ref/lavf-fate/mp3 +++ b/tests/ref/lavf-fate/mp3 @@ -1,3 +1,3 @@ -67cbcc79f018afb68f7d81625bfa234c *./tests/data/lavf-fate/lavf.mp3 -97230 ./tests/data/lavf-fate/lavf.mp3 +0f7b603ab305759ea4e853326f77da60 *./tests/data/lavf-fate/lavf.mp3 +96366 ./tests/data/lavf-fate/lavf.mp3 ./tests/data/lavf-fate/lavf.mp3 CRC=0x6c9850fe From faeb2b3e6989c23968434730f8ea371261c3bfc0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 18 Mar 2013 00:00:02 +0100 Subject: [PATCH 159/257] rmdec: flush audio packet on seeking Fixes Ticket1605 Signed-off-by: Michael Niedermayer (cherry picked from commit 519ebb5ee5b89b8ecc80b4a4540fcbeb65cda172) Signed-off-by: Michael Niedermayer --- libavformat/rmdec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index d919a9a41a..6b39e473d8 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -982,6 +982,18 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, return dts; } +static int rm_read_seek(AVFormatContext *s, int stream_index, + int64_t pts, int flags) +{ + RMDemuxContext *rm = s->priv_data; + + if (ff_seek_frame_binary(s, stream_index, pts, flags) < 0) + return -1; + rm->audio_pkt_cnt = 0; + return 0; +} + + AVInputFormat ff_rm_demuxer = { .name = "rm", .long_name = NULL_IF_CONFIG_SMALL("RealMedia format"), @@ -991,6 +1003,7 @@ AVInputFormat ff_rm_demuxer = { .read_packet = rm_read_packet, .read_close = rm_read_close, .read_timestamp = rm_read_dts, + .read_seek = rm_read_seek, }; AVInputFormat ff_rdt_demuxer = { From 2f76f544436e7f77a15a7aa4af255a79a4c20e10 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 8 Mar 2013 14:45:26 +0100 Subject: [PATCH 160/257] MAINTAINERS: update for 1.2 Signed-off-by: Michael Niedermayer (cherry picked from commit 80f91a70be5f03fc95eb89d222d760eeaf91b135) Conflicts: MAINTAINERS --- MAINTAINERS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index aa1b5ed6f0..428b2041ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -400,8 +400,9 @@ x86 Michael Niedermayer Releases ======== -0.11 Michael Niedermayer -0.10 Michael Niedermayer +1.2 Michael Niedermayer +1.1 Michael Niedermayer +1.0 Michael Niedermayer From 3e63dea5f2ebbce5b142a6521a526a83cd13860a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 14 Mar 2013 14:50:42 +0100 Subject: [PATCH 161/257] MAINTAINERS: mention that people are welcome to pick up and maintain older releases Signed-off-by: Michael Niedermayer (cherry picked from commit 7e1efeb5707ec0fec000d42fa9f2861bab97bd8f) Signed-off-by: Michael Niedermayer --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 428b2041ba..b8a6c60f8d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -404,6 +404,7 @@ Releases 1.1 Michael Niedermayer 1.0 Michael Niedermayer +If you want to maintain an older release, please contact us GnuPG Fingerprints of maintainers and contributors From a3ff859a46642002c7bbff49cc06dc3751c47d1a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 21 Mar 2013 01:10:47 +0100 Subject: [PATCH 162/257] update the current year Signed-off-by: Michael Niedermayer (cherry picked from commit f2310fff5c7bf1ec815ba7ae6a87fc872a0d82aa) Signed-off-by: Michael Niedermayer --- cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index 2c8439499d..c5f621a9b1 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -59,7 +59,7 @@ struct SwsContext *sws_opts; SwrContext *swr_opts; AVDictionary *format_opts, *codec_opts; -const int this_year = 2012; +const int this_year = 2013; static FILE *report_file; From aba32d84630cb17b68fd41d465d17580465f1d9e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 22 Mar 2013 04:05:35 +0100 Subject: [PATCH 163/257] update for 0.11.3 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index 27e40e82f3..e6dfc9bb51 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.11.2 +PROJECT_NUMBER = 0.11.3 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index bc859cbd6d..1a96df19c0 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.11.2 +0.11.3 diff --git a/VERSION b/VERSION index bc859cbd6d..1a96df19c0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.2 +0.11.3 From 8538811a1fef30da89b1f787da1f06604359cb1b Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Tue, 26 Mar 2013 15:16:07 +0100 Subject: [PATCH 164/257] Only test the first frame for missing aac_adtstoasc bistream filter. Many players ignore broken aac frames, so don't abort mov or flv muxing when encountering one, just print a warning instead. Fixes ticket #2380. (cherry picked from commit 1741fece7073f51efdd837a4f307ea2cdf3d1cfb) Conflicts: libavformat/flvenc.c --- libavformat/flvenc.c | 9 +++++++-- libavformat/movenc.c | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index c6d5408f6d..87b3704816 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -448,8 +448,13 @@ static int flv_write_packet(AVFormatContext *s, AVPacket *pkt) } } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { - av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); - return -1; + if (!s->streams[pkt->stream_index]->nb_frames) { + av_log(s, AV_LOG_ERROR, "Malformed AAC bitstream detected: " + "use audio bitstream filter 'aac_adtstoasc' to fix it " + "('-bsf:a aac_adtstoasc' option with ffmpeg)\n"); + return AVERROR_INVALIDDATA; + } + av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } if (flv->delay == AV_NOPTS_VALUE) flv->delay = -pkt->dts; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index d59580db91..4705464646 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2946,8 +2946,11 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) } } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); return -1; + } + av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } else { avio_write(pb, pkt->data, size); } From 2a30d4309f248a07de9dd9b8b744989b66679d53 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sat, 30 Mar 2013 08:41:46 +0100 Subject: [PATCH 165/257] Write broken aac frames to mov files instead of skipping them. Fixes decoding with picky media players. Signed-off-by: Michael Niedermayer (cherry picked from commit b448c0a68d0cc7dfef736267dfdaed0e213c020b) Conflicts: libavformat/movenc.c --- libavformat/movenc.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 4705464646..a1bccbe38d 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2934,6 +2934,14 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) memcpy(trk->vos_data, enc->extradata, trk->vos_len); } + if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && + (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { + if (!s->streams[pkt->stream_index]->nb_frames) { + av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); + return -1; + } + av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); + } if (enc->codec_id == CODEC_ID_H264 && trk->vos_len > 0 && *(uint8_t *)trk->vos_data != 1) { /* from x264 or from bytestream h264 */ /* nal reformating needed */ @@ -2944,13 +2952,6 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) } else { size = ff_avc_parse_nal_units(pb, pkt->data, pkt->size); } - } else if (enc->codec_id == CODEC_ID_AAC && pkt->size > 2 && - (AV_RB16(pkt->data) & 0xfff0) == 0xfff0) { - if (!s->streams[pkt->stream_index]->nb_frames) { - av_log(s, AV_LOG_ERROR, "malformated aac bitstream, use -absf aac_adtstoasc\n"); - return -1; - } - av_log(s, AV_LOG_WARNING, "aac bitstream error\n"); } else { avio_write(pb, pkt->data, size); } From 708101c6f5c5205f9494363acfe0e92671117263 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Wed, 3 Apr 2013 12:57:58 +0000 Subject: [PATCH 166/257] smacker: fix off by one error Regression since a93b572ae4f517ce0c35cf085167c318e9215908. Fixes #2426. Signed-off-by: Paul B Mahol (cherry picked from commit e3cc92a623a6ece42816c7a692c8815688a99ab0) --- libavformat/smacker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 84a53ea3c8..dd4418c6eb 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -269,7 +269,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) } else if(t & 0x40){ /* copy with offset */ off = avio_r8(s->pb); j = (t & 0x3F) + 1; - if (off + j > 0xff) { + if (off + j - 1 > 0xff) { av_log(s, AV_LOG_ERROR, "Invalid palette update, offset=%d length=%d extends beyond palette size\n", off, j); From 7dd042e657d97bcc081906d2c14c904649f85316 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 5 May 2013 19:29:00 +0200 Subject: [PATCH 167/257] Fix type of shared flac table ff_flac_blocksize_table[]. Fixes ticket #2533. (cherry picked from commit a07ac1f7888fd08e42da2bed0421e74f1cfac177) --- libavcodec/flacdata.c | 2 +- libavcodec/flacdata.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/flacdata.c b/libavcodec/flacdata.c index 6fcbe3955a..1954f32d32 100644 --- a/libavcodec/flacdata.c +++ b/libavcodec/flacdata.c @@ -27,7 +27,7 @@ const int ff_flac_sample_rate_table[16] = 8000, 16000, 22050, 24000, 32000, 44100, 48000, 96000, 0, 0, 0, 0 }; -const int16_t ff_flac_blocksize_table[16] = { +const int32_t ff_flac_blocksize_table[16] = { 0, 192, 576<<0, 576<<1, 576<<2, 576<<3, 0, 0, 256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7 }; diff --git a/libavcodec/flacdata.h b/libavcodec/flacdata.h index 96a50b9183..e2c1e5d7f2 100644 --- a/libavcodec/flacdata.h +++ b/libavcodec/flacdata.h @@ -26,6 +26,6 @@ extern const int ff_flac_sample_rate_table[16]; -extern const int16_t ff_flac_blocksize_table[16]; +extern const int32_t ff_flac_blocksize_table[16]; #endif /* AVCODEC_FLACDATA_H */ From d12294f447f4ab18d0b16e0b4efb7301c510cd6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 5 May 2013 09:46:37 +0200 Subject: [PATCH 168/257] matroska: set "done" only during resync fail. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes playback of test7.mkv validation test file. Signed-off-by: Reimar Döffinger (cherry picked from commit 762d4335aec2e5299a06bfbce15d21336af19464) --- libavformat/matroskadec.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index e8f70f96c1..129de9065f 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2160,7 +2160,6 @@ static int matroska_parse_cluster_incremental(MatroskaDemuxContext *matroska) } } - if (res < 0) matroska->done = 1; return res; } From 048cd60dc37386b97143c6a48e26fcfbf0592752 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 13 May 2013 12:39:44 +0200 Subject: [PATCH 169/257] Do not read strd chunk in avi files as H264 extradata. Fixes ticket #2561. (cherry picked from commit 231b3317184790b6be4b4619d96fd328f13aeabb) --- libavformat/avidec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 1ad126308e..22fbd077ef 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -696,7 +696,9 @@ static int avi_read_header(AVFormatContext *s) } break; case MKTAG('s', 't', 'r', 'd'): - if (stream_index >= (unsigned)s->nb_streams || s->streams[stream_index]->codec->extradata_size) { + if (stream_index >= (unsigned)s->nb_streams + || s->streams[stream_index]->codec->extradata_size + || s->streams[stream_index]->codec->codec_tag == MKTAG('H','2','6','4')) { avio_skip(pb, size); } else { uint64_t cur_pos = avio_tell(pb); From f7dbe180a02fd0e829329ce71c01aa9cd714784d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 17 May 2013 22:03:14 +0200 Subject: [PATCH 170/257] avidec: dont randomly skip packets for offseting the index Fixes Ticket2490 Signed-off-by: Michael Niedermayer (cherry picked from commit 6c593f1b671b7725b8c36f92f7c0a23ccf8e7628) --- libavformat/avidec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 22fbd077ef..6120aa4e1b 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -991,9 +991,9 @@ start_sync: || st->discard >= AVDISCARD_ALL){ if (!exit_early) { ast->frame_offset += get_duration(ast, size); + avio_skip(pb, size); + goto start_sync; } - avio_skip(pb, size); - goto start_sync; } if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { From 1b0028a3c5c03f808b73fe89da62fd938b98eb9d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 May 2013 21:42:06 +0200 Subject: [PATCH 171/257] smacker: remove av_clip_int16() Fixes Ticket2425 Signed-off-by: Michael Niedermayer (cherry picked from commit 2211c76287e073a9e176fde7dbb9a63ceb2af8d1) --- libavcodec/smacker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index c1775103e8..136569d01d 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -687,7 +687,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, } val |= h[3].values[res] << 8; pred[1] += sign_extend(val, 16); - *samples++ = av_clip_int16(pred[1]); + *samples++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); @@ -708,7 +708,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, } val |= h[1].values[res] << 8; pred[0] += sign_extend(val, 16); - *samples++ = av_clip_int16(pred[0]); + *samples++ = pred[0]; } } } else { //8-bit data From ba445be96fa832da8f8b4886a3183a964b290bf9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 May 2013 18:58:39 +0200 Subject: [PATCH 172/257] avienc: Disallow the first frame to be skiped Fixes Ticket2386 Signed-off-by: Michael Niedermayer (cherry picked from commit cc0db8cf3042186d8355dcf10be67071cfbbcc5d) Conflicts: libavformat/avienc.c --- libavformat/avienc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index a4795e9ca0..5c15e7cb6a 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -524,7 +524,7 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) int size= pkt->size; // av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %d\n", pkt->dts, avist->packet_count, stream_index); - while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != CODEC_ID_XSUB){ + while(enc->block_align==0 && pkt->dts != AV_NOPTS_VALUE && pkt->dts > avist->packet_count && enc->codec_id != CODEC_ID_XSUB && avist->packet_count){ AVPacket empty_packet; if(pkt->dts - avist->packet_count > 60000){ From 5fd83f29f7f2d2770bd5d2786a549311b3fd4112 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 30 May 2013 18:30:42 +0200 Subject: [PATCH 173/257] h264_cavlc: fix reading skip run Fixes Ticket2606 Signed-off-by: Michael Niedermayer (cherry picked from commit 826b3a75cd295c03720e00d3de83e1abcbedd4b9) Conflicts: libavcodec/h264_cavlc.c --- libavcodec/h264_cavlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_cavlc.c b/libavcodec/h264_cavlc.c index 2d62baa13c..a0b3a43471 100644 --- a/libavcodec/h264_cavlc.c +++ b/libavcodec/h264_cavlc.c @@ -709,7 +709,7 @@ int ff_h264_decode_mb_cavlc(H264Context *h){ down the code */ if(h->slice_type_nos != AV_PICTURE_TYPE_I){ if(s->mb_skip_run==-1) - s->mb_skip_run= get_ue_golomb(&s->gb); + s->mb_skip_run= get_ue_golomb_long(&s->gb); if (s->mb_skip_run--) { if(FRAME_MBAFF && (s->mb_y&1) == 0){ From f6bca606f17640e835c1f264c1c45625008eb3e6 Mon Sep 17 00:00:00 2001 From: Claudio Freire Date: Sat, 4 May 2013 18:36:37 -0300 Subject: [PATCH 174/257] AAC encoder: Fix rate control on twoloop. Fixes a case where multichannel bitrate isn't accurately targetted by psy model alone, never achieving the target bitrate. Now fixed. Fixes ticket #2625. Signed-off-by: Michael Niedermayer Signed-off-by: Carl Eugen Hoyos --- libavcodec/aaccoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index b48da99ef1..fe3fcceb02 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -713,7 +713,7 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx, const float lambda) { int start = 0, i, w, w2, g; - int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels; + int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f); float dists[128] = { 0 }, uplims[128]; float maxvals[128]; int fflag, minscaler; From 7a472e0da964d9157bb25e90a4717093498f3f7d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 13 Jun 2013 00:01:13 +0200 Subject: [PATCH 175/257] alacenc: Fix missing sign_extend() Fixes ticket #2497 Signed-off-by: Michael Niedermayer (cherry picked from commit 8aea2f05dc56f7e7d60767dd27ba8e846a05e8ae) --- libavcodec/alacenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alacenc.c b/libavcodec/alacenc.c index 0194e2fecc..d7da9369eb 100644 --- a/libavcodec/alacenc.c +++ b/libavcodec/alacenc.c @@ -264,7 +264,7 @@ static void alac_linear_predictor(AlacEncodeContext *s, int ch) // generate warm-up samples residual[0] = samples[0]; for (i = 1; i <= lpc.lpc_order; i++) - residual[i] = samples[i] - samples[i-1]; + residual[i] = sign_extend(samples[i] - samples[i-1], s->write_sample_size); // perform lpc on remaining samples for (i = lpc.lpc_order + 1; i < s->frame_size; i++) { From d5b068d44b4bf42951611a92d3697786564ef002 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 18 Jun 2013 02:09:46 +0200 Subject: [PATCH 176/257] swresample/x86/audio_convert: add emms to CONV Fixes ticket #1874 Signed-off-by: Michael Niedermayer (cherry picked from commit ca2818b88155029bb6f989ee522e7f8e9e9f5927) --- libswresample/x86/audio_convert.asm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libswresample/x86/audio_convert.asm b/libswresample/x86/audio_convert.asm index 6fc86f0748..d5563a2461 100644 --- a/libswresample/x86/audio_convert.asm +++ b/libswresample/x86/audio_convert.asm @@ -196,7 +196,12 @@ cglobal %2_to_%1_%3, 3, 3, 6, dst, src, len add lenq, 2*mmsize/(1<<%4) %endif jl .next +%if mmsize == 8 + emms + RET +%else REP_RET +%endif %endmacro %macro PACK_6CH 5-7 From 3d4a61fbda65ebdd00b049166eaedccfbe9ff6ba Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Wed, 19 Jun 2013 16:31:10 +0200 Subject: [PATCH 177/257] Autodetect idcin only if audio properties allow decoding. Fixes ticket #2688. (cherry picked from commit 06bede95fcea47d2e51e8ff248c15311f335b898) --- libavformat/idcin.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavformat/idcin.c b/libavformat/idcin.c index fd4504a566..fcfddfd1f6 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -91,7 +91,7 @@ typedef struct IdcinDemuxContext { static int idcin_probe(AVProbeData *p) { - unsigned int number; + unsigned int number, sample_rate; /* * This is what you could call a "probabilistic" file check: id CIN @@ -120,18 +120,18 @@ static int idcin_probe(AVProbeData *p) return 0; /* check the audio sample rate */ - number = AV_RL32(&p->buf[8]); - if ((number != 0) && ((number < 8000) | (number > 48000))) + sample_rate = AV_RL32(&p->buf[8]); + if (sample_rate && (sample_rate < 8000 || sample_rate > 48000)) return 0; /* check the audio bytes/sample */ number = AV_RL32(&p->buf[12]); - if (number > 2) + if (number > 2 || sample_rate && !number) return 0; /* check the audio channels */ number = AV_RL32(&p->buf[16]); - if (number > 2) + if (number > 2 || sample_rate && !number) return 0; /* return half certainly since this check is a bit sketchy */ From a1e4d1f933c94b0e47ff0d6d5f3384ac7167a5f1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 21 Jun 2013 01:11:45 +0200 Subject: [PATCH 178/257] avformat/libmodplug: Reduce the probe score for small input This ensures that theres enough data for mpeg_probe() to recognize mpeg-ps Fixes Ticket2583 Based on code by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit c605adbf562fbf535e83ae427bb681bc45e440c8) --- libavformat/libmodplug.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libavformat/libmodplug.c b/libavformat/libmodplug.c index a662dbafbc..c56327c81b 100644 --- a/libavformat/libmodplug.c +++ b/libavformat/libmodplug.c @@ -347,6 +347,19 @@ static int modplug_read_seek(AVFormatContext *s, int stream_idx, int64_t ts, int return 0; } +static const char modplug_extensions[] = "669,abc,amf,ams,dbm,dmf,dsm,far,it,mdl,med,mid,mod,mt2,mtm,okt,psm,ptm,s3m,stm,ult,umx,xm,itgz,itr,itz,mdgz,mdr,mdz,s3gz,s3r,s3z,xmgz,xmr,xmz"; + +static int modplug_probe(AVProbeData *p) +{ + if (av_match_ext(p->filename, modplug_extensions)) { + if (p->buf_size < 16384) + return AVPROBE_SCORE_MAX/4-1; + else + return AVPROBE_SCORE_MAX/2; + } + return 0; +} + static const AVClass modplug_class = { .class_name = "ModPlug demuxer", .item_name = av_default_item_name, @@ -358,11 +371,11 @@ AVInputFormat ff_libmodplug_demuxer = { .name = "libmodplug", .long_name = NULL_IF_CONFIG_SMALL("ModPlug demuxer"), .priv_data_size = sizeof(ModPlugContext), + .read_probe = modplug_probe, .read_header = modplug_read_header, .read_packet = modplug_read_packet, .read_close = modplug_read_close, .read_seek = modplug_read_seek, - .extensions = "669,abc,amf,ams,dbm,dmf,dsm,far,it,mdl,med,mid,mod,mt2,mtm,okt,psm,ptm,s3m,stm,ult,umx,xm" - ",itgz,itr,itz,mdgz,mdr,mdz,s3gz,s3r,s3z,xmgz,xmr,xmz", // compressed mods + .extensions = modplug_extensions, .priv_class = &modplug_class, }; From 274ec187dcc6bec42cd926d40de170cda3dd1836 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 15 Jun 2013 22:46:01 +0200 Subject: [PATCH 179/257] mathops/x86: work around inline asm miscompilation with GCC 4.8.1 The volatile is not required here, and prevents a miscompilation with GCC 4.8.1 when building on x86 with --cpu=i686 Signed-off-by: Michael Niedermayer (cherry picked from commit 659df32a9d8984081ccd54adc3aee7daeb33388d) --- libavcodec/x86/mathops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/mathops.h b/libavcodec/x86/mathops.h index 33d9a6c8ff..6fb7c32020 100644 --- a/libavcodec/x86/mathops.h +++ b/libavcodec/x86/mathops.h @@ -72,7 +72,7 @@ static av_always_inline av_const int64_t MUL64(int a, int b) static inline av_const int mid_pred(int a, int b, int c) { int i=b; - __asm__ volatile( + __asm__ ( "cmp %2, %1 \n\t" "cmovg %1, %0 \n\t" "cmovg %2, %1 \n\t" From 139005452d0fd2db313a0cfe934c7e3e76949daa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 1 Jul 2013 23:38:08 +0200 Subject: [PATCH 180/257] rmdec: Pass AVIOContext to rm_read_metadata() Fix null pointer dereference Fixes Ticket2588 Signed-off-by: Michael Niedermayer (cherry picked from commit bf87908cd8da31e8f8fe75c06577170928ea70a8) Conflicts: libavformat/rmdec.c --- libavformat/rmdec.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 6b39e473d8..1f2490b437 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -107,13 +107,14 @@ static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned si return 0; } -static void rm_read_metadata(AVFormatContext *s, int wide) +static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide) { char buf[1024]; int i; + for (i=0; ipb) : avio_r8(s->pb); - get_strl(s->pb, buf, sizeof(buf), len); + int len = wide ? avio_rb16(pb) : avio_r8(pb); + get_strl(pb, buf, sizeof(buf), len); av_dict_set(&s->metadata, ff_rm_metadata[i], buf, 0); } } @@ -143,7 +144,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, int header_size = avio_rb16(pb); int64_t startpos = avio_tell(pb); avio_skip(pb, 14); - rm_read_metadata(s, 0); + rm_read_metadata(s, pb, 0); if ((startpos + header_size) >= avio_tell(pb) + 2) { // fourcc (should always be "lpcJ") avio_r8(pb); @@ -290,7 +291,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, avio_r8(pb); avio_r8(pb); avio_r8(pb); - rm_read_metadata(s, 0); + rm_read_metadata(s, pb, 0); } } return 0; @@ -483,7 +484,7 @@ static int rm_read_header(AVFormatContext *s) flags = avio_rb16(pb); /* flags */ break; case MKTAG('C', 'O', 'N', 'T'): - rm_read_metadata(s, 1); + rm_read_metadata(s, pb, 1); break; case MKTAG('M', 'D', 'P', 'R'): st = avformat_new_stream(s, NULL); From cbbfdcf9ee1c31cad273a052c1294533f4fdda24 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 5 Jul 2013 03:27:07 +0200 Subject: [PATCH 181/257] mpegts: only reopen pmt_cb filter if its different from the previous. Fixes Ticket2632 Signed-off-by: Michael Niedermayer (cherry picked from commit b009267910df10c004b5f340a090d45da29089a0) --- libavformat/mpegts.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index e77b9a79dd..1fe0162884 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1579,12 +1579,18 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (sid == 0x0000) { /* NIT info */ } else { + MpegTSFilter *fil = ts->pids[pmt_pid]; program = av_new_program(ts->stream, sid); program->program_num = sid; program->pmt_pid = pmt_pid; - if (ts->pids[pmt_pid]) - mpegts_close_filter(ts, ts->pids[pmt_pid]); - mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); + if (fil) + if ( fil->type != MPEGTS_SECTION + || fil->pid != pmt_pid + || fil->u.section_filter.section_cb != pmt_cb) + mpegts_close_filter(ts, ts->pids[pmt_pid]); + + if (!ts->pids[pmt_pid]) + mpegts_open_section_filter(ts, pmt_pid, pmt_cb, ts, 1); add_pat_entry(ts, sid); add_pid_to_pmt(ts, sid, 0); //add pat pid to program add_pid_to_pmt(ts, sid, pmt_pid); From ec882942ce455e039267ac8c4b353b4b0ecdb824 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 7 Jul 2013 02:42:40 +0200 Subject: [PATCH 182/257] avformat/mov: Fix duration of fragmented mov Fixes Ticket2757 Signed-off-by: Michael Niedermayer (cherry picked from commit dc2a13aa802fc691c25d5e0194818831058316ee) --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index a7bb0762c2..5a93b12650 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -849,7 +849,7 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */ // set the AVCodecContext duration because the duration of individual tracks // may be inaccurate - if (c->time_scale > 0) + if (c->time_scale > 0 && !c->trex_data) c->fc->duration = av_rescale(c->duration, AV_TIME_BASE, c->time_scale); avio_rb32(pb); /* preferred scale */ From e452e4ca5cdb3497e32249fd9a232bc636cbeb55 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 17 Jun 2013 22:03:36 +0200 Subject: [PATCH 183/257] mmsh: dont close context on seeking failure Fixes Ticket2581 Signed-off-by: Michael Niedermayer (cherry picked from commit b4579a29c75e2968ede2ad002dd4a495dbfc883d) --- libavformat/mmsh.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c index d6e398200f..c71ecd67ef 100644 --- a/libavformat/mmsh.c +++ b/libavformat/mmsh.c @@ -309,14 +309,16 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim return 0; fail: av_freep(&stream_selection); - mmsh_close(h); av_dlog(NULL, "Connection failed with error %d\n", err); return err; } static int mmsh_open(URLContext *h, const char *uri, int flags) { - return mmsh_open_internal(h, uri, flags, 0, 0); + int ret = mmsh_open_internal(h, uri, flags, 0, 0); + if (ret < 0) + mmsh_close(h); + return ret; } static int handle_chunk_type(MMSHContext *mmsh) From c9f34c82604aa4f24f178172a3886a187b6bbd07 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 8 Jul 2013 21:46:20 +0200 Subject: [PATCH 184/257] mpeg12dec: avoid reinitialization on PS changes when possible. Fixes Ticket2574 Signed-off-by: Michael Niedermayer (cherry picked from commit 970c8df73528659925819dec31c4c8c0887f0321) Conflicts: libavcodec/mpeg12dec.c --- libavcodec/mpeg12.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c index 697eebb091..bcee1d8290 100644 --- a/libavcodec/mpeg12.c +++ b/libavcodec/mpeg12.c @@ -1251,7 +1251,7 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) s1->save_width != s->width || s1->save_height != s->height || s1->save_aspect_info != s->aspect_ratio_info || - s1->save_progressive_seq != s->progressive_sequence || + (s1->save_progressive_seq != s->progressive_sequence && (s->height&31)) || 0) { From 2a8c3a789549940fbf6ac57c72d4a45c5cc1d00e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 29 Jul 2013 20:43:45 +0200 Subject: [PATCH 185/257] avcodec/kmvc: fix MV checks Fixes Ticket2813 Fixes regression since 70b5583 Signed-off-by: Michael Niedermayer (cherry picked from commit 3cd8aaa2b2e78faf039691e1c31ff4f8d94e3bc6) --- libavcodec/kmvc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index a476fac7ac..328f41e684 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -106,7 +106,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = val & 0xF; my = val >> 4; - if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 316*196) { + if ((l0x-mx) + 320*(l0y-my) < 0 || (l0x-mx) + 320*(l0y-my) > 320*197 - 4) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } @@ -131,7 +131,7 @@ static int kmvc_decode_intra_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = val & 0xF; my = val >> 4; - if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 318*198) { + if ((l1x-mx) + 320*(l1y-my) < 0 || (l1x-mx) + 320*(l1y-my) > 320*199 - 2) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } @@ -206,7 +206,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = (val & 0xF) - 8; my = (val >> 4) - 8; - if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 318*198) { + if ((l0x+mx) + 320*(l0y+my) < 0 || (l0x+mx) + 320*(l0y+my) > 320*197 - 4) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } @@ -231,7 +231,7 @@ static int kmvc_decode_inter_8x8(KmvcContext * ctx, int w, int h) val = bytestream2_get_byte(&ctx->g); mx = (val & 0xF) - 8; my = (val >> 4) - 8; - if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 318*198) { + if ((l1x+mx) + 320*(l1y+my) < 0 || (l1x+mx) + 320*(l1y+my) > 320*199 - 2) { av_log(ctx->avctx, AV_LOG_ERROR, "Invalid MV\n"); return AVERROR_INVALIDDATA; } From d94d383f13d1a46dec1cba71bf56bdc8c63feb57 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 5 May 2013 00:23:13 +0200 Subject: [PATCH 186/257] xbmdec: fix off by one error in scanf() Fixes out of array access Signed-off-by: Michael Niedermayer (cherry picked from commit 88c1b0e7a852e48d9f0e3d79c44edaa86e59acfe) Signed-off-by: Michael Niedermayer --- libavcodec/xbmdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c index b3e4cf2f89..ef27d703fb 100644 --- a/libavcodec/xbmdec.c +++ b/libavcodec/xbmdec.c @@ -57,7 +57,7 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data, int number, len; ptr += strcspn(ptr, "#"); - if (sscanf(ptr, "#define %256s %u", name, &number) != 2) { + if (sscanf(ptr, "#define %255s %u", name, &number) != 2) { av_log(avctx, AV_LOG_ERROR, "Unexpected preprocessor directive\n"); return AVERROR_INVALIDDATA; } From c27f2ea4715c2d51f3d13317a119a56116036488 Mon Sep 17 00:00:00 2001 From: Dale Curtis Date: Wed, 22 May 2013 15:17:08 -0700 Subject: [PATCH 187/257] avformat/utils: Keep internal and external av_read_frame() packets in sync. Otherwise, during error conditions, the caller will be left with dangling pointers to a destructed packet => boom. BUG=242786 TEST=ffmpeg_regression_tests Commit slightly simplified by commiter Signed-off-by: Michael Niedermayer (cherry picked from commit c54a1565f512858ccfa70392f40f11c098bc1b63) Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 28ffaaa223..576f4aa708 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1358,6 +1358,9 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) st->skip_to_keyframe = 0; if (st->skip_to_keyframe) { av_free_packet(&cur_pkt); + if (got_packet) { + *pkt = cur_pkt; + } got_packet = 0; } } From 29b14db9163464d466d8323a9110b2478cb78a4d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 29 Jun 2013 19:47:54 +0200 Subject: [PATCH 188/257] update all trac links to use the trac subdomain Signed-off-by: Michael Niedermayer --- doc/issue_tracker.txt | 2 +- libavcodec/qtrle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/issue_tracker.txt b/doc/issue_tracker.txt index d487f66830..27b0009b58 100644 --- a/doc/issue_tracker.txt +++ b/doc/issue_tracker.txt @@ -24,7 +24,7 @@ a mail for every change to every issue. The subscription URL for the ffmpeg-trac list is: http(s)://ffmpeg.org/mailman/listinfo/ffmpeg-trac The URL of the webinterface of the tracker is: -http(s)://ffmpeg.org/trac/ffmpeg +http(s)://trac.ffmpeg.org Type: ----- diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index c7efc0c0fd..5644130521 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -67,7 +67,7 @@ static void qtrle_decode_1bpp(QtrleContext *s, int row_ptr, int lines_to_change) * line' at the beginning. Since we always interpret it as 'go to next line' * in the decoding loop (which makes code simpler/faster), the first line * would not be counted, so we count one more. - * See: https://ffmpeg.org/trac/ffmpeg/ticket/226 + * See: https://trac.ffmpeg.org/ticket/226 * In the following decoding loop, row_ptr will be the position of the * _next_ row. */ lines_to_change++; From b25c3063b2fcad7bcf6a7337f101990085b1983d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 20 Aug 2013 23:18:48 +0200 Subject: [PATCH 189/257] avcodec/flashsv: check diff_start/height Fixes out of array accesses Fixes Ticket2844 Found-by: ami_stuff Signed-off-by: Michael Niedermayer (cherry picked from commit 880c73cd76109697447fbfbaa8e5ee5683309446) Signed-off-by: Michael Niedermayer --- libavcodec/flashsv.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index 0e5543d09f..d9277c4600 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -373,6 +373,10 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, if (has_diff) { s->diff_start = get_bits(&gb, 8); s->diff_height = get_bits(&gb, 8); + if (s->diff_start + s->diff_height > cur_blk_height) { + av_log(avctx, AV_LOG_ERROR, "Block parameters invalid\n"); + return AVERROR_INVALIDDATA; + } av_log(avctx, AV_LOG_DEBUG, "%dx%d diff start %d height %d\n", i, j, s->diff_start, s->diff_height); From 453e2f1528811ac16d6a3fdef2058d0649eac00f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 22 Aug 2013 01:07:32 +0200 Subject: [PATCH 190/257] avcodec/rpza: Perform pointer advance and checks before using the pointers Fixes out of array accesses Fixes Ticket2850 Signed-off-by: Michael Niedermayer (cherry picked from commit 3819db745da2ac7fb3faacb116788c32f4753f34) Signed-off-by: Michael Niedermayer --- libavcodec/rpza.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index d83f4578a3..bbbe8a775b 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -83,7 +83,7 @@ static void rpza_decode_stream(RpzaContext *s) unsigned short *pixels = (unsigned short *)s->frame.data[0]; int row_ptr = 0; - int pixel_ptr = 0; + int pixel_ptr = -4; int block_ptr; int pixel_x, pixel_y; int total_blocks; @@ -139,6 +139,7 @@ static void rpza_decode_stream(RpzaContext *s) colorA = AV_RB16 (&s->buf[stream_ptr]); stream_ptr += 2; while (n_blocks--) { + ADVANCE_BLOCK() block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ @@ -147,7 +148,6 @@ static void rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); } break; @@ -186,6 +186,7 @@ static void rpza_decode_stream(RpzaContext *s) if (s->size - stream_ptr < n_blocks * 4) return; while (n_blocks--) { + ADVANCE_BLOCK(); block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { index = s->buf[stream_ptr++]; @@ -196,7 +197,6 @@ static void rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); } break; @@ -204,6 +204,7 @@ static void rpza_decode_stream(RpzaContext *s) case 0x00: if (s->size - stream_ptr < 16) return; + ADVANCE_BLOCK(); block_ptr = row_ptr + pixel_ptr; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++){ @@ -217,7 +218,6 @@ static void rpza_decode_stream(RpzaContext *s) } block_ptr += row_inc; } - ADVANCE_BLOCK(); break; /* Unknown opcode */ From f9e6fb50ceac05f8e0e9ff4a9a99674407fc8b85 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 24 Aug 2013 03:19:40 +0200 Subject: [PATCH 191/257] jpeg2000: check log2_cblk dimensions Fixes out of array access Fixes Ticket2895 Found-by: Piotr Bandurski Signed-off-by: Michael Niedermayer (cherry picked from commit 9a271a9368eaabf99e6c2046103acb33957e63b7) Conflicts: libavcodec/jpeg2000dec.c Signed-off-by: Michael Niedermayer --- libavcodec/j2kdec.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/j2kdec.c b/libavcodec/j2kdec.c index 9c2022e42d..6bd4355c1a 100644 --- a/libavcodec/j2kdec.c +++ b/libavcodec/j2kdec.c @@ -30,6 +30,7 @@ #include "avcodec.h" #include "bytestream.h" #include "j2k.h" +#include "libavutil/avassert.h" #include "libavutil/common.h" #define JP2_SIG_TYPE 0x6A502020 @@ -294,6 +295,10 @@ static int get_cox(J2kDecoderContext *s, J2kCodingStyle *c) c->log2_cblk_width = bytestream2_get_byteu(&s->g) + 2; // cblk width c->log2_cblk_height = bytestream2_get_byteu(&s->g) + 2; // cblk height + if (c->log2_cblk_width > 6 || c->log2_cblk_height > 6) { + return AVERROR_PATCHWELCOME; + } + c->cblk_style = bytestream2_get_byteu(&s->g); if (c->cblk_style != 0){ // cblk style av_log(s->avctx, AV_LOG_WARNING, "extra cblk styles %X\n", c->cblk_style); @@ -711,6 +716,9 @@ static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Contex int bpass_csty_symbol = J2K_CBLK_BYPASS & codsty->cblk_style; int vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style; + av_assert0(width <= J2K_MAX_CBLKW); + av_assert0(height <= J2K_MAX_CBLKH); + for (y = 0; y < height+2; y++) memset(t1->flags[y], 0, (width+2)*sizeof(int)); From 39ed5442620a7a0fd2328b7d4aefc6ae152c5441 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 14 Dec 2012 15:00:28 +0100 Subject: [PATCH 192/257] Merge commit '072be3e8969f24113d599444be4d6a0ed04a6602' * commit '072be3e8969f24113d599444be4d6a0ed04a6602': h264: set parameters from SPS whenever it changes Conflicts: libavcodec/h264.c Merged-by: Michael Niedermayer (cherry picked from commit b9d887c225466576ae80ef7f2b109e866ff137b2) Conflicts: libavcodec/h264.c --- libavcodec/h264.c | 79 +++++++++++++++++++++++++++++++++----------- libavcodec/h264.h | 2 ++ libavcodec/h264_ps.c | 7 ++-- 3 files changed, 66 insertions(+), 22 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 6e62c0dc26..059d65bfb8 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2847,6 +2847,53 @@ int ff_h264_get_profile(SPS *sps) return profile; } +static int h264_set_parameter_from_sps(H264Context *h) +{ + MpegEncContext *s = &h->s; + + if (s->flags & CODEC_FLAG_LOW_DELAY || + (h->sps.bitstream_restriction_flag && + !h->sps.num_reorder_frames)) { + if (s->avctx->has_b_frames > 1 || h->delayed_pic[0]) + av_log(h->s.avctx, AV_LOG_WARNING, "Delayed frames seen. " + "Reenabling low delay requires a codec flush.\n"); + else + s->low_delay = 1; + } + + if (s->avctx->has_b_frames < 2) + s->avctx->has_b_frames = !s->low_delay; + + if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || + h->cur_chroma_format_idc != h->sps.chroma_format_idc) { + if (s->avctx->codec && + s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU && + (h->sps.bit_depth_luma != 8 || h->sps.chroma_format_idc > 1)) { + av_log(s->avctx, AV_LOG_ERROR, + "VDPAU decoding does not support video colorspace.\n"); + return AVERROR_INVALIDDATA; + } + if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10 && + (h->sps.bit_depth_luma != 9 || !CHROMA422)) { + s->avctx->bits_per_raw_sample = h->sps.bit_depth_luma; + h->cur_chroma_format_idc = h->sps.chroma_format_idc; + h->pixel_shift = h->sps.bit_depth_luma > 8; + + ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma, + h->sps.chroma_format_idc); + ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma, + h->sps.chroma_format_idc); + s->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16; + ff_dsputil_init(&s->dsp, s->avctx); + } else { + av_log(s->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n", + h->sps.bit_depth_luma); + return AVERROR_INVALIDDATA; + } + } + return 0; +} + /** * Decode a slice header. * This will also call ff_MPV_common_init() and frame_start() as needed. @@ -2863,7 +2910,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0) MpegEncContext *const s0 = &h0->s; unsigned int first_mb_in_slice; unsigned int pps_id; - int num_ref_idx_active_override_flag; + int num_ref_idx_active_override_flag, ret; unsigned int slice_type, tmp, i, j; int default_ref_list_done = 0; int last_pic_structure, last_pic_dropable; @@ -2940,7 +2987,14 @@ static int decode_slice_header(H264Context *h, H264Context *h0) h->pps.sps_id); return -1; } - h->sps = *h0->sps_buffers[h->pps.sps_id]; + + if (h->pps.sps_id != h->current_sps_id || + h0->sps_buffers[h->pps.sps_id]->new) { + h0->sps_buffers[h->pps.sps_id]->new = 0; + + h->current_sps_id = h->pps.sps_id; + h->sps = *h0->sps_buffers[h->pps.sps_id]; + } s->avctx->profile = ff_h264_get_profile(&h->sps); s->avctx->level = h->sps.level_idc; @@ -2989,24 +3043,8 @@ static int decode_slice_header(H264Context *h, H264Context *h0) s->avctx->sample_aspect_ratio = h->sps.sar; av_assert0(s->avctx->sample_aspect_ratio.den); - if (s->avctx->bits_per_raw_sample != h->sps.bit_depth_luma || - h->cur_chroma_format_idc != h->sps.chroma_format_idc) { - if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10 && - (h->sps.bit_depth_luma != 9 || !CHROMA422)) { - s->avctx->bits_per_raw_sample = h->sps.bit_depth_luma; - h->cur_chroma_format_idc = h->sps.chroma_format_idc; - h->pixel_shift = h->sps.bit_depth_luma > 8; - - ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma, h->sps.chroma_format_idc); - ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma, h->sps.chroma_format_idc); - s->dsp.dct_bits = h->sps.bit_depth_luma > 8 ? 32 : 16; - ff_dsputil_init(&s->dsp, s->avctx); - } else { - av_log(s->avctx, AV_LOG_ERROR, "Unsupported bit depth: %d chroma_idc: %d\n", - h->sps.bit_depth_luma, h->sps.chroma_format_idc); - return -1; - } - } + if ((ret = h264_set_parameter_from_sps(h)) < 0) + return ret; if (h->sps.video_signal_type_present_flag) { s->avctx->color_range = h->sps.full_range>0 ? AVCOL_RANGE_JPEG @@ -4435,6 +4473,7 @@ again: ff_h264_decode_seq_parameter_set(h); } + if (s->flags & CODEC_FLAG_LOW_DELAY || (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames)) diff --git a/libavcodec/h264.h b/libavcodec/h264.h index a27f82f494..22f8100cc2 100644 --- a/libavcodec/h264.h +++ b/libavcodec/h264.h @@ -206,6 +206,7 @@ typedef struct SPS { int bit_depth_chroma; ///< bit_depth_chroma_minus8 + 8 int residual_color_transform_flag; ///< residual_colour_transform_flag int constraint_set_flags; ///< constraint_set[0-3]_flag + int new; ///< flag to keep track if the decoder context needs re-init due to changed SPS } SPS; /** @@ -332,6 +333,7 @@ typedef struct H264Context { int emu_edge_width; int emu_edge_height; + unsigned current_sps_id; ///< id of the current SPS SPS sps; ///< current sps /** diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index 261e2d2719..bf07cbb8db 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -478,10 +478,13 @@ int ff_h264_decode_seq_parameter_set(H264Context *h){ sps->bit_depth_luma ); } + sps->new = 1; av_free(h->sps_buffers[sps_id]); - h->sps_buffers[sps_id]= sps; - h->sps = *sps; + h->sps_buffers[sps_id] = sps; + h->sps = *sps; + h->current_sps_id = sps_id; + return 0; fail: av_free(sps); From 1934bb75361e7859873c6bf94ee1ceb17981c550 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 2 Feb 2013 21:11:54 +0100 Subject: [PATCH 193/257] h264: skip error concealment when SPS and slices are mismatching Fixes out of array accesses Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 695af8eed642ff0104834495652d1ee784a4c14d) Conflicts: libavcodec/h264.c --- libavcodec/h264.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 059d65bfb8..1e6326f881 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2783,7 +2783,7 @@ static int field_end(H264Context *h, int in_setup) * past end by one (callers fault) and resync_mb_y != 0 * causes problems for the first MB line, too. */ - if (!FIELD_PICTURE) + if (!FIELD_PICTURE && h->current_slice && !h->sps.new) ff_er_frame_end(s); ff_MPV_frame_end(s); From 7d2e17fd2d669f4139d85563fd216feaea0c8c22 Mon Sep 17 00:00:00 2001 From: James Almer Date: Wed, 17 Jul 2013 03:10:16 -0300 Subject: [PATCH 194/257] lavf/matroskaenc: Check for valid metadata before creating tags Tags must have at least one SimpleTag element to be spec conformant. Updated lavf-mkv and seek-lavf-mkv FATE references as the tests were affected by this. Fixes ticket #2785 Signed-off-by: James Almer Signed-off-by: Michael Niedermayer (cherry picked from commit 088ed5314694031e07e02e9d364c9d486a60e704) Conflicts: tests/ref/lavf/mkv tests/ref/seek/lavf-mkv --- libavformat/matroskaenc.c | 18 +++++++++++++--- tests/ref/lavf/mkv | 4 ++-- tests/ref/seek/lavf_mkv | 44 +++++++++++++++++++-------------------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 178c3f6763..b4d492cb2c 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -783,6 +783,18 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme return 0; } +static int mkv_check_tag(AVDictionary *m) +{ + AVDictionaryEntry *t = NULL; + int ret = 0; + + while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) + if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode")) + ret++; + + return ret; +} + static int mkv_write_tags(AVFormatContext *s) { ebml_master tags = {0}; @@ -790,7 +802,7 @@ static int mkv_write_tags(AVFormatContext *s) ff_metadata_conv_ctx(s, ff_mkv_metadata_conv, NULL); - if (av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + if (mkv_check_tag(s->metadata)) { ret = mkv_write_tag(s, s->metadata, 0, 0, &tags); if (ret < 0) return ret; } @@ -798,7 +810,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; - if (!av_dict_get(st->metadata, "", 0, AV_DICT_IGNORE_SUFFIX)) + if (!mkv_check_tag(st->metadata)) continue; ret = mkv_write_tag(s, st->metadata, MATROSKA_ID_TAGTARGETS_TRACKUID, i + 1, &tags); @@ -808,7 +820,7 @@ static int mkv_write_tags(AVFormatContext *s) for (i = 0; i < s->nb_chapters; i++) { AVChapter *ch = s->chapters[i]; - if (!av_dict_get(ch->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) + if (!mkv_check_tag(ch->metadata)) continue; ret = mkv_write_tag(s, ch->metadata, MATROSKA_ID_TAGTARGETS_CHAPTERUID, ch->id, &tags); diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv index 576bd058c0..84739675ad 100644 --- a/tests/ref/lavf/mkv +++ b/tests/ref/lavf/mkv @@ -1,3 +1,3 @@ -d8e8858db2fe4920d19d4267059933d6 *./tests/data/lavf/lavf.mkv -320305 ./tests/data/lavf/lavf.mkv +c7ebe0d582549859b2b27dcd5908444b *./tests/data/lavf/lavf.mkv +320273 ./tests/data/lavf/lavf.mkv ./tests/data/lavf/lavf.mkv CRC=0xd86284dd diff --git a/tests/ref/seek/lavf_mkv b/tests/ref/seek/lavf_mkv index 6c6c10e68e..b5c273febb 100644 --- a/tests/ref/seek/lavf_mkv +++ b/tests/ref/seek/lavf_mkv @@ -1,48 +1,48 @@ -ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 523 size: 208 ret: 0 st:-1 flags:0 ts:-1.000000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret: 0 st:-1 flags:1 ts: 1.894167 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292193 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292161 size: 27834 ret: 0 st: 0 flags:0 ts: 0.788000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292193 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292161 size: 27834 ret: 0 st: 0 flags:1 ts:-0.317000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret:-1 st: 1 flags:0 ts: 2.577000 ret: 0 st: 1 flags:1 ts: 1.471000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320034 size: 209 +ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320002 size: 209 ret: 0 st:-1 flags:0 ts: 0.365002 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146746 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146714 size: 27925 ret: 0 st:-1 flags:1 ts:-0.740831 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret:-1 st: 0 flags:0 ts: 2.153000 ret: 0 st: 0 flags:1 ts: 1.048000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292193 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292161 size: 27834 ret: 0 st: 1 flags:0 ts:-0.058000 -ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 523 size: 208 ret: 0 st: 1 flags:1 ts: 2.836000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320034 size: 209 +ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320002 size: 209 ret:-1 st:-1 flags:0 ts: 1.730004 ret: 0 st:-1 flags:1 ts: 0.624171 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146746 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146714 size: 27925 ret: 0 st: 0 flags:0 ts:-0.482000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret: 0 st: 0 flags:1 ts: 2.413000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292193 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292161 size: 27834 ret:-1 st: 1 flags:0 ts: 1.307000 ret: 0 st: 1 flags:1 ts: 0.201000 -ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.015000 pts: 0.015000 pos: 523 size: 208 ret: 0 st:-1 flags:0 ts:-0.904994 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret: 0 st:-1 flags:1 ts: 1.989173 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292193 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292161 size: 27834 ret: 0 st: 0 flags:0 ts: 0.883000 -ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292193 size: 27834 +ret: 0 st: 0 flags:1 dts: 0.960000 pts: 0.960000 pos: 292161 size: 27834 ret: 0 st: 0 flags:1 ts:-0.222000 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 ret:-1 st: 1 flags:0 ts: 2.672000 ret: 0 st: 1 flags:1 ts: 1.566000 -ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320034 size: 209 +ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320002 size: 209 ret: 0 st:-1 flags:0 ts: 0.460008 -ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146746 size: 27925 +ret: 0 st: 0 flags:1 dts: 0.480000 pts: 0.480000 pos: 146714 size: 27925 ret: 0 st:-1 flags:1 ts:-0.645825 -ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 555 size: 208 +ret: 0 st: 1 flags:1 dts: 0.000000 pts: 0.000000 pos: 523 size: 208 From 11bc88eebd205f1a28a0b17d5511103ce9062557 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 17 Jul 2013 13:30:36 +0200 Subject: [PATCH 195/257] matroskaenc: simplify mkv_check_tag() Signed-off-by: Michael Niedermayer (cherry picked from commit 066111bf19518a9f4d836991b34dbfc5ab72a41a) --- libavformat/matroskaenc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index b4d492cb2c..b771ceb1f8 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -786,13 +786,12 @@ static int mkv_write_tag(AVFormatContext *s, AVDictionary *m, unsigned int eleme static int mkv_check_tag(AVDictionary *m) { AVDictionaryEntry *t = NULL; - int ret = 0; while ((t = av_dict_get(m, "", t, AV_DICT_IGNORE_SUFFIX))) if (av_strcasecmp(t->key, "title") && av_strcasecmp(t->key, "stereo_mode")) - ret++; + return 1; - return ret; + return 0; } static int mkv_write_tags(AVFormatContext *s) From c4470471174cb9447fb7556023b36926685be2a8 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 17 Aug 2013 14:48:33 -0300 Subject: [PATCH 196/257] matroskadec: Improve TTA duration calculation Calculate the duration as accurately as possible to improve decoding of samples where the last frame is smaller than the rest. Signed-off-by: James Almer Approved-by: Paul B Mahol Signed-off-by: Michael Niedermayer (cherry picked from commit af248fa1174200acb537a6ab1198bb2fed38e884) Conflicts: libavformat/matroskadec.c --- libavformat/matroskadec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 129de9065f..6e0e880fbc 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1615,7 +1615,7 @@ static int matroska_read_header(AVFormatContext *s) avio_wl16(&b, track->audio.channels); avio_wl16(&b, track->audio.bitdepth); avio_wl32(&b, track->audio.out_samplerate); - avio_wl32(&b, matroska->ctx->duration * track->audio.out_samplerate); + avio_wl32(&b, av_rescale((matroska->duration * matroska->time_scale), track->audio.out_samplerate, AV_TIME_BASE * 1000)); } else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 || codec_id == CODEC_ID_RV30 || codec_id == CODEC_ID_RV40) { extradata_offset = 26; From 97f739ac9ba59793f77fb4248c8d36694e6ea75a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 18 Aug 2013 02:20:54 +0200 Subject: [PATCH 197/257] avformat/matroskadec: check out_samplerate before using it in av_rescale() Prevent assertion failure with damaged input Signed-off-by: Michael Niedermayer (cherry picked from commit 338f8b2eaf36f078eb5cc26ac10e651dc4c48243) --- libavformat/matroskadec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 6e0e880fbc..01b13a0998 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1614,6 +1614,8 @@ static int matroska_read_header(AVFormatContext *s) avio_wl16(&b, 1); avio_wl16(&b, track->audio.channels); avio_wl16(&b, track->audio.bitdepth); + if (track->audio.out_samplerate < 0 || track->audio.out_samplerate > INT_MAX) + return AVERROR_INVALIDDATA; avio_wl32(&b, track->audio.out_samplerate); avio_wl32(&b, av_rescale((matroska->duration * matroska->time_scale), track->audio.out_samplerate, AV_TIME_BASE * 1000)); } else if (codec_id == CODEC_ID_RV10 || codec_id == CODEC_ID_RV20 || From cbf73359407d562dd484851b8737ec9dec2f4f7d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 May 2013 04:00:30 +0200 Subject: [PATCH 198/257] matroska_read_seek: Fix used streams for subtitle index compensation Might fix Ticket1907 (I have no testcase so i cant test) Signed-off-by: Michael Niedermayer (cherry picked from commit 4758e32a6c48044f77102a49110c79b4f338f648) Signed-off-by: Michael Niedermayer --- libavformat/matroskadec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 01b13a0998..43010c38a6 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2251,10 +2251,11 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE && !tracks[i].stream->discard != AVDISCARD_ALL) { index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD); - if (index_sub >= 0 - && st->index_entries[index_sub].pos < st->index_entries[index_min].pos - && st->index_entries[index].timestamp - st->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale) - index_min = index_sub; + while(index_sub >= 0 + && index_min >= 0 + && tracks[i].stream->index_entries[index_sub].pos < st->index_entries[index_min].pos + && st->index_entries[index].timestamp - tracks[i].stream->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale) + index_min--; } } From 56ff47c9a5476bf3ef0b29bdf535577089ddbb6f Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 24 May 2013 12:28:48 -0700 Subject: [PATCH 199/257] doc/encoders: Add documentation for libmp3lame Signed-off-by: Michael Niedermayer (cherry picked from commit 4703a345fb41b14fe28f7e6bf7f60bb2213aa9e0) Signed-off-by: Timothy Gu --- doc/encoders.texi | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 65841eda7f..bf80707280 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -412,6 +412,35 @@ Selected by Encoder (default) @end table +@section libmp3lame + +LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper + +Requires the presence of the libmp3lame headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libmp3lame}. + +@subsection Option Mapping + +The following options are supported by the libmp3lame wrapper, +the LAME-equivalent options follow the FFmpeg ones. + +@multitable @columnfractions .2 .2 +@item FFmpeg @tab LAME +@item b @tab b +FFmpeg @code{b} option is expressed in bits/s, lame @code{bitrate} +in kilobits/s. +@item q @tab V +Quality setting for VBR. +@item compression_level @tab q +Algorithm quality. Valid options are integers from 0-9. +@item reservoir @tab N.A. +Enable use of bit reservoir. LAME has this enabled by default. +@item joint_stereo @tab -m j +Enables the the encoder to use (on a frame by frame basis) either L/R +stereo or mid/side stereo. +@end multitable + @c man end AUDIO ENCODERS @chapter Video Encoders From 8d0c2755d30df49d79e1fea12422f3e0a9882187 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 7 Jun 2013 19:54:23 -0700 Subject: [PATCH 200/257] doc/encoders: Add libvo-aacenc doc Signed-off-by: Michael Niedermayer (cherry picked from commit ba7cb4807f050c401f8fd7ef1d1065b138358135) Signed-off-by: Timothy Gu Conflicts: doc/encoders.texi --- doc/encoders.texi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index bf80707280..6cc447603f 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -441,6 +441,27 @@ Enables the the encoder to use (on a frame by frame basis) either L/R stereo or mid/side stereo. @end multitable +@section libvo-aacenc + +VisualOn AAC encoder + +Requires the presence of the libvo-aacenc headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libvo-aacenc --enable-version3}. + +@subsection Options + +The VisualOn AAC encoder only support encoding AAC-LC and up to 2 +channels. It is also CBR-only. It is considered to be worse than the +native experimental FFmpeg AAC encoder. + +@table @option + +@item b +Bitrate. + +@end table + @c man end AUDIO ENCODERS @chapter Video Encoders From 960e591e46fed20ff4b75535cf1381738281028b Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 11 Jun 2013 16:58:01 -0700 Subject: [PATCH 201/257] doc/encoders: Add libvo-amrwbenc doc Signed-off-by: Michael Niedermayer (cherry picked from commit 0ec65aa1046a4417d5c7dfcf8faeecde60e3fe00) Signed-off-by: Timothy Gu Conflicts: doc/encoders.texi --- doc/encoders.texi | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 6cc447603f..fac470a7fe 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -462,6 +462,44 @@ Bitrate. @end table +@section libvo-amrwbenc + +VisualOn Adaptive Multi-Rate Wideband encoder + +Requires the presence of the libvo-amrwbenc headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libvo-amrwbenc --enable-version3}. + +This is a mono-only encoder. Officially it only supports 16000Hz sample +rate, but you can override it by setting @option{strict} to +@samp{unofficial} or lower. + +@subsection Options + +@table @option + +@item b +Set bitrate in bits/s. Only the following bitrates are supported, otherwise +libavcodec will round to the nearest valid bitrate. + +@table @samp +@item 6600 +@item 8850 +@item 12650 +@item 14250 +@item 15850 +@item 18250 +@item 19850 +@item 23050 +@item 23850 +@end table + +@item dtx +Allow discontinuous transmission (generate comfort noise) when set to 1. The +default value is 0 (disabled). + +@end table + @c man end AUDIO ENCODERS @chapter Video Encoders From d74657922178ddac222c34d983d19445309b7eaa Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 17 Jun 2013 17:42:08 -0700 Subject: [PATCH 202/257] doc/decoders: Document libcelt Signed-off-by: Michael Niedermayer (cherry picked from commit e3580449221c79cf611995dc7e2fcb61dd867d4c) Signed-off-by: Timothy Gu --- doc/decoders.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 87ad4eea26..6a18c76a69 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -60,4 +60,12 @@ This decoder generates wave patterns according to predefined sequences. Its use is purely internal and the format of the data it accepts is not publicly documented. +@section libcelt + +libcelt decoder wrapper + +libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec. +Requires the presence of the libcelt headers and library during configuration. +You need to explicitly configure the build with @code{--enable-libcelt}. + @c man end AUDIO DECODERS From 66bfbabafcd85aaf50d1a7383d0c6d457d0bf781 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 17 Jun 2013 17:38:38 -0700 Subject: [PATCH 203/257] doc/encoders: Add libopencore-amrnb doc Signed-off-by: Michael Niedermayer (cherry picked from commit 9ead06057acfcc43bcb99a63a7c58543007b2847) Signed-off-by: Timothy Gu --- doc/encoders.texi | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index fac470a7fe..8958211ee4 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -500,6 +500,43 @@ default value is 0 (disabled). @end table +@section libopencore-amrnb + +OpenCORE Adaptive Multi-Rate Narrowband encoder. + +Requires the presence of the libopencore-amrnb headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libopencore-amrnb --enable-version3}. + +This is a mono-only encoder. Officially it only supports 8000Hz sample rate, +but you can override it by setting @option{strict} to @samp{unofficial} or +lower. + +@subsection Options + +@table @option + +@item b +Set bitrate in bits per second. Only the following bitrates are supported, +otherwise libavcodec will round to the nearest valid bitrate. + +@table @option +@item 4750 +@item 5150 +@item 5900 +@item 6700 +@item 7400 +@item 7950 +@item 10200 +@item 12200 +@end table + +@item dtx +Allow discontinuous transmission (generate comfort noise) when set to 1. The +default value is 0 (disabled). + +@end table + @c man end AUDIO ENCODERS @chapter Video Encoders From d559cfb5bd9b137739615886601a440a76a38fe5 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 18 Jun 2013 16:01:43 -0700 Subject: [PATCH 204/257] doc/decoders: Document libgsm decoder Signed-off-by: Michael Niedermayer (cherry picked from commit c16496c3770fa083472ab86146c18dc96c1feea7) Signed-off-by: Timothy Gu --- doc/decoders.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 6a18c76a69..951fe6d03b 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -68,4 +68,14 @@ libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec. Requires the presence of the libcelt headers and library during configuration. You need to explicitly configure the build with @code{--enable-libcelt}. +@section libgsm + +libgsm decoder wrapper + +libgsm allows libavcodec to decode the GSM full rate audio codec. Requires +the presence of the libgsm headers and library during configuration. You need +to explicitly configure the build with @code{--enable-libgsm}. + +This decoder supports both the ordinary GSM and the Microsoft variant. + @c man end AUDIO DECODERS From 97a24e7638c7c514426815daef9126e039801708 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 20 Jun 2013 16:33:49 -0700 Subject: [PATCH 205/257] doc/decoders: Document libilbc decoder Signed-off-by: Michael Niedermayer (cherry picked from commit 8cdea50f6eee1271e24ff0c9590522f8323e87fe) Signed-off-by: Timothy Gu --- doc/decoders.texi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 951fe6d03b..0fe55e4eb3 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -78,4 +78,25 @@ to explicitly configure the build with @code{--enable-libgsm}. This decoder supports both the ordinary GSM and the Microsoft variant. +@section libilbc + +libilbc decoder wrapper + +libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC) +audio codec. Requires the presence of the libilbc headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libilbc}. + +@subsection Options + +The following option is supported by the libilbc wrapper. + +@table @option +@item enhance + +Enable the enhancement of the decoded audio when set to 1. The default +value is 0 (disabled). + +@end table + @c man end AUDIO DECODERS From 3adf1859eeb761662998d6793031592004880fa3 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 20 Jun 2013 20:08:35 -0700 Subject: [PATCH 206/257] doc/decoders: Document libopencore-amrnb decoder Signed-off-by: Michael Niedermayer (cherry picked from commit b43860ee0c27279f2fa020ea965c03d359f8f45c) Signed-off-by: Timothy Gu --- doc/decoders.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 0fe55e4eb3..0ef9148281 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -99,4 +99,16 @@ value is 0 (disabled). @end table +@section libopencore-amrnb + +libopencore-amrnb decoder wrapper + +libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate +Narrowband audio codec. Using it requires the presence of the +libopencore-amrnb headers and library during configuration. You need to +explicitly configure the build with @code{--enable-libopencore-amrnb}. + +An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB +without this library. + @c man end AUDIO DECODERS From 3bba59bd80be5633933acd3421aa77216e886b50 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Fri, 21 Jun 2013 18:17:21 +0200 Subject: [PATCH 207/257] doc/decoders: Add libopencore-amrwb decoder doc Signed-off-by: Stefano Sabatini (cherry picked from commit 83647ace735d1707d4b28345ef77fefe525ea52e) Signed-off-by: Timothy Gu --- doc/decoders.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/decoders.texi b/doc/decoders.texi index 0ef9148281..f246fc443a 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -111,4 +111,16 @@ explicitly configure the build with @code{--enable-libopencore-amrnb}. An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB without this library. +@section libopencore-amrwb + +libopencore-amrwb decoder wrapper. + +libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate +Wideband audio codec. Using it requires the presence of the +libopencore-amrwb headers and library during configuration. You need to +explicitly configure the build with @code{--enable-libopencore-amrwb}. + +An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB +without this library. + @c man end AUDIO DECODERS From 134022ad74528059c346b96257c5c196494418e8 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Thu, 27 Jun 2013 18:50:54 -0700 Subject: [PATCH 208/257] doc/encoders: alphabetically list the encoders Signed-off-by: Stefano Sabatini (cherry picked from commit 934df3b0375743ae2b03168a4174edb9f88a6889) Signed-off-by: Timothy Gu Conflicts: doc/encoders.texi --- doc/encoders.texi | 74 +++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 8958211ee4..73bd309df0 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -441,6 +441,43 @@ Enables the the encoder to use (on a frame by frame basis) either L/R stereo or mid/side stereo. @end multitable +@section libopencore-amrnb + +OpenCORE Adaptive Multi-Rate Narrowband encoder. + +Requires the presence of the libopencore-amrnb headers and library during +configuration. You need to explicitly configure the build with +@code{--enable-libopencore-amrnb --enable-version3}. + +This is a mono-only encoder. Officially it only supports 8000Hz sample rate, +but you can override it by setting @option{strict} to @samp{unofficial} or +lower. + +@subsection Options + +@table @option + +@item b +Set bitrate in bits per second. Only the following bitrates are supported, +otherwise libavcodec will round to the nearest valid bitrate. + +@table @option +@item 4750 +@item 5150 +@item 5900 +@item 6700 +@item 7400 +@item 7950 +@item 10200 +@item 12200 +@end table + +@item dtx +Allow discontinuous transmission (generate comfort noise) when set to 1. The +default value is 0 (disabled). + +@end table + @section libvo-aacenc VisualOn AAC encoder @@ -500,43 +537,6 @@ default value is 0 (disabled). @end table -@section libopencore-amrnb - -OpenCORE Adaptive Multi-Rate Narrowband encoder. - -Requires the presence of the libopencore-amrnb headers and library during -configuration. You need to explicitly configure the build with -@code{--enable-libopencore-amrnb --enable-version3}. - -This is a mono-only encoder. Officially it only supports 8000Hz sample rate, -but you can override it by setting @option{strict} to @samp{unofficial} or -lower. - -@subsection Options - -@table @option - -@item b -Set bitrate in bits per second. Only the following bitrates are supported, -otherwise libavcodec will round to the nearest valid bitrate. - -@table @option -@item 4750 -@item 5150 -@item 5900 -@item 6700 -@item 7400 -@item 7950 -@item 10200 -@item 12200 -@end table - -@item dtx -Allow discontinuous transmission (generate comfort noise) when set to 1. The -default value is 0 (disabled). - -@end table - @c man end AUDIO ENCODERS @chapter Video Encoders From 608950bc72f7e2ffee928352f81dfdacf435bd82 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Tue, 2 Jul 2013 19:32:27 -0700 Subject: [PATCH 209/257] doc/muxers: Add AIFF doc Signed-off-by: Stefano Sabatini (cherry picked from commit 4ec46b1160eb549a551823c168905b43922add31) Signed-off-by: Timothy Gu --- doc/muxers.texi | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/muxers.texi b/doc/muxers.texi index 9b4743f12e..18d95903ce 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -18,6 +18,23 @@ enabled muxers. A description of some of the currently available muxers follows. +@anchor{aiff} +@section aiff + +Audio Interchange File Format muxer. + +It accepts the following options: + +@table @option +@item write_id3v2 +Enable ID3v2 tags writing when set to 1. Default is 0 (disabled). + +@item id3v2_version +Select ID3v2 version to write. Currently only version 3 and 4 (aka. +ID3v2.3 and ID3v2.4) are supported. The default is version 4. + +@end table + @anchor{crc} @section crc From 08f5567a0cc72413c2a258d7903a202c3ecfc746 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 29 Jul 2013 19:12:10 -0700 Subject: [PATCH 210/257] doc/encoders: add libxvid doc Signed-off-by: Stefano Sabatini (cherry picked from commit 6b255e5e70c72aa59ff7aed74b4ee976223eb140) Signed-off-by: Timothy Gu Conflicts: doc/encoders.texi --- doc/encoders.texi | 113 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 73bd309df0..2cb7dea7ad 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -710,4 +710,117 @@ ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv For more information about libx264 and the supported options see: @url{http://www.videolan.org/developers/x264.html} +@section libxvid + +Xvid MPEG-4 Part 2 encoder wrapper. + +This encoder requires the presence of the libxvidcore headers and library +during configuration. You need to explicitly configure the build with +@code{--enable-libxvid --enable-gpl}. + +The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so +users can encode to this format without this library. + +@subsection Options + +The following options are supported by the libxvid wrapper. Some of +the following options are listed but are not documented, and +correspond to shared codec options. See @ref{codec-options,,the Codec +Options chapter} for their documentation. The other shared options +which are not listed have no effect for the libxvid encoder. + +@table @option +@item b + +@item g + +@item qmin + +@item qmax + +@item mpeg_quant + +@item threads + +@item bf + +@item b_qfactor + +@item b_qoffset + +@item flags +Set specific encoding flags. Possible values: + +@table @samp + +@item mv4 +Use four motion vector by macroblock. + +@item aic +Enable high quality AC prediction. + +@item gray +Only encode grayscale. + +@item gmc +Enable the use of global motion compensation (GMC). + +@item qpel +Enable quarter-pixel motion compensation. + +@item cgop +Enable closed GOP. + +@item global_header +Place global headers in extradata instead of every keyframe. + +@end table + +@item trellis + +@item me_method +Set motion estimation method. Possible values in decreasing order of +speed and increasing order of quality: + +@table @samp +@item zero +Use no motion estimation (default). + +@item phods +@item x1 +@item log +Enable advanced diamond zonal search for 16x16 blocks and half-pixel +refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for +@samp{phods}. + +@item epzs +Enable all of the things described above, plus advanced diamond zonal +search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion +estimation on chroma planes. + +@item full +Enable all of the things described above, plus extended 16x16 and 8x8 +blocks search. +@end table + +@item mbd +Set macroblock decision algorithm. Possible values in the increasing +order of quality: + +@table @samp +@item simple +Use macroblock comparing function algorithm (default). + +@item bits +Enable rate distortion-based half pixel and quarter pixel refinement for +16x16 blocks. + +@item rd +Enable all of the things described above, plus rate distortion-based +half pixel and quarter pixel refinement for 8x8 blocks, and rate +distortion-based search using square pattern. +@end table + +@end table + @c man end VIDEO ENCODERS From 0ff11fd07eb27ca7eef8e3afe63ce60dc64dcc17 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 26 Aug 2013 16:28:54 -0700 Subject: [PATCH 211/257] doc/encoders: Remove reference to "Codec Options" chapter The chapter is only presented in later release branches. (cherry picked from commit 7364109d255ff5583c9a3930830e28f5b1f0adce) Signed-off-by: Timothy Gu --- doc/encoders.texi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 2cb7dea7ad..11f2846c4a 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -725,8 +725,7 @@ users can encode to this format without this library. The following options are supported by the libxvid wrapper. Some of the following options are listed but are not documented, and -correspond to shared codec options. See @ref{codec-options,,the Codec -Options chapter} for their documentation. The other shared options +correspond to shared codec options. The other shared options which are not listed have no effect for the libxvid encoder. @table @option From e8cae38be6be5c5b258b0fd97d83e30915103685 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 12 Aug 2012 10:35:03 +0200 Subject: [PATCH 212/257] doc/texi2pod: add "use warnings" directive The script was previously run with perl -w through the shebang command. Now that the script is executed through direct perl invocation the -w in the shebang command is ignored. This patch re-enables "use warnings" whatever way the script is invoked. Idea-By: jamal (cherry picked from commit 3239382aefd0f5fa9ffd1509ccaedd59a54ec9af) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 94323be340..5e8814feff 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -1,4 +1,4 @@ -#! /usr/bin/perl -w +#! /usr/bin/perl # Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. @@ -23,6 +23,8 @@ # markup to Perl POD format. It's intended to be used to extract # something suitable for a manpage from a Texinfo document. +use warnings; + $output = 0; $skipping = 0; %sects = (); From f00e882a1f5e6a0a72f5cd8f4dd3c38d743062c9 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Wed, 24 Oct 2012 16:39:32 +0200 Subject: [PATCH 213/257] doc/texi2pod.pl: drop unnecessary rule, which was converting "\," to "," I cannot find a reason for such a rule, which was resulting in badly escaped filtergraph snippets. Fix trac ticket #1610. (cherry picked from commit ce875a613a16b06b0a561774955111f7a24d12bb) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 5e8814feff..a057651175 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -211,7 +211,6 @@ INF: while(<$inf>) { s/\@TeX\{\}/TeX/g; s/\@pounds\{\}/\#/g; s/\@minus(?:\{\})?/-/g; - s/\\,/,/g; # Now the ones that have to be replaced by special escapes # (which will be turned back into text by unmunge()) From 6469c199b4c5f1446becc9974535e68773e391ae Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sun, 11 Nov 2012 18:44:10 +0100 Subject: [PATCH 214/257] doc/texi2pod: recognize @table @command. (cherry picked from commit ee2d6fbc92e6d55dda319fa56234c5be9a476728) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index a057651175..d20fac6bf6 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -268,7 +268,7 @@ INF: while(<$inf>) { push @icstack, $ic; $endw = $1; $ic = $2; - $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env)/B/; + $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env|command)/B/; $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; From 646bcc37e627af57f81e5e9ac9bad24a6763e841 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 16 Dec 2012 20:16:43 +0100 Subject: [PATCH 215/257] doc/texi2pod: add support to @ifhtml and @ifnothtml directives With these commands it is possible to add HTML and non-HTML snippets, which will be useful for the "See Also" manual chapters. (cherry picked from commit f14e248783f45a698947a2ed6e2c82069db46bc8) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index d20fac6bf6..6702d7a542 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -150,14 +150,14 @@ INF: while(<$inf>) { # Ignore @end foo, where foo is not an operation which may # cause us to skip, if we are presently skipping. my $ended = $1; - next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/; + next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/; die "\@end $ended without \@$ended at line $.\n" unless defined $endw; die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; $endw = pop @endwstack; - if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { + if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/) { $skipping = pop @skstack; next; } elsif ($ended =~ /^(?:example|smallexample|display)$/) { @@ -190,11 +190,11 @@ INF: while(<$inf>) { next; }; - /^\@(ignore|menu|iftex)\b/ and do { + /^\@(ignore|menu|iftex|ifhtml|ifnothtml)\b/ and do { push @endwstack, $endw; push @skstack, $skipping; $endw = $1; - $skipping = 1; + $skipping = $endw !~ /ifnothtml/; next; }; From d56dd43c50b4f3f35685de87cf1ab03c751ffd98 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Mon, 17 Dec 2012 14:29:17 +0100 Subject: [PATCH 216/257] doc/texi2pod: correctly handle @url commands in the form @url{URL,...} Ignore the other arguments, which have not to be processed by the POD renderer. (cherry picked from commit 1f9855dbc1102e63fa7ce932d0edf0d545c89b09) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 6702d7a542..bf333b891b 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -365,7 +365,7 @@ sub postprocess # @uref can take one, two, or three arguments, with different # semantics each time. @url and @email are just like @uref with # one argument, for our purposes. - s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g; + s/\@(?:uref|url|email)\{([^\},]*),?[^\}]*\}/<B<$1>>/g; s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; From ae224c924ec8cfdad8a52c03cf69c8f133a2584b Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 12 Jan 2013 00:53:42 +0100 Subject: [PATCH 217/257] doc/texipod: add rule to correctly interpret @ref{ANCHOR,XREF,SECTION_NAME,...} This allows to name an internal reference in the POD/MAN output. (cherry picked from commit c499d45c6bea8d7bbbb7a819c53fe9766136bf29) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index bf333b891b..95e52f545e 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -356,6 +356,7 @@ sub postprocess s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; + s/\@ref\{(?:[^,]*,)(?:[^,]*,)([^,\}]*).*\}/$1/g; s/\@ref\{([^\}]*)\}/$1/g; s/\@noindent\s*//g; s/\@refill//g; From 6ec4cda1829e0fb10739bf78a5b2567be1d968c1 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Wed, 23 Jan 2013 11:43:37 +0100 Subject: [PATCH 218/257] doc: support multitable in texi2pod (cherry picked from commit 5ea5ffc9cee1b91eed471fff2f51d771222cf8d2) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 95e52f545e..52af39f162 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -163,7 +163,7 @@ INF: while(<$inf>) { } elsif ($ended =~ /^(?:example|smallexample|display)$/) { $shift = ""; $_ = ""; # need a paragraph break - } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) { + } elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) { $_ = "\n=back\n"; $ic = pop @icstack; } else { @@ -263,7 +263,7 @@ INF: while(<$inf>) { $endw = "enumerate"; }; - /^\@([fv]?table)\s+(\@[a-z]+)/ and do { + /^\@((?:multi|[fv])?table)\s+(\@[a-z]+)/ and do { push @endwstack, $endw; push @icstack, $ic; $endw = $1; @@ -272,6 +272,7 @@ INF: while(<$inf>) { $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; + $ic =~ s/\@(?:columnfractions)//; $_ = "\n=over 4\n"; }; @@ -282,6 +283,21 @@ INF: while(<$inf>) { $_ = ""; # need a paragraph break }; + /^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do { + my $columns = $1; + $columns =~ s/\@tab/ : /; + + $_ = "\n=item B<". $columns .">\n"; + }; + + /^\@tab\s+(.*\S)\s*$/ and $endw eq "multitable" and do { + my $columns = $1; + $columns =~ s/\@tab/ : /; + + $_ = " : ". $columns; + $section =~ s/\n+\s+$//; + }; + /^\@itemx?\s*(.+)?$/ and do { if (defined $1) { # Entity escapes prevent munging by the <> processing below. From 7231c30bff7eab8778c615c6b0c8df8d72593e36 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sat, 26 Jan 2013 15:10:55 +0100 Subject: [PATCH 219/257] doc/texi2pod: fix warnings introduced in e7e14bc69a606a6bec82efef729263cd38f122d4 The variable "$section" was replaced by "$chapter". (cherry picked from commit c0c06c1bba80c4bee162a3c40eec678ddc65571d) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 52af39f162..8e09c09125 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -295,7 +295,7 @@ INF: while(<$inf>) { $columns =~ s/\@tab/ : /; $_ = " : ". $columns; - $section =~ s/\n+\s+$//; + $chapter =~ s/\n+\s+$//; }; /^\@itemx?\s*(.+)?$/ and do { From bdeb7b6176e8f420f56e087f7a35d9e95dd7dea0 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Thu, 7 Mar 2013 01:43:39 +0100 Subject: [PATCH 220/257] doc/texi2pod: fix @ref substitution rule, disallow "}" within the fields Fix potential spurious substitution. (cherry picked from commit 9167db3829f360f241255d4240ba6b7135ab4111) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 8e09c09125..20ca764a1a 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -372,7 +372,7 @@ sub postprocess s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; - s/\@ref\{(?:[^,]*,)(?:[^,]*,)([^,\}]*).*\}/$1/g; + s/\@ref\{(?:[^,\}]*,)(?:[^,\}]*,)([^,\}]*).*\}/$1/g; s/\@ref\{([^\}]*)\}/$1/g; s/\@noindent\s*//g; s/\@refill//g; From 3726425d517be8861767d46b2d9607a21a3e119a Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Sun, 16 Dec 2012 17:45:59 +0100 Subject: [PATCH 221/257] doc/texi2pod: rework man inclusion logic Ignore @c man begin ... @c man end comments, rely on @chapter for marking the beginning of the various manual top level sections. This allows us to write markup which is not dependent on the specific texi2pod.pl implementation. This change causes a few rendering issues, which will be fixed in further patches. (cherry picked from commit ca3d786227adf20f4e19809090c980d6d1109bf8) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 57 +++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 20ca764a1a..697576c185 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -27,9 +27,9 @@ use warnings; $output = 0; $skipping = 0; -%sects = (); -@sects_sequence = (); -$section = ""; +%chapters = (); +@chapters_sequence = (); +$chapter = ""; @icstack = (); @endwstack = (); @skstack = (); @@ -116,18 +116,24 @@ INF: while(<$inf>) { die "cannot open $1: $!\n"; }; - # Look for blocks surrounded by @c man begin SECTION ... @c man end. - # This really oughta be @ifman ... @end ifman and the like, but such - # would require rev'ing all other Texinfo translators. - /^\@c\s+man\s+begin\s+([A-Za-z ]+)/ and $sect = $1, push (@sects_sequence, $sect), $output = 1, next; - /^\@c\s+man\s+end/ and do { - $sects{$sect} = "" unless exists $sects{$sect}; - $sects{$sect} .= postprocess($section); - $section = ""; - $output = 0; + /^\@chapter\s+([A-Za-z ]+)/ and do { + # close old chapter + $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); + + # start new chapter + $chapter_name = $1, push (@chapters_sequence, $chapter_name); + $chapters{$chapter_name} = "" unless exists $chapters{$chapter_name}; + $chapter = ""; + $output = 1; next; }; + /^\@bye/ and do { + # close old chapter + $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); + last INF; + }; + # handle variables /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { $defs{$1} = $2; @@ -309,7 +315,7 @@ INF: while(<$inf>) { } }; - $section .= $shift.$_."\n"; + $chapter .= $shift.$_."\n"; } # End of current file. close($inf); @@ -318,16 +324,15 @@ $inf = pop @instack; die "No filename or title\n" unless defined $fn && defined $tl; -$sects{NAME} = "$fn \- $tl\n"; -$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; +$chapters{NAME} = "$fn \- $tl\n"; +$chapters{FOOTNOTES} .= "=back\n" if exists $chapters{FOOTNOTES}; -unshift @sects_sequence, "NAME"; -for $sect (@sects_sequence) { - if(exists $sects{$sect}) { - $head = $sect; - $head =~ s/SEEALSO/SEE ALSO/; +unshift @chapters_sequence, "NAME"; +for $chapter (@chapters_sequence) { + if (exists $chapters{$chapter}) { + $head = uc($chapter); print "=head1 $head\n\n"; - print scalar unmunge ($sects{$sect}); + print scalar unmunge ($chapters{$chapter}); print "\n"; } } @@ -426,13 +431,13 @@ sub unmunge sub add_footnote { - unless (exists $sects{FOOTNOTES}) { - $sects{FOOTNOTES} = "\n=over 4\n\n"; + unless (exists $chapters{FOOTNOTES}) { + $chapters{FOOTNOTES} = "\n=over 4\n\n"; } - $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; - $sects{FOOTNOTES} .= $_[0]; - $sects{FOOTNOTES} .= "\n\n"; + $chapters{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; + $chapters{FOOTNOTES} .= $_[0]; + $chapters{FOOTNOTES} .= "\n\n"; } # stolen from Symbol.pm From 4f74cb93346589b0d0364d4289c45e6ae33423b5 Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 19 Mar 2013 20:34:42 +0100 Subject: [PATCH 222/257] doc/texi2pod.pl: skip printing chapter names if they are disabled (cherry picked from commit c838701ce4515bd51f7827be0b20f256ba5c69f3) Signed-off-by: Timothy Gu --- doc/texi2pod.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl index 697576c185..610f349afb 100755 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -121,7 +121,7 @@ INF: while(<$inf>) { $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); # start new chapter - $chapter_name = $1, push (@chapters_sequence, $chapter_name); + $chapter_name = $1, push (@chapters_sequence, $chapter_name) unless $skipping; $chapters{$chapter_name} = "" unless exists $chapters{$chapter_name}; $chapter = ""; $output = 1; From 6fd54e4f2ec08a4065563b25248ad56ba7680015 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 28 Aug 2013 01:43:36 +0200 Subject: [PATCH 223/257] update for 0.11.4 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index e6dfc9bb51..e3347738b2 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.11.3 +PROJECT_NUMBER = 0.11.4 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 1a96df19c0..35ad34429b 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.11.3 +0.11.4 diff --git a/VERSION b/VERSION index 1a96df19c0..35ad34429b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.3 +0.11.4 From 2d945ac68f7a515b1bdf77e2766ff398d843bbe6 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 30 Aug 2013 23:14:32 +0200 Subject: [PATCH 224/257] avcodec/pngdsp: fix (un)signed type in end comparission Fixes out of array accesses Fixes Ticket2919 Found_by: ami_stuff Signed-off-by: Michael Niedermayer (cherry picked from commit 86736f59d6a527d8bc807d09b93f971c0fe0bb07) --- libavcodec/pngdsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdsp.c b/libavcodec/pngdsp.c index 75ec996ca1..eb8c6b23eb 100644 --- a/libavcodec/pngdsp.c +++ b/libavcodec/pngdsp.c @@ -30,7 +30,7 @@ static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w) { long i; - for (i = 0; i <= w - sizeof(long); i += sizeof(long)) { + for (i = 0; i <= w - (int)sizeof(long); i += sizeof(long)) { long a = *(long *)(src1 + i); long b = *(long *)(src2 + i); *(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80); From d3ef17740d930ba114deffac93d2eef898f3e77f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 31 Aug 2013 03:08:25 +0200 Subject: [PATCH 225/257] avformat/avidec: match first index and first packet size=0 handling Fixes Ticket2861 Signed-off-by: Michael Niedermayer (cherry picked from commit 227a0eb5a92409572f2cecde6137529b83e7d495) Conflicts: libavformat/avidec.c --- libavformat/avidec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 6120aa4e1b..130defd97f 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -1288,7 +1288,7 @@ static int avi_read_idx1(AVFormatContext *s, int size) st = s->streams[index]; ast = st->priv_data; - if(first_packet && first_packet_pos && len) { + if (first_packet && first_packet_pos) { data_offset = first_packet_pos - pos; first_packet = 0; } From a5ef62ede16a3245507f3d596faa45c775603052 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Mon, 2 Sep 2013 08:32:24 +0200 Subject: [PATCH 226/257] Avoid a deadlock when decoding wma. Fixes ticket #2925. (cherry picked from commit ec8a4841f7e81040f9a2757f23e70dff5e6b33a4) --- libavcodec/wmadec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index f26a1433a9..329150d4d7 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -529,6 +529,10 @@ static int wma_decode_block(WMACodecContext *s) coef escape coding */ total_gain = 1; for(;;) { + if (get_bits_left(&s->gb) < 7) { + av_log(s->avctx, AV_LOG_ERROR, "total_gain overread\n"); + return AVERROR_INVALIDDATA; + } a = get_bits(&s->gb, 7); total_gain += a; if (a != 127) From 5df35d9a21d55e69126757ad32df88764d4f27f0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 9 Oct 2013 21:43:06 +0200 Subject: [PATCH 227/257] avformat/wavdec: Dont trust the fact chunk for PCM Fixes Ticket3033 Signed-off-by: Michael Niedermayer (cherry picked from commit 83fc6c822b06688e572333299927d93eb3c6c426) Conflicts: libavformat/wav.c (cherry picked from commit 89b5f5f494a2387541de8960839c2539a73a31fa) --- libavformat/wav.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libavformat/wav.c b/libavformat/wav.c index 5bd76a95bc..08637f736e 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -532,8 +532,15 @@ break_loop: avio_seek(pb, data_ofs, SEEK_SET); - if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id)) - sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); + if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0) + if ( st->codec->channels + && data_size + && av_get_bits_per_sample(st->codec->codec_id) + && wav->data_end <= avio_size(pb)) + sample_count = (data_size << 3) + / + (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); + if (sample_count) st->duration = sample_count; From 87f719a03f23dd16c55bf7c60d3ef848936885c0 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 9 Oct 2013 23:52:54 +0200 Subject: [PATCH 228/257] avcodec/h264_refs: modify key frame detection heuristic to detect more cases Fixes Ticket2968 Signed-off-by: Michael Niedermayer (cherry picked from commit 5ac6b6028f17b64723884c9fa72cfcbd369a1ba2) Conflicts: libavcodec/h264_refs.c (cherry picked from commit 6636dd551fda4fac77f2caa25d24d81abcadcd71) --- libavcodec/h264_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index a94ef1a536..f39e69a271 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -656,7 +656,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ print_short_term(h); print_long_term(h); - if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (s->picture_structure != PICT_FRAME) && s->current_picture_ptr->f.pict_type == AV_PICTURE_TYPE_I){ + if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=2 + (s->picture_structure != PICT_FRAME) && s->current_picture_ptr->f.pict_type == AV_PICTURE_TYPE_I){ s->current_picture_ptr->sync |= 1; if(!h->s.avctx->has_b_frames) h->sync = 2; From 43af9624fe11b89c02fa67e6993ba7b5f68d35c1 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 4 Oct 2013 17:39:19 +0200 Subject: [PATCH 229/257] avformat/mov: force parsing of headers if stts is absent Fixes Ticket2991 Signed-off-by: Michael Niedermayer (cherry picked from commit e41ea866fc26f38d770bbc1ad67703e7f4400ae1) --- libavformat/mov.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 5a93b12650..e45c73628e 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1660,6 +1660,8 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!entries) { sc->keyframe_absent = 1; + if (!st->need_parsing) + st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } if (entries >= UINT_MAX / sizeof(int)) From d49761b396435282f0c823cee7e51550f8f8f921 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 25 Oct 2013 20:03:29 +0200 Subject: [PATCH 230/257] avcodec/h264: reduce noisiness of "mmco: unref short failure" Do not consider it an error if we have no frames and should discard one. This condition can easily happen when decoding is started from an I frame Fixes Ticket2811 Signed-off-by: Michael Niedermayer (cherry picked from commit 08a89761964bdd0a023eff6d37a1131fb7e1d7a0) Conflicts: libavcodec/h264_refs.c --- libavcodec/h264_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index f39e69a271..a12647db11 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -519,7 +519,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){ if(!pic){ if(mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg] || h->long_ref[mmco[i].long_arg]->frame_num != frame_num) { - av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short failure\n"); + av_log(h->s.avctx, h->short_ref_count ? AV_LOG_ERROR : AV_LOG_DEBUG, "mmco: unref short failure\n"); err = AVERROR_INVALIDDATA; } continue; From b89e5b138f01a0b051c32fe327c22b3e33192639 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 27 Oct 2013 01:03:19 +0200 Subject: [PATCH 231/257] avformat/utils: do not override pts in h264 when they are provided from the demuxer Fixes Ticket2143 Signed-off-by: Michael Niedermayer (cherry picked from commit 1e5271a9fd6ddcceb083f2185a4bbd8d44c9a813) --- libavformat/utils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 576f4aa708..7ed30ee715 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1049,12 +1049,14 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, if (pkt->dts != AV_NOPTS_VALUE) { // got DTS from the stream, update reference timestamp st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den; - pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; } else if (st->reference_dts != AV_NOPTS_VALUE) { // compute DTS based on reference timestamp pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den; - pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; } + + if (st->reference_dts != AV_NOPTS_VALUE && pkt->pts == AV_NOPTS_VALUE) + pkt->pts = pkt->dts + pc->pts_dts_delta * num / den; + if (pc->dts_sync_point > 0) st->reference_dts = pkt->dts; // new reference } From 929100ae989c67b8b35962733657b2ac1fb34960 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 5 Dec 2013 01:41:10 +0100 Subject: [PATCH 232/257] avcodec/cabac: force get_cabac to be not inlined works around bug in gccs inline asm register assignment Fixes Ticket3177 gcc from 4.4 to 4.6 is affected at least, no non affected gccs known clang seems not affected Signed-off-by: Michael Niedermayer (cherry picked from commit 0538b29ae8002c44f27bae8a1a6fc6e646998be5) --- libavcodec/cabac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c index 14ef30a758..ba59dab5f9 100644 --- a/libavcodec/cabac.c +++ b/libavcodec/cabac.c @@ -305,7 +305,7 @@ STOP_TIMER("get_cabac_bypass") for(i=0; i Date: Fri, 20 Dec 2013 15:02:35 +0200 Subject: [PATCH 233/257] arm: Don't clobber callee saved registers in scalarproduct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit q4-q7/d8-d15 are supposed to not be clobbered by the callee. CC: libav-stable@libav.org Signed-off-by: Martin Storsjö (cherry picked from commit d307e408d4a9ada22df443cc38be77cc5e492694) --- libavcodec/arm/int_neon.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavcodec/arm/int_neon.S b/libavcodec/arm/int_neon.S index 311c99d95e..d224783dbf 100644 --- a/libavcodec/arm/int_neon.S +++ b/libavcodec/arm/int_neon.S @@ -42,10 +42,10 @@ function ff_scalarproduct_int16_neon, export=1 vpadd.s32 d16, d0, d1 vpadd.s32 d17, d2, d3 - vpadd.s32 d10, d4, d5 - vpadd.s32 d11, d6, d7 + vpadd.s32 d18, d4, d5 + vpadd.s32 d19, d6, d7 vpadd.s32 d0, d16, d17 - vpadd.s32 d1, d10, d11 + vpadd.s32 d1, d18, d19 vpadd.s32 d2, d0, d1 vpaddl.s32 d3, d2 vmov.32 r0, d3[0] @@ -82,10 +82,10 @@ function ff_scalarproduct_and_madd_int16_neon, export=1 vpadd.s32 d16, d0, d1 vpadd.s32 d17, d2, d3 - vpadd.s32 d10, d4, d5 - vpadd.s32 d11, d6, d7 + vpadd.s32 d18, d4, d5 + vpadd.s32 d19, d6, d7 vpadd.s32 d0, d16, d17 - vpadd.s32 d1, d10, d11 + vpadd.s32 d1, d18, d19 vpadd.s32 d2, d0, d1 vpaddl.s32 d3, d2 vmov.32 r0, d3[0] From 2a45007f3408176a7578fb3896a560b5fc4c2a96 Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Sun, 23 Feb 2014 16:39:18 -0800 Subject: [PATCH 234/257] configure: use pkg-config to detect libbluray The current configure fails when static libbluray is compiled with libxml2 support. Signed-off-by: Timothy Gu Signed-off-by: Michael Niedermayer (cherry picked from commit baa650cc7946a9eb1cf5a083f61a581a97122f03) Signed-off-by: Timothy Gu Conflicts: configure --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 6585e46134..66112bf378 100755 --- a/configure +++ b/configure @@ -3212,7 +3212,7 @@ enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus enabled libass && require_pkg_config libass ass/ass.h ass_library_init -enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray +enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || die "ERROR: libcelt version must be >= 0.11.0."; } From fdf57ad2ff749fbea0fce24e16e27ac87eb834cd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 30 Aug 2013 23:40:47 +0200 Subject: [PATCH 235/257] avcodec/dsputil: fix signedness in sizeof() comparissions Signed-off-by: Michael Niedermayer (cherry picked from commit 454a11a1c9c686c78aa97954306fb63453299760) Signed-off-by: Michael Niedermayer --- libavcodec/dsputil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index bbcf761552..a13540d2bb 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -1909,7 +1909,7 @@ void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){ static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ long i; - for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ + for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){ long a = *(long*)(src+i); long b = *(long*)(dst+i); *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); @@ -1934,7 +1934,7 @@ static void diff_bytes_c(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, } }else #endif - for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ + for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){ long a = *(long*)(src1+i); long b = *(long*)(src2+i); *(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80); From ceff07dfb94af00233979ccd1cf6587b91a44d5f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 2 Sep 2013 04:32:23 +0200 Subject: [PATCH 236/257] avfilter/vf_fps: make sure the fifo is not empty before using it Fixes Ticket2905 Signed-off-by: Michael Niedermayer (cherry picked from commit cdd5df8189ff1537f7abe8defe971f80602cc2d2) Conflicts: libavfilter/vf_fps.c --- libavfilter/vf_fps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c index d12070c49a..1be055b6b4 100644 --- a/libavfilter/vf_fps.c +++ b/libavfilter/vf_fps.c @@ -193,7 +193,7 @@ static void end_frame(AVFilterLink *inlink) } /* now wait for the next timestamp */ - if (buf->pts == AV_NOPTS_VALUE) { + if (buf->pts == AV_NOPTS_VALUE || av_fifo_size(s->fifo) <= 0) { write_to_fifo(s->fifo, buf); return; } From 66fcda7e7043d227b3d3c73fbbb0b6688d3d8927 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 5 Sep 2013 00:36:44 +0200 Subject: [PATCH 237/257] avcodec/mjpegdec: Add some sanity checks to ljpeg_decode_rgb_scan() These prevent the rgb ljpeg code from being run on parameters that it doesnt support. No testcase available but it seems possible to trigger these. Signed-off-by: Michael Niedermayer (cherry picked from commit 61c68000eda643dfce96dc46b488d39fd5c4e309) Signed-off-by: Michael Niedermayer --- libavcodec/mjpegdec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index a2fe7e39c1..38a05a8f9d 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -719,6 +719,12 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p int resync_mb_y = 0; int resync_mb_x = 0; + if (s->nb_components != 3 && s->nb_components != 4) + return AVERROR_INVALIDDATA; + if (s->v_max != 1 || s->h_max != 1 || !s->lossless) + return AVERROR_INVALIDDATA; + + s->restart_count = s->restart_interval; av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size, From ec39abcd37022472b49abead9d2a87c7678a6ceb Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 8 Sep 2013 20:27:54 +0200 Subject: [PATCH 238/257] avcodec/truemotion2: Fix av_freep arguments Fixes null pointer dereference Fixes Ticket2944 Signed-off-by: Michael Niedermayer (cherry picked from commit c54aa2fb0f869ec025933944cbd1634fffe95d09) Conflicts: libavcodec/truemotion2.c Signed-off-by: Michael Niedermayer --- libavcodec/truemotion2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index f5222d8b8a..d7b28d6c38 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -922,14 +922,14 @@ static av_cold int decode_init(AVCodecContext *avctx){ if (!l->Y1_base || !l->Y2_base || !l->U1_base || !l->V1_base || !l->U2_base || !l->V2_base || !l->last || !l->clast) { - av_freep(l->Y1_base); - av_freep(l->Y2_base); - av_freep(l->U1_base); - av_freep(l->U2_base); - av_freep(l->V1_base); - av_freep(l->V2_base); - av_freep(l->last); - av_freep(l->clast); + av_freep(&l->Y1_base); + av_freep(&l->Y2_base); + av_freep(&l->U1_base); + av_freep(&l->U2_base); + av_freep(&l->V1_base); + av_freep(&l->V2_base); + av_freep(&l->last); + av_freep(&l->clast); return AVERROR(ENOMEM); } l->Y1 = l->Y1_base + l->y_stride * 4 + 4; From b650d5376c82e5db8f76809417a601e485991487 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 9 Sep 2013 17:58:18 +0200 Subject: [PATCH 239/257] avcodec/ffv1enc: update buffer check for 16bps Signed-off-by: Michael Niedermayer (cherry picked from commit 3728603f1854b5c79d1a64dd3b41b80640ef1e7f) Conflicts: libavcodec/ffv1enc.c (cherry picked from commit c900c6e5c26cd86cf34f9c8d4347cedbd01f3935) --- libavcodec/ffv1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c index 46293524fb..753e961428 100644 --- a/libavcodec/ffv1.c +++ b/libavcodec/ffv1.c @@ -467,7 +467,7 @@ static av_always_inline int encode_line(FFV1Context *s, int w, int run_mode=0; if(s->ac){ - if(c->bytestream_end - c->bytestream < w*20){ + if(c->bytestream_end - c->bytestream < w*35){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } From 2289bffa312dc3589efbdf44a0a5f1a26a5b709f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 26 Sep 2013 21:03:48 +0200 Subject: [PATCH 240/257] avcodec/parser: reset indexes on realloc failure Fixes Ticket2982 Signed-off-by: Michael Niedermayer (cherry picked from commit f31011e9abfb2ae75bb32bc44e2c34194c8dc40a) Signed-off-by: Michael Niedermayer --- libavcodec/parser.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libavcodec/parser.c b/libavcodec/parser.c index 58be89f349..9e4d3e6a90 100644 --- a/libavcodec/parser.c +++ b/libavcodec/parser.c @@ -241,8 +241,10 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s if(next == END_NOT_FOUND){ void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); - if(!new_buffer) + if(!new_buffer) { + pc->index = 0; return AVERROR(ENOMEM); + } pc->buffer = new_buffer; memcpy(&pc->buffer[pc->index], *buf, *buf_size); pc->index += *buf_size; @@ -255,9 +257,11 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s /* append to buffer */ if(pc->index){ void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); - - if(!new_buffer) + if(!new_buffer) { + pc->overread_index = + pc->index = 0; return AVERROR(ENOMEM); + } pc->buffer = new_buffer; memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE ); pc->index = 0; From 3b03778d35783c2eefdba90b433f87212b83ed15 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 21 Oct 2013 16:21:14 +0200 Subject: [PATCH 241/257] avfilter/ff_insert_pad: fix order of operations Fixes out of bounds access Fixes CID732170 Fixes CID732169 No filter is known to use this function in a way so the issue can be reproduced. Signed-off-by: Michael Niedermayer (cherry picked from commit ab2bfb85d49b2f8aa505816f93e75fd18ad0a361) Conflicts: libavfilter/avfilter.c (cherry picked from commit 86591b244f3a27293153896813f5569b49b2f5c0) Conflicts: libavfilter/avfilter.c (cherry picked from commit 400c4f8fa3fd58951dc3f356b2b00484e3363694) Signed-off-by: Michael Niedermayer --- libavfilter/avfilter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index 9473c355fe..e31a88ad6e 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -72,9 +72,9 @@ void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off, (*links)[idx] = NULL; (*count)++; - for (i = idx+1; i < *count; i++) - if (*links[i]) - (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++; + for (i = idx + 1; i < *count; i++) + if ((*links)[i]) + (*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++; } int avfilter_link(AVFilterContext *src, unsigned srcpad, From 82746c468b1079ac7166518fe65181c9e1c39ff7 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 19 Oct 2013 17:45:54 +0200 Subject: [PATCH 242/257] avcodec/avpacket/av_packet_split_side_data: ensure that side data padding is initialized Signed-off-by: Michael Niedermayer (cherry picked from commit 240fd8c96f59ebe9dcfc4152a1086cd3f63400c0) Signed-off-by: Michael Niedermayer (cherry picked from commit 1e48318802b3caa493a40c0584afc30cc866d9d0) Signed-off-by: Michael Niedermayer --- libavcodec/avpacket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 612f02d9ed..69ee3f65ab 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -274,7 +274,7 @@ int av_packet_split_side_data(AVPacket *pkt){ for (i=0; ; i++){ size= AV_RB32(p); av_assert0(size<=INT_MAX && p - pkt->data >= size); - pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); + pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); pkt->side_data[i].size = size; pkt->side_data[i].type = p[4]&127; if (!pkt->side_data[i].data) From 683c92adde01a0e4e13d7419a81a151687523d92 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 20 Oct 2013 18:38:48 +0200 Subject: [PATCH 243/257] avutil/opt: initialize ret Fixes CID1108610 Fixes use of uninitialized variable Signed-off-by: Michael Niedermayer (cherry picked from commit 2d8ccf0adcae09cb9e14b01cfe20e4d77c3bbf5d) Signed-off-by: Michael Niedermayer --- libavutil/opt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavutil/opt.c b/libavutil/opt.c index 3f4a5fe957..197b61c8fe 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -225,7 +225,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons int av_opt_set(void *obj, const char *name, const char *val, int search_flags) { - int ret; + int ret = 0; void *dst, *target_obj; const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); if (!o || !target_obj) From 84c84204b31287a6d3d911b564609cfaf29047b9 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 30 Oct 2013 23:27:28 +0100 Subject: [PATCH 244/257] avcodec/jpeglsdec: check err value for ls_get_code_runterm() Fixes infinite loop Fixes Ticket3086 Signed-off-by: Michael Niedermayer (cherry picked from commit cc0e47b55096361723b364afa43b79a3f5619cdc) Signed-off-by: Michael Niedermayer --- libavcodec/jpeglsdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c index e0f6e88aa6..cff0d499d2 100644 --- a/libavcodec/jpeglsdec.c +++ b/libavcodec/jpeglsdec.c @@ -142,6 +142,8 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI ret = ret >> 1; } + if(FFABS(ret) > 0xFFFF) + return -0x10000; /* update state */ state->A[Q] += FFABS(ret) - RItype; ret *= state->twonear; From 3bcf733b5a9cdb251b8c9892469890ae1bdeac10 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 16 Jan 2014 02:53:32 +0100 Subject: [PATCH 245/257] cmdutils: update year Signed-off-by: Michael Niedermayer --- cmdutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdutils.c b/cmdutils.c index c5f621a9b1..9afb54cf22 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -59,7 +59,7 @@ struct SwsContext *sws_opts; SwrContext *swr_opts; AVDictionary *format_opts, *codec_opts; -const int this_year = 2013; +const int this_year = 2014; static FILE *report_file; From 912b7fe922bcc12c9a953371c304ac39a0629df2 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 17 Jan 2014 20:09:48 +0100 Subject: [PATCH 246/257] dnxhdenc: fix mb_rc size Fixes out of array access with RC_VARIANCE set to 0 Signed-off-by: Michael Niedermayer (cherry picked from commit f1caaa1c61310beba705957e6366f0392a0b005b) Signed-off-by: Michael Niedermayer --- libavcodec/dnxhdenc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c index 646d15166f..d7f3929aed 100644 --- a/libavcodec/dnxhdenc.c +++ b/libavcodec/dnxhdenc.c @@ -222,7 +222,7 @@ static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias) static int dnxhd_init_rc(DNXHDEncContext *ctx) { - FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail); + FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*(ctx->m.avctx->qmax + 1)*sizeof(RCEntry), fail); if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail); From c598a46821f001fe73b69a59432716ad84e68cf5 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 20 Jan 2014 18:08:18 +0100 Subject: [PATCH 247/257] avcodec/vmnc: Check that rectangles are within the picture Prevents out of array accesses with CODEC_FLAG_EMU_EDGE Signed-off-by: Michael Niedermayer (cherry picked from commit 6ba02602aa7fc7d38db582e75b8b093fb3c1608d) Conflicts: libavcodec/vmnc.c Signed-off-by: Michael Niedermayer (cherry picked from commit 7c17207ab9acfaa934e8feb8fba90765c9d0b989) Signed-off-by: Michael Niedermayer --- libavcodec/vmnc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index 5eb8372ed3..4e58d59510 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -275,6 +275,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int } xy = *src++; wh = *src++; + if ( (xy >> 4) + (wh >> 4) + 1 > w - i + || (xy & 0xF) + (wh & 0xF)+1 > h - j) { + av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n"); + return AVERROR_INVALIDDATA; + } paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride); } } From b66a0dce117a89db304b82dc2498c9a70c7dcecd Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 1 Feb 2014 19:04:37 +0100 Subject: [PATCH 248/257] avcodec/vc1: reset fcm/field_mode in non advanced header parsing Fixes NULL pointer dereference Fixes: signal_sigsegv_1ab8bf4_2847_cov_4254117347_SA10091.vc1 Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit b51e9354772de446e8196dabf9aad1567b22f74d) Signed-off-by: Michael Niedermayer --- libavcodec/vc1.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c index 95ac93c7ee..0120b8e231 100644 --- a/libavcodec/vc1.c +++ b/libavcodec/vc1.c @@ -580,6 +580,8 @@ int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext* gb) { int pqindex, lowquant, status; + v->field_mode = 0; + v->fcm = 0; if (v->finterpflag) v->interpfrm = get_bits1(gb); skip_bits(gb, 2); //framecnt unused From 236b7b16ebcc2d9280336e7b02972e3c7de982e2 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 30 Jan 2014 14:08:38 -0500 Subject: [PATCH 249/257] samplefmt: avoid integer overflow in av_samples_get_buffer_size() CC:libav-stable@libav.org (cherry picked from commit 0e830094ad0dc251613a0aa3234d9c5c397e02e6) Signed-off-by: Michael Niedermayer --- libavutil/samplefmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index ae192ff3d4..3c3a0e6fb1 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -134,6 +134,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, /* auto-select alignment if not specified */ if (!align) { + if (nb_samples > INT_MAX - 31) + return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } From c23597ec7eaea16a638729c60866befcd48eda3e Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 7 Feb 2014 15:07:23 +0100 Subject: [PATCH 250/257] avcodec/wmalosslessdec: fix mclms_coeffs* array size Fixes corruption of context Fixes: 8835659dde6a4f7dcdf341de6a45c6c8-signal_sigsegv_1dce67b_4564_cov_2504444599_classical_22_16_1_14000_v3c_0_extend_0_29.wma Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit ec9578d54d09b64bf112c2bf7a34b1ef3b93dbd3) Signed-off-by: Michael Niedermayer --- libavcodec/wmalosslessdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index dabd093bf4..4966018831 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -125,8 +125,8 @@ typedef struct WmallDecodeCtx { int8_t mclms_order; int8_t mclms_scaling; - int16_t mclms_coeffs[128]; - int16_t mclms_coeffs_cur[4]; + int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32]; + int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS]; int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32]; int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32]; int mclms_recent; From 12770701856a05b6b3cd706f708f8e9a4e8a1336 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 13 Feb 2014 13:59:51 +0100 Subject: [PATCH 251/257] avformat/mpegtsenc: Check data array size in mpegts_write_pmt() Prevents out of array writes Signed-off-by: Michael Niedermayer (cherry picked from commit 842b6c14bcfc1c5da1a2d288fd65386eb8c158ad) Conflicts: libavformat/mpegtsenc.c (cherry picked from commit e87de3f50b765134588d0b048c32ed4b8acc16fb) Signed-off-by: Michael Niedermayer --- libavformat/mpegtsenc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 793e2051d4..a12d19fd10 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -240,7 +240,7 @@ static void mpegts_write_pat(AVFormatContext *s) data, q - data); } -static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) +static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) { // MpegTSWrite *ts = s->priv_data; uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr; @@ -293,6 +293,10 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) stream_type = STREAM_TYPE_PRIVATE_DATA; break; } + + if (q - data > sizeof(data) - 32) + return AVERROR(EINVAL); + *q++ = stream_type; put16(&q, 0xe000 | ts_st->pid); desc_length_ptr = q; @@ -324,7 +328,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) len_ptr = q++; *len_ptr = 0; - for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) { + for (p = lang->value; next && *len_ptr < 255 / 4 * 4 && q - data < sizeof(data) - 4; p = next + 1) { next = strchr(p, ','); if (strlen(p) != 3 && (!next || next != p + 3)) continue; /* not a 3-letter code */ @@ -386,6 +390,7 @@ static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service) } mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0, data, q - data); + return 0; } /* NOTE: str == NULL is accepted for an empty string */ From 3a893335bde2d4ba2fcd839df09afb2b95779856 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 16 Feb 2014 23:08:52 +0100 Subject: [PATCH 252/257] avcodec/msrle: use av_image_get_linesize() to calculate the linesize Fixes out of array access Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit c919e1ca2ecfc47d796382973ba0e48b8f6f92a2) Conflicts: libavcodec/msrle.c (cherry picked from commit bc1c8ec5e65098fd2ccd8456f667151dfc9cda42) Signed-off-by: Michael Niedermayer --- libavcodec/msrle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 0c54f9af5e..4cbb6ea10d 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -35,6 +35,7 @@ #include "avcodec.h" #include "dsputil.h" #include "msrledec.h" +#include "libavutil/imgutils.h" typedef struct MsrleContext { AVCodecContext *avctx; @@ -108,7 +109,7 @@ static int msrle_decode_frame(AVCodecContext *avctx, /* FIXME how to correctly detect RLE ??? */ if (avctx->height * istride == avpkt->size) { /* assume uncompressed */ - int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8; + int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0); uint8_t *ptr = s->frame.data[0]; uint8_t *buf = avpkt->data + (avctx->height-1)*istride; int i, j; From bc07ec7b2f97377c84be046d4e5b057b39486a95 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 18 Feb 2014 02:53:14 +0100 Subject: [PATCH 253/257] avcodec/snow: split block clipping checks Fixes out of array read Fixes: d4476f68ca1c1c57afbc45806f581963-asan_heap-oob_2266b27_8607_cov_4044577381_snow_chroma_bug.avi Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer (cherry picked from commit 61d59703c91869f4e5cdacd8d6be52f8b89d4ba4) Signed-off-by: Michael Niedermayer --- libavcodec/snow.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/snow.h b/libavcodec/snow.h index 32f116d34d..f312c2cd18 100644 --- a/libavcodec/snow.h +++ b/libavcodec/snow.h @@ -309,7 +309,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer if(!sliced && !offset_dst) dst -= src_x; src_x=0; - }else if(src_x + b_w > w){ + } + if(src_x + b_w > w){ b_w = w - src_x; } if(src_y<0){ @@ -318,7 +319,8 @@ static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer if(!sliced && !offset_dst) dst -= src_y*dst_stride; src_y=0; - }else if(src_y + b_h> h){ + } + if(src_y + b_h> h){ b_h = h - src_y; } From aa1fdf1a6457331d5c0e737a8680e69fe0fc0439 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 10 Mar 2014 15:14:44 +0100 Subject: [PATCH 254/257] update for 0.11.5 Signed-off-by: Michael Niedermayer --- Doxyfile | 2 +- RELEASE | 2 +- VERSION | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doxyfile b/Doxyfile index e3347738b2..5b4f19312e 100644 --- a/Doxyfile +++ b/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.11.4 +PROJECT_NUMBER = 0.11.5 # With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/RELEASE b/RELEASE index 35ad34429b..62d5dbdf3c 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -0.11.4 +0.11.5 diff --git a/VERSION b/VERSION index 35ad34429b..62d5dbdf3c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.4 +0.11.5 From 12bf790b850b817e2ac182f70f98276804bb97a4 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 4 Nov 2013 16:22:27 +0100 Subject: [PATCH 255/257] avformat/mov: only force parsing for video tracks if stss is empty Fixes playback of some AAC streams, which are otherwise mangled by the parser, and stss is typically only valid for video anyway. Fixes a regression since e41ea866. Signed-off-by: Michael Niedermayer (cherry picked from commit 019247bdc326a90bf20d3ce5d2413cc642e8bb08) --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index e45c73628e..5534629dd7 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1660,7 +1660,7 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!entries) { sc->keyframe_absent = 1; - if (!st->need_parsing) + if (!st->need_parsing && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) st->need_parsing = AVSTREAM_PARSE_HEADERS; return 0; } From 7a56695ced39dc6ef2db9e78a76792172e39068a Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Wed, 12 Feb 2014 06:32:51 +0100 Subject: [PATCH 256/257] avformat/mov: fix keyframe flags for sample from chromium Issue 340865 Fixes ticket #3362. Signed-off-by: Michael Niedermayer (cherry picked from commit a0911b059763b8f13c70adcbbe71e10382855104) Conflicts: libavformat/mov.c --- libavformat/mov.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 5534629dd7..df83a64a23 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1927,6 +1927,10 @@ static void mov_build_index(MOVContext *mov, AVStream *st) if (stps_index + 1 < sc->stps_count) stps_index++; } + if (sc->keyframe_absent + && !sc->stps_count + && st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + keyframe = 1; if (keyframe) distance = 0; sample_size = sc->alt_sample_size > 0 ? sc->alt_sample_size : sc->sample_sizes[current_sample]; From d3a1bf3579bc270a8a4ecfa8f834d14338a70f3d Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Fri, 31 Jul 2015 15:54:38 +0200 Subject: [PATCH 257/257] MAINTAINERS: Remove myself as leader Signed-off-by: Michael Niedermayer (cherry picked from commit f2c58931e629343f7d68258cc2b2d62c5f501ba5) Signed-off-by: Michael Niedermayer --- MAINTAINERS | 1 - 1 file changed, 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index b8a6c60f8d..a7af59858d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14,7 +14,6 @@ and related discussions. Project Leader ============== -Michael Niedermayer final design decisions