]> git.sesse.net Git - vlc/commitdiff
Used a vout object for vout_OSDMessage/OSDSlider/OSDIcon.
authorLaurent Aimar <fenrir@videolan.org>
Wed, 5 May 2010 20:03:43 +0000 (22:03 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Mon, 10 May 2010 17:33:03 +0000 (19:33 +0200)
It reduces the number of executed vlc_object_find.
Some macosx calls have been commented out.

include/vlc_vout_osd.h
modules/codec/zvbi.c
modules/control/hotkeys.c
modules/gui/macosx/controls.m
modules/gui/skins2/commands/cmd_quit.cpp
modules/misc/lua/libs/osd.c
src/video_output/video_output.c
src/video_output/video_text.c
src/video_output/video_widgets.c
src/video_output/vout_internal.h
src/video_output/vout_intf.c

index c35b722919271f3b3f9356b480bf56392d9d1c9a..e4fa123d7153aeadbbbd3da0b40011f970b2977f 100644 (file)
@@ -55,10 +55,7 @@ VLC_EXPORT( int, vout_OSDEpg, ( vout_thread_t *, input_item_t * ) );
  * \param i_channel Subpicture channel
  * \param psz_format printf style formatting
  **/
-VLC_EXPORT( void,  vout_OSDMessage, ( vlc_object_t *, int, const char *, ... ) LIBVLC_FORMAT( 3, 4 ) );
-
-#define vout_OSDMessage( obj, chan, ...) \
-        vout_OSDMessage( VLC_OBJECT(obj), chan, __VA_ARGS__ )
+VLC_EXPORT( void,  vout_OSDMessage, ( vout_thread_t *, int, const char *, ... ) LIBVLC_FORMAT( 3, 4 ) );
 
 /**
  * Display a slider on the video output.
@@ -68,7 +65,7 @@ VLC_EXPORT( void,  vout_OSDMessage, ( vlc_object_t *, int, const char *, ... ) L
  * \param i_type    Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
  * @see vlc_osd.h
  */
-VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
+VLC_EXPORT( void, vout_OSDSlider, ( vout_thread_t *, int, int , short ) );
 
 /**
  * Display an Icon on the video output.
@@ -77,7 +74,7 @@ VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
  * \param i_type    Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON
  * @see vlc_osd.h
  */
-VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, int, short ) );
+VLC_EXPORT( void, vout_OSDIcon, ( vout_thread_t *, int, short ) );
 
 #ifdef __cplusplus
 }
index f69a157e2c7d51b554a0f4003ece68873319c523..4c7ecc7e2809bcd6d94c2cc48a0893a4b7c1fea8 100644 (file)
@@ -661,6 +661,14 @@ static int Position( vlc_object_t *p_this, char const *psz_cmd,
     return VLC_SUCCESS;
 }
 
+#include <vlc_vout.h>
+#define OSDMessage(dec, fmt, ...) do { \
+    vout_thread_t *p_vout = vlc_object_find( dec, VLC_OBJECT_VOUT, FIND_ANYWHERE ); \
+    if( p_vout ) { \
+        vout_OSDMessage( p_vout, fmt, __VA_ARGS__ ); \
+        vlc_object_release( p_vout ); \
+    } } while(0)
+
 static int EventKey( vlc_object_t *p_this, char const *psz_cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
@@ -683,7 +691,7 @@ static int EventKey( vlc_object_t *p_this, char const *psz_cmd,
         if ( !vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x00 ) || vbi_bcd_digits_greater( p_sys->i_wanted_subpage, 0x99 ) )
                 p_sys->i_wanted_subpage = VBI_ANY_SUBNO;
         else
-            vout_OSDMessage( p_this, SPU_DEFAULT_CHANNEL, "%s: %d", _("Subpage"), vbi_bcd2dec( p_sys->i_wanted_subpage) );
+            OSDMessage( p_this, SPU_DEFAULT_CHANNEL, "%s: %d", _("Subpage"), vbi_bcd2dec( p_sys->i_wanted_subpage) );
 
         p_sys->b_update = true;
         vlc_mutex_unlock( &p_sys->lock );
@@ -697,7 +705,7 @@ static int EventKey( vlc_object_t *p_this, char const *psz_cmd,
     p_sys->i_key[0] = p_sys->i_key[1];
     p_sys->i_key[1] = p_sys->i_key[2];
     p_sys->i_key[2] = (int)(newval.i_int - '0');
-    vout_OSDMessage( p_this, SPU_DEFAULT_CHANNEL, "%s: %c%c%c", _("Page"), (char)(p_sys->i_key[0]+'0'), (char)(p_sys->i_key[1]+'0'), (char)(p_sys->i_key[2]+'0') );
+    OSDMessage( p_this, SPU_DEFAULT_CHANNEL, "%s: %c%c%c", _("Page"), (char)(p_sys->i_key[0]+'0'), (char)(p_sys->i_key[1]+'0'), (char)(p_sys->i_key[2]+'0') );
 
     int i_new_page = 0;
 
index 8e71336d0ccb3f7d35f226d0d014c00961ed6244..cbf1965b0d2312a9db0d617a183c55366195b66c 100644 (file)
@@ -71,10 +71,15 @@ static void PlayBookmark( intf_thread_t *, int );
 static void SetBookmark ( intf_thread_t *, int );
 static void DisplayPosition( intf_thread_t *, vout_thread_t *, input_thread_t * );
 static void DisplayVolume  ( intf_thread_t *, vout_thread_t *, audio_volume_t );
-static void DisplayRate ( input_thread_t *, float );
+static void DisplayRate ( vout_thread_t *, float );
 static float AdjustRateFine( input_thread_t *, const int );
 static void ClearChannels  ( intf_thread_t *, vout_thread_t * );
 
+#define DisplayMessage(vout, fmt, ...) \
+    do { if(vout) vout_OSDMessage(vout, fmt, __VA_ARGS__); } while(0)
+#define DisplayIcon(vout, icon) \
+    do { if(vout) vout_OSDIcon(vout, SPU_DEFAULT_CHANNEL, icon); } while(0)
+
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -175,7 +180,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             libvlc_Quit( p_intf->p_libvlc );
 
             ClearChannels( p_intf, p_vout );
-            vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Quit" ) );
+            DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _( "Quit" ) );
             break;
 
         /* Volume and audio actions */
@@ -204,8 +209,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 if( i_newvol == 0 )
                 {
                     ClearChannels( p_intf, p_vout );
-                    vout_OSDIcon( VLC_OBJECT( p_intf ), SPU_DEFAULT_CHANNEL,
-                                  OSD_MUTE_ICON );
+                    DisplayIcon( p_vout, OSD_MUTE_ICON );
                 }
                 else
                     DisplayVolume( p_intf, p_vout, i_newvol );
@@ -298,14 +302,12 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 int state = var_GetInteger( p_input, "state" );
                 if( state != PAUSE_S )
                 {
-                    vout_OSDIcon( VLC_OBJECT( p_intf ), SPU_DEFAULT_CHANNEL,
-                                  OSD_PAUSE_ICON );
+                    DisplayIcon( p_vout, OSD_PAUSE_ICON );
                     state = PAUSE_S;
                 }
                 else
                 {
-                    vout_OSDIcon( VLC_OBJECT( p_intf ), SPU_DEFAULT_CHANNEL,
-                                  OSD_PLAY_ICON );
+                    DisplayIcon( p_vout, OSD_PLAY_ICON );
                     state = PLAYING_S;
                 }
                 var_SetInteger( p_input, "state", state );
@@ -321,8 +323,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             else
             {
                 ClearChannels( p_intf, p_vout );
-                vout_OSDIcon( VLC_OBJECT( p_intf ), SPU_DEFAULT_CHANNEL,
-                              OSD_PLAY_ICON );
+                DisplayIcon( p_vout, OSD_PLAY_ICON );
                 playlist_Play( p_playlist );
             }
             break;
@@ -369,9 +370,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                             list.p_list->p_values[i+1] );
                     i++;
                 }
-                vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL,
-                        _("Audio Device: %s"),
-                        list2.p_list->p_values[i].psz_string);
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                _("Audio Device: %s"),
+                                list2.p_list->p_values[i].psz_string);
             }
             var_FreeList( &list, &list2 );
             break;
@@ -391,8 +392,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 if( var_GetInteger( p_input, "state" ) != PAUSE_S )
                 {
                     ClearChannels( p_intf, p_vout );
-                    vout_OSDIcon( VLC_OBJECT( p_intf ), SPU_DEFAULT_CHANNEL,
-                                  OSD_PAUSE_ICON );
+                    DisplayIcon( p_vout, OSD_PAUSE_ICON );
                     var_SetInteger( p_input, "state", PAUSE_S );
                 }
             }
@@ -466,9 +466,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     else
                         i++;
                     var_Set( p_input, "audio-es", list.p_list->p_values[i] );
-                    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                     _("Audio track: %s"),
-                                     list2.p_list->p_values[i].psz_string );
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    _("Audio track: %s"),
+                                    list2.p_list->p_values[i].psz_string );
                 }
                 var_FreeList( &list, &list2 );
             }
@@ -483,8 +483,8 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 i_count = list.p_list->i_count;
                 if( i_count <= 1 )
                 {
-                    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                     _("Subtitle track: %s"), _("N/A") );
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    _("Subtitle track: %s"), _("N/A") );
                     var_FreeList( &list, &list2 );
                     goto cleanup_and_continue;
                 }
@@ -507,9 +507,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 else
                     i++;
                 var_Set( p_input, "spu-es", list.p_list->p_values[i] );
-                vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                 _("Subtitle track: %s"),
-                                 list2.p_list->p_values[i].psz_string );
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                _("Subtitle track: %s"),
+                                list2.p_list->p_values[i].psz_string );
                 var_FreeList( &list, &list2 );
             }
             else if( i_action == ACTIONID_ASPECT_RATIO && p_vout )
@@ -532,9 +532,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     if( i == val_list.p_list->i_count ) i = 0;
                     var_SetString( p_vout, "aspect-ratio",
                                    val_list.p_list->p_values[i].psz_string );
-                    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                     _("Aspect ratio: %s"),
-                                     text_list.p_list->p_values[i].psz_string );
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    _("Aspect ratio: %s"),
+                                    text_list.p_list->p_values[i].psz_string );
 
                     var_FreeList( &val_list, &text_list );
                 }
@@ -560,9 +560,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     if( i == val_list.p_list->i_count ) i = 0;
                     var_SetString( p_vout, "crop",
                                    val_list.p_list->p_values[i].psz_string );
-                    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                     _("Crop: %s"),
-                                     text_list.p_list->p_values[i].psz_string );
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    _("Crop: %s"),
+                                    text_list.p_list->p_values[i].psz_string );
 
                     var_FreeList( &val_list, &text_list );
                 }
@@ -574,19 +574,19 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 if ( f_scalefactor != 1.0 )
                 {
                     var_SetFloat( p_vout, "scale", 1.0 );
-                    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                         "%s", _("Zooming reset") );
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    "%s", _("Zooming reset") );
                 }
                 else
                 {
                     bool b_autoscale = !var_GetBool( p_vout, "autoscale" );
                     var_SetBool( p_vout, "autoscale", b_autoscale );
                     if( b_autoscale )
-                        vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                         "%s", _("Scaled to screen") );
+                        DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                        "%s", _("Scaled to screen") );
                     else
-                        vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                         "%s", _("Original Size") );
+                        DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                        "%s", _("Original Size") );
                 }
             }
             else if( i_action == ACTIONID_SCALE_UP && p_vout )
@@ -613,8 +613,8 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 if( i_deinterlace != 0 )
                 {
                     var_SetInteger( p_vout, "deinterlace", 0 );
-                    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                     "%s", _("Deinterlace off") );
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    "%s", _("Deinterlace off") );
                 }
                 else
                 {
@@ -633,8 +633,8 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                                 break;
                             }
                         }
-                        vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                         "%s (%s)", _("Deinterlace on"), psz_text ? psz_text : psz_mode );
+                        DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                        "%s (%s)", _("Deinterlace on"), psz_text ? psz_text : psz_mode );
 
                         var_FreeList( &vlist, &tlist );
                     }
@@ -666,9 +666,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     if( i == -1 ) i = val_list.p_list->i_count-1;
                     var_SetFloat( p_vout, "zoom",
                                   val_list.p_list->p_values[i].f_float );
-                    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                     _("Zoom mode: %s"),
-                                text_list.p_list->p_values[i].psz_string );
+                    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                    _("Zoom mode: %s"),
+                                    text_list.p_list->p_values[i].psz_string );
 
                     var_FreeList( &val_list, &text_list );
                 }
@@ -692,13 +692,13 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
 
             else if( i_action == ACTIONID_NEXT )
             {
-                vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL, "%s", _("Next") );
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Next") );
                 playlist_Next( p_playlist );
             }
             else if( i_action == ACTIONID_PREV )
             {
-                vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL, "%s",
-                                 _("Previous") );
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s",
+                                _("Previous") );
                 playlist_Prev( p_playlist );
             }
             else if( i_action == ACTIONID_STOP )
@@ -708,24 +708,24 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
             else if( i_action == ACTIONID_FRAME_NEXT )
             {
                 var_TriggerCallback( p_input, "frame-next" );
-                vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                 "%s", _("Next frame") );
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                "%s", _("Next frame") );
             }
             else if( i_action == ACTIONID_RATE_NORMAL )
             {
                 var_SetFloat( p_input, "rate", 1. );
-                vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL,
-                                 "%s", _("1.00x") );
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                "%s", _("1.00x") );
             }
             else if( i_action == ACTIONID_FASTER )
             {
                 var_TriggerCallback( p_input, "rate-faster" );
-                DisplayRate( p_input, var_GetFloat( p_input, "rate" ) );
+                DisplayRate( p_vout, var_GetFloat( p_input, "rate" ) );
             }
             else if( i_action == ACTIONID_SLOWER )
             {
                 var_TriggerCallback( p_input, "rate-slower" );
-                DisplayRate( p_input, var_GetFloat( p_input, "rate" ) );
+                DisplayRate( p_vout, var_GetFloat( p_input, "rate" ) );
             }
             else if( i_action == ACTIONID_RATE_FASTER_FINE ||
                      i_action == ACTIONID_RATE_SLOWER_FINE )
@@ -734,7 +734,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 float f_newrate = AdjustRateFine( p_input, i_dir );
 
                 var_SetFloat( p_input, "rate", f_newrate );
-                DisplayRate( p_input, f_newrate );
+                DisplayRate( p_vout, f_newrate );
             }
             else if( i_action == ACTIONID_POSITION )
             {
@@ -769,9 +769,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 i_delay -= 50000;    /* 50 ms */
                 var_SetTime( p_input, "spu-delay", i_delay );
                 ClearChannels( p_intf, p_vout );
-                vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL,
-                                 _( "Subtitle delay %i ms" ),
-                                 (int)(i_delay/1000) );
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+                                _( "Subtitle delay %i ms" ),
+                                (int)(i_delay/1000) );
             }
             else if( i_action == ACTIONID_SUBDELAY_UP )
             {
@@ -779,7 +779,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 i_delay += 50000;    /* 50 ms */
                 var_SetTime( p_input, "spu-delay", i_delay );
                 ClearChannels( p_intf, p_vout );
-                vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL,
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
                                 _( "Subtitle delay %i ms" ),
                                  (int)(i_delay/1000) );
             }
@@ -789,7 +789,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 --i_pos;
                 var_SetInteger( p_input, "sub-margin", i_pos );
                 ClearChannels( p_intf, p_vout );
-                vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL,
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
                                 _( "Subtitle position %i px" ),
                                  (int)(i_pos) );
             }
@@ -799,7 +799,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 ++i_pos;
                 var_SetInteger( p_input, "sub-margin", i_pos );
                 ClearChannels( p_intf, p_vout );
-                vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL,
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
                                 _( "Subtitle position %i px" ),
                                  (int)(i_pos) );
             }
@@ -809,7 +809,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 i_delay -= 50000;    /* 50 ms */
                 var_SetTime( p_input, "audio-delay", i_delay );
                 ClearChannels( p_intf, p_vout );
-                vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL,
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
                                 _( "Audio delay %i ms" ),
                                  (int)(i_delay/1000) );
             }
@@ -819,7 +819,7 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                 i_delay += 50000;    /* 50 ms */
                 var_SetTime( p_input, "audio-delay", i_delay );
                 ClearChannels( p_intf, p_vout );
-                vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL,
+                DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
                                 _( "Audio delay %i ms" ),
                                  (int)(i_delay/1000) );
             }
@@ -858,9 +858,9 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
                     const bool b_record = var_ToggleBool( p_input, "record" );
 
                     if( b_record )
-                        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _("Recording") );
+                        DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Recording") );
                     else
-                        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _("Recording done") );
+                        DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Recording done") );
                 }
             }
         }
@@ -1008,18 +1008,18 @@ static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
     if( time.i_time > 0 )
     {
         secstotimestr( psz_duration, time.i_time / 1000000 );
-        vout_OSDMessage( p_input, POSITION_TEXT_CHAN, "%s / %s",
-                         psz_time, psz_duration );
+        DisplayMessage( p_vout, POSITION_TEXT_CHAN, "%s / %s",
+                        psz_time, psz_duration );
     }
     else if( i_seconds > 0 )
     {
-        vout_OSDMessage( p_input, POSITION_TEXT_CHAN, "%s", psz_time );
+        DisplayMessage( p_vout, POSITION_TEXT_CHAN, "%s", psz_time );
     }
 
     if( var_GetBool( p_vout, "fullscreen" ) )
     {
         var_Get( p_input, "position", &pos );
-        vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_WIDGET_CHAN,
+        vout_OSDSlider( p_vout, POSITION_WIDGET_CHAN,
                         pos.f_float * 100, OSD_HOR_SLIDER );
     }
 }
@@ -1035,19 +1035,19 @@ static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
 
     if( var_GetBool( p_vout, "fullscreen" ) )
     {
-        vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_WIDGET_CHAN,
+        vout_OSDSlider( p_vout, VOLUME_WIDGET_CHAN,
             i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
     }
     else
     {
-        vout_OSDMessage( p_vout, VOLUME_TEXT_CHAN, _( "Volume %d%%" ),
-                         i_vol*400/AOUT_VOLUME_MAX );
+        DisplayMessage( p_vout, VOLUME_TEXT_CHAN, _( "Volume %d%%" ),
+                        i_vol*400/AOUT_VOLUME_MAX );
     }
 }
 
-static void DisplayRate( input_thread_t *p_input, float f_rate )
+static void DisplayRate( vout_thread_t *p_vout, float f_rate )
 {
-    vout_OSDMessage( VLC_OBJECT(p_input), SPU_DEFAULT_CHANNEL, _("Speed: %.2fx"), f_rate );
+    DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL, _("Speed: %.2fx"), f_rate );
 }
 
 static float AdjustRateFine( input_thread_t *p_input, const int i_dir )
index 85ce2777a317a80c34761b44ef8bf4aee7c39f14..d25288d779d9c2836b64b53c098385769da9a76e 100644 (file)
     var_Set( p_playlist, "random", val );
     if( val.b_bool )
     {
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random On" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random On" ) );
         config_PutInt( p_playlist, "random", 1 );
     }
     else
     {
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Random Off" ) );
         config_PutInt( p_playlist, "random", 0 );
     }
 
         config_PutInt( p_playlist, "loop", 0 );
 
         /* show the change */
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
     }
     else if( repeating.b_bool && !looping.b_bool )
     {
         config_PutInt( p_playlist, "loop", 1 );
 
         /* show the change */
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
     }
     else
     {
         config_PutInt( p_playlist, "loop", 0 );
 
         /* show the change */
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
     }
 
     /* communicate with core and the main intf loop */
     var_Set( p_playlist, "repeat", val );
     if( val.b_bool )
     {
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat One" ) );
         config_PutInt( p_playlist, "repeat", 1 );
     }
     else
     {
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
         config_PutInt( p_playlist, "repeat", 0 );
     }
 
     var_Set( p_playlist, "loop", val );
     if( val.b_bool )
     {
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat All" ) );
         config_PutInt( p_playlist, "loop", 1 );
     }
     else
     {
-        vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
+        //vout_OSDMessage( p_intf, SPU_DEFAULT_CHANNEL, "%s", _( "Repeat Off" ) );
         config_PutInt( p_playlist, "loop", 0 );
     }
 
index 316243139b81a5eafd7d189301fc62b84418168e..b6d49fa6478cb575e77d53960166e446a03d2030 100644 (file)
 
 void CmdQuit::execute()
 {
-    // Stop the playlist
-    vout_OSDMessage( getIntf(), SPU_DEFAULT_CHANNEL, "%s", _( "Quit" ) );
+    if( getIntf()->p_sys->p_input )
+    {
+        vout_thread_t *pVout = input_GetVout( getIntf()->p_sys->p_input );
+        if( pVout )
+        {
+            vout_OSDMessage( pVout, SPU_DEFAULT_CHANNEL, "%s", _( "Quit" ) );
+            vlc_object_release( pVout );
+        }
+    }
 
     // Kill libvlc
     libvlc_Quit( getIntf()->p_libvlc );
index cb9ac9c955e753481a362d99201c7ea62fe38e6e..acba5085089b8ddaa35e3fb41f738bf23b6eb09f 100644 (file)
@@ -75,7 +75,13 @@ static int vlclua_osd_icon( lua_State *L )
     else
     {
         vlc_object_t *p_this = vlclua_get_this( L );
-        vout_OSDIcon( p_this, i_chan, i_icon );
+        vout_thread_t *p_vout = vlc_object_find( p_this, VLC_OBJECT_VOUT,
+                                                 FIND_ANYWHERE );
+        if( p_vout )
+        {
+            vout_OSDIcon( p_vout, i_chan, i_icon );
+            vlc_object_release( p_vout );
+        }
         return 0;
     }
 }
@@ -85,7 +91,13 @@ static int vlclua_osd_message( lua_State *L )
     const char *psz_message = luaL_checkstring( L, 1 );
     int i_chan = luaL_optint( L, 2, SPU_DEFAULT_CHANNEL );
     vlc_object_t *p_this = vlclua_get_this( L );
-    vout_OSDMessage( p_this, i_chan, "%s", psz_message );
+    vout_thread_t *p_vout = vlc_object_find( p_this, VLC_OBJECT_VOUT,
+                                             FIND_ANYWHERE );
+    if( p_vout )
+    {
+        vout_OSDMessage( p_vout, i_chan, "%s", psz_message );
+        vlc_object_release( p_vout );
+    }
     return 0;
 }
 
@@ -120,7 +132,13 @@ static int vlclua_osd_slider( lua_State *L )
     else
     {
         vlc_object_t *p_this = vlclua_get_this( L );
-        vout_OSDSlider( p_this, i_chan, i_position, i_type );
+        vout_thread_t *p_vout = vlc_object_find( p_this, VLC_OBJECT_VOUT,
+                                                 FIND_ANYWHERE );
+        if( p_vout )
+        {
+            vout_OSDSlider( p_vout, i_chan, i_position, i_type );
+            vlc_object_release( p_vout );
+        }
         return 0;
     }
 }
index 362e9e31b9bbfb35a19809ceca94e44938df3dbe..4c0e7a8f46bf714717f0e2258de3d1428f65e805 100644 (file)
@@ -851,19 +851,15 @@ static void ThreadDisplayOsdTitle(vout_thread_t *vout, const char *string)
 
     vlc_assert_locked(&vout->p->change_lock);
 
-    const mtime_t start = mdate();
-    const mtime_t stop = start +
-                         INT64_C(1000) * vout->p->title.timeout;
-
-    if (stop > start)
-        vout_ShowTextAbsolute(vout, SPU_DEFAULT_CHANNEL,
+    if (vout->p->title.timeout > 0)
+        vout_ShowTextRelative(vout, SPU_DEFAULT_CHANNEL,
                               string, NULL,
                               vout->p->title.position,
                               30 + vout->p->fmt_in.i_width
                                  - vout->p->fmt_in.i_visible_width
                                  - vout->p->fmt_in.i_x_offset,
                               20 + vout->p->fmt_in.i_y_offset,
-                              start, stop);
+                              INT64_C(1000) * vout->p->title.timeout);
 }
 
 static void ThreadChangeFilters(vout_thread_t *vout, const char *filters)
index 18c0a863f56160a091664dc96d5bea8531fb0042..11fb81b9e9b71d4723ec14fdcc0c9116029c6395 100644 (file)
@@ -36,7 +36,7 @@
 #include "vout_internal.h"
 
 /**
- * \brief Show text on the video for some time
+ * \brief Show text on the video from a given start date to a given end date
  * \param p_vout pointer to the vout the text is to be showed on
  * \param i_channel Subpicture channel
  * \param psz_string The text to be shown
  * \param i_duration Amount of time the text is to be shown.
  */
 int vout_ShowTextRelative( vout_thread_t *p_vout, int i_channel,
-                           char *psz_string, const text_style_t *p_style,
-                           int i_flags, int i_hmargin, int i_vmargin,
-                           mtime_t i_duration )
-{
-    mtime_t i_now = mdate();
-
-    return vout_ShowTextAbsolute( p_vout, i_channel, psz_string,
-                                  p_style, i_flags, i_hmargin, i_vmargin,
-                                  i_now, i_now + i_duration );
-}
-
-/**
- * \brief Show text on the video from a given start date to a given end date
- * \param p_vout pointer to the vout the text is to be showed on
- * \param i_channel Subpicture channel
- * \param psz_string The text to be shown
- * \param p_style Pointer to a struct with text style info (it is duplicated if non NULL)
- * \param i_flags flags for alignment and such
- * \param i_hmargin horizontal margin in pixels
- * \param i_vmargin vertical margin in pixels
- * \param i_start the time when this string is to appear on the video
- * \param i_stop the time when this string should stop to be displayed
- *               if this is 0 the string will be shown untill the next string
- *               is about to be shown
- */
-int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
                            const char *psz_string, const text_style_t *p_style,
                            int i_flags, int i_hmargin, int i_vmargin,
-                           mtime_t i_start, mtime_t i_stop )
+                           mtime_t i_duration )
 {
     subpicture_t *p_spu;
     video_format_t fmt;
@@ -87,8 +61,8 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
         return VLC_EGENERIC;
 
     p_spu->i_channel = i_channel;
-    p_spu->i_start = i_start;
-    p_spu->i_stop = i_stop;
+    p_spu->i_start = mdate();
+    p_spu->i_stop  = p_spu->i_start + i_duration;
     p_spu->b_ephemer = true;
     p_spu->b_absolute = false;
     p_spu->b_fade = true;
@@ -119,7 +93,6 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
     return VLC_SUCCESS;
 }
 
-#undef vout_OSDMessage
 /**
  * \brief Write an informative message at the default location,
  *        for the default duration and only if the OSD option is enabled.
@@ -127,31 +100,26 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
  * \param i_channel Subpicture channel
  * \param psz_format printf style formatting
  **/
-void vout_OSDMessage( vlc_object_t *p_caller, int i_channel,
+void vout_OSDMessage( vout_thread_t *p_vout, int i_channel,
                       const char *psz_format, ... )
 {
-    vout_thread_t *p_vout;
-    char *psz_string = NULL;
-    va_list args;
+    if( !var_InheritBool( p_vout, "osd" ) )
+        return;
 
-    if( !var_InheritBool( p_caller, "osd" ) ) return;
+    va_list args;
+    va_start( args, psz_format );
 
-    p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT, FIND_ANYWHERE );
-    if( p_vout )
+    char *psz_string;
+    if( vasprintf( &psz_string, psz_format, args ) != -1 )
     {
-        va_start( args, psz_format );
-        if( vasprintf( &psz_string, psz_format, args ) != -1 )
-        {
-            vout_ShowTextRelative( p_vout, i_channel, psz_string, NULL,
-                                   SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_RIGHT,
-                                   30 + p_vout->p->fmt_in.i_width
-                                      - p_vout->p->fmt_in.i_visible_width
-                                      - p_vout->p->fmt_in.i_x_offset,
-                                   20 + p_vout->p->fmt_in.i_y_offset, 1000000 );
-            free( psz_string );
-        }
-        vlc_object_release( p_vout );
-        va_end( args );
+        vout_ShowTextRelative( p_vout, i_channel, psz_string, NULL,
+                               SUBPICTURE_ALIGN_TOP|SUBPICTURE_ALIGN_RIGHT,
+                               30 + p_vout->p->fmt_in.i_width
+                                  - p_vout->p->fmt_in.i_visible_width
+                                  - p_vout->p->fmt_in.i_x_offset,
+                               20 + p_vout->p->fmt_in.i_y_offset, 1000000 );
+        free( psz_string );
     }
+    va_end( args );
 }
 
index c1a6f7b799b766c0a0254bfdc33c401afb3cc125..3033c6567c8e9e22842b32fc9b6ed4786800844d 100644 (file)
  * Displays an OSD slider.
  * Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
  *****************************************************************************/
-void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
+void vout_OSDSlider( vout_thread_t *p_vout, int i_channel, int i_position,
                      short i_type )
 {
-    vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
-                                             FIND_ANYWHERE );
+    if( !var_InheritBool( p_vout, "osd" ) || i_position < 0 )
+        return;
 
-    if( p_vout && ( var_InheritBool( p_caller, "osd" ) && ( i_position >= 0 ) ) )
-    {
-        osd_Slider( p_caller, vout_GetSpu( p_vout ),
-                    p_vout->p->fmt_render.i_width,
-                    p_vout->p->fmt_render.i_height,
-                    p_vout->p->fmt_in.i_x_offset,
-                    p_vout->p->fmt_in.i_height - p_vout->p->fmt_in.i_visible_height
-                                            - p_vout->p->fmt_in.i_y_offset,
-                    i_channel, i_position, i_type );
-    }
-    vlc_object_release( p_vout );
+    osd_Slider( VLC_OBJECT( p_vout ), vout_GetSpu( p_vout ),
+                p_vout->p->fmt_render.i_width,
+                p_vout->p->fmt_render.i_height,
+                p_vout->p->fmt_in.i_x_offset,
+                p_vout->p->fmt_in.i_height - p_vout->p->fmt_in.i_visible_height
+                                        - p_vout->p->fmt_in.i_y_offset,
+                i_channel, i_position, i_type );
 }
 
 /*****************************************************************************
  * Displays an OSD icon.
  * Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON
  *****************************************************************************/
-void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
+void vout_OSDIcon( vout_thread_t *p_vout, int i_channel, short i_type )
 {
-    vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
-                                             FIND_ANYWHERE );
-
-    if( !p_vout ) return;
-
-    if( var_InheritBool( p_caller, "osd" ) )
-    {
-        osd_Icon( p_caller,
-                  vout_GetSpu( p_vout ),
-                  p_vout->p->fmt_render.i_width,
-                  p_vout->p->fmt_render.i_height,
-                  p_vout->p->fmt_in.i_width - p_vout->p->fmt_in.i_visible_width
-                                         - p_vout->p->fmt_in.i_x_offset,
-                  p_vout->p->fmt_in.i_y_offset,
-                  i_channel, i_type );
-    }
-    vlc_object_release( p_vout );
+    if( !var_InheritBool( p_vout, "osd" ) )
+        return;
+    osd_Icon( VLC_OBJECT( p_vout ),
+              vout_GetSpu( p_vout ),
+              p_vout->p->fmt_render.i_width,
+              p_vout->p->fmt_render.i_height,
+              p_vout->p->fmt_in.i_width - p_vout->p->fmt_in.i_visible_width
+                                     - p_vout->p->fmt_in.i_x_offset,
+              p_vout->p->fmt_in.i_y_offset,
+              i_channel, i_type );
 }
 
index d6b8fe24a342800f9be8fcbbac769c15fff3de8e..747f259c64e8782b11233e6380fee4a354912449 100644 (file)
@@ -170,9 +170,7 @@ void vout_DisplayWrapper(vout_thread_t *, picture_t *);
 int spu_ProcessMouse(spu_t *, const vlc_mouse_t *, const video_format_t *);
 
 /* */
-int vout_ShowTextRelative( vout_thread_t *, int, char *, const text_style_t *, int, int, int, mtime_t );
-int vout_ShowTextAbsolute( vout_thread_t *, int, const char *, const text_style_t *, int, int, int, mtime_t, mtime_t );
-
+int vout_ShowTextRelative( vout_thread_t *, int, const char *, const text_style_t *, int, int, int, mtime_t );
 
 #endif
 
index 7848be40311562b5a3f4471ac98c34403f99aa9d..70a2768dd4e4d1ecfe4c2900d11ada6962109bdc 100644 (file)
@@ -395,7 +395,7 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic )
 static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char *psz_filename )
 {
     msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename );
-    vout_OSDMessage( VLC_OBJECT( p_vout ), SPU_DEFAULT_CHANNEL, "%s", psz_filename );
+    vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", psz_filename );
 
     if( var_GetBool( p_vout, "snapshot-preview" ) )
     {