diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-04-10 20:58:15 +0100 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-04-10 20:59:55 +0100 |
commit | 6f69f7a8bf6a0d013985578df2ef42ee6b1c7994 (patch) | |
tree | 0c2ec8349ff1763d5f48454b8b9f26374dbd80b0 /libavformat/omadec.c | |
parent | 60b75186b2c878b6257b43c8fcc0b1356ada218e (diff) | |
parent | 9200514ad8717c63f82101dc394f4378854325bf (diff) | |
download | ffmpeg-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/omadec.c')
-rw-r--r-- | libavformat/omadec.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/libavformat/omadec.c b/libavformat/omadec.c index 132992dd33..6e476dbf25 100644 --- a/libavformat/omadec.c +++ b/libavformat/omadec.c @@ -342,10 +342,10 @@ static int oma_read_header(AVFormatContext *s) return AVERROR(ENOMEM); st->start_time = 0; - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_tag = buf[32]; - st->codec->codec_id = ff_codec_get_id(ff_oma_codec_tags, - st->codec->codec_tag); + st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; + st->codecpar->codec_tag = buf[32]; + st->codecpar->codec_id = ff_codec_get_id(ff_oma_codec_tags, + st->codecpar->codec_tag); switch (buf[32]) { case OMA_CODECID_ATRAC3: @@ -362,17 +362,17 @@ static int oma_read_header(AVFormatContext *s) /* get stereo coding mode, 1 for joint-stereo */ jsflag = (codec_params >> 17) & 1; - st->codec->channels = 2; - st->codec->channel_layout = AV_CH_LAYOUT_STEREO; - st->codec->sample_rate = samplerate; - st->codec->bit_rate = st->codec->sample_rate * framesize * 8 / 1024; + st->codecpar->channels = 2; + st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; + st->codecpar->sample_rate = samplerate; + st->codecpar->bit_rate = st->codecpar->sample_rate * framesize * 8 / 1024; /* fake the ATRAC3 extradata * (wav format, makes stream copy to wav work) */ - if (ff_alloc_extradata(st->codec, 14)) + if (ff_alloc_extradata(st->codecpar, 14)) return AVERROR(ENOMEM); - edata = st->codec->extradata; + edata = st->codecpar->extradata; AV_WL16(&edata[0], 1); // always 1 AV_WL32(&edata[2], samplerate); // samples rate AV_WL16(&edata[6], jsflag); // coding mode @@ -380,7 +380,7 @@ static int oma_read_header(AVFormatContext *s) AV_WL16(&edata[10], 1); // always 1 // AV_WL16(&edata[12], 0); // always 0 - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); + avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); break; case OMA_CODECID_ATRAC3P: channel_id = (codec_params >> 10) & 7; @@ -389,16 +389,16 @@ static int oma_read_header(AVFormatContext *s) "Invalid ATRAC-X channel id: %"PRIu32"\n", channel_id); return AVERROR_INVALIDDATA; } - st->codec->channel_layout = ff_oma_chid_to_native_layout[channel_id - 1]; - st->codec->channels = ff_oma_chid_to_num_channels[channel_id - 1]; + st->codecpar->channel_layout = ff_oma_chid_to_native_layout[channel_id - 1]; + st->codecpar->channels = ff_oma_chid_to_num_channels[channel_id - 1]; framesize = ((codec_params & 0x3FF) * 8) + 8; samplerate = ff_oma_srate_tab[(codec_params >> 13) & 7] * 100; if (!samplerate) { av_log(s, AV_LOG_ERROR, "Unsupported sample rate\n"); return AVERROR_INVALIDDATA; } - st->codec->sample_rate = samplerate; - st->codec->bit_rate = samplerate * framesize * 8 / 2048; + st->codecpar->sample_rate = samplerate; + st->codecpar->bit_rate = samplerate * framesize * 8 / 2048; avpriv_set_pts_info(st, 64, 1, samplerate); break; case OMA_CODECID_MP3: @@ -407,22 +407,22 @@ static int oma_read_header(AVFormatContext *s) break; case OMA_CODECID_LPCM: /* PCM 44.1 kHz 16 bit stereo big-endian */ - st->codec->channels = 2; - st->codec->channel_layout = AV_CH_LAYOUT_STEREO; - st->codec->sample_rate = 44100; + st->codecpar->channels = 2; + st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO; + st->codecpar->sample_rate = 44100; framesize = 1024; /* bit rate = sample rate x PCM block align (= 4) x 8 */ - st->codec->bit_rate = st->codec->sample_rate * 32; - st->codec->bits_per_coded_sample = - av_get_bits_per_sample(st->codec->codec_id); - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); + st->codecpar->bit_rate = st->codecpar->sample_rate * 32; + st->codecpar->bits_per_coded_sample = + av_get_bits_per_sample(st->codecpar->codec_id); + avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); break; default: av_log(s, AV_LOG_ERROR, "Unsupported codec %d!\n", buf[32]); return AVERROR(ENOSYS); } - st->codec->block_align = framesize; + st->codecpar->block_align = framesize; return 0; } @@ -432,8 +432,8 @@ static int oma_read_packet(AVFormatContext *s, AVPacket *pkt) { OMAContext *oc = s->priv_data; AVStream *st = s->streams[0]; - int packet_size = st->codec->block_align; - int byte_rate = st->codec->bit_rate >> 3; + int packet_size = st->codecpar->block_align; + int byte_rate = st->codecpar->bit_rate >> 3; int64_t pos = avio_tell(s->pb); int ret = av_get_packet(s->pb, pkt, packet_size); |