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>
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,
59 /* RecordingEvent_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, int id ) : QEvent( (QEvent::Type)(type) )
75 virtual ~IMEvent() {};
81 class InputManager : public QObject
84 friend class MainInputManager;
87 InputManager( QObject *, intf_thread_t * );
88 virtual ~InputManager();
93 return p_input /* We have an input */
94 && !p_input->b_dead /* not dead yet, */
95 && !p_input->b_eof /* not EOF either, */
96 && vlc_object_alive (p_input); /* and the VLC object is alive */
100 bool hasVideo() { return hasInput() && b_video; }
101 void requestArtUpdate();
103 QString getName() { return oldName; }
106 intf_thread_t *p_intf;
107 input_thread_t *p_input;
109 int i_old_playing_status;
115 mtime_t timeA, timeB;
117 void customEvent( QEvent * );
125 void UpdateNavigation();
126 void UpdatePosition();
127 void UpdateTeletext();
134 void UpdateCaching();
136 void AtoBLoop( int );
139 void setInput( input_thread_t * ); ///< Our controlled input changed
140 void sliderUpdate( float ); ///< User dragged the slider. We get new pos
141 /* SpeedRate Rate Management */
152 void telexSetPage( int ); ///< Goto teletext page
153 void telexSetTransparency( bool ); ///< Transparency on teletext background
154 void telexActivation( bool ); ///< Enable disable teletext buttons
155 void activateTeletext( bool ); ///< Toggle buttons after click
160 void togglePlayPause();
163 /// Send new position, new time and new length
164 void positionUpdated( float , int, int );
165 void rateChanged( int );
166 void nameChanged( QString );
167 /// Used to signal whether we should show navigation buttons
168 void titleChanged( bool );
169 void chapterChanged( bool );
170 /// Statistics are updated
171 void statisticsUpdated( input_item_t* );
172 void infoChanged( input_item_t* );
173 void metaChanged( input_item_t* );
174 void artChanged( QString );
175 /// Play/pause status
176 void statusChanged( int );
178 void teletextPossible( bool );
179 void teletextActivated( bool );
180 void teletextTransparencyActivated( bool );
181 void newTelexPageSet( int );
183 void AtoBchanged( bool, bool );
185 void voutChanged( bool );
186 void synchroChanged();
187 void bookmarksChanged();
188 void cachingChanged( float );
189 void voutListChanged( vout_thread_t **pp_vout, int i_vout );
192 class MainInputManager : public QObject
196 static MainInputManager *getInstance( intf_thread_t *_p_intf )
199 instance = new MainInputManager( _p_intf );
202 static void killInstance()
204 if( instance ) delete instance;
206 virtual ~MainInputManager();
208 input_thread_t *getInput() { return p_input; };
209 InputManager *getIM() { return im; };
210 vout_thread_t * getVout()
212 vout_thread_t **pp_vout; int i_vout;
213 if( !input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &i_vout ) )
215 for( int i = 1; i < i_vout; i++ ) vlc_object_release( pp_vout[i]);
216 vout_thread_t *p_tmp = pp_vout[0];
224 MainInputManager( intf_thread_t * );
225 static MainInputManager *instance;
227 void customEvent( QEvent * );
230 input_thread_t *p_input;
231 intf_thread_t *p_intf;
234 void togglePlayPause();
240 void inputChanged( input_thread_t * );
241 void volumeChanged();