vlcproc.hpp
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:8k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * vlcproc.hpp
  3.  *****************************************************************************
  4.  * Copyright (C) 2003 the VideoLAN team
  5.  * $Id: 42e0d95211229fec03f4778e058589544e0706e8 $
  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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23.  *****************************************************************************/
  24. #ifndef VLCPROC_HPP
  25. #define VLCPROC_HPP
  26. #include <set>
  27. #include <vlc_vout.h>
  28. #include "../vars/equalizer.hpp"
  29. #include "../vars/playtree.hpp"
  30. #include "../vars/time.hpp"
  31. #include "../vars/volume.hpp"
  32. #include "../utils/position.hpp"
  33. #include "../utils/var_text.hpp"
  34. #include "../commands/cmd_generic.hpp"
  35. #include "../controls/ctrl_video.hpp"
  36. class OSTimer;
  37. class VarBool;
  38. struct aout_instance_t;
  39. struct vout_window_t;
  40. /// Singleton object handling VLC internal state and playlist
  41. class VlcProc: public SkinObject
  42. {
  43.     public:
  44.         /// Get the instance of VlcProc
  45.         /// Returns NULL if the initialization of the object failed
  46.         static VlcProc *instance( intf_thread_t *pIntf );
  47.         /// Delete the instance of VlcProc
  48.         static void destroy( intf_thread_t *pIntf );
  49.         /// Getter for the playtree variable
  50.         Playtree &getPlaytreeVar() { return *((Playtree*)m_cPlaytree.get()); }
  51.         /// Getter for the time variable
  52.         StreamTime &getTimeVar() { return *((StreamTime*)(m_cVarTime.get())); }
  53.         /// Getter for the volume variable
  54.         Volume &getVolumeVar() { return *((Volume*)(m_cVarVolume.get())); }
  55.         /// Getter for the stream name variable
  56.         VarText &getStreamNameVar()
  57.            { return *((VarText*)(m_cVarStreamName.get())); }
  58.         /// Getter for the stream URI variable
  59.         VarText &getStreamURIVar()
  60.             { return *((VarText*)(m_cVarStreamURI.get())); }
  61.         /// Getter for the stream bitrate variable
  62.         VarText &getStreamBitRateVar()
  63.             { return *((VarText*)(m_cVarStreamBitRate.get())); }
  64.         /// Getter for the stream sample rate variable
  65.         VarText &getStreamSampleRateVar()
  66.             { return *((VarText*)(m_cVarStreamSampleRate.get())); }
  67.         /// Getter for the vout size variable
  68.         VarBox &getVoutSizeVar() { return m_varVoutSize; }
  69.         /// Indicate whether the embedded video output is currently used
  70.         bool isVoutUsed() const { return m_pVout != NULL; }
  71.     protected:
  72.         // Protected because it is a singleton
  73.         VlcProc( intf_thread_t *pIntf );
  74.         virtual ~VlcProc();
  75.     private:
  76.         /// Timer to call manage() regularly (via doManage())
  77.         OSTimer *m_pTimer;
  78.         /// Playtree variable
  79.         VariablePtr m_cPlaytree;
  80.         VariablePtr m_cVarRandom;
  81.         VariablePtr m_cVarLoop;
  82.         VariablePtr m_cVarRepeat;
  83.         /// Variable for current position of the stream
  84.         VariablePtr m_cVarTime;
  85.         /// Variable for audio volume
  86.         VariablePtr m_cVarVolume;
  87.         /// Variable for current stream properties
  88.         VariablePtr m_cVarStreamName;
  89.         VariablePtr m_cVarStreamURI;
  90.         VariablePtr m_cVarStreamBitRate;
  91.         VariablePtr m_cVarStreamSampleRate;
  92.         /// Variable for the "mute" state
  93.         VariablePtr m_cVarMute;
  94.         /// Variables related to the input
  95.         VariablePtr m_cVarPlaying;
  96.         VariablePtr m_cVarStopped;
  97.         VariablePtr m_cVarPaused;
  98.         VariablePtr m_cVarSeekable;
  99.         /// Variables related to the vout
  100.         VariablePtr m_cVarFullscreen;
  101.         VarBox m_varVoutSize;
  102.         VariablePtr m_cVarHasVout;
  103.         /// Variables related to audio
  104.         VariablePtr m_cVarHasAudio;
  105.         /// Equalizer variables
  106.         EqualizerBands m_varEqBands;
  107.         VariablePtr m_cVarEqPreamp;
  108.         VariablePtr m_cVarEqualizer;
  109.         /// Variable for DVD detection
  110.         VariablePtr m_cVarDvdActive;
  111.         /// Vout thread
  112.         vout_thread_t *m_pVout;
  113.         /// Audio output
  114.         aout_instance_t *m_pAout;
  115.         /**
  116.          * Poll VLC internals to update the status (volume, current time in
  117.          * the stream, current filename, play/pause/stop status, ...)
  118.          * This function should be called regurlarly, since there is no
  119.          * callback mechanism (yet?) to automatically update a variable when
  120.          * the internal status changes
  121.          */
  122.         void manage();
  123.         /// Define the command that calls manage()
  124.         DEFINE_CALLBACK( VlcProc, Manage );
  125.         /// Refresh audio variables
  126.         void refreshAudio();
  127.         /// Refresh playlist variables
  128.         void refreshPlaylist();
  129.         /// Refresh input variables
  130.         void refreshInput();
  131.         /// Update the stream name variable
  132.         void updateStreamName();
  133.         /// Callback for intf-change variable
  134.         static int onIntfChange( vlc_object_t *pObj, const char *pVariable,
  135.                                  vlc_value_t oldVal, vlc_value_t newVal,
  136.                                  void *pParam );
  137.         /// Callback for intf-show variable
  138.         static int onIntfShow( vlc_object_t *pObj, const char *pVariable,
  139.                                vlc_value_t oldVal, vlc_value_t newVal,
  140.                                void *pParam );
  141.         /// Callback for item-change variable
  142.         static int onItemChange( vlc_object_t *pObj, const char *pVariable,
  143.                                  vlc_value_t oldVal, vlc_value_t newVal,
  144.                                  void *pParam );
  145.         /// Callback for item-change variable
  146.         static int onItemAppend( vlc_object_t *pObj, const char *pVariable,
  147.                                  vlc_value_t oldVal, vlc_value_t newVal,
  148.                                  void *pParam );
  149.         /// Callback for item-change variable
  150.         static int onItemDelete( vlc_object_t *pObj, const char *pVariable,
  151.                                  vlc_value_t oldVal, vlc_value_t newVal,
  152.                                  void *pParam );
  153.         /// Callback for playlist-current variable
  154.         static int onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
  155.                                      vlc_value_t oldVal, vlc_value_t newVal,
  156.                                      void *pParam );
  157.         /// Callback for skins2-to-load variable
  158.         static int onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
  159.                                  vlc_value_t oldVal, vlc_value_t newVal,
  160.                                  void *pParam );
  161.         /// Callback for interaction variable
  162.         static int onInteraction( vlc_object_t *pObj, const char *pVariable,
  163.                                   vlc_value_t oldVal, vlc_value_t newVal,
  164.                                   void *pParam );
  165.         /// Callback for equalizer-bands variable
  166.         static int onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
  167.                                     vlc_value_t oldVal, vlc_value_t newVal,
  168.                                     void *pParam );
  169.         /// Callback for equalizer-preamp variable
  170.         static int onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
  171.                                      vlc_value_t oldVal, vlc_value_t newVal,
  172.                                      void *pParam );
  173. };
  174. #endif