Commit a6233ea0 authored by Derk-Jan Hartman's avatar Derk-Jan Hartman

* implemented a vout_OSDMessage to display messages on the video at a specific

  location by any module.
* added a OSD config option to the Video options. this will allow you to disable
  the messages printed by OSDMessage. Subtitles will still be shown however.
* src/audio_output/intf.c: volumeSet sets the intf-change variable.
* modules/gui/macosx/vout.m: fix the modifier detection.
parent 1c3e013a
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* osd.h : Constants for use with osd modules * osd.h : Constants for use with osd modules
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: osd.h,v 1.4 2003/10/04 15:51:22 sigmunau Exp $ * $Id: osd.h,v 1.5 2003/10/30 22:34:48 hartman Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -47,3 +47,4 @@ static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FA ...@@ -47,3 +47,4 @@ static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FA
VLC_EXPORT( void, vout_ShowTextRelative, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t ) ); VLC_EXPORT( void, vout_ShowTextRelative, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t ) );
VLC_EXPORT( void, vout_ShowTextAbsolute, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) ); VLC_EXPORT( void, vout_ShowTextAbsolute, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
VLC_EXPORT( void, vout_OSDMessage, ( vlc_object_t *, char * ) );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* hotkeys.c: Hotkey handling for vlc * hotkeys.c: Hotkey handling for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: hotkeys.c,v 1.4 2003/10/30 17:58:07 gbazin Exp $ * $Id: hotkeys.c,v 1.5 2003/10/30 22:34:48 hartman Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -58,7 +58,6 @@ struct intf_sys_t ...@@ -58,7 +58,6 @@ struct intf_sys_t
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * ); static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * ); static void Run ( intf_thread_t * );
static void Feedback( intf_thread_t *, char * );
static int GetKey ( intf_thread_t *); static int GetKey ( intf_thread_t *);
static int KeyEvent( vlc_object_t *, char const *, static int KeyEvent( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * ); vlc_value_t, vlc_value_t, void * );
...@@ -197,7 +196,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -197,7 +196,7 @@ static void Run( intf_thread_t *p_intf )
if( i_action == ACTIONID_QUIT ) if( i_action == ACTIONID_QUIT )
{ {
p_intf->p_vlc->b_die = VLC_TRUE; p_intf->p_vlc->b_die = VLC_TRUE;
Feedback( p_intf, _("Quit" ) ); vout_OSDMessage( p_intf, _("Quit" ) );
continue; continue;
} }
else if( i_action == ACTIONID_VOL_UP ) else if( i_action == ACTIONID_VOL_UP )
...@@ -206,7 +205,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -206,7 +205,7 @@ static void Run( intf_thread_t *p_intf )
char string[9]; char string[9];
aout_VolumeUp( p_intf, 1, &i_newvol ); aout_VolumeUp( p_intf, 1, &i_newvol );
sprintf( string, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX ); sprintf( string, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX );
Feedback( p_intf, string ); vout_OSDMessage( p_intf, string );
} }
else if( i_action == ACTIONID_VOL_DOWN ) else if( i_action == ACTIONID_VOL_DOWN )
{ {
...@@ -214,7 +213,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -214,7 +213,7 @@ static void Run( intf_thread_t *p_intf )
char string[9]; char string[9];
aout_VolumeDown( p_intf, 1, &i_newvol ); aout_VolumeDown( p_intf, 1, &i_newvol );
sprintf( string, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX ); sprintf( string, "Vol %d%%", i_newvol*100/AOUT_VOLUME_MAX );
Feedback( p_intf, string ); vout_OSDMessage( p_intf, string );
} }
else if( i_action == ACTIONID_FULLSCREEN ) else if( i_action == ACTIONID_FULLSCREEN )
{ {
...@@ -243,7 +242,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -243,7 +242,7 @@ static void Run( intf_thread_t *p_intf )
if( p_input && if( p_input &&
p_input->stream.control.i_status != PAUSE_S ) p_input->stream.control.i_status != PAUSE_S )
{ {
Feedback( p_intf, _( "Pause" ) ); vout_OSDMessage( p_intf, _( "Pause" ) );
input_SetStatus( p_input, INPUT_STATUS_PAUSE ); input_SetStatus( p_input, INPUT_STATUS_PAUSE );
} }
else else
...@@ -256,7 +255,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -256,7 +255,7 @@ static void Run( intf_thread_t *p_intf )
if( p_playlist->i_size ) if( p_playlist->i_size )
{ {
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
Feedback( p_intf, _( "Play" ) ); vout_OSDMessage( p_intf, _( "Play" ) );
playlist_Play( p_playlist ); playlist_Play( p_playlist );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
...@@ -267,7 +266,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -267,7 +266,7 @@ static void Run( intf_thread_t *p_intf )
{ {
if( i_action == ACTIONID_PAUSE ) if( i_action == ACTIONID_PAUSE )
{ {
Feedback( p_intf, _( "Pause" ) ); vout_OSDMessage( p_intf, _( "Pause" ) );
input_SetStatus( p_input, INPUT_STATUS_PAUSE ); input_SetStatus( p_input, INPUT_STATUS_PAUSE );
} }
else if( i_action == ACTIONID_JUMP_BACKWARD_10SEC ) else if( i_action == ACTIONID_JUMP_BACKWARD_10SEC )
...@@ -345,16 +344,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -345,16 +344,6 @@ static void Run( intf_thread_t *p_intf )
} }
} }
static void Feedback( intf_thread_t *p_intf, char *psz_string )
{
if ( p_intf->p_sys->p_vout )
{
vout_ShowTextRelative( p_intf->p_sys->p_vout, psz_string, NULL,
OSD_ALIGN_TOP | OSD_ALIGN_RIGHT,
30, 20, 1500000 );
}
}
static int GetKey( intf_thread_t *p_intf) static int GetKey( intf_thread_t *p_intf)
{ {
vlc_mutex_lock( &p_intf->p_sys->change_lock ); vlc_mutex_lock( &p_intf->p_sys->change_lock );
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* vout.m: MacOS X video output plugin * vout.m: MacOS X video output plugin
***************************************************************************** *****************************************************************************
* Copyright (C) 2001-2003 VideoLAN * Copyright (C) 2001-2003 VideoLAN
* $Id: vout.m,v 1.59 2003/10/29 11:54:48 hartman Exp $ * $Id: vout.m,v 1.60 2003/10/30 22:34:48 hartman Exp $
* *
* Authors: Colin Delacroix <colin@zoy.org> * Authors: Colin Delacroix <colin@zoy.org>
* Florian G. Pflug <fgp@phlo.org> * Florian G. Pflug <fgp@phlo.org>
...@@ -987,6 +987,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -987,6 +987,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
unichar key = 0; unichar key = 0;
vlc_value_t val; vlc_value_t val;
unsigned int i_pressed_modifiers = 0; unsigned int i_pressed_modifiers = 0;
val.i_int = 0;
i_pressed_modifiers = [o_event modifierFlags]; i_pressed_modifiers = [o_event modifierFlags];
...@@ -999,7 +1000,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -999,7 +1000,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
if( i_pressed_modifiers & NSCommandKeyMask ) if( i_pressed_modifiers & NSCommandKeyMask )
val.i_int |= KEY_MODIFIER_COMMAND; val.i_int |= KEY_MODIFIER_COMMAND;
NSLog( @"detected the modifiers: %x", val.i_int ); NSLog( @"detected the modifiers: %x", i_pressed_modifiers );
key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0]; key = [[o_event charactersIgnoringModifiers] characterAtIndex: 0];
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* intf.c : audio output API towards the interface modules * intf.c : audio output API towards the interface modules
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: intf.c,v 1.18 2003/08/03 23:11:21 gbazin Exp $ * $Id: intf.c,v 1.19 2003/10/30 22:34:48 hartman Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -74,6 +74,7 @@ int __aout_VolumeGet( vlc_object_t * p_object, audio_volume_t * pi_volume ) ...@@ -74,6 +74,7 @@ int __aout_VolumeGet( vlc_object_t * p_object, audio_volume_t * pi_volume )
*****************************************************************************/ *****************************************************************************/
int __aout_VolumeSet( vlc_object_t * p_object, audio_volume_t i_volume ) int __aout_VolumeSet( vlc_object_t * p_object, audio_volume_t i_volume )
{ {
vlc_value_t val;
aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT, aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT,
FIND_ANYWHERE ); FIND_ANYWHERE );
int i_result = 0; int i_result = 0;
...@@ -90,6 +91,9 @@ int __aout_VolumeSet( vlc_object_t * p_object, audio_volume_t i_volume ) ...@@ -90,6 +91,9 @@ int __aout_VolumeSet( vlc_object_t * p_object, audio_volume_t i_volume )
vlc_mutex_unlock( &p_aout->mixer_lock ); vlc_mutex_unlock( &p_aout->mixer_lock );
vlc_object_release( p_aout ); vlc_object_release( p_aout );
val.b_bool = VLC_TRUE;
var_Set( p_aout, "intf-change", val );
return i_result; return i_result;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header * libvlc.h: main libvlc header
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.99 2003/10/30 17:58:07 gbazin Exp $ * $Id: libvlc.h,v 1.100 2003/10/30 22:34:48 hartman Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -220,6 +220,10 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "es", "de", "fr", "it", ...@@ -220,6 +220,10 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "es", "de", "fr", "it",
"You can use this option to place the subtitles under the movie, " \ "You can use this option to place the subtitles under the movie, " \
"instead of over the movie. Try several positions.") "instead of over the movie. Try several positions.")
#define OSD_TEXT N_("On Screen Display")
#define OSD_LONGTEXT N_( \
"You can disable the messages VLC creates in the video.")
#define FILTER_TEXT N_("Video filter module") #define FILTER_TEXT N_("Video filter module")
#define FILTER_LONGTEXT N_( \ #define FILTER_LONGTEXT N_( \
"This will allow you to add a post-processing filter to enhance the " \ "This will allow you to add a post-processing filter to enhance the " \
...@@ -639,6 +643,7 @@ vlc_module_begin(); ...@@ -639,6 +643,7 @@ vlc_module_begin();
#endif #endif
add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT, add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT,
SPUMARGIN_LONGTEXT, VLC_TRUE ); SPUMARGIN_LONGTEXT, VLC_TRUE );
add_bool( "osd", 1, NULL, OSD_TEXT, OSD_LONGTEXT, VLC_FALSE );
add_module( "filter", "video filter", NULL, NULL, add_module( "filter", "video filter", NULL, NULL,
FILTER_TEXT, FILTER_LONGTEXT, VLC_FALSE ); FILTER_TEXT, FILTER_LONGTEXT, VLC_FALSE );
add_string( "aspect-ratio", "", NULL, add_string( "aspect-ratio", "", NULL,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* video_text.c : text manipulation functions * video_text.c : text manipulation functions
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: video_text.c,v 1.45 2003/08/04 23:35:25 gbazin Exp $ * $Id: video_text.c,v 1.46 2003/10/30 22:34:48 hartman Exp $
* *
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
* *
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/ *****************************************************************************/
#include <vlc/vout.h> #include <vlc/vout.h>
#include <osd.h>
/** /**
* \brief Show text on the video for some time * \brief Show text on the video for some time
...@@ -77,3 +78,28 @@ void vout_ShowTextAbsolute( vout_thread_t *p_vout, char *psz_string, ...@@ -77,3 +78,28 @@ void vout_ShowTextAbsolute( vout_thread_t *p_vout, char *psz_string,
msg_Warn( p_vout, "No text renderer found" ); msg_Warn( p_vout, "No text renderer found" );
} }
} }
/**
* \brief Write an informative message at the default location,
* for the default duration and only if the OSD option is enabled.
* \param p_caller The object that called the function.
* \param psz_string The text to be shown
**/
void vout_OSDMessage( vlc_object_t *p_caller, char *psz_string )
{
vout_thread_t *p_vout;
if( !config_GetInt( p_caller, "osd" ) ) return;
p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE );
if( p_vout )
{
vout_ShowTextRelative( p_vout, psz_string, NULL,
OSD_ALIGN_TOP|OSD_ALIGN_RIGHT,
30,20,1000000 );
vlc_object_release( p_vout );
}
}
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