diff options
author | Paul B Mahol <onemda@gmail.com> | 2019-09-27 14:25:18 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2019-09-27 14:25:18 +0200 |
commit | bb697f30ab28604c57f4ac396f31116fd765d4b8 (patch) | |
tree | f58a0f10253722c8a68c213b563acf4de2d57a34 /libavformat/dhav.c | |
parent | 35a12d2071efa5c408e6dd4a4a6d0cf930fb3eb3 (diff) | |
download | ffmpeg-bb697f30ab28604c57f4ac396f31116fd765d4b8.tar.gz |
avformat/dhav: fix demuxer since recent breakage
Diffstat (limited to 'libavformat/dhav.c')
-rw-r--r-- | libavformat/dhav.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libavformat/dhav.c b/libavformat/dhav.c index 6a67f981c7..120b8e4318 100644 --- a/libavformat/dhav.c +++ b/libavformat/dhav.c @@ -289,8 +289,9 @@ static int read_chunk(AVFormatContext *s) static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt) { DHAVContext *dhav = s->priv_data; - int ret; + int ret, stream_index; +retry: while ((ret = read_chunk(s)) == 0) ; @@ -357,10 +358,18 @@ static int dhav_read_packet(AVFormatContext *s, AVPacket *pkt) 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); if (ret < 0) 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) pkt->flags |= AV_PKT_FLAG_KEY; if (pkt->stream_index >= 0) |