21 #include "libavutil/common.h"
22 #include "libavutil/intreadwrite.h"
29 uint8_t **poutbuf,
int *poutbuf_size,
30 const uint8_t *
buf,
int buf_size,
int keyframe){
33 int sample_rate_index=0;
39 *poutbuf_size= buf_size;
51 lsf = sample_rate < (24000+32000)/2;
52 mpeg25 = sample_rate < (12000+16000)/2;
53 sample_rate_index= (header>>10)&3;
56 for(bitrate_index=2; bitrate_index<30; bitrate_index++){
58 frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1);
59 if(frame_size == buf_size + 4)
61 if(frame_size == buf_size + 6)
64 if(bitrate_index == 30){
69 header |= (bitrate_index&1)<<9;
70 header |= (bitrate_index>>1)<<12;
71 header |= (frame_size == buf_size + 4)<<16;
78 uint8_t *p= *poutbuf + frame_size - buf_size;
81 header |= (p[1] & 0xC0)>>2;
84 header |= p[1] & 0x30;
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
mpeg audio layer common tables.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
const uint16_t avpriv_mpa_freq_tab[3]
#define FFSWAP(type, a, b)
static const uint8_t frame_size[4]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Libavcodec external API header.
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int sample_rate
samples per second
main external API structure.
int channels
number of audio channels
const uint16_t avpriv_mpa_bitrate_tab[2][3][15]