]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/vlcproc.hpp
ff397ef595577449d304021b47ee3cbca3c9dc3d
[vlc] / modules / gui / skins2 / src / vlcproc.hpp
1 /*****************************************************************************
2  * vlcproc.hpp
3  *****************************************************************************
4  * Copyright (C) 2003 the VideoLAN team
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 along
21  * with this program; if not, write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23  *****************************************************************************/
24
25 #ifndef VLCPROC_HPP
26 #define VLCPROC_HPP
27
28 #include <set>
29
30 #include <vlc_common.h>
31 #include <vlc_input.h>
32 #include <vlc_vout.h>
33 #include "../vars/equalizer.hpp"
34 #include "../vars/playtree.hpp"
35 #include "../vars/time.hpp"
36 #include "../vars/volume.hpp"
37 #include "../utils/position.hpp"
38 #include "../utils/var_text.hpp"
39 #include "../utils/var_string.hpp"
40 #include "../controls/ctrl_video.hpp"
41
42 class OSTimer;
43 class VarBool;
44 struct vout_window_t;
45
46
47 /// Singleton object handling VLC internal state and playlist
48 class VlcProc: public SkinObject
49 {
50 public:
51     /// Get the instance of VlcProc
52     /// Returns NULL if the initialization of the object failed
53     static VlcProc *instance( intf_thread_t *pIntf );
54
55     /// Delete the instance of VlcProc
56     static void destroy( intf_thread_t *pIntf );
57
58     /// Getter for the playtree variable
59     Playtree &getPlaytreeVar() { return *((Playtree*)m_cPlaytree.get()); }
60
61     /// Getter for the time variable
62     StreamTime &getTimeVar() { return *((StreamTime*)(m_cVarTime.get())); }
63
64     /// Getter for the volume variable
65     Volume &getVolumeVar() { return *((Volume*)(m_cVarVolume.get())); }
66
67     /// Getter for the current playback speed
68     VarText &getSpeedVar()
69        { return *((VarText*)(m_cVarSpeed.get())); }
70
71     /// Getter for the stream name variable
72     VarText &getStreamNameVar()
73        { return *((VarText*)(m_cVarStreamName.get())); }
74
75     /// Getter for the stream URI variable
76     VarText &getStreamURIVar()
77         { return *((VarText*)(m_cVarStreamURI.get())); }
78
79     /// Getter for the stream bitrate variable
80     VarText &getStreamBitRateVar()
81         { return *((VarText*)(m_cVarStreamBitRate.get())); }
82
83     /// Getter for the stream sample rate variable
84     VarText &getStreamSampleRateVar()
85         { return *((VarText*)(m_cVarStreamSampleRate.get())); }
86
87     /// Getter for the stream Art url variable
88     VarString &getStreamArtVar()
89        { return *((VarString*)(m_cVarStreamArt.get())); }
90
91     /// Getter/Setter for the fullscreen variable
92     VarBool &getFullscreenVar() { return *((VarBool*)(m_cVarFullscreen.get())); }
93     void setFullscreenVar( bool );
94
95     /// Indicate whether the embedded video output is currently used
96     bool isVoutUsed() const { return m_pVout != NULL; }
97
98     /// update equalizer
99     void update_equalizer( );
100
101     void on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal );
102     void on_bit_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
103     void on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
104     void on_can_record_changed( vlc_object_t* p_obj, vlc_value_t newVal );
105
106     void on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal );
107     void on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal );
108     void on_repeat_changed( vlc_object_t* p_obj, vlc_value_t newVal );
109
110     void on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal );
111     void on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal );
112
113     void on_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal );
114
115     void on_mouse_moved_changed( vlc_object_t* p_obj, vlc_value_t newVal );
116
117 protected:
118     // Protected because it is a singleton
119     VlcProc( intf_thread_t *pIntf );
120     virtual ~VlcProc();
121
122 private:
123     /// Playtree variable
124     VariablePtr m_cPlaytree;
125     VariablePtr m_cVarRandom;
126     VariablePtr m_cVarLoop;
127     VariablePtr m_cVarRepeat;
128     /// Variable for current position of the stream
129     VariablePtr m_cVarTime;
130     /// Variable for audio volume
131     VariablePtr m_cVarVolume;
132     /// Variable for speed playback
133     VariablePtr m_cVarSpeed;
134     /// Variable for current stream properties
135     VariablePtr m_cVarStreamName;
136     VariablePtr m_cVarStreamURI;
137     VariablePtr m_cVarStreamBitRate;
138     VariablePtr m_cVarStreamSampleRate;
139     VariablePtr m_cVarStreamArt;
140     /// Variable for the "mute" state
141     VariablePtr m_cVarMute;
142     /// Variables related to the input
143     VariablePtr m_cVarPlaying;
144     VariablePtr m_cVarStopped;
145     VariablePtr m_cVarPaused;
146     VariablePtr m_cVarSeekable;
147     VariablePtr m_cVarRecordable;
148     VariablePtr m_cVarRecording;
149     /// Variables related to the vout
150     VariablePtr m_cVarFullscreen;
151     VariablePtr m_cVarHasVout;
152     /// Variables related to audio
153     VariablePtr m_cVarHasAudio;
154     /// Equalizer variables
155     EqualizerBands m_varEqBands;
156     VariablePtr m_cVarEqPreamp;
157     VariablePtr m_cVarEqualizer;
158     /// Variable for DVD detection
159     VariablePtr m_cVarDvdActive;
160
161     /// Vout thread
162     vout_thread_t *m_pVout;
163     /// Audio output
164     audio_output_t *m_pAout;
165     bool m_bEqualizer_started;
166
167     // reset variables when input is over
168     void reset_input();
169
170     // init variables (libvlc and playlist levels)
171     void init_variables();
172
173     /// Callback for intf-show variable
174     static int onIntfShow( vlc_object_t *pObj, const char *pVariable,
175                            vlc_value_t oldVal, vlc_value_t newVal,
176                            void *pParam );
177
178     /// Callback for input-current variable
179     static int onInputNew( vlc_object_t *pObj, const char *pVariable,
180                            vlc_value_t oldVal, vlc_value_t newVal,
181                            void *pParam );
182
183     /// Callback for item-change variable
184     static int onItemChange( vlc_object_t *pObj, const char *pVariable,
185                              vlc_value_t oldVal, vlc_value_t newVal,
186                              void *pParam );
187
188     /// Callback for item-change variable
189     static int onItemAppend( vlc_object_t *pObj, const char *pVariable,
190                              vlc_value_t oldVal, vlc_value_t newVal,
191                              void *pParam );
192
193     /// Callback for item-change variable
194     static int onItemDelete( vlc_object_t *pObj, const char *pVariable,
195                              vlc_value_t oldVal, vlc_value_t newVal,
196                              void *pParam );
197
198     static int onInteraction( vlc_object_t *pObj, const char *pVariable,
199                               vlc_value_t oldVal, vlc_value_t newVal,
200                               void *pParam );
201
202     static int onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
203                                 vlc_value_t oldVal, vlc_value_t newVal,
204                                 void *pParam );
205
206     static int onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
207                                  vlc_value_t oldVal, vlc_value_t newVal,
208                                  void *pParam );
209
210     /// Generic Callback
211     static int onGenericCallback( vlc_object_t *pObj, const char *pVariable,
212                                   vlc_value_t oldVal, vlc_value_t newVal,
213                                   void *pParam );
214
215     /// Generic Callback for intf-event
216     static int onGenericCallback2( vlc_object_t *pObj, const char *pVariable,
217                                    vlc_value_t oldVal, vlc_value_t newVal,
218                                    void *pParam );
219 };
220
221 #endif