]> git.sesse.net Git - vlc/blob - plugins/win32/control.cpp
1a0ff337f3e9a806668f030c83998a98abc9b4f4
[vlc] / plugins / win32 / control.cpp
1 /*****************************************************************************\r
2  * control.cpp: functions to handle stream control buttons.\r
3  *****************************************************************************\r
4  * Copyright (C) 2002 VideoLAN\r
5  *\r
6  * Authors: Olivier Teuliere <ipkiss@via.ecp.fr>\r
7  *\r
8  * This program is free software; you can redistribute it and/or modify\r
9  * it under the terms of the GNU General Public License as published by\r
10  * the Free Software Foundation; either version 2 of the License, or\r
11  * (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
16  * GNU General Public License for more details.\r
17  *\r
18  * You should have received a copy of the GNU General Public License\r
19  * along with this program; if not, write to the Free Software\r
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.\r
21  *****************************************************************************/\r
22 \r
23 #include <vcl.h>\r
24 \r
25 #include <videolan/vlc.h>\r
26 \r
27 #include "stream_control.h"\r
28 #include "input_ext-intf.h"\r
29 \r
30 #include "interface.h"\r
31 #include "intf_playlist.h"\r
32 \r
33 #include "win32_common.h"\r
34 \r
35 extern  struct intf_thread_s *p_intfGlobal;\r
36 \r
37 /****************************************************************************\r
38  * Control functions: this is where the functions are defined\r
39  ****************************************************************************\r
40  * These functions are used by toolbuttons callbacks\r
41  ****************************************************************************/\r
42 bool ControlBack( TObject *Sender )\r
43 {\r
44     /* FIXME: TODO */\r
45     \r
46     return false;\r
47 }\r
48 \r
49 \r
50 bool ControlStop( TObject *Sender )\r
51 {\r
52     if( p_input_bank->pp_input[0] != NULL )\r
53     {\r
54         /* end playing item */\r
55         p_input_bank->pp_input[0]->b_eof = 1;\r
56 \r
57         /* update playlist */\r
58         vlc_mutex_lock( &p_main->p_playlist->change_lock );\r
59 \r
60         p_main->p_playlist->i_index--;\r
61         p_main->p_playlist->b_stopped = 1;\r
62 \r
63         vlc_mutex_unlock( &p_main->p_playlist->change_lock );\r
64 \r
65     }\r
66 \r
67     return true;\r
68 }\r
69 \r
70 \r
71 bool ControlPlay( TObject *Sender )\r
72 {\r
73     if( p_input_bank->pp_input[0] != NULL )\r
74     {\r
75         input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );\r
76         p_main->p_playlist->b_stopped = 0;\r
77     }\r
78     else\r
79     {\r
80         vlc_mutex_lock( &p_main->p_playlist->change_lock );\r
81 \r
82         if( p_main->p_playlist->b_stopped )\r
83         {\r
84             if( p_main->p_playlist->i_size )\r
85             {\r
86                 vlc_mutex_unlock( &p_main->p_playlist->change_lock );\r
87                 intf_PlaylistJumpto( p_main->p_playlist,\r
88                                      p_main->p_playlist->i_index );\r
89             }\r
90             else\r
91             {\r
92                 vlc_mutex_unlock( &p_main->p_playlist->change_lock );\r
93                 p_intfGlobal->p_sys->p_window->MenuOpenFileClick( Sender );\r
94             }\r
95         }\r
96         else\r
97         {\r
98             vlc_mutex_unlock( &p_main->p_playlist->change_lock );\r
99         }\r
100 \r
101     }\r
102 \r
103     return true;\r
104 }\r
105 \r
106 \r
107 bool ControlPause( TObject *Sender )\r
108 {\r
109     if( p_input_bank->pp_input[0] != NULL )\r
110     {\r
111         input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PAUSE );\r
112 \r
113         vlc_mutex_lock( &p_main->p_playlist->change_lock );\r
114         p_main->p_playlist->b_stopped = 0;\r
115         vlc_mutex_unlock( &p_main->p_playlist->change_lock );\r
116     }\r
117 \r
118     return true;\r
119 }\r
120 \r
121 \r
122 bool ControlSlow( TObject *Sender )\r
123 {\r
124     if( p_input_bank->pp_input[0] != NULL )\r
125     {\r
126         input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_SLOWER );\r
127 \r
128         vlc_mutex_lock( &p_main->p_playlist->change_lock );\r
129         p_main->p_playlist->b_stopped = 0;\r
130         vlc_mutex_unlock( &p_main->p_playlist->change_lock );\r
131     }\r
132 \r
133     return true;\r
134 }\r
135 \r
136 \r
137 bool ControlFast( TObject *Sender )\r
138 {\r
139     if( p_input_bank->pp_input[0] != NULL )\r
140     {\r
141         input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_FASTER );\r
142 \r
143         vlc_mutex_lock( &p_main->p_playlist->change_lock );\r
144         p_main->p_playlist->b_stopped = 0;\r
145         vlc_mutex_unlock( &p_main->p_playlist->change_lock );\r
146     }\r
147 \r
148     return true;\r
149 }\r
150 \r