]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/vlcproc.hpp
* skins2/src/window_manager.cpp: Added the vlc.isOnTop boolean variable
[vlc] / modules / gui / skins2 / src / vlcproc.hpp
1 /*****************************************************************************
2  * vlcproc.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 VideoLAN
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 #ifndef VLCPROC_HPP
26 #define VLCPROC_HPP
27
28 #include "../vars/playlist.hpp"
29 #include "../vars/time.hpp"
30 #include "../vars/volume.hpp"
31 #include "../vars/stream.hpp"
32
33 class OSTimer;
34 class VarBool;
35
36
37 /// Singleton object handling VLC internal state and playlist
38 class VlcProc: public SkinObject
39 {
40     public:
41         /// Get the instance of VlcProc
42         /// Returns NULL if the initialization of the object failed
43         static VlcProc *instance( intf_thread_t *pIntf );
44
45         /// Delete the instance of VlcProc
46         static void destroy( intf_thread_t *pIntf );
47
48         /// Getter for the playlist variable
49         Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); }
50
51         /// Getter for the time variable
52         StreamTime &getTimeVar() { return *((StreamTime*)(m_cVarTime.get())); }
53
54         /// Getter for the volume variable
55         Volume &getVolumeVar() { return *((Volume*)(m_cVarVolume.get())); }
56
57         /// Getter for the stream variable
58         Stream &getStreamVar() { return *((Stream*)(m_cVarStream.get())); }
59
60         /// Set the vout window handle
61         void setVoutWindow( void *pVoutWindow );
62
63     protected:
64         // Protected because it is a singleton
65         VlcProc( intf_thread_t *pIntf );
66         virtual ~VlcProc();
67
68     private:
69         /// Timer to call manage() regularly (via doManage())
70         OSTimer *m_pTimer;
71         /// Playlist variable
72         VariablePtr m_cPlaylist;
73         VariablePtr m_cVarRandom;
74         VariablePtr m_cVarLoop;
75         VariablePtr m_cVarRepeat;
76         /// Variable for current position of the stream
77         VariablePtr m_cVarTime;
78         /// Variable for audio volume
79         VariablePtr m_cVarVolume;
80         /// Variable for current stream properties (only name, currently)
81         VariablePtr m_cVarStream;
82         /// Variable for the "mute" state
83         VariablePtr m_cVarMute;
84         /// Variables related to the input
85         VariablePtr m_cVarPlaying;
86         VariablePtr m_cVarStopped;
87         VariablePtr m_cVarPaused;
88         VariablePtr m_cVarSeekable;
89         /// Vout window hanlde
90         void *m_pVoutWindow;
91         /// Vout thread
92         vout_thread_t *m_pVout;
93
94         /// Poll VLC internals to update the status (volume, current time in
95         /// the stream, current filename, play/pause/stop status, ...)
96         /// This function should be called regurlarly, since there is no
97         /// callback mechanism (yet?) to automatically update a variable when
98         /// the internal status changes
99         void manage();
100
101         /// This function directly calls manage(), because it's boring to
102         /// always write "pThis->"
103         static void doManage( SkinObject *pObj );
104
105         /// Callback for intf-change variable
106         static int onIntfChange( vlc_object_t *pObj, const char *pVariable,
107                                  vlc_value_t oldVal, vlc_value_t newVal,
108                                  void *pParam );
109
110         /// Callback for item-change variable
111         static int onItemChange( vlc_object_t *pObj, const char *pVariable,
112                                  vlc_value_t oldVal, vlc_value_t newVal,
113                                  void *pParam );
114
115         /// Callback for playlist-current variable
116         static int onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
117                                      vlc_value_t oldVal, vlc_value_t newVal,
118                                      void *pParam );
119
120         /// Callback for skins2-to-load variable
121         static int onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
122                                  vlc_value_t oldVal, vlc_value_t newVal,
123                                  void *pParam );
124
125         /// Callback to request a vout window
126         static void *getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
127                                 int *pXHint, int *pYHint,
128                                 unsigned int *pWidthHint,
129                                 unsigned int *pHeightHint );
130
131         /// Callback to release a vout window
132         static void releaseWindow( intf_thread_t *pIntf, void *pWindow );
133
134         /// Callback to change a vout window
135         static int controlWindow( intf_thread_t *pIntf, void *pWindow,
136                                   int query, va_list args );
137 };
138
139
140 #endif