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,
61 /* SignalChanged_Type, */
63 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
64 FullscreenControlShow_Type,
65 FullscreenControlHide_Type,
66 FullscreenControlPlanHide_Type,
69 class IMEvent : public QEvent
71 friend class InputManager;
73 IMEvent( int type, input_item_t *p_input = NULL )
74 : QEvent( (QEvent::Type)(type) )
76 if( (p_item = p_input) != NULL )
77 vlc_gc_incref( p_item );
82 vlc_gc_decref( p_item );
91 PLItemAppended_Type = QEvent::User + PLEventType + 1,
95 class PLEvent : public QEvent
98 PLEvent( PLEventTypes t, int i, int p )
99 : QEvent( (QEvent::Type)t ), i_item(i), i_parent(p) {}
104 class InputManager : public QObject
107 friend class MainInputManager;
110 InputManager( QObject *, intf_thread_t * );
111 virtual ~InputManager();
116 return p_input /* We have an input */
117 && !p_input->b_dead /* not dead yet, */
118 && !p_input->b_eof /* not EOF either, */
119 && vlc_object_alive (p_input); /* and the VLC object is alive */
123 bool hasVideo() { return hasInput() && b_video; }
124 void requestArtUpdate();
126 QString getName() { return oldName; }
129 intf_thread_t *p_intf;
130 input_thread_t *p_input;
131 input_item_t *p_item;
132 int i_old_playing_status;
138 mtime_t timeA, timeB;
140 void customEvent( QEvent * );
148 void UpdateNavigation();
149 void UpdatePosition();
150 void UpdateTeletext();
154 void UpdateMeta(input_item_t *);
158 void UpdateCaching();
160 void UpdateProgramEvent();
163 void setInput( input_thread_t * ); ///< Our controlled input changed
164 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
165 /* SpeedRate Rate Management */
181 void telexSetPage( int ); ///< Goto teletext page
182 void telexSetTransparency( bool ); ///< Transparency on teletext background
183 void activateTeletext( bool ); ///< Toggle buttons after click
188 void togglePlayPause();
189 void AtoBLoop( float, int, int );
192 /// Send new position, new time and new length
193 void positionUpdated( float , int, int );
194 void rateChanged( int );
195 void nameChanged( const QString& );
196 /// Used to signal whether we should show navigation buttons
197 void titleChanged( bool );
198 void chapterChanged( bool );
199 /// Statistics are updated
200 void statisticsUpdated( input_item_t* );
201 void infoChanged( input_item_t* );
202 void currentMetaChanged( input_item_t* );
203 void metaChanged( input_item_t *);
204 void artChanged( QString );
205 /// Play/pause status
206 void statusChanged( int );
207 void recordingStateChanged( bool );
209 void teletextPossible( bool );
210 void teletextActivated( bool );
211 void teletextTransparencyActivated( bool );
212 void newTelexPageSet( int );
214 void AtoBchanged( bool, bool );
216 void voutChanged( bool );
217 void voutListChanged( vout_thread_t **pp_vout, int i_vout );
219 void synchroChanged();
220 void bookmarksChanged();
221 void cachingChanged( float );
222 /// Program Event changes
223 void encryptionChanged( bool );
226 class MainInputManager : public QObject
230 static MainInputManager *getInstance( intf_thread_t *_p_intf )
233 instance = new MainInputManager( _p_intf );
236 static void killInstance()
242 input_thread_t *getInput() { return p_input; }
243 InputManager *getIM() { return im; }
245 vout_thread_t* getVout();
246 aout_instance_t *getAout();
249 MainInputManager( intf_thread_t * );
250 virtual ~MainInputManager();
252 static MainInputManager *instance;
254 void customEvent( QEvent * );
257 input_thread_t *p_input;
258 intf_thread_t *p_intf;
261 void togglePlayPause();
266 void activatePlayQuit( bool );
269 void inputChanged( input_thread_t * );
270 void volumeChanged();
271 void playlistItemAppended( int itemId, int parentId );
272 void playlistItemRemoved( int itemId );
273 void randomChanged( bool );