Commit bb697f30 authored by Paul B Mahol's avatar Paul B Mahol

avformat/dhav: fix demuxer since recent breakage

parent 35a12d20
...@@ -289,8 +289,9 @@ static int read_chunk(AVFormatContext *s) ...@@ -289,8 +289,9 @@ static int read_chunk(AVFormatContext *s)
static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt) static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt)
{ {
DHAVContext *dhav = s->priv_data; DHAVContext *dhav = s->priv_data;
int ret; int ret, stream_index;
retry:
while ((ret = read_chunk(s)) == 0) while ((ret = read_chunk(s)) == 0)
; ;
...@@ -357,10 +358,18 @@ static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -357,10 +358,18 @@ static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt)
avpriv_set_pts_info(st, 64, 1, 1000); avpriv_set_pts_info(st, 64, 1, 1000);
} }
stream_index = dhav->type == 0xf0 ? dhav->audio_stream_index : dhav->video_stream_index;
if (stream_index < 0) {
avio_skip(s->pb, ret);
if (avio_rl32(s->pb) == MKTAG('d','h','a','v'))
avio_skip(s->pb, 4);
goto retry;
}
ret = av_get_packet(s->pb, pkt, ret); ret = av_get_packet(s->pb, pkt, ret);
if (ret < 0) if (ret < 0)
return ret; return ret;
pkt->stream_index = dhav->type == 0xf0 ? dhav->audio_stream_index : dhav->video_stream_index; pkt->stream_index = stream_index;
if (dhav->type != 0xfc) if (dhav->type != 0xfc)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
if (pkt->stream_index >= 0) if (pkt->stream_index >= 0)
......
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