Mercurial > mplayer.hg
diff libmpcodecs/vf.c @ 34216:66cdad95f543
Fixes for palette allocation handling.
author | reimar |
---|---|
date | Sat, 05 Nov 2011 18:20:44 +0000 |
parents | dd8320c2a2cb |
children | ca53dc5326fa |
line wrap: on
line diff
--- a/libmpcodecs/vf.c Sat Nov 05 16:35:50 2011 +0000 +++ b/libmpcodecs/vf.c Sat Nov 05 18:20:44 2011 +0000 @@ -338,6 +338,7 @@ 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 @@ // 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"); }