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;