From 7de0fefeb5b391173fabf65e6e96bb7729b58ceb Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 29 Mar 2015 05:14:48 +0200 Subject: [PATCH 1/3] lavf/gif: Add an option max_gif_delay to limit the frame duration. Allows playback for the sample from ticket #4369 in less than 18 hours. --- doc/demuxers.texi | 5 +++++ libavformat/gifdec.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 11dfe1b9c1..3f7c45e843 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -205,6 +205,11 @@ It accepts the following options: Set the minimum valid delay between frames in hundredths of seconds. Range is 0 to 6000. Default value is 2. +@item max_gif_delay +Set the maximum valid delay between frames in hundredth of seconds. +Range is 0 to 65535. Default value is 65535 (nearly eleven minutes), +the maximum value allowed by the specification. + @item default_delay Set the default delay between frames in hundredths of seconds. Range is 0 to 6000. Default value is 10. diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c index 7db5a27408..bb4c6ec6e6 100644 --- a/libavformat/gifdec.c +++ b/libavformat/gifdec.c @@ -43,6 +43,7 @@ typedef struct GIFDemuxContext { * invalid and set to value of default_delay. */ int min_delay; + int max_delay; int default_delay; /** @@ -159,6 +160,7 @@ static int gif_read_ext(AVFormatContext *s) if (gdc->delay < gdc->min_delay) gdc->delay = gdc->default_delay; + gdc->delay = FFMIN(gdc->delay, gdc->max_delay); /* skip the rest of the Graphic Control Extension block */ if ((ret = avio_skip(pb, sb_size - 3)) < 0 ) @@ -309,6 +311,7 @@ resync: static const AVOption options[] = { { "min_delay" , "minimum valid delay between frames (in hundredths of second)", offsetof(GIFDemuxContext, min_delay) , AV_OPT_TYPE_INT, {.i64 = GIF_MIN_DELAY} , 0, 100 * 60, AV_OPT_FLAG_DECODING_PARAM }, + { "max_gif_delay", "maximum valid delay between frames (in hundredths of seconds)", offsetof(GIFDemuxContext, max_delay) , AV_OPT_TYPE_INT, {.i64 = 65535} , 0, 65535 , AV_OPT_FLAG_DECODING_PARAM }, { "default_delay", "default delay between frames (in hundredths of second)" , offsetof(GIFDemuxContext, default_delay), AV_OPT_TYPE_INT, {.i64 = GIF_DEFAULT_DELAY}, 0, 100 * 60, AV_OPT_FLAG_DECODING_PARAM }, { "ignore_loop" , "ignore loop setting (netscape extension)" , offsetof(GIFDemuxContext, ignore_loop) , AV_OPT_TYPE_INT, {.i64 = 1} , 0, 1, AV_OPT_FLAG_DECODING_PARAM }, { NULL }, From d371471c59ba1d5bbd6f1450d9d916cab6967138 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 29 Mar 2015 12:34:13 +0200 Subject: [PATCH 2/3] Fix make checkheaders if libmfx is not available. --- libavcodec/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 91a40ad049..889ed5d616 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -869,7 +869,7 @@ SKIPHEADERS += %_tablegen.h \ SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.h -SKIPHEADERS-$(CONFIG_QSVDEC) += qsv.h qsvdec.h qsv_internal.h +SKIPHEADERS-$(CONFIG_QSV) += qsv.h qsvdec.h qsvenc.h qsv_internal.h SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_internal.h From b3673f34149106eedc0457e2a2d4a9ef75a884d5 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Sun, 29 Mar 2015 12:34:43 +0200 Subject: [PATCH 3/3] lavc/h264_refs: Fix compilation with -DTRACE. --- libavcodec/h264_refs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c index 6d72d2ae19..27619d994c 100644 --- a/libavcodec/h264_refs.c +++ b/libavcodec/h264_refs.c @@ -175,16 +175,16 @@ int ff_h264_fill_default_ref_list(H264Context *h, H264SliceContext *sl) #ifdef TRACE for (i = 0; i < sl->ref_count[0]; i++) { tprintf(h->avctx, "List0: %s fn:%d 0x%p\n", - (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), + (h->default_ref_list[0][i].parent->long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, - h->default_ref_list[0][i].f.data[0]); + h->default_ref_list[0][i].parent->f.data[0]); } if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { for (i = 0; i < sl->ref_count[1]; i++) { tprintf(h->avctx, "List1: %s fn:%d 0x%p\n", - (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), + (h->default_ref_list[1][i].parent->long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, - h->default_ref_list[1][i].f.data[0]); + h->default_ref_list[1][i].parent->f.data[0]); } } #endif