diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-08-10 04:18:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-08-10 04:45:27 +0200 |
commit | 46f15de8a4ea84f68c641f3e94149b72c16dbc56 (patch) | |
tree | db04ce35ec7b3e34f765abb2ae1b463cf25e76f0 | |
parent | 8c75a338124f70fedb5a1784fc0e590c597935ed (diff) | |
download | ffmpeg-46f15de8a4ea84f68c641f3e94149b72c16dbc56.tar.gz |
avformat/gifdec: correct r_frame_rate for single frame gifs
Fixes Ticket4650
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/gifdec.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/gifdec.c b/libavformat/gifdec.c index bb4c6ec6e6..1ac47fee50 100644 --- a/libavformat/gifdec.c +++ b/libavformat/gifdec.c @@ -52,6 +52,9 @@ typedef struct GIFDemuxContext { int total_iter; int iter_count; int ignore_loop; + + int nb_frames; + int last_duration; } GIFDemuxContext; /** @@ -279,6 +282,9 @@ parse_keyframe: pkt->stream_index = 0; pkt->duration = gdc->delay; + gdc->nb_frames ++; + gdc->last_duration = pkt->duration; + /* Graphic Control Extension's scope is single frame. * Remove its influence. */ gdc->delay = gdc->default_delay; @@ -299,6 +305,9 @@ resync: } if ((ret >= 0 && !frame_parsed) || ret == AVERROR_EOF) { + if (gdc->nb_frames == 1) { + s->streams[0]->r_frame_rate = (AVRational) {100, gdc->last_duration}; + } /* This might happen when there is no image block * between extension blocks and GIF_TRAILER or EOF */ if (!gdc->ignore_loop && (block_label == GIF_TRAILER || avio_feof(pb)) |