summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2004-06-22 21:14:01 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-06-22 21:14:01 +0000
commit6f82497728c49831e230bb631c4c3d6f5deff803 (patch)
treeb7a02d38ef9f9427ffeb6874e6ce82bdcb1940c7 /libavcodec/utils.c
parentf2e92ef2915333b233846e32cd2b0ac1f785516e (diff)
flush audio encoder buffers at the end
fix vorbis in nut again Originally committed as revision 3244 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a45d57de00..4fdd0c2aba 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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;
}
/**