Commit 82ab61f9 authored by Anton Khirnov's avatar Anton Khirnov

lavc: use avpriv_ prefix for some mpegaudio symbols used in lavf.

Specifically, ff_mpa_freq_tab, ff_mpa_bitrate_tab, ff_mpa_decode_header,
ff_mpegaudio_decode_header.
parent 73ae27e1
...@@ -50,10 +50,10 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext ...@@ -50,10 +50,10 @@ static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext
lsf = sample_rate < (24000+32000)/2; lsf = sample_rate < (24000+32000)/2;
mpeg25 = sample_rate < (12000+16000)/2; mpeg25 = sample_rate < (12000+16000)/2;
sample_rate_index= (header>>10)&3; sample_rate_index= (header>>10)&3;
sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off
for(bitrate_index=2; bitrate_index<30; bitrate_index++){ for(bitrate_index=2; bitrate_index<30; bitrate_index++){
frame_size = ff_mpa_bitrate_tab[lsf][2][bitrate_index>>1]; frame_size = avpriv_mpa_bitrate_tab[lsf][2][bitrate_index>>1];
frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1); frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
if(frame_size == buf_size + 4) if(frame_size == buf_size + 4)
break; break;
......
...@@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1, ...@@ -64,7 +64,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
state= (state<<8) + buf[i++]; state= (state<<8) + buf[i++];
ret = ff_mpa_decode_header(avctx, state, &sr, &channels, &frame_size, &bit_rate); ret = avpriv_mpa_decode_header(avctx, state, &sr, &channels, &frame_size, &bit_rate);
if (ret < 4) { if (ret < 4) {
s->header_count= -2; s->header_count= -2;
} else { } else {
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "mpegaudiodata.h" #include "mpegaudiodata.h"
const uint16_t ff_mpa_bitrate_tab[2][3][15] = { const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = {
{ {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 },
{0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 },
{0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } },
...@@ -37,7 +37,7 @@ const uint16_t ff_mpa_bitrate_tab[2][3][15] = { ...@@ -37,7 +37,7 @@ const uint16_t ff_mpa_bitrate_tab[2][3][15] = {
} }
}; };
const uint16_t ff_mpa_freq_tab[3] = { 44100, 48000, 32000 }; const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 };
/*******************************************************/ /*******************************************************/
/* half mpeg encoding window (full precision) */ /* half mpeg encoding window (full precision) */
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#define MODE_EXT_MS_STEREO 2 #define MODE_EXT_MS_STEREO 2
#define MODE_EXT_I_STEREO 1 #define MODE_EXT_I_STEREO 1
extern const uint16_t ff_mpa_bitrate_tab[2][3][15]; extern const uint16_t avpriv_mpa_bitrate_tab[2][3][15];
extern const uint16_t ff_mpa_freq_tab[3]; extern const uint16_t avpriv_mpa_freq_tab[3];
extern const int32_t ff_mpa_enwindow[257]; extern const int32_t ff_mpa_enwindow[257];
extern const int ff_mpa_sblimit_table[5]; extern const int ff_mpa_sblimit_table[5];
extern const int ff_mpa_quant_steps[17]; extern const int ff_mpa_quant_steps[17];
......
...@@ -1790,7 +1790,7 @@ static int decode_frame(AVCodecContext * avctx, ...@@ -1790,7 +1790,7 @@ static int decode_frame(AVCodecContext * avctx,
return -1; return -1;
} }
if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) { if (avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
/* free format: prepare to compute frame size */ /* free format: prepare to compute frame size */
s->frame_size = -1; s->frame_size = -1;
return -1; return -1;
...@@ -1863,7 +1863,7 @@ static int decode_frame_adu(AVCodecContext * avctx, ...@@ -1863,7 +1863,7 @@ static int decode_frame_adu(AVCodecContext * avctx,
return buf_size; return buf_size;
} }
ff_mpegaudio_decode_header((MPADecodeHeader *)s, header); avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header);
/* update codec info */ /* update codec info */
avctx->sample_rate = s->sample_rate; avctx->sample_rate = s->sample_rate;
avctx->channels = s->nb_channels; avctx->channels = s->nb_channels;
...@@ -2016,7 +2016,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx, ...@@ -2016,7 +2016,7 @@ static int decode_frame_mp3on4(AVCodecContext * avctx,
if (ff_mpa_check_header(header) < 0) // Bad header, discard block if (ff_mpa_check_header(header) < 0) // Bad header, discard block
break; break;
ff_mpegaudio_decode_header((MPADecodeHeader *)m, header); avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header);
out_size += mp_decode_frame(m, outptr, buf, fsize); out_size += mp_decode_frame(m, outptr, buf, fsize);
buf += fsize; buf += fsize;
len -= fsize; len -= fsize;
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "mpegaudiodecheader.h" #include "mpegaudiodecheader.h"
int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
{ {
int sample_rate, frame_size, mpeg25, padding; int sample_rate, frame_size, mpeg25, padding;
int sample_rate_index, bitrate_index; int sample_rate_index, bitrate_index;
...@@ -46,7 +46,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) ...@@ -46,7 +46,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
s->layer = 4 - ((header >> 17) & 3); s->layer = 4 - ((header >> 17) & 3);
/* extract frequency */ /* extract frequency */
sample_rate_index = (header >> 10) & 3; sample_rate_index = (header >> 10) & 3;
sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
sample_rate_index += 3 * (s->lsf + mpeg25); sample_rate_index += 3 * (s->lsf + mpeg25);
s->sample_rate_index = sample_rate_index; s->sample_rate_index = sample_rate_index;
s->error_protection = ((header >> 16) & 1) ^ 1; s->error_protection = ((header >> 16) & 1) ^ 1;
...@@ -67,7 +67,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) ...@@ -67,7 +67,7 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
s->nb_channels = 2; s->nb_channels = 2;
if (bitrate_index != 0) { if (bitrate_index != 0) {
frame_size = ff_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index]; frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
s->bit_rate = frame_size * 1000; s->bit_rate = frame_size * 1000;
switch(s->layer) { switch(s->layer) {
case 1: case 1:
...@@ -109,14 +109,14 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) ...@@ -109,14 +109,14 @@ int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
return 0; return 0;
} }
int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate) int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
{ {
MPADecodeHeader s1, *s = &s1; MPADecodeHeader s1, *s = &s1;
if (ff_mpa_check_header(head) != 0) if (ff_mpa_check_header(head) != 0)
return -1; return -1;
if (ff_mpegaudio_decode_header(s, head) != 0) { if (avpriv_mpegaudio_decode_header(s, head) != 0) {
return -1; return -1;
} }
......
...@@ -50,11 +50,11 @@ typedef struct MPADecodeHeader { ...@@ -50,11 +50,11 @@ typedef struct MPADecodeHeader {
/* header decoding. MUST check the header before because no /* header decoding. MUST check the header before because no
consistency check is done there. Return 1 if free format found and consistency check is done there. Return 1 if free format found and
that the frame size must be computed externally */ that the frame size must be computed externally */
int ff_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header); int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header);
/* useful helper to get mpeg audio stream infos. Return -1 if error in /* useful helper to get mpeg audio stream infos. Return -1 if error in
header, otherwise the coded frame size in bytes */ header, otherwise the coded frame size in bytes */
int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate); int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate);
/* fast header check for resync */ /* fast header check for resync */
static inline int ff_mpa_check_header(uint32_t header){ static inline int ff_mpa_check_header(uint32_t header){
......
...@@ -84,9 +84,9 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) ...@@ -84,9 +84,9 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
/* encoding freq */ /* encoding freq */
s->lsf = 0; s->lsf = 0;
for(i=0;i<3;i++) { for(i=0;i<3;i++) {
if (ff_mpa_freq_tab[i] == freq) if (avpriv_mpa_freq_tab[i] == freq)
break; break;
if ((ff_mpa_freq_tab[i] / 2) == freq) { if ((avpriv_mpa_freq_tab[i] / 2) == freq) {
s->lsf = 1; s->lsf = 1;
break; break;
} }
...@@ -99,7 +99,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx) ...@@ -99,7 +99,7 @@ static av_cold int MPA_encode_init(AVCodecContext *avctx)
/* encoding bitrate & frequency */ /* encoding bitrate & frequency */
for(i=0;i<15;i++) { for(i=0;i<15;i++) {
if (ff_mpa_bitrate_tab[s->lsf][1][i] == bitrate) if (avpriv_mpa_bitrate_tab[s->lsf][1][i] == bitrate)
break; break;
} }
if (i == 15){ if (i == 15){
......
...@@ -437,7 +437,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext ...@@ -437,7 +437,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
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
st->codec->sample_rate = ff_mpa_freq_tab[cfg.sampling_index]; st->codec->sample_rate = avpriv_mpa_freq_tab[cfg.sampling_index];
else if (cfg.ext_sample_rate) else if (cfg.ext_sample_rate)
st->codec->sample_rate = cfg.ext_sample_rate; st->codec->sample_rate = cfg.ext_sample_rate;
else else
......
...@@ -51,7 +51,7 @@ static int mp3_read_probe(AVProbeData *p) ...@@ -51,7 +51,7 @@ static int mp3_read_probe(AVProbeData *p)
for(frames = 0; buf2 < end; frames++) { for(frames = 0; buf2 < end; frames++) {
header = AV_RB32(buf2); header = AV_RB32(buf2);
fsize = ff_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate); fsize = avpriv_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate);
if(fsize < 0) if(fsize < 0)
break; break;
buf2 += fsize; buf2 += fsize;
...@@ -86,7 +86,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) ...@@ -86,7 +86,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base)
if(ff_mpa_check_header(v) < 0) if(ff_mpa_check_header(v) < 0)
return -1; return -1;
if (ff_mpegaudio_decode_header(&c, v) == 0) if (avpriv_mpegaudio_decode_header(&c, v) == 0)
vbrtag_size = c.frame_size; vbrtag_size = c.frame_size;
if(c.layer != 3) if(c.layer != 3)
return -1; return -1;
......
...@@ -217,12 +217,12 @@ static void mp3_write_xing(AVFormatContext *s) ...@@ -217,12 +217,12 @@ static void mp3_write_xing(AVFormatContext *s)
MPADecodeHeader mpah; MPADecodeHeader mpah;
int srate_idx, i, channels; int srate_idx, i, channels;
for (i = 0; i < FF_ARRAY_ELEMS(ff_mpa_freq_tab); i++) for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++)
if (ff_mpa_freq_tab[i] == codec->sample_rate) { if (avpriv_mpa_freq_tab[i] == codec->sample_rate) {
srate_idx = i; srate_idx = i;
break; break;
} }
if (i == FF_ARRAY_ELEMS(ff_mpa_freq_tab)) { if (i == FF_ARRAY_ELEMS(avpriv_mpa_freq_tab)) {
av_log(s, AV_LOG_ERROR, "Unsupported sample rate.\n"); av_log(s, AV_LOG_ERROR, "Unsupported sample rate.\n");
return; return;
} }
...@@ -240,7 +240,7 @@ static void mp3_write_xing(AVFormatContext *s) ...@@ -240,7 +240,7 @@ static void mp3_write_xing(AVFormatContext *s)
header |= channels << 6; header |= channels << 6;
avio_wb32(s->pb, header); avio_wb32(s->pb, header);
ff_mpegaudio_decode_header(&mpah, header); avpriv_mpegaudio_decode_header(&mpah, header);
ffio_fill(s->pb, 0, xing_offset); ffio_fill(s->pb, 0, xing_offset);
ffio_wfourcc(s->pb, "Xing"); ffio_wfourcc(s->pb, "Xing");
......
...@@ -59,10 +59,10 @@ static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint ...@@ -59,10 +59,10 @@ static int find_expected_header(AVCodecContext *c, int size, int key_frame, uint
else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0; else if(sample_rate < (44100 + 48000)/2) sample_rate_index=0;
else sample_rate_index=1; else sample_rate_index=1;
sample_rate= ff_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25);
for(bitrate_index=2; bitrate_index<30; bitrate_index++){ for(bitrate_index=2; bitrate_index<30; bitrate_index++){
frame_size = ff_mpa_bitrate_tab[lsf][layer-1][bitrate_index>>1]; frame_size = avpriv_mpa_bitrate_tab[lsf][layer-1][bitrate_index>>1];
frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1); frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
if(frame_size == size) if(frame_size == size)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment