Originally committed as revision 19197 to svn://svn.ffmpeg.org/ffmpeg/trunk
Baptiste Coudurier authored on 2009/06/15 10:41:59... | ... |
@@ -400,7 +400,7 @@ typedef struct RawDVContext { |
400 | 400 |
static int dv_read_header(AVFormatContext *s, |
401 | 401 |
AVFormatParameters *ap) |
402 | 402 |
{ |
403 |
- unsigned state; |
|
403 |
+ unsigned state, marker_pos = 0; |
|
404 | 404 |
RawDVContext *c = s->priv_data; |
405 | 405 |
|
406 | 406 |
c->dv_demux = dv_init_demux(s); |
... | ... |
@@ -413,6 +413,13 @@ static int dv_read_header(AVFormatContext *s, |
413 | 413 |
av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n"); |
414 | 414 |
return -1; |
415 | 415 |
} |
416 |
+ if (state == 0x003f0700 || state == 0xff3f0700) |
|
417 |
+ marker_pos = url_ftell(s->pb); |
|
418 |
+ if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) { |
|
419 |
+ url_fseek(s->pb, -163, SEEK_CUR); |
|
420 |
+ state = get_be32(s->pb); |
|
421 |
+ break; |
|
422 |
+ } |
|
416 | 423 |
state = (state << 8) | get_byte(s->pb); |
417 | 424 |
} |
418 | 425 |
AV_WB32(c->buf, state); |
... | ... |
@@ -476,7 +483,7 @@ static int dv_read_close(AVFormatContext *s) |
476 | 476 |
|
477 | 477 |
static int dv_probe(AVProbeData *p) |
478 | 478 |
{ |
479 |
- unsigned state; |
|
479 |
+ unsigned state, marker_pos = 0; |
|
480 | 480 |
int i; |
481 | 481 |
|
482 | 482 |
if (p->buf_size < 5) |
... | ... |
@@ -486,6 +493,10 @@ static int dv_probe(AVProbeData *p) |
486 | 486 |
for (i = 4; i < p->buf_size; i++) { |
487 | 487 |
if ((state & 0xffffff7f) == 0x1f07003f) |
488 | 488 |
return AVPROBE_SCORE_MAX*3/4; // not max to avoid dv in mov to match |
489 |
+ if (state == 0x003f0700 || state == 0xff3f0700) |
|
490 |
+ marker_pos = i; |
|
491 |
+ if (state == 0xff3f0701 && i - marker_pos == 80) |
|
492 |
+ return AVPROBE_SCORE_MAX/4; |
|
489 | 493 |
state = (state << 8) | p->buf[i]; |
490 | 494 |
} |
491 | 495 |
|