[SCM] libav/experimental: matroskadec: correctly parse flags for simpleblock frames

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:49:55 UTC 2013


The following commit has been merged in the experimental branch:
commit 194d4b494b08ca7b715ca363e303e68cd75376de
Author: Aurelien Jacobs <aurel at gnuage.org>
Date:   Mon Aug 10 18:06:14 2009 +0000

    matroskadec: correctly parse flags for simpleblock frames
    
    Originally committed as revision 19621 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9405b46..068fcc1 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -241,6 +241,7 @@ typedef struct {
 typedef struct {
     uint64_t duration;
     int64_t  reference;
+    uint64_t non_simple;
     EbmlBin  bin;
 } MatroskaBlock;
 
@@ -479,6 +480,7 @@ static EbmlSyntax matroska_blockgroup[] = {
     { MATROSKA_ID_SIMPLEBLOCK,    EBML_BIN,  0, offsetof(MatroskaBlock,bin) },
     { MATROSKA_ID_BLOCKDURATION,  EBML_UINT, 0, offsetof(MatroskaBlock,duration), {.u=AV_NOPTS_VALUE} },
     { MATROSKA_ID_BLOCKREFERENCE, EBML_UINT, 0, offsetof(MatroskaBlock,reference) },
+    { 1,                          EBML_UINT, 0, offsetof(MatroskaBlock,non_simple), {.u=1} },
     { 0 }
 };
 
@@ -1744,12 +1746,14 @@ static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
     blocks_list = &cluster.blocks;
     blocks = blocks_list->elem;
     for (i=0; i<blocks_list->nb_elem; i++)
-        if (blocks[i].bin.size > 0)
+        if (blocks[i].bin.size > 0) {
+            int is_keyframe = blocks[i].non_simple ? !blocks[i].reference : -1;
             res=matroska_parse_block(matroska,
                                      blocks[i].bin.data, blocks[i].bin.size,
                                      blocks[i].bin.pos,  cluster.timecode,
-                                     blocks[i].duration, !blocks[i].reference,
+                                     blocks[i].duration, is_keyframe,
                                      pos);
+        }
     ebml_free(matroska_cluster, &cluster);
     if (res < 0)  matroska->done = 1;
     return res;
diff --git a/tests/seek.regression.ref b/tests/seek.regression.ref
index 0f6fab9..5faf77b 100644
--- a/tests/seek.regression.ref
+++ b/tests/seek.regression.ref
@@ -3029,7 +3029,7 @@ ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:505 size:27837 flags:1
 ret: 0 st:-1 ts:1.894167 flags:1
 ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:291894 size:27834 flags:1
 ret: 0 st: 0 ts:0.788000 flags:0
-ret: 0 st: 0 dts:0.800000 pts:0.800000 pos:252019 size:10049 flags:0
+ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:291894 size:27834 flags:1
 ret: 0 st: 0 ts:-0.317000 flags:1
 ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:505 size:27837 flags:1
 ret: 0 st: 1 ts:2.577000 flags:0
@@ -3037,7 +3037,7 @@ ret:-32
 ret: 0 st: 1 ts:1.471000 flags:1
 ret: 0 st: 1 dts:1.019000 pts:1.019000 pos:320167 size:209 flags:1
 ret: 0 st:-1 ts:0.365002 flags:0
-ret: 0 st: 0 dts:0.400000 pts:0.400000 pos:127917 size:8765 flags:0
+ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:146679 size:27925 flags:1
 ret: 0 st:-1 ts:-0.740831 flags:1
 ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:505 size:27837 flags:1
 ret: 0 st: 0 ts:2.153000 flags:0
@@ -3051,7 +3051,7 @@ ret: 0 st: 1 dts:1.019000 pts:1.019000 pos:320167 size:209 flags:1
 ret: 0 st:-1 ts:1.730004 flags:0
 ret:-32
 ret: 0 st:-1 ts:0.624171 flags:1
-ret: 0 st: 0 dts:0.600000 pts:0.600000 pos:198672 size:10122 flags:0
+ret: 0 st: 0 dts:0.480000 pts:0.480000 pos:146679 size:27925 flags:1
 ret: 0 st: 0 ts:-0.482000 flags:0
 ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:505 size:27837 flags:1
 ret: 0 st: 0 ts:2.413000 flags:1
@@ -3065,7 +3065,7 @@ ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:505 size:27837 flags:1
 ret: 0 st:-1 ts:1.989173 flags:1
 ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:291894 size:27834 flags:1
 ret: 0 st: 0 ts:0.883000 flags:0
-ret: 0 st: 0 dts:0.920000 pts:0.920000 pos:281319 size:10351 flags:0
+ret: 0 st: 0 dts:0.960000 pts:0.960000 pos:291894 size:27834 flags:1
 ret: 0 st: 0 ts:-0.222000 flags:1
 ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:505 size:27837 flags:1
 ret: 0 st: 1 ts:2.672000 flags:0

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list