Commit 14dd917d authored by Laurent Aimar's avatar Laurent Aimar

Removed unused or redondant fields from subpicture.

I removed:
 i_x/i_y: redondant with region i_x/i_y. Now a subpicture always represent the
 whole video.
 i_flags: unused anywhere in the core.

 I may have broken a few video filters (osdmenu mainly). I will fix it if you
report the problem and the way to reproduce it.
parent 3318cf72
......@@ -353,14 +353,11 @@ struct subpicture_t
* changed by the video output thread, or simply ignored depending of the
* subtitle type. */
/**@{*/
int i_x; /**< offset from alignment position */
int i_y; /**< offset from alignment position */
int i_alpha; /**< transparency */
int i_original_picture_width; /**< original width of the movie */
int i_original_picture_height;/**< original height of the movie */
bool b_absolute; /**< position is absolute */
int i_flags; /**< position flags */
bool b_subtitle; /**< the picture is a movie subtitle */
bool b_absolute; /**< position is absolute */
int i_alpha; /**< transparency */
/**@}*/
/** Pointer to function that renders this subtitle in a picture */
......
......@@ -357,8 +357,8 @@ static subpicture_t *Subtitle( decoder_t *p_dec, char *psz_subtitle, char *psz_h
/* Decode and format the subpicture unit */
/* Normal text subs, easy markup */
p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM;// | SUBPICTURE_ALIGN_LEFT;// | p_sys->i_align;
p_spu->i_x = 0; //p_sys->i_align ? 20 : 0;
p_spu->i_y = 10;
p_spu->p_region->i_x = 0; //p_sys->i_align ? 20 : 0;
p_spu->p_region->i_y = 10;
p_spu->p_region->psz_text = psz_subtitle;
p_spu->p_region->psz_html = psz_html;
......
......@@ -204,8 +204,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer,
p_block->i_buffer );
p_spu->i_x = 0;
p_spu->i_y = 0;
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length;
p_spu->b_ephemer = false;
......
......@@ -504,9 +504,6 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
p_spu = p_dec->pf_spu_buffer_new( p_dec );
if( !p_spu ) return NULL;
p_spu->i_x = p_sys->i_x_start;
p_spu->i_x = p_spu->i_x * 3 / 4; /* FIXME: use aspect ratio for x? */
p_spu->i_y = p_sys->i_y_start;
p_spu->i_start = p_data->i_pts;
p_spu->i_stop = p_data->i_pts + p_sys->i_duration;
p_spu->b_ephemer = true;
......@@ -526,7 +523,9 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
}
p_spu->p_region = p_region;
p_region->i_x = p_region->i_y = 0;
p_region->i_x = p_sys->i_x_start;
p_region->i_x = p_region->i_x * 3 / 4; /* FIXME: use aspect ratio for x? */
p_region->i_y = p_sys->i_y_start;
/* Build palette */
fmt.p_palette->i_entries = 4;
......
......@@ -1446,10 +1446,42 @@ static subpicture_t *render( decoder_t *p_dec )
subpicture_t *p_spu;
subpicture_region_t **pp_spu_region;
int i, j, i_timeout = 0;
int i_base_x;
int i_base_y;
/* Allocate the subpicture internal data. */
p_spu = p_dec->pf_spu_buffer_new( p_dec );
if( !p_spu ) return NULL;
if( !p_spu )
return NULL;
p_spu->b_absolute = p_sys->b_absolute;
/* Set the pf_render callback */
p_spu->i_start = (mtime_t) p_sys->i_pts;
//p_spu->i_stop = (mtime_t) 0;
p_spu->b_ephemer = true;
//p_spu->b_fade = true;
//p_spu->i_stop = p_spu->i_start + (mtime_t) (i_timeout * 1000000);
/* Correct positioning of SPU */
i_base_x = p_sys->i_spu_x;
i_base_y = p_sys->i_spu_y;
p_spu->i_original_picture_width = 720;
p_spu->i_original_picture_height = 576;
if( p_sys->p_display )
{
p_spu->i_original_picture_width = p_sys->p_display->i_width;
p_spu->i_original_picture_height = p_sys->p_display->i_height;
if( p_sys->p_display->b_windowed )
{
/* TODO: check that this actually works */
p_spu->i_original_picture_width = p_sys->p_display->i_max_x - p_sys->p_display->i_x;
p_spu->i_original_picture_height = p_sys->p_display->i_max_y - p_sys->p_display->i_y;
i_base_x += p_sys->p_display->i_x;
i_base_y += p_sys->p_display->i_y;
}
}
pp_spu_region = &p_spu->p_region;
......@@ -1519,8 +1551,8 @@ static subpicture_t *render( decoder_t *p_dec )
msg_Err( p_dec, "cannot allocate SPU region" );
continue;
}
p_spu_region->i_x = p_regiondef->i_x;
p_spu_region->i_y = p_regiondef->i_y;
p_spu_region->i_x = i_base_x + p_regiondef->i_x;
p_spu_region->i_y = i_base_y + p_regiondef->i_y;
p_spu_region->i_align = p_sys->i_spu_position;
*pp_spu_region = p_spu_region;
pp_spu_region = &p_spu_region->p_next;
......@@ -1574,43 +1606,14 @@ static subpicture_t *render( decoder_t *p_dec )
}
p_spu_region->psz_text = strdup( p_object_def->psz_text );
p_spu_region->i_x = p_regiondef->i_x + p_object_def->i_x;
p_spu_region->i_y = p_regiondef->i_y + p_object_def->i_y;
p_spu_region->i_x = i_base_x + p_regiondef->i_x + p_object_def->i_x;
p_spu_region->i_y = i_base_y + p_regiondef->i_y + p_object_def->i_y;
p_spu_region->i_align = p_sys->i_spu_position;
*pp_spu_region = p_spu_region;
pp_spu_region = &p_spu_region->p_next;
}
}
/* Set the pf_render callback */
p_spu->i_start = (mtime_t) p_sys->i_pts;
//p_spu->i_stop = (mtime_t) 0;
p_spu->b_ephemer = true;
//p_spu->b_fade = true;
//p_spu->i_stop = p_spu->i_start + (mtime_t) (i_timeout * 1000000);
/* Correct positioning of SPU */
p_spu->b_absolute = p_sys->b_absolute;
p_spu->i_x = p_sys->i_spu_x;
p_spu->i_y = p_sys->i_spu_y;
p_spu->i_original_picture_width = 720;
p_spu->i_original_picture_height = 576;
if( p_sys->p_display )
{
p_spu->i_original_picture_width = p_sys->p_display->i_width;
p_spu->i_original_picture_height = p_sys->p_display->i_height;
if( p_sys->p_display->b_windowed )
{
/* TODO: check that this actually works */
p_spu->i_original_picture_width = p_sys->p_display->i_max_x - p_sys->p_display->i_x;
p_spu->i_original_picture_height = p_sys->p_display->i_max_y - p_sys->p_display->i_y;
p_spu->i_x += p_sys->p_display->i_x;
p_spu->i_y += p_sys->p_display->i_y;
}
}
return p_spu;
}
......@@ -2092,8 +2095,8 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
}
else
{
bs_write( s, 16, p_subpic->i_x + p_region->i_x );
bs_write( s, 16, p_subpic->i_y + p_region->i_y );
bs_write( s, 16, p_region->i_x );
bs_write( s, 16, p_region->i_y );
}
}
}
......
......@@ -272,8 +272,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
memcpy( p_spu->p_sys->p_subs_data, p_block->p_buffer,
p_block->i_buffer );
p_spu->i_x = 0;
p_spu->i_y = 0;
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length;
p_spu->b_ephemer = true;
......
......@@ -44,6 +44,8 @@ typedef struct
{
int i_width;
int i_height;
int i_x;
int i_y;
} spu_properties_t;
static int ParseControlSeq( decoder_t *, subpicture_t *, subpicture_data_t *,
......@@ -277,15 +279,15 @@ static int ParseControlSeq( decoder_t *p_dec, subpicture_t *p_spu,
return VLC_EGENERIC;
}
p_spu->i_x = (p_sys->buffer[i_index+1]<<4)|
p_spu_properties->i_x = (p_sys->buffer[i_index+1]<<4)|
((p_sys->buffer[i_index+2]>>4)&0x0f);
p_spu_properties->i_width = (((p_sys->buffer[i_index+2]&0x0f)<<8)|
p_sys->buffer[i_index+3]) - p_spu->i_x + 1;
p_sys->buffer[i_index+3]) - p_spu_properties->i_x + 1;
p_spu->i_y = (p_sys->buffer[i_index+4]<<4)|
p_spu_properties->i_y = (p_sys->buffer[i_index+4]<<4)|
((p_sys->buffer[i_index+5]>>4)&0x0f);
p_spu_properties->i_height = (((p_sys->buffer[i_index+5]&0x0f)<<8)|
p_sys->buffer[i_index+6]) - p_spu->i_y + 1;
p_sys->buffer[i_index+6]) - p_spu_properties->i_y + 1;
/* Auto crop fullscreen subtitles */
if( p_spu_properties->i_height > 250 )
......@@ -672,8 +674,8 @@ static void Render( decoder_t *p_dec, subpicture_t *p_spu,
return;
}
p_spu->p_region->i_x = 0;
p_spu->p_region->i_y = p_spu_data->i_y_top_offset;
p_spu->p_region->i_x = p_spu_properties->i_x;
p_spu->p_region->i_y = p_spu_properties->i_y + p_spu_data->i_y_top_offset;
p_p = p_spu->p_region->picture.p->p_pixels;
i_pitch = p_spu->p_region->picture.p->i_pitch;
......
......@@ -127,8 +127,8 @@ void ParseSSAString( decoder_t *p_dec,
if( p_style == NULL )
{
p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
p_spu->i_x = p_sys->i_align ? 20 : 0;
p_spu->i_y = 10;
p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
p_spu->p_region->i_y = 10;
}
else
{
......@@ -137,13 +137,13 @@ void ParseSSAString( decoder_t *p_dec,
p_spu->p_region->i_align = p_style->i_align;
if( p_style->i_align & SUBPICTURE_ALIGN_LEFT )
{
p_spu->i_x = (i_margin_l) ? i_margin_l : p_style->i_margin_h;
p_spu->p_region->i_x = (i_margin_l) ? i_margin_l : p_style->i_margin_h;
}
else if( p_style->i_align & SUBPICTURE_ALIGN_RIGHT )
{
p_spu->i_x = (i_margin_r) ? i_margin_r : p_style->i_margin_h;
p_spu->p_region->i_x = (i_margin_r) ? i_margin_r : p_style->i_margin_h;
}
p_spu->i_y = (i_margin_v) ? i_margin_v : p_style->i_margin_v;
p_spu->p_region->i_y = (i_margin_v) ? i_margin_v : p_style->i_margin_v;
}
}
......
......@@ -427,8 +427,8 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
{
/* Normal text subs, easy markup */
p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
p_spu->i_x = p_sys->i_align ? 20 : 0;
p_spu->i_y = 10;
p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
p_spu->p_region->i_y = 10;
/* Remove formatting from string */
......@@ -616,8 +616,8 @@ static char *CreateHtmlSubtitle( int *pi_align, char *psz_subtitle )
/* Check for forced alignment */
if( !strncmp( psz_subtitle, "{\\an", 4 ) && psz_subtitle[4] >= '1' && psz_subtitle[4] <= '9' && psz_subtitle[5] == '}' )
{
static const pi_vertical[3] = { SUBPICTURE_ALIGN_BOTTOM, 0, SUBPICTURE_ALIGN_TOP };
static const pi_horizontal[3] = { SUBPICTURE_ALIGN_LEFT, 0, SUBPICTURE_ALIGN_RIGHT };
static const int pi_vertical[3] = { SUBPICTURE_ALIGN_BOTTOM, 0, SUBPICTURE_ALIGN_TOP };
static const int pi_horizontal[3] = { SUBPICTURE_ALIGN_LEFT, 0, SUBPICTURE_ALIGN_RIGHT };
const int i_id = psz_subtitle[4] - '1';
*pi_align = pi_vertical[i_id/3] | pi_horizontal[i_id%3];
......
......@@ -473,8 +473,6 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
p_spu = p_dec->pf_spu_buffer_new( p_dec );
if( !p_spu ) return NULL;
p_spu->i_x = p_sys->i_x_start;
p_spu->i_y = p_sys->i_y_start;
p_spu->i_start = p_data->i_pts;
p_spu->i_stop = p_data->i_pts + p_sys->i_duration;
p_spu->b_ephemer = true;
......@@ -506,7 +504,8 @@ static subpicture_t *DecodePacket( decoder_t *p_dec, block_t *p_data )
p_region->fmt.i_aspect = VOUT_ASPECT_FACTOR;
p_spu->p_region = p_region;
p_region->i_x = p_region->i_y = 0;
p_region->i_x = p_sys->i_x_start;
p_region->i_y = p_sys->i_y_start;
/* Build palette */
fmt.p_palette->i_entries = 4;
......
......@@ -717,10 +717,10 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
/* Normal text subs, easy markup */
p_spu->p_region->i_align = SUBPICTURE_ALIGN_BOTTOM | p_sys->i_align;
p_spu->i_x = p_sys->i_align ? 20 : 0;
p_spu->i_y = 10;
p_spu->p_region->i_x = p_sys->i_align ? 20 : 0;
p_spu->p_region->i_y = 10;
p_spu->p_region->psz_text = strdup(psz_text);
p_spu->i_start = p_block->i_pts;
p_spu->i_stop = p_block->i_pts + p_block->i_length;
p_spu->b_ephemer = (p_block->i_length == 0);
......
......@@ -495,9 +495,6 @@ static subpicture_t *Subpicture( decoder_t *p_dec, video_format_t *p_fmt,
p_spu->p_region->i_y = 0;
p_spu->p_region->i_align = i_align;
/* Normal text subs, easy markup */
p_spu->i_flags = SUBPICTURE_ALIGN_BOTTOM;
p_spu->i_start = i_pts;
p_spu->i_stop = 0;
p_spu->b_ephemer = true;
......
......@@ -337,9 +337,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
return NULL;
}
p_spu->i_flags = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
p_spu->i_x = 0;
p_spu->i_y = 0;
p_spu->b_absolute = true;
p_spu->i_start = date;
p_spu->i_stop = 0;
......
......@@ -888,8 +888,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->b_absolute = false;
}
p_spu->i_x = p_sys->posx;
p_spu->i_y = p_sys->posy;
p_region->i_x = p_sys->posx;
p_region->i_y = p_sys->posy;
p_spu->p_region = p_region;
......
......@@ -317,8 +317,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->b_absolute = false;
}
p_spu->i_x = p_sys->i_xoff;
p_spu->i_y = p_sys->i_yoff;
p_spu->p_region->i_x = p_sys->i_xoff;
p_spu->p_region->i_y = p_sys->i_yoff;
p_spu->p_region->p_style = p_sys->p_style;
......
......@@ -458,7 +458,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->i_stop = 0;
p_spu->b_ephemer = true;
p_spu->i_alpha = p_sys->i_alpha;
p_spu->i_flags = p_sys->i_align;
p_spu->b_absolute = false;
vlc_mutex_lock( &p_sys->lock );
......
......@@ -451,6 +451,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
filter_sys_t *p_sys = p_filter->p_sys;
subpicture_t *p_spu = NULL;
subpicture_region_t *p_region = NULL;
int i_x, i_y;
if( !p_sys->b_update || (p_sys->i_update <= 0) )
return NULL;
......@@ -472,7 +473,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
p_spu->b_absolute = true;
else
p_spu->b_absolute = p_sys->b_absolute;
p_spu->i_flags = p_sys->i_position;
/* Determine the duration of the subpicture */
if( p_sys->i_end_date > 0 )
......@@ -505,8 +505,11 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
NULL );
/* proper positioning of OSD menu image */
p_spu->i_x = p_filter->p_sys->p_menu->p_state->i_x;
p_spu->i_y = p_filter->p_sys->p_menu->p_state->i_y;
p_region->i_x = p_filter->p_sys->p_menu->p_state->i_x;
p_region->i_y = p_filter->p_sys->p_menu->p_state->i_y;
/* FIXME is it needed ?
p_region->i_align = p_sys->i_position;
*/
p_spu->p_region = p_region;
p_spu->i_alpha = 0xFF; /* Picture is completely non transparent. */
return p_spu;
......@@ -535,14 +538,16 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
/* proper positioning of OSD menu image */
if( p_filter->p_sys->p_menu->i_style == OSD_MENU_STYLE_CONCAT )
{
p_spu->i_x = p_filter->p_sys->p_menu->p_button->i_x;
p_spu->i_y = p_filter->p_sys->p_menu->p_button->i_y;
i_x = p_filter->p_sys->p_menu->p_button->i_x;
i_y = p_filter->p_sys->p_menu->p_button->i_y;
}
else
{
p_spu->i_x = p_filter->p_sys->p_menu->p_state->i_x;
p_spu->i_y = p_filter->p_sys->p_menu->p_state->i_y;
i_x = p_filter->p_sys->p_menu->p_state->i_x;
i_y = p_filter->p_sys->p_menu->p_state->i_y;
}
p_region->i_x = i_x;
p_region->i_y = i_y;
if( p_filter->p_sys->p_menu->i_style == OSD_MENU_STYLE_CONCAT )
{
......@@ -582,8 +587,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t i_date )
}
else
{
p_new->i_x = p_region_tail->fmt.i_visible_width;
p_new->i_y = p_button->i_y;
p_new->i_x = i_x+p_region_tail->fmt.i_visible_width;
p_new->i_y = i_y+p_button->i_y;
p_region_tail->p_next = p_new;
p_region_tail = p_new;
}
......
......@@ -1182,8 +1182,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->b_absolute = false;
p_spu->i_x = 0;
p_spu->i_y = 0;
p_spu->i_original_picture_width = 0; /*Let vout core do the horizontal scaling */
p_spu->i_original_picture_height = fmt.i_height;
......
......@@ -530,9 +530,6 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->b_absolute = false;
}
p_spu->i_x = p_sys->i_xoff;
p_spu->i_y = p_sys->i_yoff;
p_spu->p_region->p_style = p_sys->p_style;
if( p_feed->p_pic )
......@@ -558,6 +555,8 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
}
else
{
p_region->i_x = p_sys->i_xoff;
p_region->i_y = p_sys->i_yoff;
vout_CopyPicture( p_filter, &p_region->picture, p_pic );
p_spu->p_region->p_next = p_region;
}
......
......@@ -127,44 +127,10 @@ int mediacontrol_showtext( vout_thread_t *p_vout, int i_channel,
int i_flags, int i_hmargin, int i_vmargin,
mtime_t i_start, mtime_t i_stop )
{
subpicture_t *p_spu;
video_format_t fmt;
if( !psz_string ) return VLC_EGENERIC;
p_spu = spu_CreateSubpicture( p_vout->p_spu );
if( !p_spu ) return VLC_EGENERIC;
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_FOURCC('T','E','X','T');
fmt.i_aspect = 0;
fmt.i_width = fmt.i_height = 0;
fmt.i_x_offset = fmt.i_y_offset = 0;
p_spu->p_region = p_spu->pf_create_region( VLC_OBJECT(p_vout), &fmt );
if( !p_spu->p_region )
{
msg_Err( p_vout, "cannot allocate SPU region" );
spu_DestroySubpicture( p_vout->p_spu, p_spu );
return VLC_EGENERIC;
}
p_spu->p_region->psz_text = strdup( psz_string );
p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK;
p_spu->p_region->p_style = p_style;
p_spu->i_start = i_start;
p_spu->i_stop = i_stop;
p_spu->b_ephemer = false;
p_spu->b_absolute = false;
p_spu->i_x = i_hmargin;
p_spu->i_y = i_vmargin;
p_spu->i_flags = i_flags & ~SUBPICTURE_ALIGN_MASK;
p_spu->i_channel = i_channel;
spu_DisplaySubpicture( p_vout->p_spu, p_spu );
return VLC_SUCCESS;
return osd_ShowTextAbsolute( p_vout->p_spu, i_channel,
psz_string, p_style,
i_flags, i_hmargin, i_vmargin,
i_start, i_stop );
}
......
......@@ -79,7 +79,14 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
if( !psz_string ) return VLC_EGENERIC;
p_spu = spu_CreateSubpicture( p_spu_channel );
if( !p_spu ) return VLC_EGENERIC;
if( !p_spu )
return VLC_EGENERIC;
p_spu->i_channel = i_channel;
p_spu->i_start = i_start;
p_spu->i_stop = i_stop;
p_spu->b_ephemer = true;
p_spu->b_absolute = false;
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
......@@ -97,15 +104,8 @@ int osd_ShowTextAbsolute( spu_t *p_spu_channel, int i_channel,
p_spu->p_region->psz_text = strdup( psz_string );
p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK;
p_spu->i_start = i_start;
p_spu->i_stop = i_stop;
p_spu->b_ephemer = true;
p_spu->b_absolute = false;
p_spu->i_x = i_hmargin;
p_spu->i_y = i_vmargin;
p_spu->i_flags = i_flags & ~SUBPICTURE_ALIGN_MASK;
p_spu->i_channel = i_channel;
p_spu->p_region->i_x = i_hmargin;
p_spu->p_region->i_y = i_vmargin;
spu_DisplaySubpicture( p_spu_channel, p_spu );
......
......@@ -81,7 +81,16 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
if( !psz_string ) return VLC_EGENERIC;
p_spu = spu_CreateSubpicture( p_vout->p_spu );
if( !p_spu ) return VLC_EGENERIC;
if( !p_spu )
return VLC_EGENERIC;
p_spu->i_channel = i_channel;
p_spu->i_start = i_start;
p_spu->i_stop = i_stop;
p_spu->b_ephemer = true;
p_spu->b_absolute = false;
p_spu->b_fade = true;
/* Create a new subpicture region */
memset( &fmt, 0, sizeof(video_format_t) );
......@@ -99,16 +108,8 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
p_spu->p_region->psz_text = strdup( psz_string );
p_spu->p_region->i_align = i_flags & SUBPICTURE_ALIGN_MASK;
p_spu->i_start = i_start;
p_spu->i_stop = i_stop;
p_spu->b_ephemer = true;
p_spu->b_absolute = false;
p_spu->b_fade = true;
p_spu->i_x = i_hmargin;
p_spu->i_y = i_vmargin;
p_spu->i_flags = i_flags & ~SUBPICTURE_ALIGN_MASK;
p_spu->i_channel = i_channel;
p_spu->p_region->i_x = i_hmargin;
p_spu->p_region->i_y = i_vmargin;
spu_DisplaySubpicture( p_vout->p_spu, p_spu );
......
......@@ -660,20 +660,10 @@ static void SpuRegionPlace( int *pi_x, int *pi_y,
const video_format_t *p_fmt,
const subpicture_t *p_subpic,
const subpicture_region_t *p_region,
int i_subpic_x,
int i_inv_scale_x, int i_inv_scale_y,
int i_scale_width, int i_scale_height )
int i_inv_scale_x, int i_inv_scale_y )
{
/* FIXME i_delta_x/y and i_x/y in absolute mode does not use the same
* it seems weird unless I missed something
* At this point we have:
* i_subpic_x == p_subpic->i_x * i_scale_width / SCALE_UNIT
* p_region->i_x/i_y have already been scaled by i_scale_width/i_scale_height.
* */
int i_delta_x = ( i_subpic_x + p_region->i_x ) *
i_inv_scale_x / SCALE_UNIT;
int i_delta_y = ( p_subpic->i_y + p_region->i_y ) *
i_inv_scale_y / SCALE_UNIT;
int i_delta_x = p_region->i_x * i_inv_scale_x / SCALE_UNIT;
int i_delta_y = p_region->i_y * i_inv_scale_y / SCALE_UNIT;
int i_x, i_y;
if( p_region->i_align & SUBPICTURE_ALIGN_TOP )
......@@ -704,10 +694,8 @@ static void SpuRegionPlace( int *pi_x, int *pi_y,
if( p_subpic->b_absolute )
{
i_x = (p_region->i_x + i_subpic_x * i_scale_width / SCALE_UNIT) *
i_inv_scale_x / SCALE_UNIT;
i_y = (p_region->i_y + p_subpic->i_y * i_scale_height / SCALE_UNIT) *
i_inv_scale_y / SCALE_UNIT;
i_x = i_delta_x;
i_y = i_delta_y;
}
*pi_x = __MAX( i_x, 0 );
......@@ -718,7 +706,6 @@ static void SpuRenderRegion( spu_t *p_spu,
picture_t *p_pic_dst,
subpicture_t *p_subpic, subpicture_region_t *p_region,
const int i_scale_width_orig, const int i_scale_height_orig,
const int pi_subpic_x[SCALE_SIZE],
const int pi_scale_width[SCALE_SIZE],
const int pi_scale_height[SCALE_SIZE],
const video_format_t *p_fmt )
......@@ -869,9 +856,8 @@ static void SpuRenderRegion( spu_t *p_spu,
/* */
SpuRegionPlace( &i_x_offset, &i_y_offset,
p_fmt, p_subpic, p_region, pi_subpic_x[i_scale_idx],
i_inv_scale_x, i_inv_scale_y,
pi_scale_width[i_scale_idx], pi_scale_height[i_scale_idx] );
p_fmt, p_subpic, p_region,
i_inv_scale_x, i_inv_scale_y );
if( p_spu->i_margin != 0 && !b_force_crop )