vlc/vlc-2.1 | branch: master | Rafaël Carré <fun...@videolan.org> | Fri Oct 18 21:17:29 2013 +0200| [3baa05d86aff601c44125140e81dfdaf55ea51d4] | committer: Jean-Baptiste Kempf
avcodec: transmit palette to libavcodec >= 54 (cherry picked from commit 5784645841b78dc7f5bcb799db4ed66c519e0ec9) Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org> > http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=3baa05d86aff601c44125140e81dfdaf55ea51d4 --- modules/codec/avcodec/video.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index 9e1bc21..a4b6490 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -78,7 +78,7 @@ struct decoder_sys_t #if LIBAVCODEC_VERSION_MAJOR < 54 AVPaletteControl palette; #else -# warning FIXME + bool palette_sent; #endif /* */ @@ -415,7 +415,13 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, p_sys->p_context->palctrl = &p_sys->palette; } #else -# warning FIXME + if( p_dec->fmt_in.video.p_palette ) { + p_sys->palette_sent = false; + p_dec->fmt_out.video.p_palette = malloc( sizeof(video_palette_t) ); + if( p_dec->fmt_out.video.p_palette ) + *p_dec->fmt_out.video.p_palette = *p_dec->fmt_in.video.p_palette; + } else + p_sys->palette_sent = true; #endif /* ***** init this codec with special data ***** */ @@ -581,6 +587,17 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) pkt.pts = p_block->i_pts; pkt.dts = p_block->i_dts; +#if LIBAVCODEC_VERSION_MAJOR >= 54 + if( !p_sys->palette_sent ) + { + uint8_t *pal = av_packet_new_side_data(&pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); + if (pal) { + memcpy(pal, p_dec->fmt_in.video.p_palette->palette, AVPALETTE_SIZE); + p_sys->palette_sent = true; + } + } +#endif + /* Make sure we don't reuse the same timestamps twice */ p_block->i_pts = p_block->i_dts = VLC_TS_INVALID; _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits