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

Show title on video output based on users preferences. Defaults...

Show title on video output based on users preferences. Defaults are:--video-title-show --video-title-position=8 --video-title-timeout=5000
parent f075fa60
......@@ -496,6 +496,11 @@ struct vout_thread_t
/* Video output configuration */
config_chain_t *p_cfg;
/* Show media title on videoutput */
vlc_bool_t b_title_show;
mtime_t i_title_timeout;
int i_title_position;
};
#define I_OUTPUTPICTURES p_vout->output.i_pictures
......
......@@ -303,6 +303,23 @@ static const char *ppsz_align_descriptions[] =
#define VIDEO_ON_TOP_LONGTEXT N_( \
"Always place the video window on top of other windows." )
#define VIDEO_TITLE_SHOW_TEXT N_("Show media title on video.")
#define VIDEO_TITLE_SHOW_LONGTEXT N_( \
"Display the title of the video on top of the movie.")
#define VIDEO_TITLE_TIMEOUT_TEXT N_("Show video title for x miliseconds.")
#define VIDEO_TITLE_TIMEOUT_LONGTEXT N_( \
"Show the video title for n miliseconds, default is 5000 ms (5 sec.)")
#define VIDEO_TITLE_POSITION_TEXT N_("Position of video title.")
#define VIDEO_TITLE_POSITION_LONGTEXT N_( \
"Place on video where to display the title (default bottom center).")
static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 };
static const char *ppsz_pos_descriptions[] =
{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"),
N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") };
#define SS_TEXT N_("Disable screensaver")
#define SS_LONGTEXT N_("Disable the screensaver during video playback." )
......@@ -1310,6 +1327,14 @@ vlc_module_begin();
add_bool( "disable-screensaver", VLC_TRUE, NULL, SS_TEXT, SS_LONGTEXT,
VLC_TRUE );
add_bool( "video-title-show", 1, NULL, VIDEO_TITLE_SHOW_TEXT,
VIDEO_TITLE_SHOW_LONGTEXT, VLC_FALSE );
add_integer( "video-title-timeout", 5000, NULL, VIDEO_TITLE_TIMEOUT_TEXT,
VIDEO_TITLE_TIMEOUT_LONGTEXT, VLC_FALSE );
add_integer( "video-title-position", 8, NULL, VIDEO_TITLE_POSITION_TEXT,
VIDEO_TITLE_POSITION_LONGTEXT, VLC_FALSE );
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
set_section( N_("Snapshot") , NULL );
add_directory( "snapshot-path", NULL, NULL, SNAP_PATH_TEXT,
SNAP_PATH_LONGTEXT, VLC_FALSE );
......
......@@ -758,7 +758,8 @@ static void RunThread( vout_thread_t *p_vout)
return;
}
DisplayTitleOnOSD( p_vout );
if( p_vout->b_title_show )
DisplayTitleOnOSD( p_vout );
/*
* Main loop - it is not executed if an error occurred during
......@@ -1642,14 +1643,14 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout )
if( p_input )
{
i_now = mdate();
i_stop = i_now + (mtime_t)(15000000);
i_stop = i_now + (mtime_t)(p_vout->i_title_timeout * 1000);
if( input_GetItem(p_input)->p_meta &&
input_GetItem(p_input)->p_meta->psz_nowplaying &&
*input_GetItem(p_input)->p_meta->psz_nowplaying )
{
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
input_GetItem(p_input)->p_meta->psz_nowplaying, NULL,
OSD_ALIGN_BOTTOM,
p_vout->i_title_position,
30 + p_vout->fmt_in.i_width
- p_vout->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset,
......@@ -1672,7 +1673,7 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout )
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
psz_string, NULL,
OSD_ALIGN_BOTTOM,
p_vout->i_title_position,
30 + p_vout->fmt_in.i_width
- p_vout->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset,
......@@ -1685,7 +1686,7 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout )
{
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
input_GetItem(p_input)->psz_name, NULL,
OSD_ALIGN_BOTTOM,
p_vout->i_title_position,
30 + p_vout->fmt_in.i_width
- p_vout->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset,
......
......@@ -62,6 +62,8 @@ static int FullscreenCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int SnapshotCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int TitleCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/*****************************************************************************
* vout_RequestWindow: Create/Get a video window if possible.
......@@ -209,6 +211,18 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_Create( p_vout, "video-x", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-y", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-title-show", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-title-timeout", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Create( p_vout, "video-title-position", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
p_vout->b_title_show = var_GetBool( p_vout, "video-title-show" );
p_vout->i_title_timeout = (mtime_t) var_GetInteger( p_vout, "video-title-timeout" );
p_vout->i_title_position = var_GetInteger( p_vout, "video-title-position" );
var_AddCallback( p_vout, "video-title-show", TitleCallback, NULL );
var_AddCallback( p_vout, "video-title-timeout", TitleCallback, NULL );
var_AddCallback( p_vout, "video-title-position", TitleCallback, NULL );
/* Zoom object var */
var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_ISCOMMAND |
VLC_VAR_HASCHOICE | VLC_VAR_DOINHERIT );
......@@ -1167,3 +1181,16 @@ static int SnapshotCallback( vlc_object_t *p_this, char const *psz_cmd,
(void)psz_cmd; (void)oldval; (void)newval; (void)p_data;
return VLC_SUCCESS;
}
static int TitleCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
if( !strncmp( psz_cmd, "video-title-show", 16 ) )
p_vout->b_title_show = newval.b_bool;
else if( !strncmp( psz_cmd, "video-title-timeout", 19 ) )
p_vout->i_title_timeout = (mtime_t) newval.i_int;
else if( !strncmp( psz_cmd, "video-title-position", 20 ) )
p_vout->i_title_position = newval.i_int;
}
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