* 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.
+ * 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.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
#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"
#include <sstream>
+#include <assert.h>
VlcProc *VlcProc::instance( intf_thread_t *pIntf )
{
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
- m_varVoutSize( pIntf ), m_varEqBands( pIntf ),
- m_pVout( NULL ), m_pAout( NULL ), 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 );
// so they must put commands in the queue and NOT do anything else
// (X11 calls are not reentrant)
- // Called when volume sound changes
#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" )
ADD_CALLBACK( pIntf->p_sys->p_playlist, "random" )
#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 );
// TODO: properly handle item-deleted
var_AddCallback( pIntf->p_sys->p_playlist, "playlist-item-deleted",
onItemDelete, this );
- // Called when the "interface shower" wants us to show the skin
- var_AddCallback( pIntf->p_libvlc, "intf-show",
- onIntfShow, this );
// Called when the current input changes
var_AddCallback( pIntf->p_sys->p_playlist, "input-current",
onInputNew, this );
m_pVout = NULL;
}
- if( getIntf()->p_sys->p_input )
- reset_input();
-
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, "item-current",
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",
onItemDelete, this );
- var_DelCallback( getIntf()->p_libvlc, "intf-show",
- onIntfShow, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "input-current",
onInputNew, this );
var_DelCallback( getIntf()->p_sys->p_playlist, "item-change",
}
-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::onIntfShow( vlc_object_t *pObj, const char *pVariable,
- vlc_value_t oldVal, vlc_value_t newVal,
- void *pParam )
-{
- if (newVal.b_bool)
- {
- VlcProc *pThis = (VlcProc*)pParam;
-
- // Create a raise all command
- CmdRaiseAll *pCmd = new CmdRaiseAll( pThis->getIntf(),
- pThis->getIntf()->p_sys->p_theme->getWindowManager() );
-
- // Push the command in the asynchronous command queue
- AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
- pQueue->push( CmdGenericPtr( pCmd ) );
- }
-
- 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 )
ADD_CALLBACK_ENTRY( "audio-filter", audio_filter_changed )
+ ADD_CALLBACK_ENTRY( "intf-show", intf_show_changed )
+
#undef ADD_CALLBACK_ENTRY
if( pCmd )
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 )
{
- playlist_t * pPlaylist = getIntf()->p_sys->p_playlist;
- input_thread_t* pInput = getIntf()->p_sys->p_input;
input_item_t *p_item = static_cast<input_item_t*>(newVal.p_address);
- if( pInput )
- reset_input();
+ // Update short name
+ char *psz_name = input_item_GetName( p_item );
+ SET_TEXT( m_cVarStreamName, UString( getIntf(), psz_name ) );
+ free( psz_name );
- pInput = playlist_CurrentInput( pPlaylist );
- if( pInput )
- getIntf()->p_sys->p_input = pInput;
+ // Update full uri
+ char *psz_uri = input_item_GetURI( p_item );
+ SET_TEXT( m_cVarStreamURI, UString( getIntf(), psz_uri ) );
+ free( psz_uri );
- // Update the stream variable
- updateStreamName();
-
- // 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 playtree
+ getPlaytreeVar().onUpdateCurrent( true );
}
void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
input_thread_t* pInput = (input_thread_t*) p_obj;
- StreamTime *pTime = (StreamTime*)m_cVarTime.get();
- VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
- VarBoolImpl *pVarRecordable = (VarBoolImpl*)m_cVarRecordable.get();
- VarBoolImpl *pVarRecording = (VarBoolImpl*)m_cVarRecording.get();
- VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
- VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
- VarBoolImpl *pVarHasAudio = (VarBoolImpl*)m_cVarHasAudio.get();
- VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
- VarBoolImpl *pVarPlaying = (VarBoolImpl*)m_cVarPlaying.get();
- VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
- VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
- VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
+
+ if( !getIntf()->p_sys->p_input )
+ {
+ msg_Dbg( getIntf(), "new input %p detected", pInput );
+
+ getIntf()->p_sys->p_input = pInput;
+ vlc_object_hold( pInput );
+ }
switch( newVal.i_int )
{
case INPUT_EVENT_STATE:
{
int state = var_GetInteger( pInput, "state" );
- pVarStopped->set( false );
- pVarPlaying->set( state != PAUSE_S );
- pVarPaused->set( state == PAUSE_S );
+ SET_BOOL( m_cVarStopped, false );
+ SET_BOOL( m_cVarPlaying, state != PAUSE_S );
+ SET_BOOL( m_cVarPaused, state == PAUSE_S );
break;
}
case INPUT_EVENT_POSITION:
{
float pos = var_GetFloat( pInput, "position" );
- pTime->set( pos, false );
- pVarSeekable->set( pos != 0.0 );
+ SET_STREAMTIME( m_cVarTime, pos, false );
+ SET_BOOL( m_cVarSeekable, pos != 0.0 );
break;
}
vlc_value_t audio_es;
var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
&audio_es, NULL );
- pVarHasAudio->set( audio_es.i_int > 0 );
+ SET_BOOL( m_cVarHasAudio, audio_es.i_int > 0 );
break;
}
case INPUT_EVENT_VOUT:
{
vout_thread_t* pVout = input_GetVout( pInput );
- pVarHasVout->set( pVout != NULL );
+ SET_BOOL( m_cVarHasVout, pVout != NULL );
if( pVout )
{
- pVarFullscreen->set( var_GetBool( pVout, "fullscreen" ) );
+ SET_BOOL( m_cVarFullscreen,
+ var_GetBool( pVout, "fullscreen" ) );
vlc_object_release( pVout );
}
break;
case INPUT_EVENT_AOUT:
{
- char *pFilters;
aout_instance_t* pAout = input_GetAout( pInput );
- if( pAout )
+
+ // end of input or aout reuse (nothing to do)
+ if( !pAout || pAout == m_pAout )
{
- if( m_pAout )
+ if( pAout )
+ vlc_object_release( pAout );
+ break;
+ }
+
+ // remove previous Aout if any
+ if( m_pAout )
+ {
+ var_DelCallback( m_pAout, "audio-filter",
+ onGenericCallback, this );
+ if( m_bEqualizer_started )
{
- var_DelCallback( m_pAout, "audio-filter",
- onGenericCallback, this );
var_DelCallback( m_pAout, "equalizer-bands",
onEqBandsChange, this );
var_DelCallback( m_pAout, "equalizer-preamp",
onEqPreampChange, this );
- vlc_object_release( m_pAout );
- m_pAout = NULL;
}
+ vlc_object_release( m_pAout );
+ m_pAout = NULL;
+ m_bEqualizer_started = false;
+ }
- var_AddCallback( pAout, "audio-filter",
- onGenericCallback, this );
+ // New Aout (addCallbacks)
+ var_AddCallback( pAout, "audio-filter", onGenericCallback, this );
+
+ char *pFilters = var_GetNonEmptyString( pAout, "audio-filter" );
+ bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
+ free( pFilters );
+ SET_BOOL( m_cVarEqualizer, b_equalizer );
+ if( b_equalizer )
+ {
var_AddCallback( pAout, "equalizer-bands",
onEqBandsChange, this );
var_AddCallback( pAout, "equalizer-preamp",
onEqPreampChange, this );
- m_pAout = pAout;
-
- pFilters = var_GetNonEmptyString( pAout, "audio-filter" );
- }
- else
- {
- if( m_pAout )
- {
- var_DelCallback( m_pAout, "audio-filter",
- onGenericCallback, this );
- var_DelCallback( m_pAout, "equalizer-bands",
- onEqBandsChange, this );
- var_DelCallback( m_pAout, "equalizer-preamp",
- onEqPreampChange, this );
- vlc_object_release( m_pAout );
- m_pAout = NULL;
- }
- // Get the audio filters
- pFilters = config_GetPsz( getIntf(), "audio-filter" );
+ m_bEqualizer_started = true;
}
- // Refresh the equalizer variable
- bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
- pVarEqualizer->set( b_equalizer );
- free( pFilters );
+ m_pAout = pAout;
break;
}
vlc_value_t chapters_count;
var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
&chapters_count, NULL );
- pVarDvdActive->set( chapters_count.i_int > 0 );
+ SET_BOOL( m_cVarDvdActive, chapters_count.i_int > 0 );
break;
}
case INPUT_EVENT_RECORD:
- pVarRecording->set( var_GetBool( pInput, "record" ) );
+ SET_BOOL( m_cVarRecording, var_GetBool( pInput, "record" ) );
break;
case INPUT_EVENT_DEAD:
+ msg_Dbg( getIntf(), "end of input detected for %p", pInput );
+
+ var_DelCallback( pInput, "intf-event", onGenericCallback, this );
+ var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
+ var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
+ var_DelCallback( pInput, "can-record" , onGenericCallback, this );
+ vlc_object_release( pInput );
+ getIntf()->p_sys->p_input = NULL;
reset_input();
break;
{
input_thread_t* pInput = (input_thread_t*) p_obj;
- VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
- pBitrate->set( UString::fromInt( getIntf(), bitrate ) );
+ SET_TEXT( m_cVarStreamBitRate, UString::fromInt( getIntf(), bitrate ) );
}
void VlcProc::on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
input_thread_t* pInput = (input_thread_t*) p_obj;
- VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get();
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
- pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );
+ SET_TEXT( m_cVarStreamSampleRate, UString::fromInt(getIntf(),sampleRate) );
}
void VlcProc::on_can_record_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
input_thread_t* pInput = (input_thread_t*) p_obj;
- VarBoolImpl *pVarRecordable = (VarBoolImpl*)m_cVarRecordable.get();
- pVarRecordable->set( var_GetBool( pInput, "can-record" ) );
+ assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
+
+ SET_BOOL( m_cVarRecordable, var_GetBool( pInput, "can-record" ) );
}
void VlcProc::on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
playlist_t* pPlaylist = (playlist_t*) p_obj;
- // Refresh the random variable
- VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
- pVarRandom->set( var_GetBool( pPlaylist, "random" ) );
+ SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
}
void VlcProc::on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
playlist_t* pPlaylist = (playlist_t*) p_obj;
- // Refresh the loop variable
- VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
- pVarLoop->set( var_GetBool( pPlaylist, "loop" ) );
+ SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
}
void VlcProc::on_repeat_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
playlist_t* pPlaylist = (playlist_t*) p_obj;
- // Refresh the repeat variable
- VarBoolImpl *pVarRepeat = (VarBoolImpl*)m_cVarRepeat.get();
- pVarRepeat->set( var_GetBool( pPlaylist, "repeat" ) );
+ SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );
}
void VlcProc::on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal )
(void)p_obj; (void)newVal;
playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
- // Refresh sound volume
audio_volume_t volume;
aout_VolumeGet( pPlaylist, &volume );
- Volume *pVolume = (Volume*)m_cVarVolume.get();
- pVolume->set( (double)volume * 2.0 / AOUT_VOLUME_MAX, false );
-
- // Set the mute variable
- VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
- pVarMute->set( volume == 0 );
+ SET_VOLUME( m_cVarVolume, (double)volume / AOUT_VOLUME_MAX, false );
+ SET_BOOL( m_cVarMute, volume == 0 );
}
void VlcProc::on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
aout_instance_t* pAout = (aout_instance_t*) p_obj;
- char *pFilters = var_GetNonEmptyString( pAout, "audio-filter" );
+ char *pFilters = newVal.psz_string;
- VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
-
- // Refresh the equalizer variable
bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
- pVarEqualizer->set( b_equalizer );
- free( pFilters );
+ SET_BOOL( m_cVarEqualizer, b_equalizer );
+ if( b_equalizer && !m_bEqualizer_started )
+ {
+ var_AddCallback( pAout, "equalizer-bands", onEqBandsChange, this );
+ var_AddCallback( pAout, "equalizer-preamp", onEqPreampChange, this );
+ m_bEqualizer_started = true;
+ }
}
-void VlcProc::reset_input()
+void VlcProc::on_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal )
{
- input_thread_t* pInput = getIntf()->p_sys->p_input;
+ (void)p_obj;
+ bool b_fullscreen = getFullscreenVar().get();
- if( pInput )
+ if( !b_fullscreen )
+ {
+ if( newVal.b_bool )
+ {
+ // Create a raise all command
+ CmdRaiseAll *pCmd = new CmdRaiseAll( getIntf(),
+ getIntf()->p_sys->p_theme->getWindowManager() );
+
+ // Push the command in the asynchronous command queue
+ AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ }
+ }
+ else
{
- StreamTime *pTime = (StreamTime*)m_cVarTime.get();
- VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
- VarBoolImpl *pVarRecordable = (VarBoolImpl*)m_cVarRecordable.get();
- VarBoolImpl *pVarRecording = (VarBoolImpl*)m_cVarRecording.get();
- VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
- VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
- VarBoolImpl *pVarHasAudio = (VarBoolImpl*)m_cVarHasAudio.get();
- VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
- VarBoolImpl *pVarPlaying = (VarBoolImpl*)m_cVarPlaying.get();
- VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
- VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
- VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
-
- VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
- VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get();
-
- pVarSeekable->set( false );
- pVarRecordable->set( false );
- pVarRecording->set( false );
- pVarDvdActive->set( false );
- pTime->set( 0, false );
- pVarFullscreen->set( false );
- pVarHasAudio->set( false );
- pVarHasVout->set( false );
- pVarStopped->set( true );
- pVarPlaying->set( false );
- pVarPaused->set( false );
- pBitrate->set( UString( getIntf(), "") );
- pSampleRate->set( UString( getIntf(), "") );
-
- var_DelCallback( pInput, "intf-event", onGenericCallback, this );
- var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
- var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
- var_DelCallback( pInput, "can-record" , onGenericCallback, this );
- vlc_object_release( pInput );
- getIntf()->p_sys->p_input = NULL;
+ Theme* pTheme = getIntf()->p_sys->p_theme;
+ TopWindow *pWin = pTheme->getWindowById( "fullscreenController" );
+ if( pWin )
+ {
+ bool b_visible = pWin->getVisibleVar().get();
+ AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
+
+ if( !b_visible )
+ {
+ CmdShowWindow* pCmd = new CmdShowWindow( getIntf(),
+ getIntf()->p_sys->p_theme->getWindowManager(),
+ *pWin );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ }
+ else
+ {
+ CmdHideWindow* pCmd = new CmdHideWindow( getIntf(),
+ getIntf()->p_sys->p_theme->getWindowManager(),
+ *pWin );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ }
+ }
}
}
+void VlcProc::reset_input()
+{
+ SET_BOOL( m_cVarSeekable, false );
+ SET_BOOL( m_cVarRecordable, false );
+ SET_BOOL( m_cVarRecording, false );
+ SET_BOOL( m_cVarDvdActive, false );
+ SET_BOOL( m_cVarFullscreen, false );
+ SET_BOOL( m_cVarHasAudio, false );
+ SET_BOOL( m_cVarHasVout, false );
+ SET_BOOL( m_cVarStopped, true );
+ SET_BOOL( m_cVarPlaying, false );
+ 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()
{
playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
- // Refresh the random variable
- VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
- pVarRandom->set( var_GetBool( pPlaylist, "random" ) );
-
- // Refresh the loop variable
- VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
- pVarLoop->set( var_GetBool( pPlaylist, "loop" ) );
-
- // Refresh the repeat variable
- VarBoolImpl *pVarRepeat = (VarBoolImpl*)m_cVarRepeat.get();
- pVarRepeat->set( var_GetBool( pPlaylist, "repeat" ) );
+ SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
+ SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
+ SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );
- // Refresh sound volume
audio_volume_t volume;
aout_VolumeGet( pPlaylist, &volume );
- Volume *pVolume = (Volume*)m_cVarVolume.get();
- pVolume->set( (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 the mute variable
- VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
- pVarMute->set( volume == 0 );
+ update_equalizer();
+}
+
+void VlcProc::update_equalizer()
+{
+
+ char *pFilters;
+ if( m_pAout )
+ pFilters = var_GetNonEmptyString( m_pAout, "audio-filter" );
+ else
+ pFilters = config_GetPsz( getIntf(), "audio-filter" );
+
+ bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
+ free( pFilters );
+
+ SET_BOOL( m_cVarEqualizer, b_equalizer );
+}
+
+void VlcProc::setFullscreenVar( bool b_fullscreen )
+{
+ SET_BOOL( m_cVarFullscreen, b_fullscreen );
}
+#undef SET_BOOL
+#undef SET_STREAMTIME
+#undef SET_TEXT
+#undef SET_VOLUME