cmd_vars.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * cmd_vars.hpp
00003  *****************************************************************************
00004  * Copyright (C) 2004 the VideoLAN team
00005  * $Id: c4e83c4a266b5b551a0f6e5dec7a61f7fddaa80b $
00006  *
00007  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License along
00020  * with this program; if not, write to the Free Software Foundation, Inc.,
00021  * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef CMD_VARS_HPP
00025 #define CMD_VARS_HPP
00026 
00027 #include <vlc_common.h>
00028 #include <vlc_playlist.h>
00029 
00030 #include "cmd_generic.hpp"
00031 #include "../utils/ustring.hpp"
00032 
00033 class EqualizerBands;
00034 class EqualizerPreamp;
00035 class VarText;
00036 
00037 /// Command to notify the playlist of a change
00038 DEFINE_COMMAND( NotifyPlaylist, "notify playlist" )
00039 
00040 /// Command to notify the playlist of a change
00041 DEFINE_COMMAND( PlaytreeChanged, "playtree changed" )
00042 
00043 /// Command to notify the playtree of an item update
00044 class CmdPlaytreeUpdate: public CmdGeneric
00045 {
00046 public:
00047     CmdPlaytreeUpdate( intf_thread_t *pIntf, input_item_t* pItem ):
00048         CmdGeneric( pIntf ), m_pItem( pItem )
00049     {
00050         if( pItem )
00051             vlc_gc_incref( pItem );
00052     }
00053     virtual ~CmdPlaytreeUpdate()
00054     {
00055         if( m_pItem )
00056             vlc_gc_decref( m_pItem );
00057     }
00058     virtual void execute();
00059     virtual string getType() const { return "playtree update"; }
00060 
00061     /// Only accept removal of command if they concern the same item
00062     virtual bool checkRemove( CmdGeneric * ) const;
00063 
00064 private:
00065     /// input item changed
00066     input_item_t* m_pItem;
00067 };
00068 
00069 /// Command to notify the playtree of an item append
00070 class CmdPlaytreeAppend: public CmdGeneric
00071 {
00072 public:
00073     CmdPlaytreeAppend( intf_thread_t *pIntf, playlist_add_t *p_add ):
00074         CmdGeneric( pIntf ), m_pAdd( NULL )
00075     {
00076         if( p_add )
00077         {
00078             m_pAdd = new playlist_add_t;
00079             *m_pAdd = *p_add;
00080         }
00081     }
00082     virtual ~CmdPlaytreeAppend()
00083     {
00084         delete m_pAdd;
00085     }
00086     virtual void execute();
00087     virtual string getType() const { return "playtree append"; }
00088 
00089 private:
00090     playlist_add_t * m_pAdd;
00091 };
00092 
00093 /// Command to notify the playtree of an item deletion
00094 class CmdPlaytreeDelete: public CmdGeneric
00095 {
00096 public:
00097     CmdPlaytreeDelete( intf_thread_t *pIntf, int i_id ):
00098         CmdGeneric( pIntf ), m_id( i_id ) { }
00099     virtual ~CmdPlaytreeDelete() { }
00100     virtual void execute();
00101     virtual string getType() const { return "playtree append"; }
00102 
00103 private:
00104     int m_id;
00105 };
00106 
00107 
00108 /// Command to set a text variable
00109 class CmdSetText: public CmdGeneric
00110 {
00111 public:
00112     CmdSetText( intf_thread_t *pIntf, VarText &rText, const UString &rValue ):
00113         CmdGeneric( pIntf ), m_rText( rText ), m_value( rValue ) { }
00114     virtual ~CmdSetText() { }
00115     virtual void execute();
00116     virtual string getType() const { return "set text"; }
00117 
00118 private:
00119     /// Text variable to set
00120     VarText &m_rText;
00121     /// Value to set
00122     const UString m_value;
00123 };
00124 
00125 
00126 /// Command to set the equalizer preamp
00127 class CmdSetEqPreamp: public CmdGeneric
00128 {
00129 public:
00130     CmdSetEqPreamp( intf_thread_t *I, EqualizerPreamp &P, float v )
00131                   : CmdGeneric( I ), m_rPreamp( P ), m_value( v ) { }
00132     virtual ~CmdSetEqPreamp() { }
00133     virtual void execute();
00134     virtual string getType() const { return "set equalizer preamp"; }
00135 
00136 private:
00137     /// Preamp variable to set
00138     EqualizerPreamp &m_rPreamp;
00139     /// Value to set
00140     float m_value;
00141 };
00142 
00143 
00144 /// Command to set the equalizerbands
00145 class CmdSetEqBands: public CmdGeneric
00146 {
00147 public:
00148     CmdSetEqBands( intf_thread_t *I, EqualizerBands &B, const string &V )
00149                  : CmdGeneric( I ), m_rEqBands( B ), m_value( V ) { }
00150     virtual ~CmdSetEqBands() { }
00151     virtual void execute();
00152     virtual string getType() const { return "set equalizer bands"; }
00153 
00154 private:
00155     /// Equalizer variable to set
00156     EqualizerBands &m_rEqBands;
00157     /// Value to set
00158     const string m_value;
00159 };
00160 
00161 
00162 #endif

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