vout_manager.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef VOUTMANAGER_HPP
00025 #define VOUTMANAGER_HPP
00026
00027 #include <vector>
00028
00029 #include <vlc_vout.h>
00030 #include <vlc_vout_window.h>
00031 #include "../utils/position.hpp"
00032 #include "../commands/cmd_generic.hpp"
00033 #include "../controls/ctrl_video.hpp"
00034 #include "../events/evt_key.hpp"
00035
00036 class VarBool;
00037 class GenericWindow;
00038
00039 #include <stdio.h>
00040
00041 class SavedWnd
00042 {
00043 public:
00044 SavedWnd( vout_window_t* pWnd, VoutWindow* pVoutWindow = NULL,
00045 CtrlVideo* pCtrlVideo = NULL, int height = 0, int width = 0 )
00046 : pWnd( pWnd ), pVoutWindow( pVoutWindow ),
00047 pCtrlVideo( pCtrlVideo ), height( height ), width( width ) { }
00048 ~SavedWnd() { }
00049
00050 vout_window_t* pWnd;
00051 VoutWindow *pVoutWindow;
00052 CtrlVideo *pCtrlVideo;
00053 int height;
00054 int width;
00055 };
00056
00057 class VoutMainWindow: public GenericWindow
00058 {
00059 public:
00060
00061 VoutMainWindow( intf_thread_t *pIntf, int left = 0, int top = 0 ) :
00062 GenericWindow( pIntf, left, top, false, false, NULL,
00063 GenericWindow::FullscreenWindow )
00064 {
00065 resize( 10, 10 );
00066 move( -50, -50 );
00067 }
00068 virtual ~VoutMainWindow() { }
00069
00070 virtual void processEvent( EvtKey &rEvtKey )
00071 {
00072
00073 if( rEvtKey.getKeyState() == EvtKey::kDown )
00074 var_SetInteger( getIntf()->p_libvlc, "key-pressed",
00075 rEvtKey.getModKey() );
00076 }
00077 };
00078
00079
00080
00081 class VoutManager: public SkinObject
00082 {
00083 public:
00084
00085
00086 static VoutManager *instance( intf_thread_t *pIntf );
00087
00088
00089 static void destroy( intf_thread_t *pIntf );
00090
00091
00092 void* acceptWnd( vout_window_t* pWnd );
00093
00094
00095 void releaseWnd( vout_window_t* pWnd );
00096
00097
00098 void setSizeWnd( vout_window_t* pWnd, int width, int height );
00099
00100
00101 void setFullscreenWnd( vout_window_t* pWnd, bool b_fullscreen );
00102
00103
00104 static void *getWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
00105
00106
00107 static void releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
00108
00109
00110 static int controlWindow( struct vout_window_t *pWnd,
00111 int query, va_list args );
00112
00113
00114 void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
00115
00116
00117 void registerFSC( TopWindow* p_Win );
00118
00119
00120 void saveVoutConfig( );
00121 void restoreVoutConfig( bool b_success );
00122
00123
00124 void discardVout( CtrlVideo* pCtrlVideo );
00125 void requestVout( CtrlVideo* pCtrlVideo );
00126
00127
00128 CtrlVideo* getBestCtrlVideo( );
00129
00130
00131 VoutMainWindow* getVoutMainWindow() { return m_pVoutMainWindow; }
00132
00133
00134 bool hasVout() { return ( m_SavedWndVec.size() != 0 ) ; }
00135
00136 protected:
00137
00138 VoutManager( intf_thread_t *pIntf );
00139 virtual ~VoutManager();
00140
00141 private:
00142
00143 vector<CtrlVideo *> m_pCtrlVideoVec;
00144 vector<CtrlVideo *> m_pCtrlVideoVecBackup;
00145 vector<SavedWnd> m_SavedWndVec;
00146
00147 VoutMainWindow* m_pVoutMainWindow;
00148
00149 TopWindow* m_pFscWindow;
00150 };
00151
00152
00153 #endif