1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2009 the VideoLAN team
7 * Author: Erwan Tulou <erwan10 aT videolan doT org >
8 * JP Dinger <jpd (at) videolan (dot) org>
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.
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.
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 *****************************************************************************/
25 #ifndef CMD_CALLBACKS_HPP
26 #define CMD_CALLBACKS_HPP
28 #include "cmd_generic.hpp"
29 #include "../src/vlcproc.hpp"
31 class CmdLabeled : public CmdGeneric
37 void execute_on( void (VlcProc::*on_label)(vlc_object_t *,vlc_value_t) )
42 (VlcProc::instance( getIntf() )->*on_label)( m_pObj, m_newVal );
44 vlc_object_release( m_pObj );
47 CmdLabeled( intf_thread_t *pIntf, vlc_object_t *pObj, vlc_value_t newVal )
48 : CmdGeneric( pIntf ), m_pObj( pObj ), m_newVal( newVal )
51 vlc_object_hold( m_pObj );
54 virtual ~CmdLabeled() {
56 vlc_object_release( m_pObj );
60 #define ADD_COMMAND( label ) \
61 class Cmd_##label : public CmdLabeled \
63 Cmd_##label( intf_thread_t *I, vlc_object_t *O, vlc_value_t V ) \
64 : CmdLabeled (I, O, V) { } \
65 virtual string getType() const { return #label; } \
66 virtual void execute() { execute_on( &VlcProc::on_##label ); } \
69 ADD_COMMAND( item_current_changed )
70 ADD_COMMAND( intf_event_changed )
71 ADD_COMMAND( bit_rate_changed )
72 ADD_COMMAND( sample_rate_changed )
73 ADD_COMMAND( can_record_changed )
75 ADD_COMMAND( random_changed )
76 ADD_COMMAND( loop_changed )
77 ADD_COMMAND( repeat_changed )
79 ADD_COMMAND( volume_changed )
81 ADD_COMMAND( audio_filter_changed )