#include "libavutil/intreadwrite.h"
#include "libavutil/dict.h"
#include "avformat.h"
+#include "internal.h"
#include "apetag.h"
#include "id3v1.h"
return 0;
}
-static int wv_read_header(AVFormatContext *s,
- AVFormatParameters *ap)
+static int wv_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
WVContext *wc = s->priv_data;
st->codec->channel_layout = wc->chmask;
st->codec->sample_rate = wc->rate;
st->codec->bits_per_coded_sample = wc->bpp;
- av_set_pts_info(st, 64, 1, wc->rate);
+ avpriv_set_pts_info(st, 64, 1, wc->rate);
st->start_time = 0;
st->duration = wc->samples;
int ret;
int size, ver, off;
int64_t pos;
+ uint32_t block_samples;
if (url_feof(s->pb))
return AVERROR(EIO);
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;
}