[FFmpeg-cvslog] avformat/ty: try harder to find stream signature

Paul B Mahol git at videolan.org
Mon Nov 6 21:54:06 EET 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Mon Nov  6 20:50:16 2017 +0100| [cdd19e2c560397a72433425b1c5f781cc157a7cf] | committer: Paul B Mahol

avformat/ty: try harder to find stream signature

Search all chunks, not just first one.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

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

 libavformat/ty.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/libavformat/ty.c b/libavformat/ty.c
index bd871cba2e..3926d3e9b7 100644
--- a/libavformat/ty.c
+++ b/libavformat/ty.c
@@ -108,11 +108,16 @@ typedef struct TYDemuxContext {
 
 static int ty_probe(AVProbeData *p)
 {
-    if (AV_RB32(p->buf) == TIVO_PES_FILEID &&
-        AV_RB32(p->buf + 4) == 0x02 &&
-        AV_RB32(p->buf + 8) == CHUNK_SIZE) {
-        return AVPROBE_SCORE_MAX;
+    int i;
+
+    for (i = 0; i + 12 < p->buf_size; i += CHUNK_SIZE) {
+        if (AV_RB32(p->buf + i) == TIVO_PES_FILEID &&
+            AV_RB32(p->buf + i + 4) == 0x02 &&
+            AV_RB32(p->buf + i + 8) == CHUNK_SIZE) {
+            return AVPROBE_SCORE_MAX;
+        }
     }
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list