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,
47 SoundMuteChanged_Type,
49 ItemTeletextChanged_Type,
50 InterfaceVoutUpdate_Type,
51 StatisticsUpdate_Type, /*10*/
52 InterfaceAoutUpdate_Type,
58 BookmarksChanged_Type,
64 /* SignalChanged_Type, */
66 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
67 FullscreenControlShow_Type,
68 FullscreenControlHide_Type,
69 FullscreenControlPlanHide_Type,
72 enum { NORMAL, /* loop: 0, repeat: 0 */
73 REPEAT_ONE,/* loop: 1, repeat: 0 */
74 REPEAT_ALL,/* loop: 0, repeat: 1 */
77 class IMEvent : public QEvent
79 friend class InputManager;
81 IMEvent( int type, input_item_t *p_input = NULL )
82 : QEvent( (QEvent::Type)(type) )
84 if( (p_item = p_input) != NULL )
85 vlc_gc_incref( p_item );
90 vlc_gc_decref( p_item );
99 PLItemAppended_Type = QEvent::User + PLEventType + 1,
103 class PLEvent : public QEvent
106 PLEvent( PLEventTypes t, int i, int p )
107 : QEvent( (QEvent::Type)t ), i_item(i), i_parent(p) {}
112 class InputManager : public QObject
115 friend class MainInputManager;
118 InputManager( QObject *, intf_thread_t * );
119 virtual ~InputManager();
124 return p_input /* We have an input */
125 && !p_input->b_dead /* not dead yet, */
126 && !p_input->b_eof /* not EOF either, */
127 && vlc_object_alive (p_input); /* and the VLC object is alive */
131 bool hasVideo() { return hasInput() && b_video; }
132 void requestArtUpdate();
134 QString getName() { return oldName; }
137 intf_thread_t *p_intf;
138 input_thread_t *p_input;
139 input_item_t *p_item;
140 int i_old_playing_status;
146 mtime_t timeA, timeB;
148 void customEvent( QEvent * );
156 void UpdateNavigation();
157 void UpdatePosition();
158 void UpdateTeletext();
162 void UpdateMeta(input_item_t *);
166 void UpdateCaching();
168 void UpdateProgramEvent();
171 void setInput( input_thread_t * ); ///< Our controlled input changed
172 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
173 /* SpeedRate Rate Management */
189 void telexSetPage( int ); ///< Goto teletext page
190 void telexSetTransparency( bool ); ///< Transparency on teletext background
191 void activateTeletext( bool ); ///< Toggle buttons after click
196 void togglePlayPause();
197 void AtoBLoop( float, int, int );
200 /// Send new position, new time and new length
201 void positionUpdated( float , int, int );
202 void rateChanged( int );
203 void nameChanged( const QString& );
204 /// Used to signal whether we should show navigation buttons
205 void titleChanged( bool );
206 void chapterChanged( bool );
207 /// Statistics are updated
208 void statisticsUpdated( input_item_t* );
209 void infoChanged( input_item_t* );
210 void currentMetaChanged( input_item_t* );
211 void metaChanged( input_item_t *);
212 void artChanged( QString );
213 /// Play/pause status
214 void statusChanged( int );
215 void recordingStateChanged( bool );
217 void teletextPossible( bool );
218 void teletextActivated( bool );
219 void teletextTransparencyActivated( bool );
220 void newTelexPageSet( int );
222 void AtoBchanged( bool, bool );
224 void voutChanged( bool );
225 void voutListChanged( vout_thread_t **pp_vout, int i_vout );
227 void synchroChanged();
228 void bookmarksChanged();
229 void cachingChanged( float );
230 /// Program Event changes
231 void encryptionChanged( bool );
234 class MainInputManager : public QObject
238 static MainInputManager *getInstance( intf_thread_t *_p_intf )
241 instance = new MainInputManager( _p_intf );
244 static void killInstance()
250 input_thread_t *getInput() { return p_input; }
251 InputManager *getIM() { return im; }
253 vout_thread_t* getVout();
254 aout_instance_t *getAout();
257 MainInputManager( intf_thread_t * );
258 virtual ~MainInputManager();
260 static MainInputManager *instance;
262 void customEvent( QEvent * );
265 input_thread_t *p_input;
266 intf_thread_t *p_intf;
268 void notifyRepeatLoop();
270 void togglePlayPause();
275 void activatePlayQuit( bool );
277 void loopRepeatLoopStatus();
280 void inputChanged( input_thread_t * );
281 void volumeChanged();
282 void soundMuteChanged();
283 void playlistItemAppended( int itemId, int parentId );
284 void playlistItemRemoved( int itemId );
285 void randomChanged( bool );
286 void repeatLoopChanged( int );