Commit 41cab40d authored by Jean-Paul Saman's avatar Jean-Paul Saman

Also allow an empty palette marked with palette.i_entries = 0

parent 39cc95b6
...@@ -1795,14 +1795,20 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic ) ...@@ -1795,14 +1795,20 @@ static block_t *Encode( encoder_t *p_enc, subpicture_t *p_subpic )
if( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') && if( p_region->fmt.i_chroma != VLC_FOURCC('T','E','X','T') &&
p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') ) return NULL; p_region->fmt.i_chroma != VLC_FOURCC('Y','U','V','P') ) return NULL;
if( p_region->fmt.p_palette && if( p_region->fmt.p_palette )
( p_region->fmt.p_palette->i_entries != 4 ) &&
( p_region->fmt.p_palette->i_entries != 16 ) &&
( p_region->fmt.p_palette->i_entries != 256 ) )
{ {
msg_Err( p_enc, "subpicture palette (%d) not handled", switch( p_region->fmt.p_palette->i_entries )
p_region->fmt.p_palette->i_entries ); {
return NULL; case 0:
case 4:
case 16:
case 256:
break;
default:
msg_Err( p_enc, "subpicture palette (%d) not handled",
p_region->fmt.p_palette->i_entries );
return NULL;
}
} }
/* End of hack */ /* End of hack */
...@@ -2187,6 +2193,9 @@ static void encode_pixel_data( encoder_t *p_enc, bs_t *s, ...@@ -2187,6 +2193,9 @@ static void encode_pixel_data( encoder_t *p_enc, bs_t *s,
{ {
switch( p_region->fmt.p_palette->i_entries ) switch( p_region->fmt.p_palette->i_entries )
{ {
case 0:
break;
case 4: case 4:
bs_write( s, 8, 0x10 ); /* 2 bit/pixel code string */ bs_write( s, 8, 0x10 ); /* 2 bit/pixel code string */
encode_pixel_line_2bp( p_enc, s, p_region, i_line ); encode_pixel_line_2bp( p_enc, s, p_region, i_line );
......
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