flush audio encoder buffers at the end

fix vorbis in nut again

Originally committed as revision 3244 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer
2004-06-22 21:14:01 +00:00
parent f2e92ef291
commit 6f82497728
6 changed files with 96 additions and 44 deletions

View File

@@ -453,24 +453,25 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
int avcodec_encode_audio(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const short *samples)
{
int ret;
ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples);
avctx->frame_number++;
return ret;
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || samples){
int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)samples);
avctx->frame_number++;
return ret;
}else
return 0;
}
int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVFrame *pict)
{
int ret;
ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);
if((avctx->codec->capabilities & CODEC_CAP_DELAY) || pict){
int ret = avctx->codec->encode(avctx, buf, buf_size, (void *)pict);
avctx->frame_number++;
emms_c(); //needed to avoid a emms_c() call before every return;
emms_c(); //needed to avoid a emms_c() call before every return;
avctx->frame_number++;
return ret;
return ret;
}else
return 0;
}
/**