]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
dv probe
authorbcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 26 Feb 2009 08:45:59 +0000 (08:45 +0000)
committerbcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 26 Feb 2009 08:45:59 +0000 (08:45 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@17607 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/dv.c

index 7b4cb0b093c5c65c598f0eece0ef16528a722e43..820c3b5cec8a38b24df09e1419dce8440a7de656 100644 (file)
@@ -474,12 +474,30 @@ static int dv_read_close(AVFormatContext *s)
     return 0;
 }
 
+static int dv_probe(AVProbeData *p)
+{
+    unsigned state;
+    int i;
+
+    if (p->buf_size < 5)
+        return 0;
+
+    state = AV_RB32(p->buf);
+    for (i = 4; i < p->buf_size; i++) {
+        if ((state & 0xffffff7f) == 0x1f07003f)
+            return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match
+        state = (state << 8) | p->buf[i];
+    }
+
+    return 0;
+}
+
 #if CONFIG_DV_DEMUXER
 AVInputFormat dv_demuxer = {
     "dv",
     NULL_IF_CONFIG_SMALL("DV video format"),
     sizeof(RawDVContext),
-    NULL,
+    dv_probe,
     dv_read_header,
     dv_read_packet,
     dv_read_close,