#include <vlc_interface.h>
#include <vlc_input.h>
#include <vlc_vout.h>
-#include <vlc_aout_intf.h>
#include <vlc_osd.h>
#include <vlc_playlist.h>
#include <vlc_keys.h>
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 DisplayVolume( intf_thread_t *, vout_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 * );
set_subcategory( SUBCAT_INTERFACE_HOTKEYS )
add_integer( "hotkeys-mousewheel-mode", MOUSEWHEEL_VOLUME,
- N_("MouseWheel x-axis Control"),
- N_("MouseWheel x-axis can control volume, position or "
+ N_("MouseWheel up-down axis Control"),
+ N_("The MouseWheel up-down (vertical) axis can control volume, position or "
"mousewheel event can be ignored"), false )
change_integer_list( i_mode_list, psz_mode_list_text )
return VLC_ENOMEM;
p_intf->p_sys = p_sys;
- p_intf->pf_run = NULL;
p_sys->p_last_vout = NULL;
p_intf->p_sys->i_mousewheel_mode =
/* Update the vout */
vout_thread_t *p_vout = p_input ? input_GetVout( p_input ) : NULL;
- /* Update the aout */
- vlc_object_t *p_aout = p_input ? (vlc_object_t *)input_GetAout( p_input ) : NULL;
-
/* Register OSD channels */
/* FIXME: this check can fail if the new vout is reallocated at the same
* address as the old one... We should rather listen to vout events.
/* Volume and audio actions */
case ACTIONID_VOL_UP:
{
- audio_volume_t i_newvol;
- aout_VolumeUp( p_playlist, 1, &i_newvol );
- DisplayVolume( p_intf, p_vout, i_newvol );
+ float vol;
+ if( playlist_VolumeUp( p_playlist, 1, &vol ) == 0 )
+ DisplayVolume( p_intf, p_vout, vol );
break;
}
case ACTIONID_VOL_DOWN:
{
- audio_volume_t i_newvol;
- aout_VolumeDown( p_playlist, 1, &i_newvol );
- DisplayVolume( p_intf, p_vout, i_newvol );
+ float vol;
+ if( playlist_VolumeDown( p_playlist, 1, &vol ) == 0 )
+ DisplayVolume( p_intf, p_vout, vol );
break;
}
case ACTIONID_VOL_MUTE:
- {
- audio_volume_t i_newvol = -1;
- aout_ToggleMute( p_playlist, &i_newvol );
- if( p_vout )
+ if( playlist_MuteToggle( p_playlist ) == 0 )
{
- if( i_newvol == 0 )
+ float vol = playlist_VolumeGet( p_playlist );
+ if( playlist_MuteGet( p_playlist ) > 0 || vol == 0.f )
{
ClearChannels( p_intf, p_vout );
DisplayIcon( p_vout, OSD_MUTE_ICON );
}
else
- DisplayVolume( p_intf, p_vout, i_newvol );
+ DisplayVolume( p_intf, p_vout, vol );
}
break;
- }
/* Interface showing */
- case ACTIONID_INTF_SHOW:
- var_SetBool( p_intf->p_libvlc, "intf-show", true );
+ case ACTIONID_INTF_TOGGLE_FSC:
+ case ACTIONID_INTF_HIDE:
+ var_TriggerCallback( p_intf->p_libvlc, "intf-toggle-fscontrol" );
break;
- case ACTIONID_INTF_HIDE:
- var_SetBool( p_intf->p_libvlc, "intf-show", false );
+ case ACTIONID_INTF_BOSS:
+ var_TriggerCallback( p_intf->p_libvlc, "intf-boss" );
break;
/* Video Output actions */
ClearChannels( p_intf, p_vout );
int state = var_GetInteger( p_input, "state" );
- if( state != PAUSE_S )
- {
- DisplayIcon( p_vout, OSD_PAUSE_ICON );
- state = PAUSE_S;
- }
- else
- {
- DisplayIcon( p_vout, OSD_PLAY_ICON );
- state = PLAYING_S;
- }
- var_SetInteger( p_input, "state", state );
+ DisplayIcon( p_vout, state != PAUSE_S ? OSD_PAUSE_ICON : OSD_PLAY_ICON );
+ playlist_Pause( p_playlist );
}
else
playlist_Play( p_playlist );
case ACTIONID_AUDIODEVICE_CYCLE:
{
- if( !p_aout )
+ vlc_object_t *p_aout =
+ (vlc_object_t *)playlist_GetAout( p_playlist );
+ if( p_aout == NULL )
break;
- vlc_value_t val, list, list2;
- int i_count, i;
+ vlc_value_t val, ids, names;
- var_Get( p_aout, "audio-device", &val );
- var_Change( p_aout, "audio-device", VLC_VAR_GETCHOICES,
- &list, &list2 );
- i_count = list.p_list->i_count;
+ var_Get( p_aout, "device", &val );
+ var_Change( p_aout, "device", VLC_VAR_GETCHOICES, &ids, &names );
- if( i_count > 1 )
+ for( int i = 0; i < ids.p_list->i_count; i++ )
{
- for( i = 0; i < i_count; i++ )
+ if( !strcmp(val.psz_string,
+ ids.p_list->p_values[i].psz_string) )
{
- if( val.i_int == list.p_list->p_values[i].i_int )
- {
- break;
- }
- }
- if( i == i_count )
- {
- msg_Warn( p_aout,
- "invalid current audio device, selecting 0" );
- var_Set( p_aout, "audio-device",
- list.p_list->p_values[0] );
- i = 0;
- }
- else if( i == i_count -1 )
- {
- var_Set( p_aout, "audio-device",
- list.p_list->p_values[0] );
- i = 0;
- }
- else
- {
- var_Set( p_aout, "audio-device",
- list.p_list->p_values[i+1] );
- i++;
+ int j = i + 1;
+ if( j >= ids.p_list->i_count )
+ j = 0;
+
+ DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+ _("Audio Device: %s"),
+ names.p_list->p_values[j].psz_string);
+ var_Set( p_aout, "device", ids.p_list->p_values[j] );
+ break;
}
- DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
- _("Audio Device: %s"),
- list2.p_list->p_values[i].psz_string);
}
- var_FreeList( &list, &list2 );
+ var_FreeList( &ids, &names );
+ vlc_object_release( p_aout );
break;
}
list2.p_list->p_values[i].psz_string );
var_FreeList( &list, &list2 );
}
+ else if( i_action == ACTIONID_PROGRAM_SID )
+ {
+ vlc_value_t val, list, list2;
+ int i_count, i;
+ var_Get( p_input, "program", &val );
+
+ var_Change( p_input, "program", VLC_VAR_GETCHOICES,
+ &list, &list2 );
+ i_count = list.p_list->i_count;
+ if( i_count <= 1 )
+ {
+ DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+ _("Program Service ID: %s"), _("N/A") );
+ var_FreeList( &list, &list2 );
+ goto cleanup_and_continue;
+ }
+ for( i = 0; i < i_count; i++ )
+ {
+ if( val.i_int == list.p_list->p_values[i].i_int )
+ {
+ break;
+ }
+ }
+ /* value of program was not in choices list */
+ if( i == i_count )
+ {
+ msg_Warn( p_input,
+ "invalid current program SID, selecting 0" );
+ i = 0;
+ }
+ else if( i == i_count - 1 )
+ i = 0;
+ else
+ i++;
+ var_Set( p_input, "program", list.p_list->p_values[i] );
+ DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+ _("Program Service ID: %s"),
+ list2.p_list->p_values[i].psz_string );
+ var_FreeList( &list, &list2 );
+ }
else if( i_action == ACTIONID_ASPECT_RATIO && p_vout )
{
vlc_value_t val={0}, val_list, text_list;
free( psz_mode );
}
}
+ else if( i_action == ACTIONID_DEINTERLACE_MODE && p_vout )
+ {
+ char *psz_mode = var_GetString( p_vout, "deinterlace-mode" );
+ vlc_value_t vlist, tlist;
+ if( psz_mode && !var_Change( p_vout, "deinterlace-mode", VLC_VAR_GETCHOICES, &vlist, &tlist ) >= 0 )
+ {
+ const char *psz_text = NULL;
+ int i;
+ for( i = 0; i < vlist.p_list->i_count; i++ )
+ {
+ if( !strcmp( vlist.p_list->p_values[i].psz_string, psz_mode ) )
+ {
+ i++;
+ break;
+ }
+ }
+ if( i == vlist.p_list->i_count ) i = 0;
+ psz_text = tlist.p_list->p_values[i].psz_string;
+ var_SetString( p_vout, "deinterlace-mode", vlist.p_list->p_values[i].psz_string );
+
+ int i_deinterlace = var_GetInteger( p_vout, "deinterlace" );
+ if( i_deinterlace != 0 )
+ {
+ DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+ "%s (%s)", _("Deinterlace on"), psz_text ? psz_text : psz_mode );
+ }
+ else
+ {
+ DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
+ "%s (%s)", _("Deinterlace off"), psz_text ? psz_text : psz_mode );
+ }
+
+ var_FreeList( &vlist, &tlist );
+ }
+ free( psz_mode );
+ }
else if( ( i_action == ACTIONID_ZOOM ||
i_action == ACTIONID_UNZOOM ) && p_vout )
{
}
}
cleanup_and_continue:
- if( p_aout )
- vlc_object_release( p_aout );
if( p_vout )
vlc_object_release( p_vout );
if( p_input )
}
static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
- audio_volume_t i_vol )
+ float vol )
{
if( p_vout == NULL )
- {
return;
- }
ClearChannels( p_intf, p_vout );
if( var_GetBool( p_vout, "fullscreen" ) )
- {
- vout_OSDSlider( p_vout, VOLUME_WIDGET_CHAN,
- i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
- }
- DisplayMessage( p_vout, VOLUME_TEXT_CHAN, _( "Volume %d%%" ),
- i_vol*100/AOUT_VOLUME_DEFAULT );
+ vout_OSDSlider( p_vout, VOLUME_WIDGET_CHAN, lround(vol * 100.),
+ OSD_VERT_SLIDER );
+ DisplayMessage( p_vout, VOLUME_TEXT_CHAN, _( "Volume %ld%%" ),
+ lround(vol * 100.) );
}
static void DisplayRate( vout_thread_t *p_vout, float f_rate )