[FFmpeg-cvslog] lavf/gif: add final_delay option.

Clément Bœsch git at videolan.org
Sat Apr 20 00:39:38 CEST 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sat Apr 20 00:11:04 2013 +0200| [67cc31d6c74be37ba17262d29afb7a92ee4f3642] | committer: Clément Bœsch

lavf/gif: add final_delay option.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67cc31d6c74be37ba17262d29afb7a92ee4f3642
---

 libavformat/gif.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/gif.c b/libavformat/gif.c
index 594eb6b..d459bd6 100644
--- a/libavformat/gif.c
+++ b/libavformat/gif.c
@@ -68,6 +68,7 @@ static int gif_image_write_header(AVIOContext *pb, int width, int height,
 typedef struct {
     AVClass *class;         /** Class for private options. */
     int loop;
+    int last_delay;
     AVPacket *prev_pkt;
     int duration;
 } GIFContext;
@@ -139,6 +140,8 @@ static int flush_packet(AVFormatContext *s, AVPacket *new)
 
     if (new && new->pts != AV_NOPTS_VALUE)
         gif->duration = av_clip_uint16(new->pts - gif->prev_pkt->pts);
+    else if (!new && gif->last_delay >= 0)
+        gif->duration = gif->last_delay;
 
     /* graphic control extension block */
     avio_w8(pb, 0x21);
@@ -188,6 +191,8 @@ static int gif_write_trailer(AVFormatContext *s)
 static const AVOption options[] = {
     { "loop", "Number of times to loop the output.", OFFSET(loop),
       AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 65535, ENC },
+    { "final_delay", "Force delay (in ms) after the last frame", OFFSET(last_delay),
+      AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 65535, ENC },
     { NULL },
 };
 



More information about the ffmpeg-cvslog mailing list