Hi!
Attached patch allows users to force a delay for an animated gif.
Related to ticket #4369 (I don't think there is a bug, if there
is a bug, it is reproducible with avi etc.)
Please comment, Carl Eugen
diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c
index 7db5a27..4e0467e 100644
--- a/libavformat/gifdec.c
+++ b/libavformat/gifdec.c
@@ -44,6 +44,7 @@ typedef struct GIFDemuxContext {
*/
int min_delay;
int default_delay;
+ int ignore_delay;
/**
* loop options
@@ -157,7 +158,7 @@ static int gif_read_ext(AVFormatContext *s)
gdc->delay = avio_rl16(pb);
- if (gdc->delay < gdc->min_delay)
+ if (gdc->delay < gdc->min_delay || gdc->ignore_delay)
gdc->delay = gdc->default_delay;
/* skip the rest of the Graphic Control Extension block */
@@ -311,6 +312,7 @@ 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 },
{ "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 },
+ { "ignore_delay" , "always use the default delay between frames"
, offsetof(GIFDemuxContext, ignore_delay) , AV_OPT_TYPE_INT, {.i64 = 0}
, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
_______________________________________________
ffmpeg-devel mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel