]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/vlcproc.hpp
* all: added a new variable "equalizer.preamp" (self-explanatory ;) in skins
[vlc] / modules / gui / skins2 / src / vlcproc.hpp
old mode 100755 (executable)
new mode 100644 (file)
index 2af81ec..16e6580
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * vlcproc.hpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
- *          Olivier Teulière <ipkiss@via.ecp.fr>
+ *          Olivier Teulie <ipkiss@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #ifndef VLCPROC_HPP
 #define VLCPROC_HPP
 
+#include <set>
+
+#include "../vars/equalizer.hpp"
 #include "../vars/playlist.hpp"
+#include "../vars/playtree.hpp"
 #include "../vars/time.hpp"
 #include "../vars/volume.hpp"
-#include "../vars/stream.hpp"
+#include "../utils/position.hpp"
+#include "../utils/var_text.hpp"
+#include "../commands/cmd_generic.hpp"
 
 class OSTimer;
 class VarBool;
+struct aout_instance_t;
 
 
 /// Singleton object handling VLC internal state and playlist
@@ -48,29 +55,38 @@ class VlcProc: public SkinObject
         /// Getter for the playlist variable
         Playlist &getPlaylistVar() { return *((Playlist*)m_cPlaylist.get()); }
 
+        /// Getter for the playtree variable
+        Playtree &getPlaytreeVar() { return *((Playtree*)m_cPlaytree.get()); }
+
         /// Getter for the time variable
-        Time &getTimeVar() { return *((Time*)(m_cVarTime.get())); }
+        StreamTime &getTimeVar() { return *((StreamTime*)(m_cVarTime.get())); }
 
         /// Getter for the volume variable
         Volume &getVolumeVar() { return *((Volume*)(m_cVarVolume.get())); }
 
-        /// Getter for the stream variable
-        Stream &getStreamVar() { return *((Stream*)(m_cVarStream.get())); }
+        /// Getter for the stream name variable
+        VarText &getStreamNameVar()
+           { return *((VarText*)(m_cVarStreamName.get())); }
+
+        /// Getter for the stream URI variable
+        VarText &getStreamURIVar()
+            { return *((VarText*)(m_cVarStreamURI.get())); }
 
-        /// Getter for the mute variable
-        VarBool &getIsMuteVar() { return *((VarBool*)(m_cVarMute.get())); }
+        /// Getter for the vout size variable
+        VarBox &getVoutSizeVar() { return m_varVoutSize; }
 
-        /// Getter for the playing variable
-        VarBool &getIsPlayingVar() { return *((VarBool*)(m_cVarPlaying.get())); }
+        /// Set the vout window handle
+        void registerVoutWindow( void *pVoutWindow );
 
-        /// Getter for the stopped variable
-        VarBool &getIsStoppedVar() { return *((VarBool*)(m_cVarStopped.get())); }
+        /// Unset the vout window handle
+        void unregisterVoutWindow( void *pVoutWindow );
 
-        /// Getter for the paused variable
-        VarBool &getIsPausedVar() { return *((VarBool*)(m_cVarPaused.get())); }
+        /// Indicate whether the embedded video output is currently used
+        bool isVoutUsed() const { return m_pVout != NULL; }
 
-        /// Getter for the seekable variable
-        VarBool &getIsSeekableVar() { return *((VarBool*)(m_cVarSeekable.get())); }
+        /// If an embedded video output is used, drop it (i.e. tell it to stop
+        /// using our window handle)
+        void dropVout();
 
     protected:
         // Protected because it is a singleton
@@ -82,14 +98,18 @@ class VlcProc: public SkinObject
         OSTimer *m_pTimer;
         /// Playlist variable
         VariablePtr m_cPlaylist;
+        /// Playtree variable FIXME
+        VariablePtr m_cPlaytree;
         VariablePtr m_cVarRandom;
         VariablePtr m_cVarLoop;
+        VariablePtr m_cVarRepeat;
         /// Variable for current position of the stream
         VariablePtr m_cVarTime;
         /// Variable for audio volume
         VariablePtr m_cVarVolume;
-        /// Variable for current stream properties (only name, currently)
-        VariablePtr m_cVarStream;
+        /// Variable for current stream properties
+        VariablePtr m_cVarStreamName;
+        VariablePtr m_cVarStreamURI;
         /// Variable for the "mute" state
         VariablePtr m_cVarMute;
         /// Variables related to the input
@@ -97,23 +117,52 @@ class VlcProc: public SkinObject
         VariablePtr m_cVarStopped;
         VariablePtr m_cVarPaused;
         VariablePtr m_cVarSeekable;
-
-        /// Poll VLC internals to update the status (volume, current time in
-        /// the stream, current filename, play/pause/stop status, ...)
-        /// This function should be called regurlarly, since there is no
-        /// callback mechanism (yet?) to automatically update a variable when
-        /// the internal status changes
+        /// Variable for the vout
+        VarBox m_varVoutSize;
+        /// Equalizer variables
+        EqualizerBands m_varEqBands;
+        VariablePtr m_cVarEqPreamp;
+        VariablePtr m_cVarEqualizer;
+
+        /// Set of handles of vout windows
+        /**
+         * When changing the skin, the handles of the 2 skins coexist in the
+         * set (but this is temporary, until the old theme is destroyed).
+         */
+        set<void *> m_handleSet;
+        /// Vout thread
+        vout_thread_t *m_pVout;
+        /// Audio output
+        aout_instance_t *m_pAout;
+
+        /**
+         * Poll VLC internals to update the status (volume, current time in
+         * the stream, current filename, play/pause/stop status, ...)
+         * This function should be called regurlarly, since there is no
+         * callback mechanism (yet?) to automatically update a variable when
+         * the internal status changes
+         */
         void manage();
 
-        /// This function directly calls manage(), because it's boring to
-        /// always write "pThis->"
-        static void doManage( SkinObject *pObj );
+        /// Define the command that calls manage()
+        DEFINE_CALLBACK( VlcProc, Manage );
+
+        /// Refresh audio variables
+        void refreshAudio();
+
+        /// Update the stream name variable
+        void updateStreamName( playlist_t *p_playlist );
 
         /// Callback for intf-change variable
         static int onIntfChange( vlc_object_t *pObj, const char *pVariable,
                                  vlc_value_t oldVal, vlc_value_t newVal,
                                  void *pParam );
 
+        /// Callback for intf-show variable
+        static int onIntfShow( vlc_object_t *pObj, const char *pVariable,
+                               vlc_value_t oldVal, vlc_value_t newVal,
+                               void *pParam );
+
         /// Callback for item-change variable
         static int onItemChange( vlc_object_t *pObj, const char *pVariable,
                                  vlc_value_t oldVal, vlc_value_t newVal,
@@ -123,6 +172,34 @@ class VlcProc: public SkinObject
         static int onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
                                      vlc_value_t oldVal, vlc_value_t newVal,
                                      void *pParam );
+
+        /// Callback for skins2-to-load variable
+        static int onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
+                                 vlc_value_t oldVal, vlc_value_t newVal,
+                                 void *pParam );
+
+        /// Callback to request a vout window
+        static void *getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
+                                int *pXHint, int *pYHint,
+                                unsigned int *pWidthHint,
+                                unsigned int *pHeightHint );
+
+        /// Callback to release a vout window
+        static void releaseWindow( intf_thread_t *pIntf, void *pWindow );
+
+        /// Callback to change a vout window
+        static int controlWindow( intf_thread_t *pIntf, void *pWindow,
+                                  int query, va_list args );
+
+        /// Callback for equalizer-bands variable
+        static int onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
+                                    vlc_value_t oldVal, vlc_value_t newVal,
+                                    void *pParam );
+
+        /// Callback for equalizer-preamp variable
+        static int onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
+                                     vlc_value_t oldVal, vlc_value_t newVal,
+                                     void *pParam );
 };