Commit ac6a6b68 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Fix region width/height encoding bug. Dvbsub never tested for a change in...

Fix region width/height encoding bug. Dvbsub never tested for a change in region widht/height that made a region smaller then the previous one that was encoded. The encoded region size would always been the largest size encountered, this is now fixed. Removed some superflous whitespace/
parent a5b73abf
......@@ -685,7 +685,6 @@ static void decode_page_composition( decoder_t *p_dec, bs_t *s )
int i_version, i_state, i_segment_length, i_timeout, i;
/* A page is composed by 0 or more region */
i_segment_length = bs_read( s, 16 );
i_timeout = bs_read( s, 8 );
i_version = bs_read( s, 4 );
......@@ -814,6 +813,9 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s )
i_width = bs_read( s, 16 );
i_height = bs_read( s, 16 );
#ifdef DEBUG_DVBSUB
msg_Dbg( p_dec, " width=%d height=%d", i_width, i_height );
#endif
i_level_comp = bs_read( s, 3 );
i_depth = bs_read( s, 3 );
bs_skip( s, 2 ); /* Reserved */
......@@ -841,7 +843,7 @@ static void decode_region_composition( decoder_t *p_dec, bs_t *s )
{
if( p_region->p_pixbuf )
{
msg_Dbg( p_dec, "region size changed (not allowed)" );
msg_Dbg( p_dec, " changed (not allowed)" );
free( p_region->p_pixbuf );
}
......@@ -1904,8 +1906,10 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
p_sys->p_regions[p_sys->i_regions++] = region;
}
if( p_sys->p_regions[i_regions].i_width <
(int)p_region->fmt.i_visible_width )
if( ( p_sys->p_regions[i_regions].i_width <
(int)p_region->fmt.i_visible_width ) ||
( p_sys->p_regions[i_regions].i_width >
(int)p_region->fmt.i_visible_width ) )
{
b_mode_change = VLC_TRUE;
msg_Dbg( p_enc, "region %i width change: %i -> %i",
......@@ -1914,8 +1918,10 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
p_sys->p_regions[i_regions].i_width =
p_region->fmt.i_visible_width;
}
if( p_sys->p_regions[i_regions].i_height <
(int)p_region->fmt.i_visible_height )
if( ( p_sys->p_regions[i_regions].i_height <
(int)p_region->fmt.i_visible_height ) ||
( p_sys->p_regions[i_regions].i_height >
(int)p_region->fmt.i_visible_height ) )
{
b_mode_change = VLC_TRUE;
msg_Dbg( p_enc, "region %i height change: %i -> %i",
......
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