#include "../commands/cmd_resize.hpp"
#include "../commands/cmd_vars.hpp"
#include "../commands/cmd_dialogs.hpp"
-#include "../commands/cmd_update_item.hpp"
#include "../commands/cmd_audio.hpp"
#include "../commands/cmd_callbacks.hpp"
#include "../utils/var_bool.hpp"
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
- m_varVoutSize( pIntf ), m_varEqBands( pIntf ),
- m_pVout( NULL ), m_pAout( NULL ), m_bEqualizer_started( false ),
- m_cmdManage( this )
+ m_varEqBands( pIntf ), m_pVout( NULL ), m_pAout( NULL ),
+ m_bEqualizer_started( false ), m_cmdManage( this )
{
// Create a timer to poll the status of the vlc
OSFactory *pOsFactory = OSFactory::instance( pIntf );
#define ADD_CALLBACK( p_object, var ) \
var_AddCallback( p_object, var, onGenericCallback, this );
- ADD_CALLBACK( pIntf->p_libvlc, "volume-change" )
+ ADD_CALLBACK( pIntf->p_sys->p_playlist, "volume-change" )
ADD_CALLBACK( pIntf->p_libvlc, "intf-show" )
ADD_CALLBACK( pIntf->p_sys->p_playlist, "item-current" )
#undef ADD_CALLBACK
- // Called when the playlist changes
- var_AddCallback( pIntf->p_sys->p_playlist, "intf-change",
- onIntfChange, this );
// Called when a playlist item is added
var_AddCallback( pIntf->p_sys->p_playlist, "playlist-item-append",
onItemAppend, this );
interaction_Unregister( getIntf() );
- var_DelCallback( getIntf()->p_libvlc, "volume-change",
+ var_DelCallback( getIntf()->p_sys->p_playlist, "volume-change",
onGenericCallback, this );
var_DelCallback( getIntf()->p_libvlc, "intf-show",
onGenericCallback, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "repeat",
onGenericCallback, this );
- var_DelCallback( getIntf()->p_sys->p_playlist, "intf-change",
- onIntfChange, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-append",
onItemAppend, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-deleted",
}
-int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
- vlc_value_t oldVal, vlc_value_t newVal,
- void *pParam )
-{
- VlcProc *pThis = (VlcProc*)pParam;
-
- // Update the stream variable
- pThis->updateStreamName();
-
- // Create a playtree notify command (for new style playtree)
- CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
-
- // Push the command in the asynchronous command queue
- AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
- pQueue->push( CmdGenericPtr( pCmdTree ) );
-
- return VLC_SUCCESS;
-}
-
-
-
int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldval, vlc_value_t newval, void *pParam )
{
VlcProc *pThis = (VlcProc*)pParam;
input_item_t *p_item = static_cast<input_item_t*>(newval.p_address);
- // Update the stream variable
- pThis->updateStreamName();
-
// Create a playtree notify command
CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
- p_item->i_id );
+ p_item );
// Push the command in the asynchronous command queue
AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
return VLC_SUCCESS;
}
-
-void VlcProc::updateStreamName()
-{
- // Create a update item command
- CmdUpdateItem *pCmdItem = new CmdUpdateItem( getIntf(), getStreamNameVar(), getStreamURIVar() );
-
- // Push the command in the asynchronous command queue
- AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
- pQueue->push( CmdGenericPtr( pCmdItem ) );
-}
-
int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
void *pParam )
return VLC_SUCCESS;
}
+#define SET_BOOL(m,v) ((VarBoolImpl*)(m).get())->set(v)
+#define SET_STREAMTIME(m,v,b) ((StreamTime*)(m).get())->set(v,b)
+#define SET_TEXT(m,v) ((VarText*)(m).get())->set(v)
+#define SET_VOLUME(m,v,b) ((Volume*)(m).get())->set(v,b)
+
void VlcProc::on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
input_item_t *p_item = static_cast<input_item_t*>(newVal.p_address);
- // Update the stream variable
- updateStreamName();
+ // Update short name
+ char *psz_name = input_item_GetName( p_item );
+ SET_TEXT( m_cVarStreamName, UString( getIntf(), psz_name ) );
+ free( psz_name );
- // Create a playtree notify command
- AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
- CmdPlaytreeUpdate *pCmdTree =
- new CmdPlaytreeUpdate( getIntf(), p_item->i_id );
- pQueue->push( CmdGenericPtr( pCmdTree ) , true );
-}
+ // Update full uri
+ char *psz_uri = input_item_GetURI( p_item );
+ SET_TEXT( m_cVarStreamURI, UString( getIntf(), psz_uri ) );
+ free( psz_uri );
-#define SET_BOOL(m,v) ((VarBoolImpl*)(m).get())->set(v)
-#define SET_STREAMTIME(m,v,b) ((StreamTime*)(m).get())->set(v,b)
-#define SET_TEXT(m,v) ((VarText*)(m).get())->set(v)
-#define SET_VOLUME(m,v,b) ((Volume*)(m).get())->set(v,b)
+ // Update playtree
+ getPlaytreeVar().onUpdateCurrent( true );
+}
void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
audio_volume_t volume;
aout_VolumeGet( pPlaylist, &volume );
- SET_VOLUME( m_cVarVolume, (double)volume * 2.0 / AOUT_VOLUME_MAX, false );
+ SET_VOLUME( m_cVarVolume, (double)volume / AOUT_VOLUME_MAX, false );
SET_BOOL( m_cVarMute, volume == 0 );
}
SET_BOOL( m_cVarPaused, false );
SET_STREAMTIME( m_cVarTime, 0, false );
+ SET_TEXT( m_cVarStreamName, UString( getIntf(), "") );
+ SET_TEXT( m_cVarStreamURI, UString( getIntf(), "") );
SET_TEXT( m_cVarStreamBitRate, UString( getIntf(), "") );
SET_TEXT( m_cVarStreamSampleRate, UString( getIntf(), "") );
+
+ getPlaytreeVar().onUpdateCurrent( false );
}
void VlcProc::init_variables()
audio_volume_t volume;
aout_VolumeGet( pPlaylist, &volume );
- SET_VOLUME( m_cVarVolume, (double)volume * 2.0 / AOUT_VOLUME_MAX, false );
+ SET_VOLUME( m_cVarVolume, (double)volume / AOUT_VOLUME_MAX, false );
SET_BOOL( m_cVarMute, volume == 0 );
update_equalizer();