[MPlayer-cvslog] r35474 - trunk/libmpcodecs/vf.c

reimar subversion at mplayerhq.hu
Sun Nov 25 15:18:12 CET 2012


Author: reimar
Date: Sun Nov 25 15:18:12 2012
New Revision: 35474

Log:
Fix incorrect mp_image allocations when the input format changes.

Should fix crashes when decoding JPEG images with different
subsampling.

Modified:
   trunk/libmpcodecs/vf.c

Modified: trunk/libmpcodecs/vf.c
==============================================================================
--- trunk/libmpcodecs/vf.c	Sun Nov 25 15:17:23 2012	(r35473)
+++ trunk/libmpcodecs/vf.c	Sun Nov 25 15:18:12 2012	(r35474)
@@ -358,15 +358,16 @@ mp_image_t* vf_get_image(vf_instance_t* 
     mpi->flags|=mp_imgflag&(MP_IMGFLAGMASK_RESTRICTIONS|MP_IMGFLAG_DRAW_CALLBACK|MP_IMGFLAG_RGB_PALETTE);
     if(!vf->draw_slice) mpi->flags&=~MP_IMGFLAG_DRAW_CALLBACK;
     missing_palette = !(mpi->flags & MP_IMGFLAG_RGB_PALETTE) && (mp_imgflag & MP_IMGFLAG_RGB_PALETTE);
-    if(mpi->width!=w2 || mpi->height!=h || missing_palette){
+    if(mpi->width!=w2 || mpi->height!=h || mpi->imgfmt != outfmt || missing_palette){
 //      printf("vf.c: MPI parameters changed!  %dx%d -> %dx%d   \n", mpi->width,mpi->height,w2,h);
         if(mpi->flags&MP_IMGFLAG_ALLOCATED){
-            if(mpi->width<w2 || mpi->height<h || missing_palette){
+            if(mpi->width<w2 || mpi->height<h || mpi->imgfmt != outfmt || missing_palette){
                 // need to re-allocate buffer memory:
                 av_freep(&mpi->planes[0]);
                 if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)
                     av_freep(&mpi->planes[1]);
                 mpi->flags&=~MP_IMGFLAG_ALLOCATED;
+                mpi->bpp = 0;
                 mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory in vf_%s :(\n",
                        vf->info->name);
             }


More information about the MPlayer-cvslog mailing list