changeset 4582:082712eaff7e libavformat

dv probe
author bcoudurier
date Thu, 26 Feb 2009 08:45:59 +0000
parents c52d40f0a955
children 8d5d5bcf76c9
files dv.c
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dv.c	Thu Feb 26 02:41:53 2009 +0000
+++ b/dv.c	Thu Feb 26 08:45:59 2009 +0000
@@ -474,12 +474,30 @@
     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,