Commit 953dfa8b authored by reimar's avatar reimar

Extend DV autodetection to also reliably detect single-frame DVs with

a higher score that MAX/4.
It checks that there are at least 10 DIF headers and at least one per
24000 bytes, and if so considers the file reliably detected as DV.
Passes probetest, too.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@20074 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 4749b5c7
...@@ -489,6 +489,7 @@ static int dv_probe(AVProbeData *p) ...@@ -489,6 +489,7 @@ static int dv_probe(AVProbeData *p)
unsigned state, marker_pos = 0; unsigned state, marker_pos = 0;
int i; int i;
int matches = 0; int matches = 0;
int secondary_matches = 0;
if (p->buf_size < 5) if (p->buf_size < 5)
return 0; return 0;
...@@ -497,6 +498,10 @@ static int dv_probe(AVProbeData *p) ...@@ -497,6 +498,10 @@ static int dv_probe(AVProbeData *p)
for (i = 4; i < p->buf_size; i++) { for (i = 4; i < p->buf_size; i++) {
if ((state & 0xffffff7f) == 0x1f07003f) if ((state & 0xffffff7f) == 0x1f07003f)
matches++; matches++;
// any section header, also with seq/chan num != 0,
// should appear around every 12000 bytes, at least 10 per frame
if ((state & 0xff07ff7f) == 0x1f07003f)
secondary_matches++;
if (state == 0x003f0700 || state == 0xff3f0700) if (state == 0x003f0700 || state == 0xff3f0700)
marker_pos = i; marker_pos = i;
if (state == 0xff3f0701 && i - marker_pos == 80) if (state == 0xff3f0701 && i - marker_pos == 80)
...@@ -505,7 +510,7 @@ static int dv_probe(AVProbeData *p) ...@@ -505,7 +510,7 @@ static int dv_probe(AVProbeData *p)
} }
if (matches && p->buf_size / matches < 1024*1024) { if (matches && p->buf_size / matches < 1024*1024) {
if (matches > 4) if (matches > 4 || (secondary_matches >= 10 && p->buf_size / secondary_matches < 24000))
return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match
return AVPROBE_SCORE_MAX/4; return AVPROBE_SCORE_MAX/4;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment