Browse code

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: Luca Barbato <lu_zero@gentoo.org>

Kostya Shishkov authored on 2011/08/21 01:14:58
Showing 1 changed files
... ...
@@ -250,6 +250,7 @@ static int wv_read_packet(AVFormatContext *s,
250 250
     WVContext *wc = s->priv_data;
251 251
     int ret;
252 252
     int size, ver, off;
253
+    int64_t pos;
253 254
 
254 255
     if (s->pb->eof_reached)
255 256
         return AVERROR(EIO);
... ...
@@ -258,6 +259,7 @@ static int wv_read_packet(AVFormatContext *s,
258 258
             return -1;
259 259
     }
260 260
 
261
+    pos = wc->pos;
261 262
     off = wc->multichannel ? 4 : 0;
262 263
     if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE + off) < 0)
263 264
         return AVERROR(ENOMEM);
... ...
@@ -314,7 +316,7 @@ static int wv_read_packet(AVFormatContext *s,
314 314
     pkt->stream_index = 0;
315 315
     wc->block_parsed = 1;
316 316
     pkt->pts = wc->soff;
317
-    av_add_index_entry(s->streams[0], wc->pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
317
+    av_add_index_entry(s->streams[0], pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
318 318
     return 0;
319 319
 }
320 320