Mercurial > mplayer.hg
diff libmpcodecs/vd_ffmpeg.c @ 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 | 67b386883561 |
children | 7470ba76f228 |
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c Sat Dec 26 11:33:45 2009 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Sat Dec 26 11:51:19 2009 +0000 @@ -27,6 +27,10 @@ #include "libavcodec/avcodec.h" +#if AVPALETTE_SIZE > 1024 +#error palette too large, adapt libmpcodecs/vf.c:vf_get_image +#endif + #if CONFIG_XVMC #include "libavcodec/xvmc.h" #endif @@ -593,6 +597,8 @@ mp_msg(MSGT_DECVIDEO, MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n"); } + if (ctx->best_csp == IMGFMT_RGB8 || ctx->best_csp == IMGFMT_BGR8) + flags |= MP_IMGFLAG_RGB_PALETTE; mpi= mpcodecs_get_image(sh, type, flags, width, height); if (!mpi) return -1; @@ -630,10 +636,6 @@ } #endif - // Palette support: libavcodec copies palette to *data[1] - if (mpi->bpp == 8) - mpi->planes[1] = av_malloc(AVPALETTE_SIZE); - pic->data[0]= mpi->planes[0]; pic->data[1]= mpi->planes[1]; pic->data[2]= mpi->planes[2];