Commit 50b65815 authored by Yoann Peronneau's avatar Yoann Peronneau

Support for multiple OSD channels :

* added i_channel and i_content properties to subpicture_t
* p_last_osd_message is no more used

An OSD channel can contain simultaneously an OSD text and an OSD widget.
parent 9b7132be
......@@ -53,16 +53,16 @@ struct text_style_t
};
static const text_style_t default_text_style = { 22, 0xffffff, VLC_FALSE, VLC_FALSE, VLC_FALSE };
VLC_EXPORT( subpicture_t *, vout_ShowTextRelative, ( vout_thread_t *, char *, text_style_t *, int, int, int, mtime_t ) );
VLC_EXPORT( int, 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 *, ... ) );
VLC_EXPORT( subpicture_t *, vout_ShowTextRelative, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t ) );
VLC_EXPORT( int, vout_ShowTextAbsolute, ( vout_thread_t *, int, char *, text_style_t *, int, int, int, mtime_t, mtime_t ) );
VLC_EXPORT( void, __vout_OSDMessage, ( vlc_object_t *, int, char *, ... ) );
/**
* Same as __vlc_OSDMessage() but with automatic casting
*/
#if defined(HAVE_VARIADIC_MACROS)
# define vout_OSDMessage( obj, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), fmt, ## args )
# define vout_OSDMessage( obj, chan, fmt, args...) __vout_OSDMessage( VLC_OBJECT(obj), chan, fmt, ## args )
#else
# define vout_OSDMessage __vout_OSDMessage
#endif
VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int , short ) );
VLC_EXPORT( void, vout_OSDSlider, ( vlc_object_t *, int, int , short ) );
VLC_EXPORT( void, vout_OSDIcon, ( vlc_object_t *, short ) );
......@@ -126,8 +126,6 @@ struct vout_thread_t
picture_t p_picture[2*VOUT_MAX_PICTURES]; /**< pictures */
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /**< subpictures */
subpicture_t * p_last_osd_message;
/* Statistics */
count_t c_loops;
count_t c_pictures, c_late_pictures;
......@@ -147,8 +145,9 @@ struct vout_thread_t
the text renderer */
module_t * p_text_renderer_module; /**< text renderer module */
/** callback used when a new string needs to be shown on the vout */
subpicture_t * ( *pf_add_string ) ( vout_thread_t *, char *, text_style_t *, int,
int, int, mtime_t, mtime_t );
subpicture_t * ( *pf_add_string ) ( vout_thread_t *, int, char *,
text_style_t *, int, int, int, mtime_t,
mtime_t );
};
#define I_OUTPUTPICTURES p_vout->output.i_pictures
......@@ -257,7 +256,7 @@ enum output_query_e
* \addtogroup subpicture
* @{
*/
VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int ) );
VLC_EXPORT( subpicture_t *, vout_CreateSubPicture, ( vout_thread_t *, int, int, int ) );
VLC_EXPORT( void, vout_DestroySubPicture, ( vout_thread_t *, subpicture_t * ) );
VLC_EXPORT( void, vout_DisplaySubPicture, ( vout_thread_t *, subpicture_t * ) );
......
......@@ -4,7 +4,7 @@
* includes all common video types and constants.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_video.h,v 1.9 2004/01/25 18:17:08 zorglub Exp $
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -193,6 +193,12 @@ struct picture_heap_t
*/
struct subpicture_t
{
/** \name Channel and content type */
/**@{*/
int i_channel; /**< subpicture channel */
int i_content; /**< content type */
/**@}*/
/** \name Type and flags
Should NOT be modified except by the vout thread */
/**@{*/
......@@ -240,6 +246,19 @@ struct subpicture_t
#define RESERVED_SUBPICTURE 1 /* allocated and reserved */
#define READY_SUBPICTURE 2 /* ready for display */
/* Subpicture channel */
#define SUBT1_CHAN 1
#define SUBT2_CHAN 2
#define BEGIN_EXCLUSIVE_CHAN 3 /* exclusive subpic-channels list */
#define POSITION_CHAN 3
#define VOLUME_CHAN 4
#define SOLO_CHAN 5
#define END_EXCLUSIVE_CHAN 5 /*end of list */
/* Subpicture content type */
#define TEXT_CONTENT 0
#define GRAPH_CONTENT 1 /* used for OSD icon, slider... */
/*****************************************************************************
* Prototypes
*****************************************************************************/
......
......@@ -843,8 +843,8 @@ static int DisplayAnchor( intf_thread_t *p_intf,
/* TODO: p_subpicture doesn't have the proper i_x and i_y
* coordinates. Need to look at the subpicture display system to
* work out why. */
if ( vout_ShowTextAbsolute( p_vout,
psz_anchor_description, p_style, OSD_ALIGN_BOTTOM,
if ( vout_ShowTextAbsolute( p_vout, SOLO_CHAN,
psz_anchor_description, p_style, OSD_ALIGN_BOTTOM,
i_margin_h, i_margin_v, i_now, 0 ) == VLC_SUCCESS )
{
/* Displayed successfully */
......
......@@ -1258,7 +1258,8 @@ static void render( dvbsub_all_t *dvbsub, vout_thread_t *p_vout )
/* Allocate the subpicture internal data. */
dvbsub->p_spu[j] =
vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
vout_CreateSubPicture( p_vout, SUBT1_CHAN, TEXT_CONTENT,
MEMORY_SUBPICTURE );
if( dvbsub->p_spu[j] == NULL )
{
msg_Err(p_vout, "Unable to allocate memory, skipping");
......
......@@ -2,7 +2,7 @@
* parse.c: Philips OGT (SVCD subtitle) packet parser
*****************************************************************************
* Copyright (C) 2003, 2004 VideoLAN
* $Id: cvd_parse.c,v 1.14 2004/01/22 04:46:19 rocky Exp $
* $Id$
*
* Authors: Rocky Bernstein
* based on code from:
......@@ -292,7 +292,8 @@ E_(ParsePacket)( decoder_t *p_dec)
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
/* Allocate the subpicture internal data. */
p_spu = vout_CreateSubPicture( p_sys->p_vout, MEMORY_SUBPICTURE );
p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
return;
......
......@@ -2,7 +2,7 @@
* Philips OGT (SVCD subtitle) packet parser
*****************************************************************************
* Copyright (C) 2003, 2004 VideoLAN
* $Id: ogt_parse.c,v 1.12 2004/01/22 04:46:19 rocky Exp $
* $Id$
*
* Author: Rocky Bernstein
* based on code from:
......@@ -165,7 +165,8 @@ E_(ParsePacket)( decoder_t *p_dec)
dbg_print( (DECODE_DBG_CALL|DECODE_DBG_EXT) , "");
/* Allocate the subpicture internal data. */
p_spu = vout_CreateSubPicture( p_sys->p_vout, MEMORY_SUBPICTURE );
p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
return;
......
......@@ -2,7 +2,7 @@
* parse.c: SPU parser
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: parse.c,v 1.17 2004/01/27 22:51:39 hartman Exp $
* $Id$
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Laurent Aimar <fenrir@via.ecp.fr>
......@@ -72,7 +72,8 @@ void E_(ParsePacket)( decoder_t *p_dec)
subpicture_t *p_spu;
/* Allocate the subpicture internal data. */
p_spu = vout_CreateSubPicture( p_sys->p_vout, MEMORY_SUBPICTURE );
p_spu = vout_CreateSubPicture( p_sys->p_vout, SUBT1_CHAN, TEXT_CONTENT,
MEMORY_SUBPICTURE );
if( p_spu == NULL )
{
return;
......
......@@ -371,7 +371,7 @@ static void ParseText( decoder_t *p_dec, block_t *p_block,
}
}
StripTags( psz_subtitle );
vout_ShowTextAbsolute( p_vout, psz_subtitle, NULL,
vout_ShowTextAbsolute( p_vout, SUBT1_CHAN, psz_subtitle, NULL,
OSD_ALIGN_BOTTOM | p_sys->i_align, i_align_h,
i_align_v, p_block->i_pts,
p_block->i_length ? p_block->i_pts + p_block->i_length : 0 );
......
......@@ -232,7 +232,7 @@ static void Run( intf_thread_t *p_intf )
if( i_action == ACTIONID_QUIT )
{
p_intf->p_vlc->b_die = VLC_TRUE;
vout_OSDMessage( p_intf, _( "Quit" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Quit" ) );
continue;
}
else if( i_action == ACTIONID_VOL_UP )
......@@ -243,12 +243,12 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
vout_OSDMessage( p_intf, "Vol %d%%",
vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
2*i_newvol*100/AOUT_VOLUME_MAX );
}
}
......@@ -261,12 +261,12 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
vout_OSDMessage( p_intf, "Vol %d%%",
vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
2*i_newvol*100/AOUT_VOLUME_MAX );
}
}
......@@ -280,19 +280,19 @@ static void Run( intf_thread_t *p_intf )
{
if( i_newvol == 0 )
{
vout_OSDMessage( p_intf, _( "Mute" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Mute" ) );
vout_OSDIcon( VLC_OBJECT( p_intf ), OSD_MUTE_ICON );
}
else
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), VOLUME_CHAN,
i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
vout_OSDMessage( p_intf, "Vol %d%%",
vout_OSDMessage( p_intf, VOLUME_CHAN, "Vol %d%%",
i_newvol * 100 / AOUT_VOLUME_MAX );
}
}
......@@ -307,7 +307,8 @@ static void Run( intf_thread_t *p_intf )
{
i_delay--;
input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
vout_OSDMessage( p_intf, "Subtitle delay %i ms", i_delay*100);
vout_OSDMessage( p_intf, SOLO_CHAN, "Subtitle delay %i ms",
i_delay*100);
}
}
else if( i_action == ACTIONID_SUBDELAY_UP )
......@@ -318,7 +319,8 @@ static void Run( intf_thread_t *p_intf )
{
i_delay++;
input_Control( p_input, INPUT_SET_SUBDELAY, i_delay );
vout_OSDMessage( p_intf, "Subtitle delay %i ms", i_delay*100);
vout_OSDMessage( p_intf, SOLO_CHAN, "Subtitle delay %i ms",
i_delay*100);
}
}
else if( i_action == ACTIONID_FULLSCREEN && p_vout )
......@@ -367,7 +369,7 @@ static void Run( intf_thread_t *p_intf )
if( i_action == ACTIONID_PAUSE )
{
vout_OSDMessage( p_intf, _( "Pause" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
......@@ -377,12 +379,13 @@ static void Run( intf_thread_t *p_intf )
var_Set( p_input, "time-offset", val );
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, _( "Jump -10 seconds" ) );
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump -10 seconds" ) );
}
}
else if( i_action == ACTIONID_JUMP_FORWARD_10SEC && b_seekable )
......@@ -393,12 +396,13 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, _( "Jump +10 seconds" ) );
vout_OSDMessage( p_intf, POSITION_CHAN,
_( "Jump +10 seconds" ) );
}
}
}
......@@ -410,12 +414,13 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, _( "Jump -1 minute" ) );
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump -1 minute" ) );
}
}
}
......@@ -427,12 +432,13 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, _( "Jump +1 minute" ) );
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump +1 minute" ) );
}
}
}
......@@ -444,12 +450,13 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, _( "Jump -5 minutes" ) );
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump -5 minutes" ) );
}
}
}
......@@ -461,12 +468,13 @@ static void Run( intf_thread_t *p_intf )
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
vout_OSDSlider( VLC_OBJECT( p_intf ), POSITION_CHAN,
GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
vout_OSDMessage( p_intf, _( "Jump +5 minutes" ) );
vout_OSDMessage( p_intf, SOLO_CHAN,
_( "Jump +5 minutes" ) );
}
}
}
......@@ -525,12 +533,12 @@ static void Run( intf_thread_t *p_intf )
if( time.i_time > 0 )
{
secstotimestr( psz_duration, time.i_time / 1000000 );
vout_OSDMessage( p_input, "%s / %s",
vout_OSDMessage( p_input, POSITION_CHAN, "%s / %s",
psz_time, psz_duration );
}
else if( i_seconds > 0 )
{
vout_OSDMessage( p_input, psz_time );
vout_OSDMessage( p_input, POSITION_CHAN, psz_time );
}
}
else if( i_action >= ACTIONID_PLAY_BOOKMARK1 &&
......
......@@ -189,21 +189,21 @@ static void Run( intf_thread_t *p_intf )
if( !strcmp( c, "QUIT" ) )
{
p_intf->p_vlc->b_die = VLC_TRUE;
vout_OSDMessage( p_intf, _("Quit" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _("Quit" ) );
continue;
}
else if( !strcmp( c, "VOL_UP" ) )
{
audio_volume_t i_newvol;
aout_VolumeUp( p_intf, 1, &i_newvol );
vout_OSDMessage( p_intf, _("Vol %%%d"),
vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %%%d"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
else if( !strcmp( c, "VOL_DOWN" ) )
{
audio_volume_t i_newvol;
aout_VolumeDown( p_intf, 1, &i_newvol );
vout_OSDMessage( p_intf, _("Vol %%%d"),
vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %%%d"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
else if( !strcmp( c, "MUTE" ) )
......@@ -212,11 +212,11 @@ static void Run( intf_thread_t *p_intf )
aout_VolumeMute( p_intf, &i_newvol );
if( i_newvol == 0 )
{
vout_OSDMessage( p_intf, _( "Mute" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Mute" ) );
}
else
{
vout_OSDMessage( p_intf, _("Vol %d%%"),
vout_OSDMessage( p_intf, SOLO_CHAN, _("Vol %d%%"),
i_newvol * 100 / AOUT_VOLUME_MAX );
}
}
......@@ -305,7 +305,8 @@ static void Run( intf_thread_t *p_intf )
}
if( p_input && val.i_int != PAUSE_S )
{
vout_OSDMessage( VLC_OBJECT(p_intf), _( "Pause" ) );
vout_OSDMessage( VLC_OBJECT(p_intf), SOLO_CHAN,
_( "Pause" ) );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
......@@ -319,7 +320,7 @@ static void Run( intf_thread_t *p_intf )
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vout_OSDMessage( p_intf, _( "Play" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Play" ) );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
......@@ -366,7 +367,8 @@ static void Run( intf_thread_t *p_intf )
list.p_list->p_values[i+1] );
i++;
}
vout_OSDMessage( VLC_OBJECT(p_input), _("Audio track: %s"),
vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN,
_("Audio track: %s"),
list2.p_list->p_values[i].psz_string );
}
else if( !strcmp( c, "SUBTITLE_TRACK" ) )
......@@ -401,12 +403,14 @@ static void Run( intf_thread_t *p_intf )
var_Set( p_input, "spu-es", list.p_list->p_values[i+1] );
i = i + 1;
}
vout_OSDMessage( VLC_OBJECT(p_input), _("Subtitle track: %s"), list2.p_list->p_values[i].psz_string );
vout_OSDMessage( VLC_OBJECT(p_input), SOLO_CHAN,
_("Subtitle track: %s"),
list2.p_list->p_values[i].psz_string );
}
else if( !strcmp( c, "PAUSE" ) )
{
vlc_value_t val;
vout_OSDMessage( p_intf, _( "Pause" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
......
......@@ -56,7 +56,7 @@
}
if( p_input && val.i_int != PAUSE_S )
{
vout_OSDMessage( p_intf, _( "Pause" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Pause" ) );
val.i_int = PAUSE_S;
var_Set( p_input, "state", val );
}
......@@ -70,7 +70,7 @@
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
vout_OSDMessage( p_intf, _( "Play" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Play" ) );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
......@@ -92,7 +92,7 @@
FIND_ANYWHERE );
if( p_playlist != NULL )
{
vout_OSDMessage( p_intf, _( "Stop" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Stop" ) );
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
......@@ -108,7 +108,7 @@
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-faster", val );
vout_OSDMessage( p_intf, _( "Faster" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Faster" ) );
vlc_object_release( p_input );
}
}
......@@ -123,7 +123,7 @@
vlc_value_t val; val.b_bool = VLC_TRUE;
var_Set( p_input, "rate-slower", val );
vout_OSDMessage( p_intf, _( "Slower" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Slower" ) );
vlc_object_release( p_input );
}
}
......@@ -137,7 +137,7 @@
{
playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
vout_OSDMessage( p_intf, _( "Previous" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Previous" ) );
}
}
......@@ -150,7 +150,7 @@
{
playlist_Next( p_playlist );
vlc_object_release( p_playlist );
vout_OSDMessage( p_intf, _( "Next" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Next" ) );
}
}
......@@ -170,11 +170,11 @@
var_Set( p_playlist, "random", val );
if( val.b_bool )
{
vout_OSDMessage( p_intf, _( "Random On" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Random On" ) );
}
else
{
vout_OSDMessage( p_intf, _( "Random Off" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Random Off" ) );
}
p_intf->p_sys->b_playlist_update = VLC_TRUE;
......@@ -202,11 +202,11 @@
var_Set( p_playlist, "repeat", val );
if( val.b_bool )
{
vout_OSDMessage( p_intf, _( "Repeat All" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) );
}
else
{
vout_OSDMessage( p_intf, _( "Repeat Off" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
}
p_intf->p_sys->b_playlist_update = VLC_TRUE;
......@@ -234,11 +234,11 @@
var_Set( p_playlist, "loop", val );
if( val.b_bool )
{
vout_OSDMessage( p_intf, _( "Repeat One" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) );
}
else
{
vout_OSDMessage( p_intf, _( "Repeat Off" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
}
p_intf->p_sys->b_playlist_update = VLC_TRUE;
......@@ -256,7 +256,7 @@
vlc_value_t time;
time.i_time = 10 * 1000000;
var_Set( p_input, "time-offset", time );
vout_OSDMessage( p_intf, _( "Jump +10 Seconds" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Jump +10 Seconds" ) );
vlc_object_release( p_input );
}
}
......@@ -271,7 +271,7 @@
vlc_value_t time;
time.i_time = -10 * 1000000;
var_Set( p_input, "time-offset", time );
vout_OSDMessage( p_intf, _( "Jump -10 Seconds" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Jump -10 Seconds" ) );
vlc_object_release( p_input );
}
}
......@@ -333,7 +333,8 @@
[o_volumeslider setFloatValue: (float)(i_volume / AOUT_VOLUME_STEP)];
vout_OSDMessage( p_intf, "Vol %d%%", i_volume*100/AOUT_VOLUME_MAX );
vout_OSDMessage( p_intf, SOLO_CHAN, "Vol %d%%",
i_volume*100/AOUT_VOLUME_MAX );
}
- (IBAction)windowAction:(id)sender
......
......@@ -545,7 +545,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
var_Set( p_playlist, "loop", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "repeat", val1 );
vout_OSDMessage( p_intf, _( "Repeat One" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat One" ) );
break;
case 2:
......@@ -553,7 +553,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
var_Set( p_playlist, "repeat", val1 );
val1.b_bool = 1;
var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, _( "Repeat All" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat All" ) );
break;
default:
......@@ -564,7 +564,7 @@ belongs to an Apple hidden private API, and then can "disapear" at any time*/
val1.b_bool = 0;
var_Set( p_playlist, "repeat", val1 );
var_Set( p_playlist, "loop", val1 );
vout_OSDMessage( p_intf, _( "Repeat Off" ) );
vout_OSDMessage( p_intf, SOLO_CHAN, _( "Repeat Off" ) );
}
break;
}
......
......@@ -2,7 +2,7 @@
* renderer.c : dummy text rendering functions
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: renderer.c,v 1.4 2003/12/08 17:48:13 yoann Exp $
* $Id$
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
*
......@@ -24,8 +24,8 @@
#include <vlc/vlc.h>
#include <vlc/vout.h>
static subpicture_t * AddText ( vout_thread_t *, char *, text_style_t *, int,
int, int, mtime_t, mtime_t );
static subpicture_t * AddText( vout_thread_t *, int, char *, text_style_t *,
int, int, int, mtime_t, mtime_t );
int E_(OpenRenderer)( vlc_object_t *p_this )
{
......@@ -34,9 +34,10 @@ int E_(OpenRenderer)( vlc_object_t *p_this )
return VLC_SUCCESS;
}
static subpicture_t * AddText ( vout_thread_t *p_vout, char *psz_string,
text_style_t *p_style , int i_flags, int i_x_margin,
int i_y_margin, mtime_t i_start, mtime_t i_stop )
static subpicture_t * AddText( vout_thread_t *p_vout, int i_channel,
char *psz_string, text_style_t *p_style , int i_flags,
int i_x_margin, int i_y_margin, mtime_t i_start,
mtime_t i_stop )
{
return VLC_SUCCESS;
}
......
......@@ -77,8 +77,8 @@ static void RenderYUY2( vout_thread_t *, picture_t *,
const subpicture_t * );
static void RenderRV32( vout_thread_t *, picture_t *,
const subpicture_t * );
static subpicture_t *AddText ( vout_thread_t *, char *, text_style_t *, int,
int, int, mtime_t, mtime_t );
static subpicture_t *AddText ( vout_thread_t *, int, char *, text_style_t *,
int, int, int, mtime_t, mtime_t );
static void FreeString( subpicture_t * );
......@@ -667,9 +667,10 @@ static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
* needed glyphs into memory. It is used as pf_add_string callback in
* the vout method by this module
*/
static subpicture_t *AddText ( vout_thread_t *p_vout, char *psz_string,
text_style_t *p_style, int i_flags, int i_hmargin,
int i_vmargin, mtime_t i_start, mtime_t i_stop )
static subpicture_t *AddText ( vout_thread_t *p_vout, int i_channel,
char *psz_string, text_style_t *p_style, int i_flags,
int i_hmargin, int i_vmargin, mtime_t i_start,
mtime_t i_stop )
{
subpicture_sys_t *p_string;
int i, i_pen_y, i_pen_x, i_error, i_glyph_index, i_previous;
......@@ -705,7 +706,8 @@ static subpicture_t *AddText ( vout_thread_t *p_vout, char *psz_string,
p_subpic = 0;
/* Create and initialize a subpicture */
p_subpic = vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
p_subpic = vout_CreateSubPicture( p_vout, i_channel, TEXT_CONTENT,
MEMORY_SUBPICTURE );
if ( p_subpic == NULL )
{
return NULL;
......
......@@ -26,6 +26,7 @@
/**
* \brief Show text on the video for some time
* \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
* \param i_flags flags for alignment and such
......@@ -33,9 +34,9 @@
* \param i_vmargin vertical margin in pixels
* \param i_duration Amount of time the text is to be shown.
*/
subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
text_style_t *p_style, int i_flags,
int i_hmargin, int i_vmargin,
subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, int i_channel,
char *psz_string, text_style_t *p_style,
int i_flags, int i_hmargin, int i_vmargin,
mtime_t i_duration )
{
subpicture_t *p_subpic = NULL;
......@@ -43,8 +44,8 @@ subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
if ( p_vout->pf_add_string )
{
p_subpic = p_vout->pf_add_string( p_vout, psz_string, p_style, i_flags,
i_hmargin, i_vmargin, i_now, i_now + i_duration );
p_subpic = p_vout->pf_add_string( p_vout, i_channel, psz_string,
p_style, i_flags, i_hmargin, i_vmargin, i_now, i_now + i_duration );
}
else
{
......@@ -57,6 +58,7 @@ subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
/**
* \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
* \param i_flags flags for alignment and such
......@@ -67,14 +69,14 @@ subpicture_t *vout_ShowTextRelative( vout_thread_t *p_vout, char *psz_string,
* 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, char *psz_string,
text_style_t *p_style, int i_flags,
int i_hmargin, int i_vmargin, mtime_t i_start,
mtime_t i_stop )
int vout_ShowTextAbsolute( vout_thread_t *p_vout, int i_channel,
char *psz_string, text_style_t *p_style,
int i_flags, int i_hmargin, int i_vmargin,
mtime_t i_start, mtime_t i_stop )
{
if ( p_vout->pf_add_string )
{
p_vout->pf_add_string( p_vout, psz_string, p_style, i_flags,
p_vout->pf_add_string( p_vout, i_channel, psz_string, p_style, i_flags,
i_hmargin, i_vmargin, i_start, i_stop );
return VLC_SUCCESS;
}
......@@ -90,9 +92,11 @@ int vout_ShowTextAbsolute( vout_thread_t *p_vout, char *psz_string,
* \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 i_channel Subpicture channel
* \param psz_format printf style formatting
**/
void __vout_OSDMessage( vlc_object_t *p_caller, char *psz_format, ... )
void __vout_OSDMessage( vlc_object_t *p_caller, int i_channel,
char *psz_format, ... )
{
vout_thread_t *p_vout;
char *psz_string;
......@@ -106,17 +110,9 @@ void __vout_OSDMessage( vlc_object_t *p_caller, char *psz_format, ... )
{
va_start( args, psz_format );
vasprintf( &psz_string, psz_format, args );
vlc_mutex_lock( &p_vout->change_lock );
if( p_vout->p_last_osd_message )
{
vout_DestroySubPicture( p_vout, p_vout->p_last_osd_message );
}
p_vout->p_last_osd_message = vout_ShowTextRelative( p_vout, psz_string,
NULL, OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
vlc_mutex_unlock( &p_vout->change_lock );
vout_ShowTextRelative( p_vout, i_channel, psz_string, NULL,
OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, 30,20,1000000 );
vlc_object_release( p_vout );
free( psz_string );
......
......@@ -45,7 +45,7 @@ static void RenderYUY2( vout_thread_t *, picture_t *, const subpicture_t *,
int );
static void RenderRV32( vout_thread_t *, picture_t *, const subpicture_t *,
int );
static subpicture_t *vout_CreateWidget( vout_thread_t * );
static subpicture_t *vout_CreateWidget( vout_thread_t *, int );
static void FreeWidget( subpicture_t * );
/**
......@@ -162,9 +162,9 @@ static void DrawTriangle( vout_thread_t *p_vout, subpicture_t *p_subpic,
}
/*****************************************************************************
* Render: place string in picture
* Render: place widget in picture
*****************************************************************************
* This function merges the previously rendered freetype glyphs into a picture
* This function merges the previously drawn widget into a picture
*****************************************************************************/
static void Render( vout_thread_t *p_vout, picture_t *p_pic,
const subpicture_t *p_subpic )
......@@ -372,7 +372,7 @@ static void RenderRV32( vout_thread_t *p_vout, picture_t *p_pic,
/*****************************************************************************
* Creates and initializes an OSD widget.
*****************************************************************************/
subpicture_t *vout_CreateWidget( vout_thread_t *p_vout )
subpicture_t *vout_CreateWidget( vout_thread_t *p_vout, int i_channel )
{
subpicture_t *p_subpic;
subpicture_sys_t *p_widget;
......@@ -382,7 +382,8 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout )
p_widget = 0;
/* Create and initialize a subpicture */
p_subpic = vout_CreateSubPicture( p_vout, MEMORY_SUBPICTURE );
p_subpic = vout_CreateSubPicture( p_vout, i_channel, GRAPH_CONTENT,
MEMORY_SUBPICTURE );
if( p_subpic == NULL )
{
return NULL;
......@@ -409,7 +410,8 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout )
* Displays an OSD slider.
* Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
*****************************************************************************/
void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
short i_type )
{
vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
FIND_ANYWHERE );
......@@ -422,7 +424,7 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
return;
}
p_subpic = vout_CreateWidget( p_vout );
p_subpic = vout_CreateWidget( p_vout, i_channel );
if( p_subpic == NULL )
{
return;
......@@ -481,17 +483,8 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
p_widget->i_height - 1, STYLE_EMPTY );
}
vlc_mutex_lock( &p_vout->change_lock );
if( p_vout->p_last_osd_message )
{
vout_DestroySubPicture( p_vout, p_vout->p_last_osd_message );
}
p_vout->p_last_osd_message = p_subpic;
vout_DisplaySubPicture( p_vout, p_subpic );
vlc_mutex_unlock( &p_vout->change_lock );
vlc_object_release( p_vout );
return;
}
......@@ -506,14 +499,24 @@ void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
FIND_ANYWHERE );
subpicture_t *p_subpic;
subpicture_sys_t *p_widget;
int i_x_margin, i_y_margin;
int i_x_margin, i_y_margin, i_channel;
if( p_vout == NULL || !config_GetInt( p_caller, "osd" ) )
{
return;
}
p_subpic = vout_CreateWidget( p_vout );
switch( i_type )
{
case OSD_SPEAKER_ICON:
i_channel = VOLUME_CHAN;
break;
default:
i_channel = SOLO_CHAN;
break;
}
p_subpic = vout_CreateWidget( p_vout, i_channel );
if( p_subpic == NULL )
{
return;
......@@ -575,17 +578,8 @@ void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
}
}
vlc_mutex_lock( &p_vout->change_lock );
if( p_vout->p_last_osd_message )
{
vout_DestroySubPicture( p_vout, p_vout->p_last_osd_message );
}
p_vout->p_last_osd_message = p_subpic;
vout_DisplaySubPicture( p_vout, p_subpic );
vlc_mutex_unlock( &p_vout->change_lock );
vlc_object_release( p_vout );
return;
}
......
......@@ -82,7 +82,8 @@ void vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
* \param i_type the type of the subpicture
* \return NULL on error, a reserved subpicture otherwise
*/
subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type )
subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_channel,
int i_content, int i_type )
{
int i_subpic; /* subpicture index */
subpicture_t * p_subpic = NULL; /* first free subpicture */
......@@ -90,9 +91,40 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type )
/* Get lock */
vlc_mutex_lock( &p_vout->subpicture_lock );
/*
* Destroy all subpics which are not in the correct channel and
* subpics which are in the right channel and have the same content type
* (only concerns exclusive channels)
*/
if( i_channel >= BEGIN_EXCLUSIVE_CHAN )
{
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
{
p_subpic = &p_vout->p_subpicture[i_subpic];
if( p_subpic->i_status == FREE_SUBPICTURE
|| ( p_subpic->i_status != RESERVED_SUBPICTURE
&& p_subpic->i_status != READY_SUBPICTURE ) )
{
continue;
}
if( ( p_subpic->i_channel != i_channel
&& p_subpic->i_channel >= BEGIN_EXCLUSIVE_CHAN )
|| ( p_subpic->i_channel == i_channel
&& p_subpic->i_content == i_content ) )
{
if( p_subpic->pf_destroy )
{
p_subpic->pf_destroy( p_subpic );
}
p_subpic->i_status = FREE_SUBPICTURE;
}
}
}
/*
* Look for an empty place
*/
p_subpic = NULL;
for( i_subpic = 0; i_subpic < VOUT_MAX_SUBPICTURES; i_subpic++ )
{
if( p_vout->p_subpicture[i_subpic].i_status == FREE_SUBPICTURE )
......@@ -113,6 +145,9 @@ subpicture_t *vout_CreateSubPicture( vout_thread_t *p_vout, int i_type )
}
/* Copy subpicture information, set some default values */
p_subpic->i_channel = i_channel;
p_subpic->i_content = i_content;
p_subpic->i_type = i_type;
p_subpic->i_status = RESERVED_SUBPICTURE;
......@@ -163,11 +198,6 @@ void vout_DestroySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
p_subpic->pf_destroy( p_subpic );
}
if( p_subpic == p_vout->p_last_osd_message )
{
p_vout->p_last_osd_message = NULL;
}
p_subpic->i_status = FREE_SUBPICTURE;
vlc_mutex_unlock( &p_vout->subpicture_lock );
......
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