Commit ebd6d41f authored by Erwan Tulou's avatar Erwan Tulou

skins2: replace polling with callbacks

parent 6ce54993
...@@ -33,10 +33,4 @@ void CmdSetEqualizer::execute() ...@@ -33,10 +33,4 @@ void CmdSetEqualizer::execute()
aout_EnableFilter( getIntf(), "equalizer", m_enable ); aout_EnableFilter( getIntf(), "equalizer", m_enable );
} }
void CmdVolumeChanged::execute()
{
VlcProc* p_VlcProc = getIntf()->p_sys->p_vlcProc;
p_VlcProc->refreshVolume();
}
...@@ -46,21 +46,4 @@ class CmdSetEqualizer: public CmdGeneric ...@@ -46,21 +46,4 @@ class CmdSetEqualizer: public CmdGeneric
}; };
/// Command to enable/disable the equalizer
class CmdVolumeChanged: public CmdGeneric
{
public:
CmdVolumeChanged( intf_thread_t *pIntf ) : CmdGeneric( pIntf ) {}
virtual ~CmdVolumeChanged() {}
/// This method does the real job of the command
virtual void execute();
/// Return the type of the command
virtual string getType() const { return "set volume"; }
private:
};
#endif #endif
/*****************************************************************************
* cmd_callbacks.hpp
*****************************************************************************
* Copyright (C) 2009 the VideoLAN team
* $Id$
*
* Author: Erwan Tulou <erwan10 aT videolan doT org >
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CMD_CALLBACKS_HPP
#define CMD_CALLBACKS_HPP
#include "cmd_generic.hpp"
#include "../src/vlcproc.hpp"
#define ADD_COMMAND( label ) \
class Cmd_##label : public CmdGeneric \
{ \
public: \
Cmd_##label( intf_thread_t *pIntf, \
vlc_object_t *pObj, vlc_value_t newVal ) \
: CmdGeneric( pIntf ), m_pObj( pObj ), m_newVal( newVal ) \
{ \
if( m_pObj ) \
vlc_object_hold( m_pObj ); \
} \
virtual ~Cmd_##label() \
{ \
if( m_pObj ) \
vlc_object_release( m_pObj ); \
} \
\
virtual void execute() \
{ \
if( !m_pObj ) \
return; \
\
VlcProc* p_VlcProc = VlcProc::instance( getIntf() ); \
p_VlcProc->on_##label( m_pObj, m_newVal ); \
\
vlc_object_release( m_pObj ); \
m_pObj = NULL; \
} \
\
virtual string getType() const { return #label ; } \
\
private: \
vlc_object_t* m_pObj; \
vlc_value_t m_newVal; \
};
ADD_COMMAND( item_current_changed )
ADD_COMMAND( intf_event_changed )
ADD_COMMAND( bit_rate_changed )
ADD_COMMAND( sample_rate_changed )
ADD_COMMAND( random_changed )
ADD_COMMAND( loop_changed )
ADD_COMMAND( repeat_changed )
ADD_COMMAND( volume_changed )
ADD_COMMAND( audio_filter_changed )
#undef ADD_COMMAND
#endif
This diff is collapsed.
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include <set> #include <set>
#include <vlc_common.h>
#include <vlc_input.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include "../vars/equalizer.hpp" #include "../vars/equalizer.hpp"
#include "../vars/playtree.hpp" #include "../vars/playtree.hpp"
...@@ -85,8 +87,17 @@ class VlcProc: public SkinObject ...@@ -85,8 +87,17 @@ class VlcProc: public SkinObject
/// Indicate whether the embedded video output is currently used /// Indicate whether the embedded video output is currently used
bool isVoutUsed() const { return m_pVout != NULL; } bool isVoutUsed() const { return m_pVout != NULL; }
/// Refresh Volume void on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void refreshVolume(); void on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_bit_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_repeat_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal );
void on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal );
protected: protected:
// Protected because it is a singleton // Protected because it is a singleton
...@@ -147,21 +158,9 @@ class VlcProc: public SkinObject ...@@ -147,21 +158,9 @@ class VlcProc: public SkinObject
/// Define the command that calls manage() /// Define the command that calls manage()
DEFINE_CALLBACK( VlcProc, Manage ); DEFINE_CALLBACK( VlcProc, Manage );
/// Refresh audio variables
void refreshAudio();
/// Refresh playlist variables
void refreshPlaylist();
/// Refresh input variables
void refreshInput();
/// Update the stream name variable /// Update the stream name variable
void updateStreamName(); void updateStreamName();
/// Callback for volume variable
static int onVolumeChanged( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam );
/// Callback for intf-change variable /// Callback for intf-change variable
static int onIntfChange( vlc_object_t *pObj, const char *pVariable, static int onIntfChange( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal, vlc_value_t oldVal, vlc_value_t newVal,
...@@ -212,6 +211,12 @@ class VlcProc: public SkinObject ...@@ -212,6 +211,12 @@ class VlcProc: public SkinObject
static int onEqPreampChange( vlc_object_t *pObj, const char *pVariable, static int onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal, vlc_value_t oldVal, vlc_value_t newVal,
void *pParam ); void *pParam );
/// Generic Callback
static int onGenericCallback( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam );
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment