diff utils.c @ 2453:f67b63ed036d libavcodec

avoid buf_size == 0 checks in every decoder
author michael
date Sun, 23 Jan 2005 18:09:06 +0000
parents 1ee03f2a6cd5
children 8dd4672b9f74
line wrap: on
line diff
--- a/utils.c	Sun Jan 23 17:59:01 2005 +0000
+++ b/utils.c	Sun Jan 23 18:09:06 2005 +0000
@@ -587,13 +587,17 @@
     *got_picture_ptr= 0;
     if((avctx->coded_width||avctx->coded_height) && avcodec_check_dimensions(avctx,avctx->coded_width,avctx->coded_height))
         return -1;
-    ret = avctx->codec->decode(avctx, picture, got_picture_ptr, 
-                               buf, buf_size);
+    if((avctx->codec->capabilities & CODEC_CAP_DELAY) || buf_size){
+        ret = avctx->codec->decode(avctx, picture, got_picture_ptr, 
+                                buf, buf_size);
 
-    emms_c(); //needed to avoid a emms_c() call before every return;
+        emms_c(); //needed to avoid a emms_c() call before every return;
     
-    if (*got_picture_ptr)                           
-        avctx->frame_number++;
+        if (*got_picture_ptr)                           
+            avctx->frame_number++;
+    }else
+        ret= 0;
+
     return ret;
 }