diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-10-10 14:41:49 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-10-10 15:50:32 +0000 |
commit | ee109c6bc2cf4aebe6202c2c9022816c968d2d00 (patch) | |
tree | 79409dedfff35171c8fde75701e5a6e2d3c8b733 /libavformat/dtshddec.c | |
parent | 73ad355d23ab0db0c3de098932a2691a42930ee2 (diff) | |
download | ffmpeg-ee109c6bc2cf4aebe6202c2c9022816c968d2d00.tar.gz |
dtshd: fix seeking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavformat/dtshddec.c')
-rw-r--r-- | libavformat/dtshddec.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libavformat/dtshddec.c b/libavformat/dtshddec.c index cee4d333d6..55c4ca607e 100644 --- a/libavformat/dtshddec.c +++ b/libavformat/dtshddec.c @@ -38,7 +38,7 @@ #define TIMECODE 0x54494D45434F4445 typedef struct DTSHDDemuxContext { - uint64_t left; + uint64_t data_end; } DTSHDDemuxContext; static int dtshd_probe(AVProbeData *p) @@ -79,7 +79,9 @@ static int dtshd_read_header(AVFormatContext *s) switch (chunk_type) { case STRMDATA: - dtshd->left = chunk_size; + dtshd->data_end = chunk_size + avio_tell(pb); + if (dtshd->data_end <= chunk_size) + return AVERROR_INVALIDDATA; return 0; break; case FILEINFO: @@ -107,11 +109,12 @@ skip: static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) { DTSHDDemuxContext *dtshd = s->priv_data; - uint64_t size; + int64_t size, left; int ret; - size = FFMIN(dtshd->left, 1024); - if (size == 0) + left = dtshd->data_end - avio_tell(s->pb); + size = FFMIN(left, 1024); + if (size <= 0) return AVERROR_EOF; ret = av_get_packet(s->pb, pkt, size); @@ -119,7 +122,6 @@ static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; pkt->stream_index = 0; - dtshd->left -= ret; return ret; } |