]> git.sesse.net Git - vlc/commitdiff
* implemented a vout_OSDMessage to display messages on the video at a specific
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 30 Oct 2003 22:34:48 +0000 (22:34 +0000)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 30 Oct 2003 22:34:48 +0000 (22:34 +0000)
  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.

include/osd.h
modules/control/hotkeys.c
modules/gui/macosx/vout.m
src/audio_output/intf.c
src/libvlc.h
src/video_output/video_text.c

index 4ae30bc7870455cdd0e8965d16698679ec41f3e5..b98916472a9d77a436332b990fe20e99bc1c4a45 100644 (file)
@@ -2,7 +2,7 @@
  * osd.h : Constants for use with osd modules
  *****************************************************************************
  * 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>
  *
@@ -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_ShowTextAbsolute, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
+VLC_EXPORT( void,  vout_OSDMessage, ( vlc_object_t *, char * ) );
index cd0f20a12f9adef407e0e1b6b582d53af6c88c03..c7e46734a7184290c412b68424759f0a8293cf13 100755 (executable)
@@ -2,7 +2,7 @@
  * hotkeys.c: Hotkey handling for vlc
  *****************************************************************************
  * 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>
  *
@@ -58,7 +58,6 @@ struct intf_sys_t
 static int  Open    ( vlc_object_t * );
 static void Close   ( vlc_object_t * );
 static void Run     ( intf_thread_t * );
-static void Feedback( intf_thread_t *, char * );
 static int  GetKey  ( intf_thread_t *);
 static int  KeyEvent( vlc_object_t *, char const *,
                       vlc_value_t, vlc_value_t, void * );
@@ -197,7 +196,7 @@ static void Run( intf_thread_t *p_intf )
         if( i_action == ACTIONID_QUIT )
         {
             p_intf->p_vlc->b_die = VLC_TRUE;
-            Feedback( p_intf, _("Quit" ) );
+            vout_OSDMessage( p_intf, _("Quit" ) );
             continue;
         }
         else if( i_action == ACTIONID_VOL_UP )
@@ -206,7 +205,7 @@ static void Run( intf_thread_t *p_intf )
             char string[9];
             aout_VolumeUp( p_intf, 1, &i_newvol );
             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 )
         {
@@ -214,7 +213,7 @@ static void Run( intf_thread_t *p_intf )
             char string[9];
             aout_VolumeDown( p_intf, 1, &i_newvol );
             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 )
         {
@@ -243,7 +242,7 @@ static void Run( intf_thread_t *p_intf )
             if( p_input &&
                 p_input->stream.control.i_status != PAUSE_S )
             {
-                Feedback( p_intf, _( "Pause" ) );
+                vout_OSDMessage( p_intf, _( "Pause" ) );
                 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
             }
             else
@@ -256,7 +255,7 @@ static void Run( intf_thread_t *p_intf )
                     if( p_playlist->i_size )
                     {
                         vlc_mutex_unlock( &p_playlist->object_lock );
-                        Feedback( p_intf, _( "Play" ) );
+                        vout_OSDMessage( p_intf, _( "Play" ) );
                         playlist_Play( p_playlist );
                         vlc_object_release( p_playlist );
                     }
@@ -267,7 +266,7 @@ static void Run( intf_thread_t *p_intf )
         {
             if( i_action == ACTIONID_PAUSE )
             {
-                Feedback( p_intf, _( "Pause" ) );
+                vout_OSDMessage( p_intf, _( "Pause" ) );
                 input_SetStatus( p_input, INPUT_STATUS_PAUSE );
             }
             else if( i_action == ACTIONID_JUMP_BACKWARD_10SEC )
@@ -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)
 {
     vlc_mutex_lock( &p_intf->p_sys->change_lock );
index 0889c34c0de15a0f02d0f1b37dc260621f4863ec..431fd80b38d2dd708b4d03232f98556836668354 100644 (file)
@@ -3,7 +3,7 @@
  * vout.m: MacOS X video output plugin
  *****************************************************************************
  * 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>
  *          Florian G. Pflug <fgp@phlo.org>
@@ -987,7 +987,8 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
     unichar key = 0;
     vlc_value_t val;
     unsigned int i_pressed_modifiers = 0;
-
+    val.i_int = 0;
+    
     i_pressed_modifiers = [o_event modifierFlags];
 
     if( i_pressed_modifiers & NSShiftKeyMask )
@@ -999,7 +1000,7 @@ static void QTFreePicture( vout_thread_t *p_vout, picture_t *p_pic )
     if( i_pressed_modifiers & NSCommandKeyMask )
         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];
 
index ecdebaaa8153b31bb7ad2a5658eee4bae2340038..d6fbe35d6227b9c32c0b7647740607702ee98fae 100644 (file)
@@ -2,7 +2,7 @@
  * intf.c : audio output API towards the interface modules
  *****************************************************************************
  * 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>
  *
@@ -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 )
 {
+    vlc_value_t val;
     aout_instance_t * p_aout = vlc_object_find( p_object, VLC_OBJECT_AOUT,
                                                 FIND_ANYWHERE );
     int i_result = 0;
@@ -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_object_release( p_aout );
+
+    val.b_bool = VLC_TRUE;
+    var_Set( p_aout, "intf-change", val );
     return i_result;
 }
 
index 0f89d396443a9e685b6f460e0bb273ee378b79bc..fe5daf774aeed42c541bef483f385a250bd656e2 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * 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>
  *          Samuel Hocevar <sam@zoy.org>
@@ -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, " \
     "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_LONGTEXT N_( \
     "This will allow you to add a post-processing filter to enhance the " \
@@ -639,6 +643,7 @@ vlc_module_begin();
 #endif
     add_integer( "spumargin", -1, NULL, SPUMARGIN_TEXT, 
                         SPUMARGIN_LONGTEXT, VLC_TRUE );
+    add_bool( "osd", 1, NULL, OSD_TEXT, OSD_LONGTEXT, VLC_FALSE );
     add_module( "filter", "video filter", NULL, NULL,
                 FILTER_TEXT, FILTER_LONGTEXT, VLC_FALSE );
     add_string( "aspect-ratio", "", NULL,
index 15a08d02e1ead35d127182a6565c6f4289e43802..371627f7263f7b574815ece94f617399a3ee6ec5 100644 (file)
@@ -2,7 +2,7 @@
  * video_text.c : text manipulation functions
  *****************************************************************************
  * 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>
  *
@@ -21,6 +21,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 #include <vlc/vout.h>
+#include <osd.h>
 
 /**
  * \brief Show text on the video for some time
@@ -77,3 +78,28 @@ void vout_ShowTextAbsolute( vout_thread_t *p_vout, char *psz_string,
        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 );
+    }
+}
+