1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 VideoLAN
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
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.
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.
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 *****************************************************************************/
28 #include "../vars/playlist.hpp"
29 #include "../vars/time.hpp"
30 #include "../vars/volume.hpp"
31 #include "../vars/stream.hpp"
37 /// Singleton object handling VLC internal state and playlist
38 class VlcProc: public SkinObject
41 /// Get the instance of VlcProc
42 /// Returns NULL if the initialization of the object failed
43 static VlcProc *instance( intf_thread_t *pIntf );
45 /// Delete the instance of VlcProc
46 static void destroy( intf_thread_t *pIntf );
48 /// Getter for the playlist variable
49 Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); }
51 /// Getter for the time variable
52 StreamTime &getTimeVar() { return *((StreamTime*)(m_cVarTime.get())); }
54 /// Getter for the volume variable
55 Volume &getVolumeVar() { return *((Volume*)(m_cVarVolume.get())); }
57 /// Getter for the stream variable
58 Stream &getStreamVar() { return *((Stream*)(m_cVarStream.get())); }
60 /// Getter for the mute variable
61 VarBool &getIsMuteVar() { return *((VarBool*)(m_cVarMute.get())); }
63 /// Getter for the playing variable
64 VarBool &getIsPlayingVar() { return *((VarBool*)(m_cVarPlaying.get())); }
66 /// Getter for the stopped variable
67 VarBool &getIsStoppedVar() { return *((VarBool*)(m_cVarStopped.get())); }
69 /// Getter for the paused variable
70 VarBool &getIsPausedVar() { return *((VarBool*)(m_cVarPaused.get())); }
72 /// Getter for the seekable variable
73 VarBool &getIsSeekableVar() { return *((VarBool*)(m_cVarSeekable.get())); }
75 /// Set the vout window handle
76 void setVoutWindow( void *pVoutWindow );
79 // Protected because it is a singleton
80 VlcProc( intf_thread_t *pIntf );
84 /// Timer to call manage() regularly (via doManage())
87 VariablePtr m_cPlaylist;
88 VariablePtr m_cVarRandom;
89 VariablePtr m_cVarLoop;
90 VariablePtr m_cVarRepeat;
91 /// Variable for current position of the stream
92 VariablePtr m_cVarTime;
93 /// Variable for audio volume
94 VariablePtr m_cVarVolume;
95 /// Variable for current stream properties (only name, currently)
96 VariablePtr m_cVarStream;
97 /// Variable for the "mute" state
98 VariablePtr m_cVarMute;
99 /// Variables related to the input
100 VariablePtr m_cVarPlaying;
101 VariablePtr m_cVarStopped;
102 VariablePtr m_cVarPaused;
103 VariablePtr m_cVarSeekable;
104 /// Vout window hanlde
107 vout_thread_t *m_pVout;
109 /// Poll VLC internals to update the status (volume, current time in
110 /// the stream, current filename, play/pause/stop status, ...)
111 /// This function should be called regurlarly, since there is no
112 /// callback mechanism (yet?) to automatically update a variable when
113 /// the internal status changes
116 /// This function directly calls manage(), because it's boring to
117 /// always write "pThis->"
118 static void doManage( SkinObject *pObj );
120 /// Callback for intf-change variable
121 static int onIntfChange( vlc_object_t *pObj, const char *pVariable,
122 vlc_value_t oldVal, vlc_value_t newVal,
125 /// Callback for item-change variable
126 static int onItemChange( vlc_object_t *pObj, const char *pVariable,
127 vlc_value_t oldVal, vlc_value_t newVal,
130 /// Callback for playlist-current variable
131 static int onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
132 vlc_value_t oldVal, vlc_value_t newVal,
135 /// Callback for skins2-to-load variable
136 static int onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
137 vlc_value_t oldVal, vlc_value_t newVal,
140 /// Callback to request a vout window
141 static void *getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
142 int *pXHint, int *pYHint,
143 unsigned int *pWidthHint,
144 unsigned int *pHeightHint );
146 /// Callback to release a vout window
147 static void releaseWindow( intf_thread_t *pIntf, void *pWindow );
149 /// Callback to change a vout window
150 static int controlWindow( intf_thread_t *pIntf, void *pWindow,
151 int query, va_list args );