summaryrefslogtreecommitdiff
path: root/libavformat/wv.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-02-08 22:17:54 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2012-02-09 13:13:04 -0500
commit0f3d8baef9f83d278ef3ef8d02fab742a44ee484 (patch)
tree65b7a48f4b295c3e245b6e36c4887b09197082a4 /libavformat/wv.c
parent9aff2d17533576f4ff52531e534f1319fb36a590 (diff)
WavPack demuxer: set packet duration
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavformat/wv.c')
-rw-r--r--libavformat/wv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/wv.c b/libavformat/wv.c
index c39cc6843c..49ca486a93 100644
--- a/libavformat/wv.c
+++ b/libavformat/wv.c
@@ -251,6 +251,7 @@ static int wv_read_packet(AVFormatContext *s,
int ret;
int size, ver, off;
int64_t pos;
+ uint32_t block_samples;
if (s->pb->eof_reached)
return AVERROR(EIO);
@@ -316,6 +317,12 @@ static int wv_read_packet(AVFormatContext *s,
pkt->stream_index = 0;
wc->block_parsed = 1;
pkt->pts = wc->soff;
+ block_samples = AV_RN32(wc->extra);
+ if (block_samples > INT32_MAX)
+ av_log(s, AV_LOG_WARNING, "Too many samples in block: %"PRIu32"\n", block_samples);
+ else
+ pkt->duration = block_samples;
+
av_add_index_entry(s->streams[0], pos, pkt->pts, 0, 0, AVINDEX_KEYFRAME);
return 0;
}