|
|
|
@@ -51,6 +51,7 @@ static int MP3lame_encode_init(AVCodecContext *avctx) |
|
|
|
/* lame 3.91 doesn't work in mono */ |
|
|
|
lame_set_mode(s->gfp, JOINT_STEREO); |
|
|
|
lame_set_brate(s->gfp, avctx->bit_rate/1000); |
|
|
|
lame_set_bWriteVbrTag(s->gfp,0); |
|
|
|
if (lame_init_params(s->gfp) < 0) |
|
|
|
goto err_close; |
|
|
|
|
|
|
|
@@ -71,7 +72,10 @@ int MP3lame_encode_frame(AVCodecContext *avctx, |
|
|
|
unsigned char *frame, int buf_size, void *data) |
|
|
|
{ |
|
|
|
Mp3AudioContext *s = avctx->priv_data; |
|
|
|
int num; |
|
|
|
int num, i; |
|
|
|
//av_log(avctx, AV_LOG_DEBUG, "%X %d %X\n", (int)frame, buf_size, (int)data); |
|
|
|
// if(data==NULL) |
|
|
|
// return lame_encode_flush(s->gfp, frame, buf_size); |
|
|
|
|
|
|
|
/* lame 3.91 dies on '1-channel interleaved' data */ |
|
|
|
if (s->stereo) { |
|
|
|
@@ -80,6 +84,11 @@ int MP3lame_encode_frame(AVCodecContext *avctx, |
|
|
|
} else { |
|
|
|
num = lame_encode_buffer(s->gfp, data, data, MPA_FRAME_SIZE, |
|
|
|
frame, buf_size); |
|
|
|
|
|
|
|
/*av_log(avctx, AV_LOG_DEBUG, "in:%d out:%d\n", MPA_FRAME_SIZE, num); |
|
|
|
for(i=0; i<num; i++){ |
|
|
|
av_log(avctx, AV_LOG_DEBUG, "%2X ", frame[i]); |
|
|
|
}*/ |
|
|
|
} |
|
|
|
|
|
|
|
return num; |
|
|
|
|