1 /*****************************************************************************
2 * cmd_input.cpp
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
5 * $Id: e0a6ecf93905c649d521c65fa945ffda1aee6779 $
6 *
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
24
25 #include "cmd_input.hpp"
26 #include "cmd_dialogs.hpp"
27 #include <vlc_input.h>
28 #include <vlc_playlist.h>
29
execute()30 void CmdPlay::execute()
31 {
32 playlist_t *pPlaylist = getPL();
33
34 // if already playing an input, reset rate to normal speed
35 input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
36 if( pInput )
37 {
38 var_SetFloat( getPL(), "rate", 1.0 );
39 vlc_object_release( pInput );
40 }
41
42 playlist_Lock( pPlaylist );
43 const bool b_empty = playlist_IsEmpty( pPlaylist );
44 playlist_Unlock( pPlaylist );
45
46 if( !b_empty )
47 {
48 playlist_Play( pPlaylist );
49 }
50 else
51 {
52 // If the playlist is empty, open a file requester instead
53 CmdDlgFile( getIntf() ).execute();
54 }
55 }
56
57
execute()58 void CmdPause::execute()
59 {
60 playlist_TogglePause( getPL() );
61 }
62
63
execute()64 void CmdStop::execute()
65 {
66 playlist_Stop( getPL() );
67 }
68
69
execute()70 void CmdSlower::execute()
71 {
72 var_TriggerCallback( getPL(), "rate-slower" );
73 }
74
75
execute()76 void CmdFaster::execute()
77 {
78 var_TriggerCallback( getPL(), "rate-faster" );
79 }
80
81
execute()82 void CmdMute::execute()
83 {
84 playlist_MuteToggle( getPL() );
85 }
86
87
execute()88 void CmdVolumeUp::execute()
89 {
90 playlist_VolumeUp( getPL(), 1, NULL );
91 }
92
93
execute()94 void CmdVolumeDown::execute()
95 {
96 playlist_VolumeDown( getPL(), 1, NULL );
97 }
98
99