[FFmpeg-cvslog] dtshd: fix seeking
Paul B Mahol
git at videolan.org
Wed Oct 10 17:53:28 CEST 2012
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Oct 10 14:41:49 2012 +0000| [ee109c6bc2cf4aebe6202c2c9022816c968d2d00] | committer: Paul B Mahol
dtshd: fix seeking
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ee109c6bc2cf4aebe6202c2c9022816c968d2d00
---
libavformat/dtshddec.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/libavformat/dtshddec.c b/libavformat/dtshddec.c
index cee4d33..55c4ca6 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;
}
More information about the ffmpeg-cvslog
mailing list