]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/vout_manager.hpp
Removed unused defined.
[vlc] / modules / gui / skins2 / src / vout_manager.hpp
1 /*****************************************************************************
2  * vout_manager.hpp
3  *****************************************************************************
4  * Copyright (C) 2009 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Erwan Tulou < brezhoneg1 at yahoo.fr r>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 #ifndef VOUTMANAGER_HPP
25 #define VOUTMANAGER_HPP
26
27 #include <vector>
28
29 #include <vlc_vout.h>
30 #include <vlc_window.h>
31 #include "../utils/position.hpp"
32 #include "../commands/cmd_generic.hpp"
33 #include "../controls/ctrl_video.hpp"
34
35 class VarBool;
36 class GenericWindow;
37
38 #include <stdio.h>
39
40 class SavedVout
41 {
42 public:
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 ) {}
47
48     ~SavedVout() {}
49
50     vout_thread_t* pVout;
51     VoutWindow *pVoutWindow;
52     CtrlVideo *pCtrlVideo;
53     int height;
54     int width;
55 };
56
57 class VoutMainWindow: public GenericWindow
58 {
59     public:
60
61         VoutMainWindow( intf_thread_t *pIntf, int left = 0, int top = 0 ) :
62                 GenericWindow( pIntf, left, top, false, false, NULL )
63         {
64             resize( 10, 10 );
65             move( -50, -50 );
66         }
67         virtual ~VoutMainWindow() {}
68
69 };
70
71
72 /// Singleton object handling VLC internal state and playlist
73 class VoutManager: public SkinObject
74 {
75     public:
76         /// Get the instance of VoutManager
77         /// Returns NULL if the initialization of the object failed
78         static VoutManager *instance( intf_thread_t *pIntf );
79
80         /// Delete the instance of VoutManager
81         static void destroy( intf_thread_t *pIntf );
82
83         /// Callback to request a vout window
84         static void *getWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
85
86         /// Accept Vout
87         void* acceptVout( vout_thread_t* pVout, int width, int height );
88
89         // Window provider (release)
90         static void releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd  );
91
92         /// Callback to change a vout window
93         static int controlWindow( struct vout_window_t *pWnd,
94                                   int query, va_list args );
95
96         // Register Video Controls (when building theme)
97         void registerCtrlVideo( CtrlVideo* p_CtrlVideo );
98
99         // save and restore vouts (when changing theme)
100         void saveVoutConfig( );
101         void restoreVoutConfig( bool b_success );
102
103         // save and restore vouts (when swapping Layout)
104         void discardVout( CtrlVideo* pCtrlVideo );
105         void requestVout( CtrlVideo* pCtrlVideo );
106
107         // get a VoutWindow
108         void* getHandle( vout_thread_t* pVout, int width, int height );
109
110         // get a useable video Control
111         CtrlVideo* getBestCtrlVideo( );
112
113         // get the VoutMainWindow
114         VoutMainWindow* getVoutMainWindow() { return m_pVoutMainWindow; }
115
116         // (un)lock functions to protect vout sets
117         void lockVout( ) { vlc_mutex_lock( &vout_lock ); }
118         void unlockVout( ) { vlc_mutex_unlock( &vout_lock ); }
119
120     protected:
121         // Protected because it is a singleton
122         VoutManager( intf_thread_t *pIntf );
123         virtual ~VoutManager();
124
125     private:
126
127         vector<CtrlVideo *> m_pCtrlVideoVec;
128         vector<CtrlVideo *> m_pCtrlVideoVecBackup;
129         vector<SavedVout> m_SavedVoutVec;
130
131         VoutMainWindow* m_pVoutMainWindow;
132
133         vlc_mutex_t vout_lock;
134 };
135
136
137 #endif