[FFmpeg-cvslog] Allow reading of growing avi files (currently being written)

Joakim Plate git at videolan.org
Mon Dec 8 21:13:44 CET 2014


ffmpeg | branch: master | Joakim Plate <elupus at ecce.se> | Fri Dec  5 03:06:50 2014 +0000| [90411b333d6b6bb69d8937117b9250785730dc53] | committer: Vittorio Giovara

Allow reading of growing avi files (currently being written)

This uses the RIFF header stored size to figure out the expected AVI
file size, instead of the actual file. To work fully it requires handling
failed avio_seek() instead of assuming they always succeed.

Some fate file has been cut off and contains half a frame at the end which
previously was not output during demuxing. This frame is now output to
encoder, thus the fate diff update.

Bug-Id: 261
Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

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

 libavformat/avidec.c             |    8 ++++----
 tests/ref/fate/aasc              |    1 +
 tests/ref/fate/cllc-argb         |    1 +
 tests/ref/fate/cllc-rgb          |    1 +
 tests/ref/fate/cllc-yuy2-noblock |    1 +
 tests/ref/fate/cvid-partial      |    1 +
 tests/ref/fate/fic-avi           |    1 +
 tests/ref/fate/truemotion1-24    |    1 +
 tests/ref/fate/vp5               |    1 +
 tests/ref/fate/zmbv-8bit         |    1 +
 10 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index c24a6c4..e7202de 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -151,7 +151,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num)
     AVIStream *ast;
     int i;
     int64_t last_pos = -1;
-    int64_t filesize = avio_size(s->pb);
+    int64_t filesize = avi->fsize;
 
     av_dlog(s,
             "longs_pre_entry:%d index_type:%d entries_in_use:%d "
@@ -374,7 +374,7 @@ static int avi_read_header(AVFormatContext *s)
         return ret;
 
     avi->fsize = avio_size(pb);
-    if (avi->fsize <= 0)
+    if (avi->fsize <= 0 || avi->fsize < avi->riff_end)
         avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end;
 
     /* first list tag */
@@ -402,7 +402,7 @@ static int avi_read_header(AVFormatContext *s)
                 if (size)
                     avi->movi_end = avi->movi_list + size + (size & 1);
                 else
-                    avi->movi_end = avio_size(pb);
+                    avi->movi_end = avi->fsize;
                 av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end);
                 goto end_of_header;
             } else if (tag1 == MKTAG('I', 'N', 'F', 'O'))
@@ -774,7 +774,7 @@ static int avi_read_header(AVFormatContext *s)
                 if (s->error_recognition & AV_EF_EXPLODE)
                     goto fail;
                 avi->movi_list = avio_tell(pb) - 4;
-                avi->movi_end  = avio_size(pb);
+                avi->movi_end  = avi->fsize;
                 goto end_of_header;
             }
             /* skip tag */
diff --git a/tests/ref/fate/aasc b/tests/ref/fate/aasc
index 57d59a9..83f83b9 100644
--- a/tests/ref/fate/aasc
+++ b/tests/ref/fate/aasc
@@ -22,3 +22,4 @@
 0,         20,         20,        1,   168000, 0x7a2b1006
 0,         21,         21,        1,   168000, 0xc7ca1345
 0,         22,         22,        1,   168000, 0x8841c413
+0,         23,         23,        1,   168000, 0xbaed0290
diff --git a/tests/ref/fate/cllc-argb b/tests/ref/fate/cllc-argb
index 0283863..4a5dce5 100644
--- a/tests/ref/fate/cllc-argb
+++ b/tests/ref/fate/cllc-argb
@@ -3,3 +3,4 @@
 0,          1,          1,        1,  3686400, 0x66a45032
 0,          2,          2,        1,  3686400, 0xdf0c861f
 0,          3,          3,        1,  3686400, 0xa4a68cdb
+0,          4,          4,        1,  3686400, 0xb5f9526e
diff --git a/tests/ref/fate/cllc-rgb b/tests/ref/fate/cllc-rgb
index 06d54da..b4ca055 100644
--- a/tests/ref/fate/cllc-rgb
+++ b/tests/ref/fate/cllc-rgb
@@ -13,3 +13,4 @@
 0,         11,         11,        1,   921600, 0x4d7488fa
 0,         12,         12,        1,   921600, 0x16b9c9c9
 0,         13,         13,        1,   921600, 0xa0a4f77f
+0,         14,         14,        1,   921600, 0xf61a5501
diff --git a/tests/ref/fate/cllc-yuy2-noblock b/tests/ref/fate/cllc-yuy2-noblock
index 2cb9e78..6ad59d5 100644
--- a/tests/ref/fate/cllc-yuy2-noblock
+++ b/tests/ref/fate/cllc-yuy2-noblock
@@ -14,3 +14,4 @@
 0,         12,         12,        1,   614400, 0x2d8fd7cc
 0,         13,         13,        1,   614400, 0xd9dfc2ef
 0,         14,         14,        1,   614400, 0xaf95cef0
+0,         15,         15,        1,   614400, 0x6dcf5ed6
diff --git a/tests/ref/fate/cvid-partial b/tests/ref/fate/cvid-partial
index 71596b4..907ef4a 100644
--- a/tests/ref/fate/cvid-partial
+++ b/tests/ref/fate/cvid-partial
@@ -77,3 +77,4 @@
 0,         75,         75,        1,   112400, 0xe4394f1f
 0,         76,         76,        1,   112400, 0x8ca8649f
 0,         77,         77,        1,   112400, 0x804d44eb
+0,         78,         78,        1,   112400, 0x3864488b
diff --git a/tests/ref/fate/fic-avi b/tests/ref/fate/fic-avi
index e2b26a3..cc4ea5d 100644
--- a/tests/ref/fate/fic-avi
+++ b/tests/ref/fate/fic-avi
@@ -119,3 +119,4 @@
 0,        117,        117,        1,  1566720, 0xfe83b964
 0,        118,        118,        1,  1566720, 0x25dc30a6
 0,        119,        119,        1,  1566720, 0x25dc30a6
+0,        120,        120,        1,  1566720, 0x25dc30a6
diff --git a/tests/ref/fate/truemotion1-24 b/tests/ref/fate/truemotion1-24
index f097ed0..73bb9e7 100644
--- a/tests/ref/fate/truemotion1-24
+++ b/tests/ref/fate/truemotion1-24
@@ -14,3 +14,4 @@
 0,         12,         12,        1,    69120, 0xf55d74c7
 0,         13,         13,        1,    69120, 0xb5082ca7
 0,         14,         14,        1,    69120, 0x5876d758
+0,         15,         15,        1,    69120, 0x45e7dd5c
diff --git a/tests/ref/fate/vp5 b/tests/ref/fate/vp5
index 791fe60..0e601ba 100644
--- a/tests/ref/fate/vp5
+++ b/tests/ref/fate/vp5
@@ -245,3 +245,4 @@
 0,        243,        243,        1,   233472, 0x6f530ac6
 0,        244,        244,        1,   233472, 0x94f7466c
 0,        245,        245,        1,   233472, 0xa8c1d365
+0,        246,        246,        1,   233472, 0xedcff050
diff --git a/tests/ref/fate/zmbv-8bit b/tests/ref/fate/zmbv-8bit
index 64dacae..9f02ae3 100644
--- a/tests/ref/fate/zmbv-8bit
+++ b/tests/ref/fate/zmbv-8bit
@@ -274,3 +274,4 @@
 0,        272,        272,        1,   192000, 0xd08e49d1
 0,        273,        273,        1,   192000, 0xd08e49d1
 0,        274,        274,        1,   192000, 0xd08e49d1
+0,        275,        275,        1,   192000, 0x1f34135f



More information about the ffmpeg-cvslog mailing list