summaryrefslogtreecommitdiff
path: root/libavformat/wv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-08-21 15:27:02 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-08-21 15:27:02 +0200
commitff96098084542c3ef98b360f70583999433d13a7 (patch)
tree620b6e7702ddbc0fb1ccc3525299feb0781abfca /libavformat/wv.c
parent34c997599e14b4ef5f84aa324fdea7ae03d7a2ba (diff)
parentccb919e34b1276db5cfcd903e405e47ccb932d58 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: WavPack demuxer: do not rely on index when timestamp is not in indexed range. WavPack demuxer: store position of the first block in index. WavPack decoder: implement flush function avconv: Separate initialization from the main transcode loop. Conflicts: avconv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/wv.c')
-rw-r--r--libavformat/wv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/wv.c b/libavformat/wv.c
index ec59c26521..e995e51bb9 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -250,6 +250,7 @@ static int wv_read_packet(AVFormatContext *s,
WVContext *wc = s->priv_data;
int ret;
int size, ver, off;
+ int64_t pos;
if (url_feof(s->pb))
return AVERROR(EIO);
@@ -258,6 +259,7 @@ static int wv_read_packet(AVFormatContext *s,
return -1;
}
+ pos = wc->pos;
off = wc->multichannel ? 4 : 0;
if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0)
return AVERROR(ENOMEM);
@@ -314,7 +316,7 @@ static int wv_read_packet(AVFormatContext *s,
pkt->stream_index = 0;
wc->block_parsed = 1;
pkt->pts = wc->soff;
- av_add_index_entry(s->streams[0], wc->pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
+ av_add_index_entry(s->streams[0], pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
return 0;
}
@@ -328,7 +330,8 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
int64_t pos, pts;
/* if found, seek there */
- if (index >= 0){
+ if (index >= 0 &&
+ timestamp <= st->index_entries[st->nb_index_entries - 1].timestamp) {
wc->block_parsed = 1;
avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET);
return 0;