diff libmpcodecs/mp_image.h @ 30074:5cb79ad246f2

Support mp_image with allocated palette. Fixes playback and a memory leak for FFmpeg codecs which use reget_buffer with paletted data, e.g. cdgraphics.
author reimar
date Sat, 26 Dec 2009 11:51:19 +0000
parents 6d0da4fd4544
children 76c25bfa181b
line wrap: on
line diff
--- a/libmpcodecs/mp_image.h	Sat Dec 26 11:33:45 2009 +0000
+++ b/libmpcodecs/mp_image.h	Sat Dec 26 11:51:19 2009 +0000
@@ -38,7 +38,7 @@
 #define MP_IMGFLAG_YUV 0x200
 // set if it's swapped (BGR or YVU) plane/byteorder
 #define MP_IMGFLAG_SWAPPED 0x400
-// using palette for RGB data
+// set if you want memory for palette allocated and managed by vf_get_image etc.
 #define MP_IMGFLAG_RGB_PALETTE 0x800
 
 #define MP_IMGFLAGMASK_COLORS 0xF00
@@ -223,6 +223,8 @@
     if(mpi->flags&MP_IMGFLAG_ALLOCATED){
 	/* becouse we allocate the whole image in once */
 	if(mpi->planes[0]) free(mpi->planes[0]);
+	if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)
+	    free(mpi->planes[1]);
     }
     free(mpi);
 }