[MPlayer-cvslog] r34328 - trunk/libmpcodecs/vd_ffmpeg.c

reimar subversion at mplayerhq.hu
Tue Nov 8 21:24:36 CET 2011


Author: reimar
Date: Tue Nov  8 21:24:35 2011
New Revision: 34328

Log:
Detect codecs requiring too many references for DR also when they
use buffer_hints.

Modified:
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Mon Nov  7 20:54:49 2011	(r34327)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Tue Nov  8 21:24:35 2011	(r34328)
@@ -540,11 +540,9 @@ static int get_buffer(AVCodecContext *av
         type = MP_IMGTYPE_TEMP;
         if (pic->buffer_hints & FF_BUFFER_HINTS_READABLE)
             flags |= MP_IMGFLAG_READABLE;
-        if (pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) {
-            type = MP_IMGTYPE_IP;
-            flags |= MP_IMGFLAG_PRESERVE;
-        }
-        if (pic->buffer_hints & FF_BUFFER_HINTS_REUSABLE) {
+        if (pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE ||
+            pic->buffer_hints & FF_BUFFER_HINTS_REUSABLE) {
+            ctx->ip_count++;
             type = MP_IMGTYPE_IP;
             flags |= MP_IMGFLAG_PRESERVE;
         }
@@ -561,6 +559,11 @@ static int get_buffer(AVCodecContext *av
             flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE
                       | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0);
         }
+        if(avctx->has_b_frames || ctx->b_count){
+            type= MP_IMGTYPE_IPB;
+        }else{
+            type= MP_IMGTYPE_IP;
+        }
     }
 
     if(init_vo(sh, avctx->pix_fmt) < 0){
@@ -575,7 +578,7 @@ static int get_buffer(AVCodecContext *av
     if (IMGFMT_IS_HWACCEL(ctx->best_csp)) {
         type =  MP_IMGTYPE_NUMBERED | (0xffff << 16);
     } else
-    if (!pic->buffer_hints) {
+    if (type == MP_IMGTYPE_IP || type == MP_IMGTYPE_IPB) {
         if(ctx->b_count>1 || ctx->ip_count>2){
             mp_msg(MSGT_DECVIDEO, MSGL_WARN, MSGTR_MPCODECS_DRIFailure);
 
@@ -591,11 +594,6 @@ static int get_buffer(AVCodecContext *av
             return avctx->get_buffer(avctx, pic);
         }
 
-        if(avctx->has_b_frames || ctx->b_count){
-            type= MP_IMGTYPE_IPB;
-        }else{
-            type= MP_IMGTYPE_IP;
-        }
         mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n");
     }
 


More information about the MPlayer-cvslog mailing list