Commit 5561fe48 authored by Kostya Shishkov's avatar Kostya Shishkov Committed by Luca Barbato

WavPack demuxer: store position of the first block in index.

Currently for multichannel audio position for the last block position is
stored in index (and used for seeking), which is obviously not correct.
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent 4ba8c521
...@@ -250,6 +250,7 @@ static int wv_read_packet(AVFormatContext *s, ...@@ -250,6 +250,7 @@ static int wv_read_packet(AVFormatContext *s,
WVContext *wc = s->priv_data; WVContext *wc = s->priv_data;
int ret; int ret;
int size, ver, off; int size, ver, off;
int64_t pos;
if (s->pb->eof_reached) if (s->pb->eof_reached)
return AVERROR(EIO); return AVERROR(EIO);
...@@ -258,6 +259,7 @@ static int wv_read_packet(AVFormatContext *s, ...@@ -258,6 +259,7 @@ static int wv_read_packet(AVFormatContext *s,
return -1; return -1;
} }
pos = wc->pos;
off = wc->multichannel ? 4 : 0; off = wc->multichannel ? 4 : 0;
if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0) if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
...@@ -314,7 +316,7 @@ static int wv_read_packet(AVFormatContext *s, ...@@ -314,7 +316,7 @@ static int wv_read_packet(AVFormatContext *s,
pkt->stream_index = 0; pkt->stream_index = 0;
wc->block_parsed = 1; wc->block_parsed = 1;
pkt->pts = wc->soff; 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; return 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