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 _INPUT_MANAGER_H_
26 #define _INPUT_MANAGER_H_
32 #include <vlc_input.h>
43 PositionUpdate_Type = QEvent::User + IMEventType + 1,
45 ItemStateChanged_Type,
46 ItemTitleChanged_Type,
50 ItemTeletextChanged_Type,
51 InterfaceVoutUpdate_Type,
52 StatisticsUpdate_Type, /*10*/
53 InterfaceAoutUpdate_Type,
59 BookmarksChanged_Type,
61 /* ProgramChanged_Type,
62 SignalChanged_Type, */
64 FullscreenControlToggle_Type = QEvent::User + IMEventType + 20,
65 FullscreenControlShow_Type,
66 FullscreenControlHide_Type,
67 FullscreenControlPlanHide_Type,
70 class IMEvent : public QEvent
72 friend class InputManager;
74 IMEvent( int type, int id ) : QEvent( (QEvent::Type)(type) )
76 virtual ~IMEvent() {};
82 class InputManager : public QObject
85 friend class MainInputManager;
88 InputManager( QObject *, intf_thread_t * );
89 virtual ~InputManager();
94 return p_input /* We have an input */
95 && !p_input->b_dead /* not dead yet, */
96 && !p_input->b_eof /* not EOF either, */
97 && vlc_object_alive (p_input); /* and the VLC object is alive */
101 bool hasVideo() { return hasInput() && b_video; }
102 void requestArtUpdate();
104 QString getName() { return oldName; }
107 intf_thread_t *p_intf;
108 input_thread_t *p_input;
110 int i_old_playing_status;
116 mtime_t timeA, timeB;
118 void customEvent( QEvent * );
126 void UpdateNavigation();
127 void UpdatePosition();
128 void UpdateTeletext();
135 void UpdateCaching();
138 void AtoBLoop( int );
141 void setInput( input_thread_t * ); ///< Our controlled input changed
142 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
143 /* SpeedRate Rate Management */
154 void telexSetPage( int ); ///< Goto teletext page
155 void telexSetTransparency( bool ); ///< Transparency on teletext background
156 void telexActivation( bool ); ///< Enable disable teletext buttons
157 void activateTeletext( bool ); ///< Toggle buttons after click
162 void togglePlayPause();
165 /// Send new position, new time and new length
166 void positionUpdated( float , int, int );
167 void rateChanged( int );
168 void nameChanged( QString );
169 /// Used to signal whether we should show navigation buttons
170 void titleChanged( bool );
171 void chapterChanged( bool );
172 /// Statistics are updated
173 void statisticsUpdated( input_item_t* );
174 void infoChanged( input_item_t* );
175 void metaChanged( input_item_t* );
176 void artChanged( QString );
177 /// Play/pause status
178 void statusChanged( int );
179 void recordingStateChanged( bool );
181 void teletextPossible( bool );
182 void teletextActivated( bool );
183 void teletextTransparencyActivated( bool );
184 void newTelexPageSet( int );
186 void AtoBchanged( bool, bool );
188 void voutChanged( bool );
189 void synchroChanged();
190 void bookmarksChanged();
191 void cachingChanged( float );
192 void voutListChanged( vout_thread_t **pp_vout, int i_vout );
195 class MainInputManager : public QObject
199 static MainInputManager *getInstance( intf_thread_t *_p_intf )
202 instance = new MainInputManager( _p_intf );
205 static void killInstance()
207 if( instance ) delete instance;
209 virtual ~MainInputManager();
211 input_thread_t *getInput() { return p_input; };
212 InputManager *getIM() { return im; };
214 vout_thread_t* getVout();
215 aout_instance_t *getAout();
218 MainInputManager( intf_thread_t * );
219 static MainInputManager *instance;
221 void customEvent( QEvent * );
224 input_thread_t *p_input;
225 intf_thread_t *p_intf;
228 void togglePlayPause();
234 void inputChanged( input_thread_t * );
235 void volumeChanged();