It reduces the number of executed vlc_object_find.
Some macosx calls have been commented out.
* \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.
* \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.
* \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
}
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 )
{
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 );
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;
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
*****************************************************************************/
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 */
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 );
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 );
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;
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;
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 );
}
}
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 );
}
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;
}
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 )
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 );
}
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 );
}
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 )
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
{
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 );
}
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 );
}
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 )
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 )
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 )
{
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 )
{
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) );
}
--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) );
}
++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) );
}
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) );
}
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) );
}
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") );
}
}
}
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 );
}
}
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 )
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 );
}
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 );
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;
}
}
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;
}
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;
}
}
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)
#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;
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;
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.
* \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 );
}
* 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 );
}
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
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" ) )
{