From 2ad5cc2ba9b397e6d8c3aa401ea3a054ff5634c5 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Thu, 6 Apr 2006 22:41:06 +0000 Subject: [PATCH] Fix OSD display when vout crop is used (so that every thing stays on the displayed image). --- include/vlc_osd.h | 4 ++-- include/vlc_symbols.h | 4 ++-- src/osd/osd_widgets.c | 11 ++++++++--- src/video_output/video_text.c | 6 +++++- src/video_output/video_widgets.c | 15 ++++++++++++--- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/include/vlc_osd.h b/include/vlc_osd.h index 99db0757db..9fda7077ba 100644 --- a/include/vlc_osd.h +++ b/include/vlc_osd.h @@ -468,8 +468,8 @@ VLC_EXPORT( void,osd_Message, ( spu_t *, int, char *, ... ) ); * object. The types are declared in the include file include/vlc_osd.h * @see vlc_osd.h */ -VLC_EXPORT( int, osd_Slider, ( vlc_object_t *, spu_t *, int, int, int, int, short ) ); -VLC_EXPORT( int, osd_Icon, ( vlc_object_t *, spu_t *, int, int, int, short ) ); +VLC_EXPORT( int, osd_Slider, ( vlc_object_t *, spu_t *, int, int, int, int, int, int, short ) ); +VLC_EXPORT( int, osd_Icon, ( vlc_object_t *, spu_t *, int, int, int, int, int, short ) ); /** * Loading and parse the OSD Configuration file diff --git a/include/vlc_symbols.h b/include/vlc_symbols.h index 3e306030a5..a9b95722c8 100644 --- a/include/vlc_symbols.h +++ b/include/vlc_symbols.h @@ -420,9 +420,9 @@ struct module_symbols_t void (*httpd_HandlerDelete_inner) (httpd_handler_t *); int (*__vlc_execve_inner) (vlc_object_t *p_object, int i_argc, char **pp_argv, char **pp_env, char *psz_cwd, char *p_in, int i_in, char **pp_data, int *pi_data); httpd_handler_t * (*httpd_HandlerNew_inner) (httpd_host_t *, const char *psz_url, const char *psz_user, const char *psz_password, const vlc_acl_t *p_acl, httpd_handler_callback_t pf_fill, httpd_handler_sys_t *); - int (*osd_Slider_inner) (vlc_object_t *, spu_t *, int, int, int, int, short); + int (*osd_Slider_inner) (vlc_object_t *, spu_t *, int, int, int, int, int, int, short); int (*osd_ShowTextRelative_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t); - int (*osd_Icon_inner) (vlc_object_t *, spu_t *, int, int, int, short); + int (*osd_Icon_inner) (vlc_object_t *, spu_t *, int, int, int, int, int, short); void (*osd_Message_inner) (spu_t *, int, char *, ...); int (*osd_ShowTextAbsolute_inner) (spu_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t); char * (*config_GetUserDir_inner) (void); diff --git a/src/osd/osd_widgets.c b/src/osd/osd_widgets.c index 2a508c1bcc..c89ad56c7b 100644 --- a/src/osd/osd_widgets.c +++ b/src/osd/osd_widgets.c @@ -213,6 +213,7 @@ subpicture_t *osd_CreateWidget( spu_t *p_spu, int i_channel ) *****************************************************************************/ int osd_Slider( vlc_object_t *p_this, spu_t *p_spu, int i_render_width, int i_render_height, + int i_margin_left, int i_margin_bottom, int i_channel, int i_position, short i_type ) { subpicture_t *p_subpic; @@ -225,7 +226,9 @@ int osd_Slider( vlc_object_t *p_this, spu_t *p_spu, } i_y_margin = i_render_height / 10; - i_x_margin = i_y_margin; + i_x_margin = i_y_margin + i_margin_left; + i_y_margin += i_margin_bottom; + if( i_type == OSD_HOR_SLIDER ) { i_width = i_render_width - 2 * i_x_margin; @@ -272,7 +275,8 @@ int osd_Slider( vlc_object_t *p_this, spu_t *p_spu, * Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON *****************************************************************************/ int osd_Icon( vlc_object_t *p_this, spu_t *p_spu, - int i_render_width, int i_render_height, int i_channel, short i_type ) + int i_render_width, int i_render_height, int i_margin_right, + int i_margin_top, int i_channel, short i_type ) { subpicture_t *p_subpic; int i_x_margin, i_y_margin, i_x, i_y, i_width, i_height; @@ -284,7 +288,8 @@ int osd_Icon( vlc_object_t *p_this, spu_t *p_spu, } i_y_margin = i_render_height / 15; - i_x_margin = i_y_margin; + i_x_margin = i_y_margin + i_margin_right; + i_y_margin += i_margin_top; i_width = i_render_width / 20; i_height = i_width; i_x = i_render_width - i_x_margin - i_width; diff --git a/src/video_output/video_text.c b/src/video_output/video_text.c index 3fcdc5b366..80a1b72946 100644 --- a/src/video_output/video_text.c +++ b/src/video_output/video_text.c @@ -129,7 +129,11 @@ void __vout_OSDMessage( vlc_object_t *p_caller, int i_channel, vasprintf( &psz_string, psz_format, args ); vout_ShowTextRelative( p_vout, i_channel, psz_string, NULL, - OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 ); + OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, + 30 + p_vout->fmt_in.i_width + - p_vout->fmt_in.i_visible_width + - p_vout->fmt_in.i_x_offset, + 20 + p_vout->fmt_in.i_y_offset, 1000000 ); vlc_object_release( p_vout ); free( psz_string ); diff --git a/src/video_output/video_widgets.c b/src/video_output/video_widgets.c index 1bd5189ca9..504c7d5ee8 100644 --- a/src/video_output/video_widgets.c +++ b/src/video_output/video_widgets.c @@ -44,7 +44,10 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position, if( p_vout && ( config_GetInt( p_caller, "osd" ) || ( i_position >= 0 ) ) ) { osd_Slider( p_caller, p_vout->p_spu, p_vout->render.i_width, - p_vout->render.i_height, i_channel, i_position, i_type ); + p_vout->render.i_height, p_vout->fmt_in.i_x_offset, + p_vout->fmt_in.i_height - p_vout->fmt_in.i_visible_height + - p_vout->fmt_in.i_y_offset, + i_channel, i_position, i_type ); } vlc_object_release( p_vout ); } @@ -62,8 +65,14 @@ void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type ) if( config_GetInt( p_caller, "osd" ) ) { - osd_Icon( p_caller, p_vout->p_spu, p_vout->render.i_width, - p_vout->render.i_height, i_channel, i_type ); + osd_Icon( p_caller, + p_vout->p_spu, + p_vout->render.i_width, + p_vout->render.i_height, + p_vout->fmt_in.i_width - p_vout->fmt_in.i_visible_width + - p_vout->fmt_in.i_x_offset, + p_vout->fmt_in.i_y_offset, + i_channel, i_type ); } vlc_object_release( p_vout ); } -- 2.39.5