1 /*****************************************************************************
2 * input_manager.hpp : Manage an input and interact with its GUI elements
3 ****************************************************************************
4 * Copyright (C) 2006-2008 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Jean-Baptiste <jb@videolan.org>
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.
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.
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 *****************************************************************************/
25 #ifndef QVLC_INPUT_MANAGER_H_
26 #define QVLC_INPUT_MANAGER_H_
32 #include <vlc_input.h>
41 PositionUpdate_Type = QEvent::User + IMEventType + 1,
43 ItemStateChanged_Type,
44 ItemTitleChanged_Type,
48 ItemTeletextChanged_Type,
49 InterfaceVoutUpdate_Type,
50 StatisticsUpdate_Type, /*10*/
51 InterfaceAoutUpdate_Type,
57 BookmarksChanged_Type,
63 /* SignalChanged_Type, */
65 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
66 FullscreenControlShow_Type,
67 FullscreenControlHide_Type,
68 FullscreenControlPlanHide_Type,
71 enum { NORMAL, /* loop: 0, repeat: 0 */
72 REPEAT_ONE,/* loop: 1, repeat: 0 */
73 REPEAT_ALL,/* loop: 0, repeat: 1 */
76 class IMEvent : public QEvent
78 friend class InputManager;
80 IMEvent( int type, input_item_t *p_input = NULL )
81 : QEvent( (QEvent::Type)(type) )
83 if( (p_item = p_input) != NULL )
84 vlc_gc_incref( p_item );
89 vlc_gc_decref( p_item );
98 PLItemAppended_Type = QEvent::User + PLEventType + 1,
102 class PLEvent : public QEvent
105 PLEvent( PLEventTypes t, int i, int p )
106 : QEvent( (QEvent::Type)t ), i_item(i), i_parent(p) {}
111 class InputManager : public QObject
114 friend class MainInputManager;
117 InputManager( QObject *, intf_thread_t * );
118 virtual ~InputManager();
123 return p_input /* We have an input */
124 && !p_input->b_dead /* not dead yet, */
125 && !p_input->b_eof /* not EOF either, */
126 && vlc_object_alive (p_input); /* and the VLC object is alive */
130 bool hasVideo() { return hasInput() && b_video; }
131 void requestArtUpdate();
133 QString getName() { return oldName; }
136 intf_thread_t *p_intf;
137 input_thread_t *p_input;
138 input_item_t *p_item;
139 int i_old_playing_status;
145 mtime_t timeA, timeB;
147 void customEvent( QEvent * );
155 void UpdateNavigation();
156 void UpdatePosition();
157 void UpdateTeletext();
161 void UpdateMeta(input_item_t *);
165 void UpdateCaching();
167 void UpdateProgramEvent();
170 void setInput( input_thread_t * ); ///< Our controlled input changed
171 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
172 /* SpeedRate Rate Management */
188 void telexSetPage( int ); ///< Goto teletext page
189 void telexSetTransparency( bool ); ///< Transparency on teletext background
190 void activateTeletext( bool ); ///< Toggle buttons after click
195 void togglePlayPause();
196 void AtoBLoop( float, int, int );
199 /// Send new position, new time and new length
200 void positionUpdated( float , int, int );
201 void rateChanged( int );
202 void nameChanged( const QString& );
203 /// Used to signal whether we should show navigation buttons
204 void titleChanged( bool );
205 void chapterChanged( bool );
206 /// Statistics are updated
207 void statisticsUpdated( input_item_t* );
208 void infoChanged( input_item_t* );
209 void currentMetaChanged( input_item_t* );
210 void metaChanged( input_item_t *);
211 void artChanged( QString );
212 /// Play/pause status
213 void statusChanged( int );
214 void recordingStateChanged( bool );
216 void teletextPossible( bool );
217 void teletextActivated( bool );
218 void teletextTransparencyActivated( bool );
219 void newTelexPageSet( int );
221 void AtoBchanged( bool, bool );
223 void voutChanged( bool );
224 void voutListChanged( vout_thread_t **pp_vout, int i_vout );
226 void synchroChanged();
227 void bookmarksChanged();
228 void cachingChanged( float );
229 /// Program Event changes
230 void encryptionChanged( bool );
233 class MainInputManager : public QObject
237 static MainInputManager *getInstance( intf_thread_t *_p_intf )
240 instance = new MainInputManager( _p_intf );
243 static void killInstance()
249 input_thread_t *getInput() { return p_input; }
250 InputManager *getIM() { return im; }
252 vout_thread_t* getVout();
253 aout_instance_t *getAout();
256 MainInputManager( intf_thread_t * );
257 virtual ~MainInputManager();
259 static MainInputManager *instance;
261 void customEvent( QEvent * );
264 input_thread_t *p_input;
265 intf_thread_t *p_intf;
267 void notifyRepeatLoop();
269 void togglePlayPause();
274 void activatePlayQuit( bool );
276 void loopRepeatLoopStatus();
279 void inputChanged( input_thread_t * );
280 void volumeChanged();
281 void playlistItemAppended( int itemId, int parentId );
282 void playlistItemRemoved( int itemId );
283 void randomChanged( bool );
284 void repeatLoopChanged( int );