[vlc-commits] avcodec: transmit palette to libavcodec >= 54
Rafaël Carré
git at videolan.org
Fri Oct 18 21:29:41 CEST 2013
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Fri Oct 18 21:17:29 2013 +0200| [5784645841b78dc7f5bcb799db4ed66c519e0ec9] | committer: Rafaël Carré
avcodec: transmit palette to libavcodec >= 54
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5784645841b78dc7f5bcb799db4ed66c519e0ec9
---
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 5ac682f..3098ab9 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -77,7 +77,7 @@ struct decoder_sys_t
#if LIBAVCODEC_VERSION_MAJOR < 54
AVPaletteControl palette;
#else
-# warning FIXME
+ bool palette_sent;
#endif
/* */
@@ -389,7 +389,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 ***** */
@@ -557,6 +563,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;
More information about the vlc-commits
mailing list