aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/latmenc.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/latmenc.c
parent60b75186b2c878b6257b43c8fcc0b1356ada218e (diff)
parent9200514ad8717c63f82101dc394f4378854325bf (diff)
downloadffmpeg-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/latmenc.c')
-rw-r--r--libavformat/latmenc.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
index 9713b1b8ec..43ca4821cb 100644
--- a/libavformat/latmenc.c
+++ b/libavformat/latmenc.c
@@ -85,13 +85,13 @@ static int latm_decode_extradata(LATMContext *ctx, uint8_t *buf, int size)
static int latm_write_header(AVFormatContext *s)
{
LATMContext *ctx = s->priv_data;
- AVCodecContext *avctx = s->streams[0]->codec;
+ AVCodecParameters *par = s->streams[0]->codecpar;
- if (avctx->codec_id == AV_CODEC_ID_AAC_LATM)
+ if (par->codec_id == AV_CODEC_ID_AAC_LATM)
return 0;
- if (avctx->extradata_size > 0 &&
- latm_decode_extradata(ctx, avctx->extradata, avctx->extradata_size) < 0)
+ if (par->extradata_size > 0 &&
+ latm_decode_extradata(ctx, par->extradata, par->extradata_size) < 0)
return AVERROR_INVALIDDATA;
return 0;
@@ -100,7 +100,7 @@ static int latm_write_header(AVFormatContext *s)
static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
{
LATMContext *ctx = s->priv_data;
- AVCodecContext *avctx = s->streams[0]->codec;
+ AVCodecParameters *par = s->streams[0]->codecpar;
int header_size;
/* AudioMuxElement */
@@ -116,16 +116,16 @@ static void latm_write_frame_header(AVFormatContext *s, PutBitContext *bs)
/* AudioSpecificConfig */
if (ctx->object_type == AOT_ALS) {
- header_size = avctx->extradata_size-(ctx->off >> 3);
- avpriv_copy_bits(bs, &avctx->extradata[ctx->off >> 3], header_size);
+ header_size = par->extradata_size-(ctx->off >> 3);
+ avpriv_copy_bits(bs, &par->extradata[ctx->off >> 3], header_size);
} else {
// + 3 assumes not scalable and dependsOnCoreCoder == 0,
// see decode_ga_specific_config in libavcodec/aacdec.c
- avpriv_copy_bits(bs, avctx->extradata, ctx->off + 3);
+ avpriv_copy_bits(bs, par->extradata, ctx->off + 3);
if (!ctx->channel_conf) {
GetBitContext gb;
- int ret = init_get_bits8(&gb, avctx->extradata, avctx->extradata_size);
+ int ret = init_get_bits8(&gb, par->extradata, par->extradata_size);
av_assert0(ret >= 0); // extradata size has been checked already, so this should not fail
skip_bits_long(&gb, ctx->off + 3);
avpriv_copy_pce_data(bs, &gb);
@@ -151,10 +151,10 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
int i, len;
uint8_t loas_header[] = "\x56\xe0\x00";
- if (s->streams[0]->codec->codec_id == AV_CODEC_ID_AAC_LATM)
+ if (s->streams[0]->codecpar->codec_id == AV_CODEC_ID_AAC_LATM)
return ff_raw_write_packet(s, pkt);
- if (!s->streams[0]->codec->extradata) {
+ if (!s->streams[0]->codecpar->extradata) {
if(pkt->size > 2 && pkt->data[0] == 0x56 && (pkt->data[1] >> 4) == 0xe &&
(AV_RB16(pkt->data + 1) & 0x1FFF) + 3 == pkt->size)
return ff_raw_write_packet(s, pkt);
@@ -218,7 +218,7 @@ static int latm_check_bitstream(struct AVFormatContext *s, const AVPacket *pkt)
int ret = 1;
AVStream *st = s->streams[pkt->stream_index];
- if (st->codec->codec_id == AV_CODEC_ID_AAC) {
+ if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
if (pkt->size > 2 && (AV_RB16(pkt->data) & 0xfff0) == 0xfff0)
ret = ff_stream_add_bitstream_filter(st, "aac_adtstoasc", NULL);
}