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
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef VOUTMANAGER_HPP
25 #define VOUTMANAGER_HPP
30 #include <vlc_window.h>
31 #include "../utils/position.hpp"
32 #include "../commands/cmd_generic.hpp"
33 #include "../controls/ctrl_video.hpp"
43 SavedVout( vout_thread_t* pVout, VoutWindow* pVoutWindow = NULL,
44 CtrlVideo* pCtrlVideo = NULL, int height = 0, int width = 0 ) :
45 pVout( pVout ), pVoutWindow( pVoutWindow ), pCtrlVideo( pCtrlVideo ),
46 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 )
67 virtual ~VoutMainWindow() {}
72 /// Singleton object handling VLC internal state and playlist
73 class VoutManager: public SkinObject
76 /// Get the instance of VoutManager
77 /// Returns NULL if the initialization of the object failed
78 static VoutManager *instance( intf_thread_t *pIntf );
80 /// Delete the instance of VoutManager
81 static void destroy( intf_thread_t *pIntf );
83 /// Callback to request a vout window
84 static void *getWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
87 void* acceptVout( vout_thread_t* pVout, int width, int height );
89 // Window provider (release)
90 static void releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
92 /// Callback to change a vout window
93 static int controlWindow( struct vout_window_t *pWnd,
94 int query, va_list args );
96 // Register Video Controls (when building theme)
97 void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
99 // save and restore vouts (when changing theme)
100 void saveVoutConfig( );
101 void restoreVoutConfig( bool b_success );
103 // save and restore vouts (when swapping Layout)
104 void discardVout( CtrlVideo* pCtrlVideo );
105 void requestVout( CtrlVideo* pCtrlVideo );
108 void* getHandle( vout_thread_t* pVout, int width, int height );
110 // get a useable video Control
111 CtrlVideo* getBestCtrlVideo( );
113 // get the VoutMainWindow
114 VoutMainWindow* getVoutMainWindow() { return m_pVoutMainWindow; }
116 // (un)lock functions to protect vout sets
117 void lockVout( ) { vlc_mutex_lock( &vout_lock ); }
118 void unlockVout( ) { vlc_mutex_unlock( &vout_lock ); }
121 // Protected because it is a singleton
122 VoutManager( intf_thread_t *pIntf );
123 virtual ~VoutManager();
127 vector<CtrlVideo *> m_pCtrlVideoVec;
128 vector<CtrlVideo *> m_pCtrlVideoVecBackup;
129 vector<SavedVout> m_SavedVoutVec;
131 VoutMainWindow* m_pVoutMainWindow;
133 vlc_mutex_t vout_lock;