[MPlayer-cvslog] r34949 - in trunk/libmpcodecs: vd_ffmpeg.c vf.c

reimar subversion at mplayerhq.hu
Mon May 21 21:59:58 CEST 2012


Author: reimar
Date: Mon May 21 21:59:58 2012
New Revision: 34949

Log:
Change MP_IMGTYPE_NUMBERED semantics.

This makes it easier to detect filters that claim to
support it for direct rendering but actually don't.

Modified:
   trunk/libmpcodecs/vd_ffmpeg.c
   trunk/libmpcodecs/vf.c

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Mon May 21 21:17:55 2012	(r34948)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Mon May 21 21:59:58 2012	(r34949)
@@ -581,7 +581,7 @@ static int get_buffer(AVCodecContext *av
     }
 
     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){

Modified: trunk/libmpcodecs/vf.c
==============================================================================
--- trunk/libmpcodecs/vf.c	Mon May 21 21:17:55 2012	(r34948)
+++ trunk/libmpcodecs/vf.c	Mon May 21 21:59:58 2012	(r34949)
@@ -278,7 +278,7 @@ void vf_mpi_clear(mp_image_t* mpi,int x0
 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 @@ mp_image_t* vf_get_image(vf_instance_t* 
           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;


More information about the MPlayer-cvslog mailing list