Commit 24c25e99 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jean-Baptiste Kempf

avcodec: copy frame-based palette

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 1df0c915
......@@ -852,6 +852,19 @@ static void ffmpeg_CopyPicture( decoder_t *p_dec,
uint8_t *p_dst, *p_src;
int i_src_stride, i_dst_stride;
if( p_sys->p_context->pix_fmt == PIX_FMT_PAL8 )
{
if( !p_pic->format.p_palette )
{
p_pic->format.p_palette = calloc( 1, sizeof(video_palette_t) );
p_pic->format.p_palette->i_entries = 256;
}
if( p_pic->format.p_palette )
{
memcpy( p_pic->format.p_palette->palette, p_ff_pic->data[1], AVPALETTE_SIZE );
}
}
for( i_plane = 0; i_plane < p_pic->i_planes; i_plane++ )
{
p_src = p_ff_pic->data[i_plane];
......
......@@ -583,9 +583,13 @@ static void Convert( filter_t *p_filter, struct SwsContext *ctx,
GetPixels( src, src_stride, p_src, i_plane_start, i_plane_count, b_swap_uvi );
if( p_filter->fmt_in.video.i_chroma == VLC_CODEC_RGBP )
{
video_palette_t *src_pal =
p_src->format.p_palette ?
p_src->format.p_palette :
p_filter->fmt_in.video.p_palette;
memset( palette, 0, sizeof(palette) );
if( p_filter->fmt_in.video.p_palette )
memcpy( palette, p_filter->fmt_in.video.p_palette->palette,
if( src_pal )
memcpy( palette, src_pal->palette,
__MIN( sizeof(video_palette_t), AVPALETTE_SIZE ) );
src[1] = palette;
src_stride[1] = 4;
......
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