[FFmpeg-devel] [PATCH] another stab at improved dv probe
Maksym Veremeyenko
verem
Sun Sep 27 12:27:54 CEST 2009
Reimar D?ffinger ???????(??):
> Hello,
> another attempt at dv probe. It is still on the simple side, checking
> that the distance between the section header difs is exactly 12000 bytes
> or also checking the video header difs etc. is possible, but currently I
> am still going for "as stupid as I can get away with".
May i propose one more improvement to your patch that check if headers
starts in position odd to 12000 that cause to rise ratio:
Index: dv.c
===================================================================
--- dv.c (revision 19970)
+++ dv.c (working copy)
@@ -489,6 +489,8 @@
unsigned state, marker_pos = 0;
int i;
int matches = 0;
+ int secondary_matches = 0;
+ int primary_matches = 0;
if (p->buf_size < 5)
return 0;
@@ -497,6 +499,12 @@
for (i = 4; i < p->buf_size; i++) {
if ((state & 0xffffff7f) == 0x1f07003f)
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++;
+ primary_matches += (i - 4) % 12000;
+ }
if (state == 0x003f0700 || state == 0xff3f0700)
marker_pos = i;
if (state == 0xff3f0701 && i - marker_pos == 80)
@@ -505,8 +513,11 @@
}
if (matches && p->buf_size / matches < 1024*1024) {
- if (matches > 4)
- return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov
to match
+ if (matches > 4 || (secondary_matches >= 10 && p->buf_size /
secondary_matches < 24000)) {
+ if(!primary_matches)
+ return AVPROBE_SCORE_MAX - 1;
+ return AVPROBE_SCORE_MAX / 2;
+ }
return AVPROBE_SCORE_MAX/4;
}
return 0;
i had a mov file where DV frames chunk start from 17-th byte and probe
test found that its a raw DV stream with ratio 0.75. In that case
truncated raw DV stream will have 0.5 but normal 0.99
--
________________________________________
Maksym Veremeyenko
More information about the ffmpeg-devel
mailing list