vlcproc.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * vlcproc.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: 08c1a8b71e21d024d30171b688dfa3c522d93ac2 $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *          Olivier Teulière <ipkiss@via.ecp.fr>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License along
00021  * with this program; if not, write to the Free Software Foundation, Inc.,
00022  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00023  *****************************************************************************/
00024 
00025 #ifndef VLCPROC_HPP
00026 #define VLCPROC_HPP
00027 
00028 #include <set>
00029 
00030 #include <vlc_common.h>
00031 #include <vlc_input.h>
00032 #include <vlc_vout.h>
00033 #include "../vars/equalizer.hpp"
00034 #include "../vars/playtree.hpp"
00035 #include "../vars/time.hpp"
00036 #include "../vars/volume.hpp"
00037 #include "../utils/position.hpp"
00038 #include "../utils/var_text.hpp"
00039 #include "../utils/var_string.hpp"
00040 #include "../commands/cmd_generic.hpp"
00041 #include "../controls/ctrl_video.hpp"
00042 
00043 class OSTimer;
00044 class VarBool;
00045 struct aout_instance_t;
00046 struct vout_window_t;
00047 
00048 
00049 /// Singleton object handling VLC internal state and playlist
00050 class VlcProc: public SkinObject
00051 {
00052 public:
00053     /// Get the instance of VlcProc
00054     /// Returns NULL if the initialization of the object failed
00055     static VlcProc *instance( intf_thread_t *pIntf );
00056 
00057     /// Delete the instance of VlcProc
00058     static void destroy( intf_thread_t *pIntf );
00059 
00060     /// Getter for the playtree variable
00061     Playtree &getPlaytreeVar() { return *((Playtree*)m_cPlaytree.get()); }
00062 
00063     /// Getter for the time variable
00064     StreamTime &getTimeVar() { return *((StreamTime*)(m_cVarTime.get())); }
00065 
00066     /// Getter for the volume variable
00067     Volume &getVolumeVar() { return *((Volume*)(m_cVarVolume.get())); }
00068 
00069     /// Getter for the stream name variable
00070     VarText &getStreamNameVar()
00071        { return *((VarText*)(m_cVarStreamName.get())); }
00072 
00073     /// Getter for the stream URI variable
00074     VarText &getStreamURIVar()
00075         { return *((VarText*)(m_cVarStreamURI.get())); }
00076 
00077     /// Getter for the stream bitrate variable
00078     VarText &getStreamBitRateVar()
00079         { return *((VarText*)(m_cVarStreamBitRate.get())); }
00080 
00081     /// Getter for the stream sample rate variable
00082     VarText &getStreamSampleRateVar()
00083         { return *((VarText*)(m_cVarStreamSampleRate.get())); }
00084 
00085     /// Getter for the stream Art url variable
00086     VarString &getStreamArtVar()
00087        { return *((VarString*)(m_cVarStreamArt.get())); }
00088 
00089     /// Getter/Setter for the fullscreen variable
00090     VarBool &getFullscreenVar() { return *((VarBool*)(m_cVarFullscreen.get())); }
00091     void setFullscreenVar( bool );
00092 
00093     /// Indicate whether the embedded video output is currently used
00094     bool isVoutUsed() const { return m_pVout != NULL; }
00095 
00096     /// update equalizer
00097     void update_equalizer( );
00098 
00099     void on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00100     void on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00101     void on_bit_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00102     void on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00103     void on_can_record_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00104 
00105     void on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00106     void on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00107     void on_repeat_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00108 
00109     void on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00110     void on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00111 
00112     void on_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal );
00113 
00114 protected:
00115     // Protected because it is a singleton
00116     VlcProc( intf_thread_t *pIntf );
00117     virtual ~VlcProc();
00118 
00119 private:
00120     /// Timer to call manage() regularly (via doManage())
00121     OSTimer *m_pTimer;
00122     /// Playtree variable
00123     VariablePtr m_cPlaytree;
00124     VariablePtr m_cVarRandom;
00125     VariablePtr m_cVarLoop;
00126     VariablePtr m_cVarRepeat;
00127     /// Variable for current position of the stream
00128     VariablePtr m_cVarTime;
00129     /// Variable for audio volume
00130     VariablePtr m_cVarVolume;
00131     /// Variable for current stream properties
00132     VariablePtr m_cVarStreamName;
00133     VariablePtr m_cVarStreamURI;
00134     VariablePtr m_cVarStreamBitRate;
00135     VariablePtr m_cVarStreamSampleRate;
00136     VariablePtr m_cVarStreamArt;
00137     /// Variable for the "mute" state
00138     VariablePtr m_cVarMute;
00139     /// Variables related to the input
00140     VariablePtr m_cVarPlaying;
00141     VariablePtr m_cVarStopped;
00142     VariablePtr m_cVarPaused;
00143     VariablePtr m_cVarSeekable;
00144     VariablePtr m_cVarRecordable;
00145     VariablePtr m_cVarRecording;
00146     /// Variables related to the vout
00147     VariablePtr m_cVarFullscreen;
00148     VariablePtr m_cVarHasVout;
00149     /// Variables related to audio
00150     VariablePtr m_cVarHasAudio;
00151     /// Equalizer variables
00152     EqualizerBands m_varEqBands;
00153     VariablePtr m_cVarEqPreamp;
00154     VariablePtr m_cVarEqualizer;
00155     /// Variable for DVD detection
00156     VariablePtr m_cVarDvdActive;
00157 
00158     /// Vout thread
00159     vout_thread_t *m_pVout;
00160     /// Audio output
00161     aout_instance_t *m_pAout;
00162     bool m_bEqualizer_started;
00163 
00164     /**
00165      * Poll VLC internals to update the status (volume, current time in
00166      * the stream, current filename, play/pause/stop status, ...)
00167      * This function should be called regurlarly, since there is no
00168      * callback mechanism (yet?) to automatically update a variable when
00169      * the internal status changes
00170      */
00171     void manage();
00172 
00173     // reset variables when input is over
00174     void reset_input();
00175 
00176     // init variables (libvlc and playlist levels)
00177     void init_variables();
00178 
00179     /// Define the command that calls manage()
00180     DEFINE_CALLBACK( VlcProc, Manage );
00181 
00182     /// Callback for intf-show variable
00183     static int onIntfShow( vlc_object_t *pObj, const char *pVariable,
00184                            vlc_value_t oldVal, vlc_value_t newVal,
00185                            void *pParam );
00186 
00187     /// Callback for input-current variable
00188     static int onInputNew( vlc_object_t *pObj, const char *pVariable,
00189                            vlc_value_t oldVal, vlc_value_t newVal,
00190                            void *pParam );
00191 
00192     /// Callback for item-change variable
00193     static int onItemChange( vlc_object_t *pObj, const char *pVariable,
00194                              vlc_value_t oldVal, vlc_value_t newVal,
00195                              void *pParam );
00196 
00197     /// Callback for item-change variable
00198     static int onItemAppend( vlc_object_t *pObj, const char *pVariable,
00199                              vlc_value_t oldVal, vlc_value_t newVal,
00200                              void *pParam );
00201 
00202     /// Callback for item-change variable
00203     static int onItemDelete( vlc_object_t *pObj, const char *pVariable,
00204                              vlc_value_t oldVal, vlc_value_t newVal,
00205                              void *pParam );
00206 
00207     /// Callback for skins2-to-load variable
00208     static int onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
00209                              vlc_value_t oldVal, vlc_value_t newVal,
00210                              void *pParam );
00211 
00212     static int onInteraction( vlc_object_t *pObj, const char *pVariable,
00213                               vlc_value_t oldVal, vlc_value_t newVal,
00214                               void *pParam );
00215 
00216     static int onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
00217                                 vlc_value_t oldVal, vlc_value_t newVal,
00218                                 void *pParam );
00219 
00220     static int onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
00221                                  vlc_value_t oldVal, vlc_value_t newVal,
00222                                  void *pParam );
00223 
00224     /// Generic Callback
00225     static int onGenericCallback( vlc_object_t *pObj, const char *pVariable,
00226                                   vlc_value_t oldVal, vlc_value_t newVal,
00227                                   void *pParam );
00228 
00229 };
00230 
00231 
00232 #endif

Generated on Tue May 25 08:04:58 2010 for VLC by  doxygen 1.5.6