Specifically, ff_mpeg4audio_sample_rates, ff_mpeg4audio_get_config and ff_copy_pce_datatags/n0.9
| @@ -78,7 +78,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| init_put_bits(&pb, pce_data, MAX_PCE_SIZE); | init_put_bits(&pb, pce_data, MAX_PCE_SIZE); | ||||
| pce_size = ff_copy_pce_data(&pb, &gb)/8; | |||||
| pce_size = avpriv_copy_pce_data(&pb, &gb)/8; | |||||
| flush_put_bits(&pb); | flush_put_bits(&pb); | ||||
| buf_size -= get_bits_count(&gb)/8; | buf_size -= get_bits_count(&gb)/8; | ||||
| buf += get_bits_count(&gb)/8; | buf += get_bits_count(&gb)/8; | ||||
| @@ -39,7 +39,7 @@ int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) | |||||
| crc_abs = get_bits1(gbc); /* protection_absent */ | crc_abs = get_bits1(gbc); /* protection_absent */ | ||||
| aot = get_bits(gbc, 2); /* profile_objecttype */ | aot = get_bits(gbc, 2); /* profile_objecttype */ | ||||
| sr = get_bits(gbc, 4); /* sample_frequency_index */ | sr = get_bits(gbc, 4); /* sample_frequency_index */ | ||||
| if(!ff_mpeg4audio_sample_rates[sr]) | |||||
| if(!avpriv_mpeg4audio_sample_rates[sr]) | |||||
| return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; | return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; | ||||
| skip_bits1(gbc); /* private_bit */ | skip_bits1(gbc); /* private_bit */ | ||||
| ch = get_bits(gbc, 3); /* channel_configuration */ | ch = get_bits(gbc, 3); /* channel_configuration */ | ||||
| @@ -62,7 +62,7 @@ int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) | |||||
| hdr->crc_absent = crc_abs; | hdr->crc_absent = crc_abs; | ||||
| hdr->num_aac_frames = rdb + 1; | hdr->num_aac_frames = rdb + 1; | ||||
| hdr->sampling_index = sr; | hdr->sampling_index = sr; | ||||
| hdr->sample_rate = ff_mpeg4audio_sample_rates[sr]; | |||||
| hdr->sample_rate = avpriv_mpeg4audio_sample_rates[sr]; | |||||
| hdr->samples = (rdb + 1) * 1024; | hdr->samples = (rdb + 1) * 1024; | ||||
| hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples; | hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples; | ||||
| @@ -470,7 +470,7 @@ static int decode_audio_specific_config(AACContext *ac, | |||||
| init_get_bits(&gb, data, data_size * 8); | init_get_bits(&gb, data, data_size * 8); | ||||
| if ((i = ff_mpeg4audio_get_config(m4ac, data, data_size)) < 0) | |||||
| if ((i = avpriv_mpeg4audio_get_config(m4ac, data, data_size)) < 0) | |||||
| return -1; | return -1; | ||||
| if (m4ac->sampling_index > 12) { | if (m4ac->sampling_index > 12) { | ||||
| av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index); | av_log(avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", m4ac->sampling_index); | ||||
| @@ -171,7 +171,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) | |||||
| avctx->frame_size = 1024; | avctx->frame_size = 1024; | ||||
| for (i = 0; i < 16; i++) | for (i = 0; i < 16; i++) | ||||
| if (avctx->sample_rate == ff_mpeg4audio_sample_rates[i]) | |||||
| if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i]) | |||||
| break; | break; | ||||
| if (i == 16) { | if (i == 16) { | ||||
| av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); | av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", avctx->sample_rate); | ||||
| @@ -289,7 +289,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx) | |||||
| init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); | init_get_bits(&gb, avctx->extradata, avctx->extradata_size * 8); | ||||
| config_offset = ff_mpeg4audio_get_config(&m4ac, avctx->extradata, | |||||
| config_offset = avpriv_mpeg4audio_get_config(&m4ac, avctx->extradata, | |||||
| avctx->extradata_size); | avctx->extradata_size); | ||||
| if (config_offset < 0) | if (config_offset < 0) | ||||
| @@ -63,7 +63,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) | |||||
| } | } | ||||
| for (index = 0; index < 16; index++) | for (index = 0; index < 16; index++) | ||||
| if (avctx->sample_rate == ff_mpeg4audio_sample_rates[index]) | |||||
| if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[index]) | |||||
| break; | break; | ||||
| if (index == 16) { | if (index == 16) { | ||||
| av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", | av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate %d\n", | ||||
| @@ -52,7 +52,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| const int ff_mpeg4audio_sample_rates[16] = { | |||||
| const int avpriv_mpeg4audio_sample_rates[16] = { | |||||
| 96000, 88200, 64000, 48000, 44100, 32000, | 96000, 88200, 64000, 48000, 44100, 32000, | ||||
| 24000, 22050, 16000, 12000, 11025, 8000, 7350 | 24000, 22050, 16000, 12000, 11025, 8000, 7350 | ||||
| }; | }; | ||||
| @@ -73,10 +73,10 @@ static inline int get_sample_rate(GetBitContext *gb, int *index) | |||||
| { | { | ||||
| *index = get_bits(gb, 4); | *index = get_bits(gb, 4); | ||||
| return *index == 0x0f ? get_bits(gb, 24) : | return *index == 0x0f ? get_bits(gb, 24) : | ||||
| ff_mpeg4audio_sample_rates[*index]; | |||||
| avpriv_mpeg4audio_sample_rates[*index]; | |||||
| } | } | ||||
| int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size) | |||||
| int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size) | |||||
| { | { | ||||
| GetBitContext gb; | GetBitContext gb; | ||||
| int specific_config_bitindex; | int specific_config_bitindex; | ||||
| @@ -151,7 +151,7 @@ static av_always_inline unsigned int copy_bits(PutBitContext *pb, | |||||
| return el; | return el; | ||||
| } | } | ||||
| int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb) | |||||
| int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb) | |||||
| { | { | ||||
| int five_bit_ch, four_bit_ch, comment_size, bits; | int five_bit_ch, four_bit_ch, comment_size, bits; | ||||
| int offset = put_bits_count(pb); | int offset = put_bits_count(pb); | ||||
| @@ -40,7 +40,7 @@ typedef struct { | |||||
| int ps; ///< -1 implicit, 1 presence | int ps; ///< -1 implicit, 1 presence | ||||
| } MPEG4AudioConfig; | } MPEG4AudioConfig; | ||||
| extern const int ff_mpeg4audio_sample_rates[16]; | |||||
| extern const int avpriv_mpeg4audio_sample_rates[16]; | |||||
| extern const uint8_t ff_mpeg4audio_channels[8]; | extern const uint8_t ff_mpeg4audio_channels[8]; | ||||
| /** | /** | ||||
| * Parse MPEG-4 systems extradata to retrieve audio configuration. | * Parse MPEG-4 systems extradata to retrieve audio configuration. | ||||
| @@ -49,7 +49,7 @@ extern const uint8_t ff_mpeg4audio_channels[8]; | |||||
| * @param[in] buf_size Extradata size. | * @param[in] buf_size Extradata size. | ||||
| * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata. | * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata. | ||||
| */ | */ | ||||
| int ff_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size); | |||||
| int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, int buf_size); | |||||
| enum AudioObjectType { | enum AudioObjectType { | ||||
| AOT_NULL, | AOT_NULL, | ||||
| @@ -101,6 +101,6 @@ enum AudioObjectType { | |||||
| #define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE | #define MAX_PCE_SIZE 304 ///<Maximum size of a PCE including the 3-bit ID_PCE | ||||
| ///<marker and the comment | ///<marker and the comment | ||||
| int ff_copy_pce_data(PutBitContext *pb, GetBitContext *gb); | |||||
| int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb); | |||||
| #endif /* AVCODEC_MPEG4AUDIO_H */ | #endif /* AVCODEC_MPEG4AUDIO_H */ | ||||
| @@ -1924,7 +1924,7 @@ static int decode_init_mp3on4(AVCodecContext * avctx) | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| ff_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size); | |||||
| avpriv_mpeg4audio_get_config(&cfg, avctx->extradata, avctx->extradata_size); | |||||
| if (!cfg.chan_config || cfg.chan_config > 7) { | if (!cfg.chan_config || cfg.chan_config > 7) { | ||||
| av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n"); | av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n"); | ||||
| return -1; | return -1; | ||||
| @@ -35,7 +35,7 @@ int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf | |||||
| int off; | int off; | ||||
| init_get_bits(&gb, buf, size * 8); | init_get_bits(&gb, buf, size * 8); | ||||
| off = ff_mpeg4audio_get_config(&m4ac, buf, size); | |||||
| off = avpriv_mpeg4audio_get_config(&m4ac, buf, size); | |||||
| if (off < 0) | if (off < 0) | ||||
| return off; | return off; | ||||
| skip_bits_long(&gb, off); | skip_bits_long(&gb, off); | ||||
| @@ -67,7 +67,7 @@ int ff_adts_decode_extradata(AVFormatContext *s, ADTSContext *adts, uint8_t *buf | |||||
| init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE); | init_put_bits(&pb, adts->pce_data, MAX_PCE_SIZE); | ||||
| put_bits(&pb, 3, 5); //ID_PCE | put_bits(&pb, 3, 5); //ID_PCE | ||||
| adts->pce_size = (ff_copy_pce_data(&pb, &gb) + 3) / 8; | |||||
| adts->pce_size = (avpriv_copy_pce_data(&pb, &gb) + 3) / 8; | |||||
| flush_put_bits(&pb); | flush_put_bits(&pb); | ||||
| } | } | ||||
| @@ -531,7 +531,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
| return ret; | return ret; | ||||
| if (st->codec->codec_id == CODEC_ID_AAC) { | if (st->codec->codec_id == CODEC_ID_AAC) { | ||||
| MPEG4AudioConfig cfg; | MPEG4AudioConfig cfg; | ||||
| ff_mpeg4audio_get_config(&cfg, st->codec->extradata, | |||||
| avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata, | |||||
| st->codec->extradata_size); | st->codec->extradata_size); | ||||
| st->codec->channels = cfg.channels; | st->codec->channels = cfg.channels; | ||||
| if (cfg.ext_sample_rate) | if (cfg.ext_sample_rate) | ||||
| @@ -433,7 +433,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext | |||||
| st->codec->extradata_size = len; | st->codec->extradata_size = len; | ||||
| if (st->codec->codec_id == CODEC_ID_AAC) { | if (st->codec->codec_id == CODEC_ID_AAC) { | ||||
| MPEG4AudioConfig cfg; | MPEG4AudioConfig cfg; | ||||
| ff_mpeg4audio_get_config(&cfg, st->codec->extradata, | |||||
| avpriv_mpeg4audio_get_config(&cfg, st->codec->extradata, | |||||
| st->codec->extradata_size); | st->codec->extradata_size); | ||||
| st->codec->channels = cfg.channels; | st->codec->channels = cfg.channels; | ||||
| if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4 | if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4 | ||||
| @@ -54,7 +54,7 @@ static int latm_decode_extradata(LATMContext *ctx, uint8_t *buf, int size) | |||||
| MPEG4AudioConfig m4ac; | MPEG4AudioConfig m4ac; | ||||
| init_get_bits(&gb, buf, size * 8); | init_get_bits(&gb, buf, size * 8); | ||||
| ctx->off = ff_mpeg4audio_get_config(&m4ac, buf, size); | |||||
| ctx->off = avpriv_mpeg4audio_get_config(&m4ac, buf, size); | |||||
| if (ctx->off < 0) | if (ctx->off < 0) | ||||
| return ctx->off; | return ctx->off; | ||||
| skip_bits_long(&gb, ctx->off); | skip_bits_long(&gb, ctx->off); | ||||
| @@ -111,7 +111,7 @@ static int latm_write_frame_header(AVFormatContext *s, PutBitContext *bs) | |||||
| ff_copy_bits(bs, avctx->extradata, ctx->off + 3); | ff_copy_bits(bs, avctx->extradata, ctx->off + 3); | ||||
| if (!ctx->channel_conf) { | if (!ctx->channel_conf) { | ||||
| ff_copy_pce_data(bs, &gb); | |||||
| avpriv_copy_pce_data(bs, &gb); | |||||
| } | } | ||||
| } | } | ||||
| @@ -1263,8 +1263,8 @@ static int matroska_aac_sri(int samplerate) | |||||
| { | { | ||||
| int sri; | int sri; | ||||
| for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++) | |||||
| if (ff_mpeg4audio_sample_rates[sri] == samplerate) | |||||
| for (sri=0; sri<FF_ARRAY_ELEMS(avpriv_mpeg4audio_sample_rates); sri++) | |||||
| if (avpriv_mpeg4audio_sample_rates[sri] == samplerate) | |||||
| break; | break; | ||||
| return sri; | return sri; | ||||
| } | } | ||||
| @@ -443,7 +443,7 @@ static void get_aac_sample_rates(AVFormatContext *s, AVCodecContext *codec, int | |||||
| { | { | ||||
| MPEG4AudioConfig mp4ac; | MPEG4AudioConfig mp4ac; | ||||
| if (ff_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) { | |||||
| if (avpriv_mpeg4audio_get_config(&mp4ac, codec->extradata, codec->extradata_size) < 0) { | |||||
| av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n"); | av_log(s, AV_LOG_WARNING, "Error parsing AAC extradata, unable to determine samplerate.\n"); | ||||
| return; | return; | ||||
| } | } | ||||
| @@ -342,7 +342,7 @@ static char *latm_context2config(AVCodecContext *c) | |||||
| char *config; | char *config; | ||||
| for (rate_index = 0; rate_index < 16; rate_index++) | for (rate_index = 0; rate_index < 16; rate_index++) | ||||
| if (ff_mpeg4audio_sample_rates[rate_index] == c->sample_rate) | |||||
| if (avpriv_mpeg4audio_sample_rates[rate_index] == c->sample_rate) | |||||
| break; | break; | ||||
| if (rate_index == 16) { | if (rate_index == 16) { | ||||
| av_log(c, AV_LOG_ERROR, "Unsupported sample rate\n"); | av_log(c, AV_LOG_ERROR, "Unsupported sample rate\n"); | ||||