/***************************************************************************** * libvlc_audio_get_mute : Get the volume state, true if muted *****************************************************************************/ void libvlc_audio_toggle_mute( libvlc_instance_t *p_instance, libvlc_exception_t *p_e ) { VLC_UNUSED(p_e); aout_ToggleMute( p_instance->p_libvlc_int, NULL ); }
void libvlc_audio_set_mute( libvlc_instance_t *p_instance, int mute, libvlc_exception_t *p_e ) { if ( mute ^ libvlc_audio_get_mute( p_instance, p_e ) ) { aout_ToggleMute( p_instance->p_libvlc_int, NULL ); } }
/***************************************************************************** * libvlc_audio_get_mute : Get the volume state, true if muted *****************************************************************************/ void libvlc_audio_toggle_mute( libvlc_media_player_t *mp ) { aout_ToggleMute( mp, NULL ); }
/***************************************************************************** * InterfaceWindow::MessageReceived *****************************************************************************/ void InterfaceWindow::MessageReceived( BMessage * p_message ) { switch( p_message->what ) { case B_ABOUT_REQUESTED: { BAlert * alert; alert = new BAlert( "VLC media player" VERSION, "VLC media player" VERSION " (BeOS interface)\n\n" "The VideoLAN team <*****@*****.**>\n" "http://www.videolan.org/", _("OK") ); alert->Go(); break; } case TOGGLE_ON_TOP: break; case OPEN_FILE: _ShowFilePanel( B_REFS_RECEIVED, _("VLC media player: Open Media Files") ); break; case LOAD_SUBFILE: _ShowFilePanel( SUBFILE_RECEIVED, _("VLC media player: Open Subtitle File") ); break; #if 0 case OPEN_PLAYLIST: if (fPlaylistWindow->Lock()) { if (fPlaylistWindow->IsHidden()) fPlaylistWindow->Show(); else fPlaylistWindow->Activate(); fPlaylistWindow->Unlock(); } break; #endif case OPEN_DVD: { const char * psz_device; if( p_playlist && p_message->FindString( "device", &psz_device ) == B_OK ) { char psz_uri[1024]; memset( psz_uri, 0, 1024 ); snprintf( psz_uri, 1024, "dvdnav:%s", psz_device ); playlist_Add( p_playlist, psz_uri, psz_device, PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true ); } UpdatePlaylist(); } break; case SUBFILE_RECEIVED: { entry_ref ref; if( p_message->FindRef( "refs", 0, &ref ) == B_OK ) { BPath path( &ref ); if ( path.InitCheck() == B_OK ) config_PutPsz( p_intf, "sub-file", path.Path() ); } break; } case STOP_PLAYBACK: if( p_playlist ) { playlist_Stop( p_playlist ); } p_mediaControl->SetStatus(-1, INPUT_RATE_DEFAULT); break; case START_PLAYBACK: case PAUSE_PLAYBACK: { vlc_value_t val; val.i_int = PLAYING_S; if( p_input ) { var_Get( p_input, "state", &val ); } if( p_input && val.i_int != PAUSE_S ) { val.i_int = PAUSE_S; var_Set( p_input, "state", val ); } else { playlist_Play( p_playlist ); } break; } case HEIGHTH_PLAY: if( p_input ) { var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT * 8 ); } break; case QUARTER_PLAY: if( p_input ) { var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT * 4 ); } break; case HALF_PLAY: if( p_input ) { var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT * 2 ); } break; case NORMAL_PLAY: if( p_input ) { var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT ); } break; case TWICE_PLAY: if( p_input ) { var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT / 2 ); } break; case FOUR_PLAY: if( p_input ) { var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT / 4 ); } break; case HEIGHT_PLAY: if( p_input ) { var_SetInteger( p_input, "rate", INPUT_RATE_DEFAULT / 8 ); } break; case SEEK_PLAYBACK: /* handled by semaphores */ break; case VOLUME_CHG: aout_VolumeSet( p_intf, p_mediaControl->GetVolume() ); break; case VOLUME_MUTE: aout_ToggleMute( p_intf, NULL ); break; case SELECT_CHANNEL: { int32 channel; if( p_input ) { if( p_message->FindInt32( "audio-es", &channel ) == B_OK ) { var_SetInteger( p_input, "audio-es", channel ); } else if( p_message->FindInt32( "spu-es", &channel ) == B_OK ) { var_SetInteger( p_input, "spu-es", channel ); } } break; } case PREV_TITLE: if( p_input ) { var_TriggerCallback( p_input, "prev-title" ); } break; case NEXT_TITLE: if( p_input ) { var_TriggerCallback( p_input, "next-title" ); } break; case TOGGLE_TITLE: { int32 index; if( p_input && p_message->FindInt32( "index", &index ) == B_OK ) { var_SetInteger( p_input, "title", index ); } break; } case PREV_CHAPTER: if( p_input ) { var_TriggerCallback( p_input, "prev-chapter" ); } break; case NEXT_CHAPTER: if( p_input ) { var_TriggerCallback( p_input, "next-chapter" ); } break; case TOGGLE_CHAPTER: { int32 index; if( p_input && p_message->FindInt32( "index", &index ) == B_OK ) { var_SetInteger( p_input, "chapter", index ); } break; } case PREV_FILE: if( p_playlist ) { playlist_Prev( p_playlist ); } break; case NEXT_FILE: if( p_playlist ) { playlist_Next( p_playlist ); } break; case NAVIGATE_PREV: if( p_input ) { vlc_value_t val; /* First try to go to previous chapter */ if( !var_Get( p_input, "chapter", &val ) ) { if( val.i_int > 1 ) { var_TriggerCallback( p_input, "prev-chapter" ); break; } } /* Try to go to previous title */ if( !var_Get( p_input, "title", &val ) ) { if( val.i_int > 1 ) { var_TriggerCallback( p_input, "prev-title" ); break; } } /* Try to go to previous file */ if( p_playlist ) { playlist_Prev( p_playlist ); } } break; case NAVIGATE_NEXT: if( p_input ) { /* First try to go to next chapter */ if( !var_Get( p_input, "chapter", &val ) ) { int i_chapter_count = var_CountChoices( p_input, "chapter" ); if( i_chapter_count > val.i_int ) { var_TriggerCallback( p_input, "next-chapter" ); break; } } /* Try to go to next title */ if( !var_Get( p_input, "title", &val ) ) { int i_title_count = var_CountChoices( p_input, "title" ); if( i_title_count > val.i_int ) { var_TriggerCallback( p_input, "next-title" ); break; } } /* Try to go to next file */ if( p_playlist ) { playlist_Next( p_playlist ); } } break; // drag'n'drop and system messages case MSG_SOUNDPLAY: // convert soundplay drag'n'drop message (containing paths) // to normal message (containing refs) { const char* path; for ( int32 i = 0; p_message->FindString( "path", i, &path ) == B_OK; i++ ) { entry_ref ref; if ( get_ref_for_path( path, &ref ) == B_OK ) p_message->AddRef( "refs", &ref ); } } // fall through case B_REFS_RECEIVED: case B_SIMPLE_DATA: { /* file(s) opened by the File menu -> append to the playlist; file(s) opened by drag & drop -> replace playlist; file(s) opened by 'shift' + drag & drop -> append */ int32 count; type_code dummy; if( p_message->GetInfo( "refs", &dummy, &count ) != B_OK || count < 1 ) { break; } bool b_remove = ( p_message->WasDropped() && !( modifiers() & B_SHIFT_KEY ) ); if( b_remove && p_playlist ) { playlist_Clear( p_playlist, true ); } entry_ref ref; for( int i = 0; p_message->FindRef( "refs", i, &ref ) == B_OK; i++ ) { BPath path( &ref ); /* TODO: find out if this is a DVD icon */ if( p_playlist ) { playlist_Add( p_playlist, path.Path(), NULL, PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END, true ); } } UpdatePlaylist(); break; } case OPEN_PREFERENCES: { if( fPreferencesWindow->Lock() ) { if (fPreferencesWindow->IsHidden()) fPreferencesWindow->Show(); else fPreferencesWindow->Activate(); fPreferencesWindow->Unlock(); } break; } case OPEN_MESSAGES: { if( fMessagesWindow->Lock() ) { if (fMessagesWindow->IsHidden()) fMessagesWindow->Show(); else fMessagesWindow->Activate(); fMessagesWindow->Unlock(); } break; } case MSG_UPDATE: UpdateInterface(); break; default: BWindow::MessageReceived( p_message ); break; } }
void CmdMute::execute() { aout_ToggleMute( getIntf()->p_sys->p_playlist, NULL ); }
/***************************************************************************** * RunIntf: main loop *****************************************************************************/ static void RunIntf( intf_thread_t *p_intf ) { intf_sys_t *p_sys = p_intf->p_sys; int canc = vlc_savecancel(); input_thread_t *p_input; /* Main loop */ while( vlc_object_alive( p_intf ) ) { vlc_mutex_lock( &p_sys->lock ); /* * mouse cursor */ if( p_sys->b_got_gesture ) { int i_interval = 0; /* Do something */ /* If you modify this, please try to follow this convention: Start with LEFT, RIGHT for playback related commands and UP, DOWN, for other commands */ playlist_t * p_playlist = pl_Get( p_intf ); switch( p_sys->i_pattern ) { case LEFT: msg_Dbg( p_intf, "Go backward in the movie!" ); p_input = playlist_CurrentInput( p_playlist ); if( p_input ) { i_interval = var_InheritInteger( p_intf , "short-jump-size" ); if ( i_interval > 0 ) { mtime_t i_time = ( (mtime_t)( -i_interval ) * 1000000L); var_SetTime( p_input, "time-offset", i_time ); } vlc_object_release( p_input ); } break; case RIGHT: msg_Dbg( p_intf, "Go forward in the movie!" ); p_input = playlist_CurrentInput( p_playlist ); if( p_input ) { i_interval = var_InheritInteger( p_intf , "short-jump-size" ); if ( i_interval > 0 ) { mtime_t i_time = ( (mtime_t)( i_interval ) * 1000000L); var_SetTime( p_input, "time-offset", i_time ); } vlc_object_release( p_input ); } break; case GESTURE(LEFT,UP,NONE,NONE): msg_Dbg( p_intf, "Going slower." ); p_input = playlist_CurrentInput( p_playlist ); if( p_input ) { var_TriggerCallback( p_input, "rate-slower" ); vlc_object_release( p_input ); } break; case GESTURE(RIGHT,UP,NONE,NONE): msg_Dbg( p_intf, "Going faster." ); p_input = playlist_CurrentInput( p_playlist ); if( p_input ) { var_TriggerCallback( p_input, "rate-faster" ); vlc_object_release( p_input ); } break; case GESTURE(LEFT,RIGHT,NONE,NONE): case GESTURE(RIGHT,LEFT,NONE,NONE): msg_Dbg( p_intf, "Play/Pause" ); p_input = playlist_CurrentInput( p_playlist ); if( p_input ) { int i_state = var_GetInteger( p_input, "state" ); var_SetInteger( p_input, "state", ( i_state != PLAYING_S ) ? PLAYING_S : PAUSE_S ); vlc_object_release( p_input ); } break; case GESTURE(LEFT,DOWN,NONE,NONE): playlist_Prev( p_playlist ); break; case GESTURE(RIGHT,DOWN,NONE,NONE): playlist_Next( p_playlist ); break; case UP: msg_Dbg(p_intf, "Louder"); aout_VolumeUp( p_playlist, 1, NULL ); break; case DOWN: msg_Dbg(p_intf, "Quieter"); aout_VolumeDown( p_playlist, 1, NULL ); break; case GESTURE(UP,DOWN,NONE,NONE): case GESTURE(DOWN,UP,NONE,NONE): msg_Dbg( p_intf, "Mute sound" ); aout_ToggleMute( p_playlist, NULL ); break; case GESTURE(UP,RIGHT,NONE,NONE): { vlc_value_t list, list2; int i_count, i, i_audio_es; p_input = playlist_CurrentInput( p_playlist ); if( !p_input ) break; i_audio_es = var_GetInteger( p_input, "audio-es" ); var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES, &list, &list2 ); i_count = list.p_list->i_count; if( i_count <= 1 ) { var_FreeList( &list, &list2 ); vlc_object_release( p_input ); break; } for( i = 0; i < i_count; i++ ) { if( i_audio_es == list.p_list->p_values[i].i_int ) break; } /* value of audio-es was not in choices list */ if( i == i_count ) { msg_Warn( p_input, "invalid current audio track, selecting 0" ); i = 0; } else if( i == i_count - 1 ) i = 1; else i++; var_SetInteger( p_input, "audio-es", list.p_list->p_values[i].i_int ); var_FreeList( &list, &list2 ); vlc_object_release( p_input ); } break; case GESTURE(DOWN,RIGHT,NONE,NONE): { vlc_value_t list, list2; int i_count, i, i_spu_es; p_input = playlist_CurrentInput( p_playlist ); if( !p_input ) break; i_spu_es = var_GetInteger( p_input, "spu-es" ); var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES, &list, &list2 ); i_count = list.p_list->i_count; if( i_count <= 1 ) { vlc_object_release( p_input ); var_FreeList( &list, &list2 ); break; } for( i = 0; i < i_count; i++ ) { if( i_spu_es == list.p_list->p_values[i].i_int ) { break; } } /* value of spu-es was not in choices list */ if( i == i_count ) { msg_Warn( p_input, "invalid current subtitle track, selecting 0" ); i = 0; } else if( i == i_count - 1 ) i = 0; else i++; var_SetInteger( p_input, "spu-es", list.p_list->p_values[i].i_int); var_FreeList( &list, &list2 ); vlc_object_release( p_input ); } break; case GESTURE(UP,LEFT,NONE,NONE): { bool val = var_ToggleBool( pl_Get( p_intf ), "fullscreen" ); if( p_sys->p_vout ) var_SetBool( p_sys->p_vout, "fullscreen", val ); break; } case GESTURE(DOWN,LEFT,NONE,NONE): /* FIXME: Should close the vout!"*/ libvlc_Quit( p_intf->p_libvlc ); break; case GESTURE(DOWN,LEFT,UP,RIGHT): case GESTURE(UP,RIGHT,DOWN,LEFT): msg_Dbg( p_intf, "a square was drawn!" ); break; default: break; } p_sys->i_num_gestures = 0; p_sys->i_pattern = 0; p_sys->b_got_gesture = false; } /* * video output */ if( p_sys->p_vout && !vlc_object_alive( p_sys->p_vout ) ) { var_DelCallback( p_sys->p_vout, "mouse-moved", MouseEvent, p_intf ); var_DelCallback( p_sys->p_vout, "mouse-button-down", MouseEvent, p_intf ); vlc_object_release( p_sys->p_vout ); p_sys->p_vout = NULL; } if( p_sys->p_vout == NULL ) { p_input = playlist_CurrentInput( pl_Get( p_intf ) ); if( p_input ) { p_sys->p_vout = input_GetVout( p_input ); vlc_object_release( p_input ); } if( p_sys->p_vout ) { var_AddCallback( p_sys->p_vout, "mouse-moved", MouseEvent, p_intf ); var_AddCallback( p_sys->p_vout, "mouse-button-down", MouseEvent, p_intf ); } } vlc_mutex_unlock( &p_sys->lock ); /* Wait a bit */ msleep( INTF_IDLE_SLEEP ); } vlc_restorecancel( canc ); }