changeset 34861:bbbe5519f1e7

Change MP_IMGTYPE_NUMBERED semantics. This makes it easier to detect filters that claim to support it for direct rendering but actually don't.
author reimar
date Mon, 21 May 2012 19:59:58 +0000
parents 4a7962b0f3d4
children e28caa1840a0
files libmpcodecs/vd_ffmpeg.c libmpcodecs/vf.c
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c	Mon May 21 19:17:55 2012 +0000
+++ b/libmpcodecs/vd_ffmpeg.c	Mon May 21 19:59:58 2012 +0000
@@ -581,7 +581,7 @@
     }
 
     if (IMGFMT_IS_HWACCEL(ctx->best_csp)) {
-        type =  MP_IMGTYPE_NUMBERED | (0xffff << 16);
+        type =  MP_IMGTYPE_NUMBERED;
     } else
     if (type == MP_IMGTYPE_IP || type == MP_IMGTYPE_IPB) {
         if(ctx->b_count>1 || ctx->ip_count>2){
--- a/libmpcodecs/vf.c	Mon May 21 19:17:55 2012 +0000
+++ b/libmpcodecs/vf.c	Mon May 21 19:59:58 2012 +0000
@@ -278,7 +278,7 @@
 mp_image_t* vf_get_image(vf_instance_t* vf, unsigned int outfmt, int mp_imgtype, int mp_imgflag, int w, int h){
   mp_image_t* mpi=NULL;
   int w2;
-  int number = mp_imgtype >> 16;
+  int number = (mp_imgtype >> 16) - 1;
 
 #ifdef MP_DEBUG
   assert(w == -1 || w >= vf->w);
@@ -333,7 +333,10 @@
           break;
       number = i;
     }
-    if (number < 0 || number >= NUM_NUMBERED_MPI) return NULL;
+    if (number < 0 || number >= NUM_NUMBERED_MPI) {
+      mp_msg(MSGT_VFILTER, MSGL_FATAL, "Ran out of numbered images, expect crash. Filter before %s is broken.\n", vf->info->name);
+      return NULL;
+    }
     if (!vf->imgctx.numbered_images[number]) vf->imgctx.numbered_images[number] = new_mp_image(w2,h);
     mpi = vf->imgctx.numbered_images[number];
     mpi->number = number;