1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2009 the VideoLAN team
7 * Authors: Erwan Tulou < brezhoneg1 at yahoo.fr r>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef VOUTMANAGER_HPP
25 #define VOUTMANAGER_HPP
30 #include <vlc_vout_window.h>
31 #include "../utils/position.hpp"
32 #include "../commands/cmd_generic.hpp"
33 #include "../controls/ctrl_video.hpp"
34 #include "../events/evt_key.hpp"
44 SavedWnd( vout_window_t* pWnd, VoutWindow* pVoutWindow = NULL,
45 CtrlVideo* pCtrlVideo = NULL, int height = 0, int width = 0 )
46 : pWnd( pWnd ), pVoutWindow( pVoutWindow ),
47 pCtrlVideo( pCtrlVideo ), height( height ), width( width ) { }
51 VoutWindow *pVoutWindow;
52 CtrlVideo *pCtrlVideo;
57 class VoutMainWindow: public GenericWindow
61 VoutMainWindow( intf_thread_t *pIntf, int left = 0, int top = 0 ) :
62 GenericWindow( pIntf, left, top, false, false, NULL,
63 GenericWindow::FullscreenWindow )
68 virtual ~VoutMainWindow() { }
70 virtual void processEvent( EvtKey &rEvtKey )
72 // Only do the action when the key is down
73 if( rEvtKey.getKeyState() == EvtKey::kDown )
74 var_SetInteger( getIntf()->p_libvlc, "key-pressed",
75 rEvtKey.getModKey() );
80 /// Singleton object handling VLC internal state and playlist
81 class VoutManager: public SkinObject
84 /// Get the instance of VoutManager
85 /// Returns NULL if the initialization of the object failed
86 static VoutManager *instance( intf_thread_t *pIntf );
88 /// Delete the instance of VoutManager
89 static void destroy( intf_thread_t *pIntf );
92 void* acceptWnd( vout_window_t* pWnd );
95 void releaseWnd( vout_window_t* pWnd );
98 void setSizeWnd( vout_window_t* pWnd, int width, int height );
100 /// set fullscreen Wnd
101 void setFullscreenWnd( vout_window_t* pWnd, bool b_fullscreen );
103 /// Callback to request a vout window
104 static void *getWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
106 // Window provider (release)
107 static void releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
109 /// Callback to change a vout window
110 static int controlWindow( struct vout_window_t *pWnd,
111 int query, va_list args );
113 // Register Video Controls (when building theme)
114 void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
116 // Register Video Controls (when building theme)
117 void registerFSC( TopWindow* p_Win );
119 // save and restore vouts (when changing theme)
120 void saveVoutConfig( );
121 void restoreVoutConfig( bool b_success );
123 // save and restore vouts (when swapping Layout)
124 void discardVout( CtrlVideo* pCtrlVideo );
125 void requestVout( CtrlVideo* pCtrlVideo );
127 // get a useable video Control
128 CtrlVideo* getBestCtrlVideo( );
130 // get the VoutMainWindow
131 VoutMainWindow* getVoutMainWindow() { return m_pVoutMainWindow; }
133 // test if vout are running
134 bool hasVout() { return ( m_SavedWndVec.size() != 0 ) ; }
137 // Protected because it is a singleton
138 VoutManager( intf_thread_t *pIntf );
139 virtual ~VoutManager();
143 vector<CtrlVideo *> m_pCtrlVideoVec;
144 vector<CtrlVideo *> m_pCtrlVideoVecBackup;
145 vector<SavedWnd> m_SavedWndVec;
147 VoutMainWindow* m_pVoutMainWindow;
149 TopWindow* m_pFscWindow;