[MPlayer-cvslog] r34304 - in trunk/libmpcodecs: vd_ffmpeg.c vf.c
reimar
subversion at mplayerhq.hu
Sat Nov 5 19:20:44 CET 2011
Author: reimar
Date: Sat Nov 5 19:20:44 2011
New Revision: 34304
Log:
Fixes for palette allocation handling.
Modified:
trunk/libmpcodecs/vd_ffmpeg.c
trunk/libmpcodecs/vf.c
Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c Sat Nov 5 17:35:50 2011 (r34303)
+++ trunk/libmpcodecs/vd_ffmpeg.c Sat Nov 5 19:20:44 2011 (r34304)
@@ -709,9 +709,6 @@ static void release_buffer(struct AVCode
}
if (mpi) {
- // Palette support: free palette buffer allocated in get_buffer
- if (mpi->bpp == 8)
- av_freep(&mpi->planes[1]);
// release mpi (in case MPI_IMGTYPE_NUMBERED is used, e.g. for VDPAU)
mpi->usage_count--;
}
Modified: trunk/libmpcodecs/vf.c
==============================================================================
--- trunk/libmpcodecs/vf.c Sat Nov 5 17:35:50 2011 (r34303)
+++ trunk/libmpcodecs/vf.c Sat Nov 5 19:20:44 2011 (r34304)
@@ -338,6 +338,7 @@ mp_image_t* vf_get_image(vf_instance_t*
break;
}
if(mpi){
+ int missing_palette = !(mpi->flags & MP_IMGFLAG_RGB_PALETTE) && (mp_imgflag & MP_IMGFLAG_RGB_PALETTE);
mpi->type=mp_imgtype;
mpi->w=vf->w; mpi->h=vf->h;
// keep buffer allocation status & color flags only:
@@ -346,12 +347,14 @@ mp_image_t* vf_get_image(vf_instance_t*
// accept restrictions, draw_slice and palette flags only:
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;
- if(mpi->width!=w2 || mpi->height!=h){
+ if(mpi->width!=w2 || mpi->height!=h || 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){
+ if(mpi->width<w2 || mpi->height<h || missing_palette){
// need to re-allocate buffer memory:
- av_free(mpi->planes[0]);
+ av_freep(&mpi->planes[0]);
+ if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)
+ av_freep(&mpi->planes[1]);
mpi->flags&=~MP_IMGFLAG_ALLOCATED;
mp_msg(MSGT_VFILTER,MSGL_V,"vf.c: have to REALLOCATE buffer memory :(\n");
}
More information about the MPlayer-cvslog
mailing list