summaryrefslogtreecommitdiffstats
path: root/libavformat/voc_packet.c
diff options
context:
space:
mode:
authorDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:58:15 +0100
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>2016-04-10 20:59:55 +0100
commit6f69f7a8bf6a0d013985578df2ef42ee6b1c7994 (patch)
tree0c2ec8349ff1763d5f48454b8b9f26374dbd80b0 /libavformat/voc_packet.c
parent60b75186b2c878b6257b43c8fcc0b1356ada218e (diff)
parent9200514ad8717c63f82101dc394f4378854325bf (diff)
downloadffmpeg-streaming-6f69f7a8bf6a0d013985578df2ef42ee6b1c7994.zip
ffmpeg-streaming-6f69f7a8bf6a0d013985578df2ef42ee6b1c7994.tar.gz
Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf': lavf: replace AVStream.codec with AVStream.codecpar This has been a HUGE effort from: - Derek Buitenhuis <derek.buitenhuis@gmail.com> - Hendrik Leppkes <h.leppkes@gmail.com> - wm4 <nfxjfg@googlemail.com> - Clément Bœsch <clement@stupeflix.com> - James Almer <jamrial@gmail.com> - Michael Niedermayer <michael@niedermayer.cc> - Rostislav Pehlivanov <atomnuker@gmail.com> Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/voc_packet.c')
-rw-r--r--libavformat/voc_packet.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/libavformat/voc_packet.c b/libavformat/voc_packet.c
index f4b8231..5833a79 100644
--- a/libavformat/voc_packet.c
+++ b/libavformat/voc_packet.c
@@ -27,7 +27,7 @@ int
ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
{
VocDecContext *voc = s->priv_data;
- AVCodecContext *dec = st->codec;
+ AVCodecParameters *par = st->codecpar;
AVIOContext *pb = s->pb;
VocType type;
int size, tmp_codec=-1;
@@ -57,13 +57,13 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
switch (type) {
case VOC_TYPE_VOICE_DATA:
- if (!dec->sample_rate) {
- dec->sample_rate = 1000000 / (256 - avio_r8(pb));
+ if (!par->sample_rate) {
+ par->sample_rate = 1000000 / (256 - avio_r8(pb));
if (sample_rate)
- dec->sample_rate = sample_rate;
- avpriv_set_pts_info(st, 64, 1, dec->sample_rate);
- dec->channels = channels;
- dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);
+ par->sample_rate = sample_rate;
+ avpriv_set_pts_info(st, 64, 1, par->sample_rate);
+ par->channels = channels;
+ par->bits_per_coded_sample = av_get_bits_per_sample(par->codec_id);
} else
avio_skip(pb, 1);
tmp_codec = avio_r8(pb);
@@ -85,11 +85,11 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
break;
case VOC_TYPE_NEW_VOICE_DATA:
- if (!dec->sample_rate) {
- dec->sample_rate = avio_rl32(pb);
- avpriv_set_pts_info(st, 64, 1, dec->sample_rate);
- dec->bits_per_coded_sample = avio_r8(pb);
- dec->channels = avio_r8(pb);
+ if (!par->sample_rate) {
+ par->sample_rate = avio_rl32(pb);
+ avpriv_set_pts_info(st, 64, 1, par->sample_rate);
+ par->bits_per_coded_sample = avio_r8(pb);
+ par->channels = avio_r8(pb);
} else
avio_skip(pb, 6);
tmp_codec = avio_rl16(pb);
@@ -108,11 +108,11 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
if (tmp_codec >= 0) {
tmp_codec = ff_codec_get_id(ff_voc_codec_tags, tmp_codec);
- if (dec->codec_id == AV_CODEC_ID_NONE)
- dec->codec_id = tmp_codec;
- else if (dec->codec_id != tmp_codec)
+ if (par->codec_id == AV_CODEC_ID_NONE)
+ par->codec_id = tmp_codec;
+ else if (par->codec_id != tmp_codec)
av_log(s, AV_LOG_WARNING, "Ignoring mid-stream change in audio codec\n");
- if (dec->codec_id == AV_CODEC_ID_NONE) {
+ if (par->codec_id == AV_CODEC_ID_NONE) {
if (s->audio_codec_id == AV_CODEC_ID_NONE) {
av_log(s, AV_LOG_ERROR, "unknown codec tag\n");
return AVERROR(EINVAL);
@@ -121,7 +121,7 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
}
}
- dec->bit_rate = dec->sample_rate * dec->channels * dec->bits_per_coded_sample;
+ par->bit_rate = par->sample_rate * par->channels * par->bits_per_coded_sample;
if (max_size <= 0)
max_size = 2048;
@@ -131,7 +131,7 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
ret = av_get_packet(pb, pkt, size);
pkt->dts = pkt->pts = voc->pts;
- duration = av_get_audio_frame_duration(st->codec, size);
+ duration = av_get_audio_frame_duration2(st->codecpar, size);
if (duration > 0 && voc->pts != AV_NOPTS_VALUE)
voc->pts += duration;
else
OpenPOWER on IntegriCloud