changeset 34240:43b60a64debf

Detect codecs requiring too many references for DR also when they use buffer_hints.
author reimar
date Tue, 08 Nov 2011 20:24:35 +0000
parents 4e2f4bd081ce
children f6cce8c4ea66
files libmpcodecs/vd_ffmpeg.c
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Mon Nov 07 19:54:49 2011 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Tue Nov 08 20:24:35 2011 +0000
@@ -540,11 +540,9 @@
         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 @@
             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 @@
     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 @@
             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");
     }