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>
32 #include "../utils/position.hpp"
33 #include "../commands/cmd_generic.hpp"
34 #include "../controls/ctrl_video.hpp"
35 #include "../events/evt_key.hpp"
36 #include "../events/evt_scroll.hpp"
37 #include "../src/fsc_window.hpp"
48 SavedWnd( vout_window_t
* pWnd
, VoutWindow
* pVoutWindow
= NULL
,
49 CtrlVideo
* pCtrlVideo
= NULL
, int height
= -1, int width
= -1 )
50 : pWnd( pWnd
), pVoutWindow( pVoutWindow
),
51 pCtrlVideo( pCtrlVideo
), height( height
), width( width
) { }
55 VoutWindow
*pVoutWindow
;
56 CtrlVideo
*pCtrlVideo
;
61 class VoutMainWindow
: public GenericWindow
65 VoutMainWindow( intf_thread_t
*pIntf
, int left
= 0, int top
= 0 ) :
66 GenericWindow( pIntf
, left
, top
, false, false, NULL
,
67 GenericWindow::FullscreenWindow
)
72 virtual ~VoutMainWindow() { }
74 #if defined( _WIN32 ) || defined( __OS2__ )
76 virtual void processEvent( EvtKey
&rEvtKey
)
78 // Only do the action when the key is down
79 if( rEvtKey
.getKeyState() == EvtKey::kDown
)
80 getIntf()->p_sys
->p_dialogs
->sendKey( rEvtKey
.getModKey() );
83 virtual void processEvent( EvtScroll
&rEvtScroll
)
85 // scroll events sent to core as hotkeys
87 i_vlck
|= rEvtScroll
.getMod();
88 i_vlck
|= ( rEvtScroll
.getDirection() == EvtScroll::kUp
) ?
89 KEY_MOUSEWHEELUP
: KEY_MOUSEWHEELDOWN
;
91 getIntf()->p_sys
->p_dialogs
->sendKey( i_vlck
);
98 /// Singleton object handling VLC internal state and playlist
99 class VoutManager
: public SkinObject
, public Observer
<VarBool
>
102 /// Get the instance of VoutManager
103 /// Returns NULL if the initialization of the object failed
104 static VoutManager
*instance( intf_thread_t
*pIntf
);
106 /// Delete the instance of VoutManager
107 static void destroy( intf_thread_t
*pIntf
);
109 /// accept window request (vout window provider)
110 void acceptWnd( vout_window_t
*pWnd
, int width
, int height
);
112 // release window (vout window provider)
113 void releaseWnd( vout_window_t
*pWnd
);
115 /// set window size (vout window provider)
116 void setSizeWnd( vout_window_t
* pWnd
, int width
, int height
);
118 /// set fullscreen mode (vout window provider)
119 void setFullscreenWnd( vout_window_t
* pWnd
, bool b_fullscreen
);
121 // Register Video Controls (when building theme)
122 void registerCtrlVideo( CtrlVideo
* p_CtrlVideo
);
124 // Register Video Controls (when building theme)
125 void registerFSC( FscWindow
* p_Win
);
127 // get the fullscreen controller window
128 FscWindow
* getFscWindow( ) { return m_pFscWindow
; }
130 // save and restore vouts (when changing theme)
131 void saveVoutConfig( );
132 void restoreVoutConfig( bool b_success
);
134 // save and restore vouts (when swapping Layout)
135 void discardVout( CtrlVideo
* pCtrlVideo
);
136 void requestVout( CtrlVideo
* pCtrlVideo
);
138 // get a useable video Control
139 CtrlVideo
* getBestCtrlVideo( );
141 // get the VoutMainWindow
142 VoutMainWindow
* getVoutMainWindow() { return m_pVoutMainWindow
; }
144 // test if vout are running
145 bool hasVout() { return ( m_SavedWndVec
.size() != 0 ) ; }
147 /// called when fullscreen variable changed
148 virtual void onUpdate( Subject
<VarBool
> &rVariable
, void* );
150 /// reconfigure fullscreen (multiple screens)
151 virtual void configureFullscreen( VoutWindow
& rWindow
);
154 // Protected because it is a singleton
155 VoutManager( intf_thread_t
*pIntf
);
156 virtual ~VoutManager();
160 vector
<CtrlVideo
*> m_pCtrlVideoVec
;
161 vector
<CtrlVideo
*> m_pCtrlVideoVecBackup
;
162 vector
<SavedWnd
> m_SavedWndVec
;
164 VoutMainWindow
* m_pVoutMainWindow
;
166 FscWindow
* m_pFscWindow
;