if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- i_newvol*100/AOUT_VOLUME_MAX, 1 );
+ i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- i_newvol*100/AOUT_VOLUME_MAX, 1 );
+ i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
}
else
{
}
}
+ else if( i_action == ACTIONID_VOL_MUTE )
+ {
+ audio_volume_t i_newvol = -1;
+ aout_VolumeMute( p_intf, &i_newvol );
+ if( p_vout )
+ {
+ if( i_newvol == 0 )
+ {
+ vout_OSDMessage( p_intf, _( "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 ),
+ i_newvol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
+ }
+ else
+ {
+ vout_OSDMessage( p_intf, "Vol %d%%",
+ i_newvol * 100 / AOUT_VOLUME_MAX );
+ }
+ }
+ }
+ }
+
else if( i_action == ACTIONID_SUBDELAY_DOWN )
{
int i_delay;
vout_OSDMessage( p_intf, "Subtitle delay %i ms", i_delay*100);
}
}
- else if( i_action == ACTIONID_VOL_MUTE )
- {
- audio_volume_t i_newvol = -1;
- aout_VolumeMute( p_intf, &i_newvol );
- if( i_newvol == 0 )
- {
- vout_OSDMessage( p_intf, _( "Mute" ) );
- }
- else
- {
- vout_OSDMessage( p_intf, "Vol %d%%",
- i_newvol * 100 / AOUT_VOLUME_MAX );
- }
- }
else if( i_action == ACTIONID_FULLSCREEN && p_vout )
{
var_Get( p_vout, "fullscreen", &val );
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- GetPosition( p_intf ), 0 );
+ GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- GetPosition( p_intf ), 0 );
+ GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- GetPosition( p_intf ), 0 );
+ GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- GetPosition( p_intf ), 0 );
+ GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
}
else if( i_action == ACTIONID_JUMP_BACKWARD_5MIN && b_seekable )
{
- vout_OSDMessage( p_intf, _( "Jump -5 minutes" ) );
val.i_time = -300000000;
var_Set( p_input, "time-offset", val );
if( p_vout )
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- GetPosition( p_intf ), 0 );
+ GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
if( !p_vout->p_parent_intf || p_vout->b_fullscreen )
{
vout_OSDSlider( VLC_OBJECT( p_intf ),
- GetPosition( p_intf ), 0 );
+ GetPosition( p_intf ), OSD_HOR_SLIDER );
}
else
{
#include <vlc/vout.h>
#include <osd.h>
-#define RECT_EMPTY 0
-#define RECT_FILLED 1
+#define STYLE_EMPTY 0
+#define STYLE_FILLED 1
/*****************************************************************************
* Local prototypes
/*****************************************************************************
* Draws a rectangle at the given position in the subpic.
- * It may be filled (fill == RECT_FILLED) or empty (fill == RECT_EMPTY).
+ * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).
*****************************************************************************/
static void DrawRect( vout_thread_t *p_vout, subpicture_t *p_subpic,
int i_x1, int i_y1, int i_x2, int i_y2, short fill )
int x, y;
subpicture_sys_t *p_widget = p_subpic->p_sys;
- if( fill == RECT_FILLED )
+ if( fill == STYLE_FILLED )
{
for( y = i_y1; y <= i_y2; y++ )
{
/*****************************************************************************
* Draws a triangle at the given position in the subpic.
- * It may be filled (fill == RECT_FILLED) or empty (fill == RECT_EMPTY).
+ * It may be filled (fill == STYLE_FILLED) or empty (fill == STYLE_EMPTY).
*****************************************************************************/
static void DrawTriangle( vout_thread_t *p_vout, subpicture_t *p_subpic,
int i_x1, int i_y1, int i_x2, int i_y2, short fill )
i_mid = i_y1 + ( ( i_y2 - i_y1 ) >> 1 );
- if( fill == RECT_FILLED )
+ if( i_x2 >= i_x1 )
{
- for( y = i_y1; y <= i_mid; y++ )
+ if( fill == STYLE_FILLED )
{
- h = y - i_y1;
- for( x = i_x1; x <= i_x1 + h && x <= i_x2; x++ )
+ for( y = i_y1; y <= i_mid; y++ )
{
- p_widget->p_pic[ x + p_widget->i_width * y ] = 1;
- p_widget->p_pic[ x + p_widget->i_width * ( i_y2 - h ) ] = 1;
+ h = y - i_y1;
+ for( x = i_x1; x <= i_x1 + h && x <= i_x2; x++ )
+ {
+ p_widget->p_pic[ x + p_widget->i_width * y ] = 1;
+ p_widget->p_pic[ x + p_widget->i_width * ( i_y2 - h ) ] = 1;
+ }
+ }
+ }
+ else
+ {
+ for( y = i_y1; y <= i_mid; y++ )
+ {
+ h = y - i_y1;
+ p_widget->p_pic[ i_x1 + p_widget->i_width * y ] = 1;
+ p_widget->p_pic[ i_x1 + h + p_widget->i_width * y ] = 1;
+ p_widget->p_pic[ i_x1 + p_widget->i_width * ( i_y2 - h ) ] = 1;
+ p_widget->p_pic[ i_x1 + h + p_widget->i_width * ( i_y2 - h ) ] = 1;
}
}
}
else
{
- for( y = i_y1; y <= i_mid; y++ )
+ if( fill == STYLE_FILLED )
{
- h = y - i_y1;
- p_widget->p_pic[ i_x1 + p_widget->i_width * y ] = 1;
- p_widget->p_pic[ i_x1 + h + p_widget->i_width * y ] = 1;
- p_widget->p_pic[ i_x1 + p_widget->i_width * ( i_y2 - h ) ] = 1;
- p_widget->p_pic[ i_x1 + h + p_widget->i_width * ( i_y2 - h ) ] = 1;
+ for( y = i_y1; y <= i_mid; y++ )
+ {
+ h = y - i_y1;
+ for( x = i_x1; x >= i_x1 - h && x >= i_x2; x-- )
+ {
+ p_widget->p_pic[ x + p_widget->i_width * y ] = 1;
+ p_widget->p_pic[ x + p_widget->i_width * ( i_y2 - h ) ] = 1;
+ }
+ }
+ }
+ else
+ {
+ for( y = i_y1; y <= i_mid; y++ )
+ {
+ h = y - i_y1;
+ p_widget->p_pic[ i_x1 + p_widget->i_width * y ] = 1;
+ p_widget->p_pic[ i_x1 - h + p_widget->i_width * y ] = 1;
+ p_widget->p_pic[ i_x1 + p_widget->i_width * ( i_y2 - h ) ] = 1;
+ p_widget->p_pic[ i_x1 - h + p_widget->i_width * ( i_y2 - h ) ] = 1;
+ }
}
}
}
/*****************************************************************************
* Displays an OSD slider.
- * Type 0 is position slider-like, and type 1 is volume slider-like.
+ * Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
*****************************************************************************/
void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
{
i_y_margin = p_vout->render.i_height / 10;
i_x_margin = i_y_margin;
- if( i_type == 0 )
+ if( i_type == OSD_HOR_SLIDER )
{
p_widget->i_width = p_vout->render.i_width - 2 * i_x_margin;
p_widget->i_height = p_vout->render.i_height / 20;
}
memset( p_widget->p_pic, 0, p_widget->i_width * p_widget->i_height );
- if( i_type == 0 )
+ if( i_type == OSD_HOR_SLIDER )
{
int i_x_pos = ( p_widget->i_width - 2 ) * i_position / 100;
int i_y_pos = p_widget->i_height / 2;
DrawRect( p_vout, p_subpic, i_x_pos - 1, 2, i_x_pos + 1,
- p_widget->i_height - 3, RECT_FILLED );
+ p_widget->i_height - 3, STYLE_FILLED );
DrawRect( p_vout, p_subpic, 0, 0, p_widget->i_width - 1,
- p_widget->i_height - 1, RECT_EMPTY );
+ p_widget->i_height - 1, STYLE_EMPTY );
}
- else if( i_type == 1 )
+ else if( i_type == OSD_VERT_SLIDER )
{
int i_y_pos = p_widget->i_height / 2;
DrawRect( p_vout, p_subpic, 2, p_widget->i_height -
( p_widget->i_height - 2 ) * i_position / 100,
p_widget->i_width - 3, p_widget->i_height - 3,
- RECT_FILLED );
- DrawRect( p_vout, p_subpic, 1, i_y_pos, 1, i_y_pos, RECT_FILLED );
+ STYLE_FILLED );
+ DrawRect( p_vout, p_subpic, 1, i_y_pos, 1, i_y_pos, STYLE_FILLED );
DrawRect( p_vout, p_subpic, p_widget->i_width - 2, i_y_pos,
- p_widget->i_width - 2, i_y_pos, RECT_FILLED );
+ p_widget->i_width - 2, i_y_pos, STYLE_FILLED );
DrawRect( p_vout, p_subpic, 0, 0, p_widget->i_width - 1,
- p_widget->i_height - 1, RECT_EMPTY );
+ p_widget->i_height - 1, STYLE_EMPTY );
}
vlc_mutex_lock( &p_vout->change_lock );
/*****************************************************************************
* Displays an OSD icon.
- * Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON
+ * Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON
*****************************************************************************/
void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
{
i_y_margin = p_vout->render.i_height / 15;
i_x_margin = i_y_margin;
- p_widget->i_width = p_vout->render.i_width / 22;
+ p_widget->i_width = p_vout->render.i_width / 20;
p_widget->i_height = p_widget->i_width;
p_widget->i_x = p_vout->render.i_width - i_x_margin -
p_widget->i_width;
{
int i_bar_width = p_widget->i_width / 3;
DrawRect( p_vout, p_subpic, 0, 0, i_bar_width - 1,
- p_widget->i_height - 1, RECT_FILLED );
+ p_widget->i_height - 1, STYLE_FILLED );
DrawRect( p_vout, p_subpic, p_widget->i_width - i_bar_width, 0,
- p_widget->i_width - 1, p_widget->i_height - 1, RECT_FILLED );
+ p_widget->i_width - 1, p_widget->i_height - 1, STYLE_FILLED );
}
else if( i_type == OSD_PLAY_ICON )
{
int i_delta = ( p_widget->i_width - i_mid ) >> 1;
int i_y2 = ( ( p_widget->i_height - 1 ) >> 1 ) * 2;
DrawTriangle( p_vout, p_subpic, i_delta, 0,
- p_widget->i_width - i_delta, i_y2, RECT_FILLED );
+ p_widget->i_width - i_delta, i_y2, STYLE_FILLED );
+ }
+ else if( i_type == OSD_SPEAKER_ICON || i_type == OSD_MUTE_ICON )
+ {
+ int i_mid = p_widget->i_height >> 1;
+ int i_delta = ( p_widget->i_width - i_mid ) >> 1;
+ int i_y2 = ( ( p_widget->i_height - 1 ) >> 1 ) * 2;
+ DrawRect( p_vout, p_subpic, i_delta, i_mid / 2,
+ p_widget->i_width - i_delta,
+ p_widget->i_height - 1 - i_mid / 2, STYLE_FILLED );
+ DrawTriangle( p_vout, p_subpic, p_widget->i_width - i_delta, 0,
+ i_delta, i_y2, STYLE_FILLED );
+ if( i_type == OSD_MUTE_ICON )
+ {
+ int i;
+ for( i = 1; i < p_widget->i_width; i++ )
+ {
+ int k = i + ( p_widget->i_height - i - 1 ) * p_widget->i_width;
+ p_widget->p_pic[ k ] = 1 - p_widget->p_pic[ k ];
+ }
+ }
}
vlc_mutex_lock( &p_vout->change_lock );