Commit e6f5e48c authored by Mark Moriarty's avatar Mark Moriarty
Browse files

time/marq -- correct positioning so that x-y are always referenced to upper left corner

parent f5da6786
...@@ -69,7 +69,6 @@ struct filter_sys_t ...@@ -69,7 +69,6 @@ struct filter_sys_t
int i_font_color, i_font_opacity, i_font_size; /* font control */ int i_font_color, i_font_opacity, i_font_size; /* font control */
time_t last_time; time_t last_time;
vlc_bool_t b_absolute; /* position control, relative vs. absolute */
vlc_bool_t b_need_update; vlc_bool_t b_need_update;
}; };
...@@ -239,16 +238,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) ...@@ -239,16 +238,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
return NULL; return NULL;
} }
p_sys->b_absolute = VLC_TRUE;
if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
{
p_sys->b_absolute = VLC_FALSE;
}
p_spu = p_filter->pf_sub_buffer_new( p_filter ); p_spu = p_filter->pf_sub_buffer_new( p_filter );
if( !p_spu ) return NULL; if( !p_spu ) return NULL;
p_spu->b_absolute = p_sys->b_absolute;
memset( &fmt, 0, sizeof(video_format_t) ); memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_FOURCC('T','E','X','T'); fmt.i_chroma = VLC_FOURCC('T','E','X','T');
fmt.i_aspect = 0; fmt.i_aspect = 0;
...@@ -268,13 +260,26 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) ...@@ -268,13 +260,26 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->i_start = date; p_spu->i_start = date;
p_spu->i_stop = p_sys->i_timeout == 0 ? 0 : date + p_sys->i_timeout * 1000; p_spu->i_stop = p_sys->i_timeout == 0 ? 0 : date + p_sys->i_timeout * 1000;
p_spu->b_ephemer = VLC_TRUE; p_spu->b_ephemer = VLC_TRUE;
/* where to locate the string: */
if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
{ /* set to one of the 9 relative locations */
p_spu->i_flags = p_sys->i_pos;
p_spu->i_x = 0;
p_spu->i_y = 0;
p_spu->b_absolute = VLC_FALSE;
}
else
{ /* set to an absolute xy, referenced to upper left corner */
p_spu->i_flags = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
p_spu->i_x = p_sys->i_xoff; p_spu->i_x = p_sys->i_xoff;
p_spu->i_y = p_sys->i_yoff; p_spu->i_y = p_sys->i_yoff;
p_spu->b_absolute = VLC_TRUE;
}
p_spu->p_region->i_font_color = p_sys->i_font_color; p_spu->p_region->i_font_color = p_sys->i_font_color;
p_spu->p_region->i_font_opacity = p_sys->i_font_opacity; p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;
p_spu->p_region->i_font_size = p_sys->i_font_size; p_spu->p_region->i_font_size = p_sys->i_font_size;
p_spu->i_flags = p_sys->i_pos;
p_sys->b_need_update = VLC_FALSE; p_sys->b_need_update = VLC_FALSE;
return p_spu; return p_spu;
......
...@@ -62,7 +62,6 @@ struct filter_sys_t ...@@ -62,7 +62,6 @@ struct filter_sys_t
char *psz_format; /* time format string */ char *psz_format; /* time format string */
int i_pos; /* permit relative positioning (top, bottom, left, right, center) */ int i_pos; /* permit relative positioning (top, bottom, left, right, center) */
int i_font_color, i_font_opacity, i_font_size; /* font control */ int i_font_color, i_font_opacity, i_font_size; /* font control */
vlc_bool_t b_absolute; /* position control, relative vs. absolute */
time_t last_time; time_t last_time;
}; };
...@@ -127,7 +126,6 @@ static int CreateFilter( vlc_object_t *p_this ) ...@@ -127,7 +126,6 @@ static int CreateFilter( vlc_object_t *p_this )
filter_t *p_filter = (filter_t *)p_this; filter_t *p_filter = (filter_t *)p_this;
filter_sys_t *p_sys; filter_sys_t *p_sys;
vlc_object_t *p_input; vlc_object_t *p_input;
vlc_value_t val;
/* Allocate structure */ /* Allocate structure */
p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) ); p_sys = p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
...@@ -233,16 +231,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) ...@@ -233,16 +231,9 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
if( p_sys->last_time == time( NULL ) ) return NULL; if( p_sys->last_time == time( NULL ) ) return NULL;
p_sys->b_absolute = VLC_TRUE;
if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
{
p_sys->b_absolute = VLC_FALSE;
}
p_spu = p_filter->pf_sub_buffer_new( p_filter ); p_spu = p_filter->pf_sub_buffer_new( p_filter );
if( !p_spu ) return NULL; if( !p_spu ) return NULL;
p_spu->b_absolute = p_sys->b_absolute;
memset( &fmt, 0, sizeof(video_format_t) ); memset( &fmt, 0, sizeof(video_format_t) );
fmt.i_chroma = VLC_FOURCC('T','E','X','T'); fmt.i_chroma = VLC_FOURCC('T','E','X','T');
fmt.i_aspect = 0; fmt.i_aspect = 0;
...@@ -262,15 +253,26 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date ) ...@@ -262,15 +253,26 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->i_start = date; p_spu->i_start = date;
p_spu->i_stop = 0; p_spu->i_stop = 0;
p_spu->b_ephemer = VLC_TRUE; p_spu->b_ephemer = VLC_TRUE;
/* where to locate the string: */
if( p_sys->i_xoff < 0 || p_sys->i_yoff < 0 )
{ /* set to one of the 9 relative locations */
p_spu->i_flags = p_sys->i_pos;
p_spu->i_x = 0;
p_spu->i_y = 0;
p_spu->b_absolute = VLC_FALSE; p_spu->b_absolute = VLC_FALSE;
}
else
{ /* set to an absolute xy, referenced to upper left corner */
p_spu->i_flags = OSD_ALIGN_LEFT | OSD_ALIGN_TOP;
p_spu->i_x = p_sys->i_xoff; p_spu->i_x = p_sys->i_xoff;
p_spu->i_y = p_sys->i_yoff; p_spu->i_y = p_sys->i_yoff;
p_spu->b_absolute = VLC_TRUE;
}
p_spu->p_region->i_font_color = p_sys->i_font_color; p_spu->p_region->i_font_color = p_sys->i_font_color;
p_spu->p_region->i_font_opacity = p_sys->i_font_opacity; p_spu->p_region->i_font_opacity = p_sys->i_font_opacity;
p_spu->p_region->i_font_size = p_sys->i_font_size; p_spu->p_region->i_font_size = p_sys->i_font_size;
p_spu->i_flags = p_sys->i_pos;
return p_spu; return p_spu;
} }
/********************************************************************** /**********************************************************************
......
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