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>
42 PositionUpdate_Type = QEvent::User + IMEventType + 1,
44 ItemStateChanged_Type,
45 ItemTitleChanged_Type,
49 ItemTeletextChanged_Type,
50 InterfaceVoutUpdate_Type,
51 StatisticsUpdate_Type, /*10*/
52 InterfaceAoutUpdate_Type,
58 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 );
89 class InputManager : public QObject
92 friend class MainInputManager;
95 InputManager( QObject *, intf_thread_t * );
96 virtual ~InputManager();
101 return p_input /* We have an input */
102 && !p_input->b_dead /* not dead yet, */
103 && !p_input->b_eof /* not EOF either, */
104 && vlc_object_alive (p_input); /* and the VLC object is alive */
108 bool hasVideo() { return hasInput() && b_video; }
109 void requestArtUpdate();
111 QString getName() { return oldName; }
114 intf_thread_t *p_intf;
115 input_thread_t *p_input;
116 input_item_t *p_item;
117 int i_old_playing_status;
123 mtime_t timeA, timeB;
125 void customEvent( QEvent * );
133 void UpdateNavigation();
134 void UpdatePosition();
135 void UpdateTeletext();
139 void UpdateMeta(input_item_t *);
143 void UpdateCaching();
145 void UpdateProgramEvent();
148 void setInput( input_thread_t * ); ///< Our controlled input changed
149 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
150 /* SpeedRate Rate Management */
166 void telexSetPage( int ); ///< Goto teletext page
167 void telexSetTransparency( bool ); ///< Transparency on teletext background
168 void activateTeletext( bool ); ///< Toggle buttons after click
173 void togglePlayPause();
174 void AtoBLoop( float, int, int );
177 /// Send new position, new time and new length
178 void positionUpdated( float , int, int );
179 void rateChanged( int );
180 void nameChanged( const QString& );
181 /// Used to signal whether we should show navigation buttons
182 void titleChanged( bool );
183 void chapterChanged( bool );
184 /// Statistics are updated
185 void statisticsUpdated( input_item_t* );
186 void infoChanged( input_item_t* );
187 void currentMetaChanged( input_item_t* );
188 void metaChanged( input_item_t *);
189 void artChanged( QString );
190 /// Play/pause status
191 void statusChanged( int );
192 void recordingStateChanged( bool );
194 void teletextPossible( bool );
195 void teletextActivated( bool );
196 void teletextTransparencyActivated( bool );
197 void newTelexPageSet( int );
199 void AtoBchanged( bool, bool );
201 void voutChanged( bool );
202 void voutListChanged( vout_thread_t **pp_vout, int i_vout );
204 void synchroChanged();
205 void bookmarksChanged();
206 void cachingChanged( float );
207 /// Program Event changes
208 void encryptionChanged( bool );
211 class MainInputManager : public QObject
215 static MainInputManager *getInstance( intf_thread_t *_p_intf )
218 instance = new MainInputManager( _p_intf );
221 static void killInstance()
227 input_thread_t *getInput() { return p_input; };
228 InputManager *getIM() { return im; };
230 vout_thread_t* getVout();
231 aout_instance_t *getAout();
234 MainInputManager( intf_thread_t * );
235 virtual ~MainInputManager();
237 static MainInputManager *instance;
239 void customEvent( QEvent * );
242 input_thread_t *p_input;
243 intf_thread_t *p_intf;
246 void togglePlayPause();
250 void activatePlayQuit( bool );
253 void inputChanged( input_thread_t * );
254 void volumeChanged();