[FFmpeg-cvslog] avcodec/bink: fix seeking to frame 0

Michael Niedermayer git at videolan.org
Thu Oct 31 01:02:01 CET 2013


ffmpeg | branch: release/1.2 | Michael Niedermayer <michaelni at gmx.at> | Wed Oct 30 23:56:52 2013 +0100| [fd8af75109913d09fb6673f4aa189b4bf49bede9] | committer: Carl Eugen Hoyos

avcodec/bink: fix seeking to frame 0

Fixes Ticket3088

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit cb52d6da0a9c88c584a38a9a7a94825565854b7e)

Conflicts:
	libavcodec/bink.c

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

 libavcodec/bink.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index 5d000a8..fcaa863 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -117,6 +117,7 @@ typedef struct BinkContext {
     int            version;              ///< internal Bink file version
     int            has_alpha;
     int            swap_planes;
+    unsigned       frame_num;
 
     Bundle         bundle[BINKB_NB_SRC]; ///< bundles for decoding all data types
     Tree           col_high[16];         ///< trees for decoding high nibble in "colours" data type
@@ -1207,6 +1208,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
     if (c->version >= 'i')
         skip_bits_long(&gb, 32);
 
+    c->frame_num++;
+
     for (plane = 0; plane < 3; plane++) {
         plane_idx = (!plane || !c->swap_planes) ? plane : (plane ^ 3);
 
@@ -1215,7 +1218,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
                 return ret;
         } else {
             if ((ret = binkb_decode_plane(c, &gb, plane_idx,
-                                          !avctx->frame_number, !!plane)) < 0)
+                                          c->frame_num == 1, !!plane)) < 0)
                 return ret;
         }
         if (get_bits_count(&gb) >= bits_count)
@@ -1339,6 +1342,13 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
+static void flush(AVCodecContext *avctx)
+{
+    BinkContext * const c = avctx->priv_data;
+
+    c->frame_num = 0;
+}
+
 AVCodec ff_bink_decoder = {
     .name           = "binkvideo",
     .type           = AVMEDIA_TYPE_VIDEO,
@@ -1348,5 +1358,6 @@ AVCodec ff_bink_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .long_name      = NULL_IF_CONFIG_SMALL("Bink video"),
+    .flush          = flush,
     .capabilities   = CODEC_CAP_DR1,
 };



More information about the ffmpeg-cvslog mailing list