aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-06-15 01:41:59 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2009-06-15 01:41:59 +0000
commit70606675801410371c8fbe2d369906882f303cdc (patch)
treeaa10bd136288b8ee9b4571f7c7ff7a508326d721 /libavformat
parentd310d56a3690a959a41d5c3765792d6c678d3a88 (diff)
downloadffmpeg-70606675801410371c8fbe2d369906882f303cdc.tar.gz
fix probing and demuxing of pond.dv, issue #887
Originally committed as revision 19197 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/dv.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/dv.c b/libavformat/dv.c
index 28d44ee54f..78e3b38d18 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -400,7 +400,7 @@ typedef struct RawDVContext {
static int dv_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- unsigned state;
+ unsigned state, marker_pos = 0;
RawDVContext *c = s->priv_data;
c->dv_demux = dv_init_demux(s);
@@ -413,6 +413,13 @@ static int dv_read_header(AVFormatContext *s,
av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
return -1;
}
+ if (state == 0x003f0700 || state == 0xff3f0700)
+ marker_pos = url_ftell(s->pb);
+ if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
+ url_fseek(s->pb, -163, SEEK_CUR);
+ state = get_be32(s->pb);
+ break;
+ }
state = (state << 8) | get_byte(s->pb);
}
AV_WB32(c->buf, state);
@@ -476,7 +483,7 @@ static int dv_read_close(AVFormatContext *s)
static int dv_probe(AVProbeData *p)
{
- unsigned state;
+ unsigned state, marker_pos = 0;
int i;
if (p->buf_size < 5)
@@ -486,6 +493,10 @@ static int dv_probe(AVProbeData *p)
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
+ if (state == 0x003f0700 || state == 0xff3f0700)
+ marker_pos = i;
+ if (state == 0xff3f0701 && i - marker_pos == 80)
+ return AVPROBE_SCORE_MAX/4;
state = (state << 8) | p->buf[i];
}