28 uint8_t **poutbuf,
int *poutbuf_size,
29 const uint8_t *buf,
int buf_size,
int keyframe){
32 int sample_rate_index=0;
33 int lsf, mpeg25, bitrate_index, frame_size;
37 *poutbuf= (uint8_t *) buf;
38 *poutbuf_size= buf_size;
50 lsf = sample_rate < (24000+32000)/2;
51 mpeg25 = sample_rate < (12000+16000)/2;
52 sample_rate_index= (header>>10)&3;
55 for(bitrate_index=2; bitrate_index<30; bitrate_index++){
57 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
58 if(frame_size == buf_size + 4)
60 if(frame_size == buf_size + 6)
63 if(bitrate_index == 30){
68 header |= (bitrate_index&1)<<9;
69 header |= (bitrate_index>>1)<<12;
70 header |= (frame_size == buf_size + 4)<<16;
72 *poutbuf_size= frame_size;
77 uint8_t *p= *poutbuf + frame_size - buf_size;
80 header |= (p[1] & 0xC0)>>2;
83 header |= p[1] & 0x30;
AV_WL32 AV_WL24 AV_WL16 AV_RB32
mpeg audio layer common tables.
const uint16_t avpriv_mpa_freq_tab[3]
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
void av_log(void *avcl, int level, const char *fmt,...)
int sample_rate
samples per second
main external API structure.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int channels
number of audio channels
const uint16_t avpriv_mpa_bitrate_tab[2][3][15]
#define FFSWAP(type, a, b)