Commit 57846458 authored by Rafaël Carré's avatar Rafaël Carré

avcodec: transmit palette to libavcodec >= 54

parent 8972e11e
...@@ -77,7 +77,7 @@ struct decoder_sys_t ...@@ -77,7 +77,7 @@ struct decoder_sys_t
#if LIBAVCODEC_VERSION_MAJOR < 54 #if LIBAVCODEC_VERSION_MAJOR < 54
AVPaletteControl palette; AVPaletteControl palette;
#else #else
# warning FIXME bool palette_sent;
#endif #endif
/* */ /* */
...@@ -389,7 +389,13 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -389,7 +389,13 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
p_sys->p_context->palctrl = &p_sys->palette; p_sys->p_context->palctrl = &p_sys->palette;
} }
#else #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 #endif
/* ***** init this codec with special data ***** */ /* ***** init this codec with special data ***** */
...@@ -557,6 +563,17 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block ) ...@@ -557,6 +563,17 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
pkt.pts = p_block->i_pts; pkt.pts = p_block->i_pts;
pkt.dts = p_block->i_dts; 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 */ /* Make sure we don't reuse the same timestamps twice */
p_block->i_pts = p_block->i_pts =
p_block->i_dts = VLC_TS_INVALID; p_block->i_dts = VLC_TS_INVALID;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment