diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-12-26 11:51:19 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-12-26 11:51:19 +0000 |
commit | afc5a627d85cec556e7fca13fc5a03e5c4452850 (patch) | |
tree | e865cca32e1c14512cccb11f4f15f90bbd31ff32 /libmpcodecs/vd_ffmpeg.c | |
parent | bd06a94738d902bbac42c4573ba8640463423b8e (diff) | |
download | mpv-afc5a627d85cec556e7fca13fc5a03e5c4452850.tar.bz2 mpv-afc5a627d85cec556e7fca13fc5a03e5c4452850.tar.xz |
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.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30116 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vd_ffmpeg.c')
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index e8ad07b33f..a3cb9ee1d8 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -27,6 +27,10 @@ LIBVD_EXTERN(ffmpeg) #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 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ 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 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ } #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]; |