1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003-2009 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teulière <ipkiss@via.ecp.fr>
9 * Erwan Tulou <erwan10@videolan.org>
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24 *****************************************************************************/
30 #include <vlc_common.h>
33 #include <vlc_playlist.h>
35 #include "vlcproc.hpp"
36 #include "os_factory.hpp"
37 #include "os_loop.hpp"
38 #include "os_timer.hpp"
39 #include "var_manager.hpp"
40 #include "vout_manager.hpp"
42 #include "window_manager.hpp"
43 #include "../commands/async_queue.hpp"
44 #include "../commands/cmd_change_skin.hpp"
45 #include "../commands/cmd_show_window.hpp"
46 #include "../commands/cmd_quit.hpp"
47 #include "../commands/cmd_resize.hpp"
48 #include "../commands/cmd_vars.hpp"
49 #include "../commands/cmd_dialogs.hpp"
50 #include "../commands/cmd_audio.hpp"
51 #include "../commands/cmd_callbacks.hpp"
52 #include "../utils/var_bool.hpp"
57 VlcProc *VlcProc::instance( intf_thread_t *pIntf )
59 if( pIntf->p_sys->p_vlcProc == NULL )
61 pIntf->p_sys->p_vlcProc = new VlcProc( pIntf );
64 return pIntf->p_sys->p_vlcProc;
68 void VlcProc::destroy( intf_thread_t *pIntf )
70 delete pIntf->p_sys->p_vlcProc;
71 pIntf->p_sys->p_vlcProc = NULL;
75 VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
76 m_varEqBands( pIntf ), m_pVout( NULL ), m_pAout( NULL ),
77 m_bEqualizer_started( false ), m_cmdManage( this )
79 // Create a timer to poll the status of the vlc
80 OSFactory *pOsFactory = OSFactory::instance( pIntf );
81 m_pTimer = pOsFactory->createOSTimer( m_cmdManage );
82 m_pTimer->start( 100, false );
84 // Create and register VLC variables
85 VarManager *pVarManager = VarManager::instance( getIntf() );
87 #define REGISTER_VAR( var, type, name ) \
88 var = VariablePtr( new type( getIntf() ) ); \
89 pVarManager->registerVar( var, name );
90 REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
91 REGISTER_VAR( m_cVarLoop, VarBoolImpl, "playlist.isLoop" )
92 REGISTER_VAR( m_cVarRepeat, VarBoolImpl, "playlist.isRepeat" )
93 REGISTER_VAR( m_cPlaytree, Playtree, "playtree" )
94 pVarManager->registerVar( getPlaytreeVar().getPositionVarPtr(),
96 pVarManager->registerVar( m_cVarRandom, "playtree.isRandom" );
97 pVarManager->registerVar( m_cVarLoop, "playtree.isLoop" );
99 REGISTER_VAR( m_cVarPlaying, VarBoolImpl, "vlc.isPlaying" )
100 REGISTER_VAR( m_cVarStopped, VarBoolImpl, "vlc.isStopped" )
101 REGISTER_VAR( m_cVarPaused, VarBoolImpl, "vlc.isPaused" )
103 /* Input variables */
104 pVarManager->registerVar( m_cVarRepeat, "playtree.isRepeat" );
105 REGISTER_VAR( m_cVarTime, StreamTime, "time" )
106 REGISTER_VAR( m_cVarSeekable, VarBoolImpl, "vlc.isSeekable" )
107 REGISTER_VAR( m_cVarDvdActive, VarBoolImpl, "dvd.isActive" )
109 REGISTER_VAR( m_cVarRecordable, VarBoolImpl, "vlc.canRecord" )
110 REGISTER_VAR( m_cVarRecording, VarBoolImpl, "vlc.isRecording" )
113 REGISTER_VAR( m_cVarFullscreen, VarBoolImpl, "vlc.isFullscreen" )
114 REGISTER_VAR( m_cVarHasVout, VarBoolImpl, "vlc.hasVout" )
117 REGISTER_VAR( m_cVarHasAudio, VarBoolImpl, "vlc.hasAudio" )
118 REGISTER_VAR( m_cVarVolume, Volume, "volume" )
119 REGISTER_VAR( m_cVarMute, VarBoolImpl, "vlc.isMute" )
120 REGISTER_VAR( m_cVarEqualizer, VarBoolImpl, "equalizer.isEnabled" )
121 REGISTER_VAR( m_cVarEqPreamp, EqualizerPreamp, "equalizer.preamp" )
124 m_cVarStreamName = VariablePtr( new VarText( getIntf(), false ) );
125 pVarManager->registerVar( m_cVarStreamName, "streamName" );
126 m_cVarStreamURI = VariablePtr( new VarText( getIntf(), false ) );
127 pVarManager->registerVar( m_cVarStreamURI, "streamURI" );
128 m_cVarStreamBitRate = VariablePtr( new VarText( getIntf(), false ) );
129 pVarManager->registerVar( m_cVarStreamBitRate, "bitrate" );
130 m_cVarStreamSampleRate = VariablePtr( new VarText( getIntf(), false ) );
131 pVarManager->registerVar( m_cVarStreamSampleRate, "samplerate" );
133 // Register the equalizer bands
134 for( int i = 0; i < EqualizerBands::kNbBands; i++)
137 ss << "equalizer.band(" << i << ")";
138 pVarManager->registerVar( m_varEqBands.getBand( i ), ss.str() );
142 // The object variable callbacks are called from other VLC threads,
143 // so they must put commands in the queue and NOT do anything else
144 // (X11 calls are not reentrant)
146 #define ADD_CALLBACK( p_object, var ) \
147 var_AddCallback( p_object, var, onGenericCallback, this );
149 ADD_CALLBACK( pIntf->p_libvlc, "volume-change" )
150 ADD_CALLBACK( pIntf->p_libvlc, "intf-show" )
152 ADD_CALLBACK( pIntf->p_sys->p_playlist, "item-current" )
153 ADD_CALLBACK( pIntf->p_sys->p_playlist, "random" )
154 ADD_CALLBACK( pIntf->p_sys->p_playlist, "loop" )
155 ADD_CALLBACK( pIntf->p_sys->p_playlist, "repeat" )
159 // Called when a playlist item is added
160 var_AddCallback( pIntf->p_sys->p_playlist, "playlist-item-append",
161 onItemAppend, this );
162 // Called when a playlist item is deleted
163 // TODO: properly handle item-deleted
164 var_AddCallback( pIntf->p_sys->p_playlist, "playlist-item-deleted",
165 onItemDelete, this );
166 // Called when the current input changes
167 var_AddCallback( pIntf->p_sys->p_playlist, "input-current",
169 // Called when a playlist item changed
170 var_AddCallback( pIntf->p_sys->p_playlist, "item-change",
171 onItemChange, this );
172 // Called when our skins2 demux wants us to load a new skin
173 var_AddCallback( pIntf, "skin-to-load", onSkinToLoad, this );
175 // Called when we have an interaction dialog to display
176 var_Create( pIntf, "interaction", VLC_VAR_ADDRESS );
177 var_AddCallback( pIntf, "interaction", onInteraction, this );
178 interaction_Register( pIntf );
180 // initialize variables refering to liblvc and playlist objects
192 vlc_object_release( m_pAout );
197 vlc_object_release( m_pVout );
201 interaction_Unregister( getIntf() );
203 var_DelCallback( getIntf()->p_libvlc, "volume-change",
204 onGenericCallback, this );
205 var_DelCallback( getIntf()->p_libvlc, "intf-show",
206 onGenericCallback, this );
208 var_DelCallback( getIntf()->p_sys->p_playlist, "item-current",
209 onGenericCallback, this );
210 var_DelCallback( getIntf()->p_sys->p_playlist, "random",
211 onGenericCallback, this );
212 var_DelCallback( getIntf()->p_sys->p_playlist, "loop",
213 onGenericCallback, this );
214 var_DelCallback( getIntf()->p_sys->p_playlist, "repeat",
215 onGenericCallback, this );
217 var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-append",
218 onItemAppend, this );
219 var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-deleted",
220 onItemDelete, this );
221 var_DelCallback( getIntf()->p_sys->p_playlist, "input-current",
223 var_DelCallback( getIntf()->p_sys->p_playlist, "item-change",
224 onItemChange, this );
225 var_DelCallback( getIntf(), "skin-to-load", onSkinToLoad, this );
226 var_DelCallback( getIntf(), "interaction", onInteraction, this );
229 void VlcProc::manage()
231 // Did the user request to quit vlc ?
232 if( !vlc_object_alive( getIntf() ) )
234 // Get the instance of OSFactory
235 OSFactory *pOsFactory = OSFactory::instance( getIntf() );
237 // Exit the main OS loop
238 pOsFactory->getOSLoop()->exit();
244 void VlcProc::CmdManage::execute()
246 // Just forward to VlcProc
251 int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable,
252 vlc_value_t oldval, vlc_value_t newval, void *pParam )
254 VlcProc *pThis = (VlcProc*)pParam;
255 input_thread_t *pInput = static_cast<input_thread_t*>(newval.p_address);
257 var_AddCallback( pInput, "intf-event", onGenericCallback, pThis );
258 var_AddCallback( pInput, "bit-rate", onGenericCallback, pThis );
259 var_AddCallback( pInput, "sample-rate", onGenericCallback, pThis );
260 var_AddCallback( pInput, "can-record", onGenericCallback, pThis );
266 int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
267 vlc_value_t oldval, vlc_value_t newval,
270 VlcProc *pThis = (VlcProc*)pParam;
271 input_item_t *p_item = static_cast<input_item_t*>(newval.p_address);
273 // Create a playtree notify command
274 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
277 // Push the command in the asynchronous command queue
278 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
279 pQueue->push( CmdGenericPtr( pCmdTree ), true );
284 int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
285 vlc_value_t oldVal, vlc_value_t newVal,
288 VlcProc *pThis = (VlcProc*)pParam;
290 playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(
293 memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
295 CmdGenericPtr ptrTree;
296 CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),
298 ptrTree = CmdGenericPtr( pCmdTree );
300 // Push the command in the asynchronous command queue
301 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
302 pQueue->push( ptrTree , false );
307 int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
308 vlc_value_t oldVal, vlc_value_t newVal,
311 VlcProc *pThis = (VlcProc*)pParam;
313 int i_id = newVal.i_int;
315 CmdGenericPtr ptrTree;
316 CmdPlaytreeDelete *pCmdTree = new CmdPlaytreeDelete( pThis->getIntf(),
318 ptrTree = CmdGenericPtr( pCmdTree );
320 // Push the command in the asynchronous command queue
321 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
322 pQueue->push( ptrTree , false );
328 int VlcProc::onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
329 vlc_value_t oldVal, vlc_value_t newVal,
332 VlcProc *pThis = (VlcProc*)pParam;
334 // Create a playlist notify command
335 CmdChangeSkin *pCmd =
336 new CmdChangeSkin( pThis->getIntf(), newVal.psz_string );
338 // Push the command in the asynchronous command queue
339 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
340 pQueue->push( CmdGenericPtr( pCmd ) );
345 int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
346 vlc_value_t oldVal, vlc_value_t newVal,
349 VlcProc *pThis = (VlcProc*)pParam;
350 interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);
352 CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );
353 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
354 pQueue->push( CmdGenericPtr( pCmd ) );
358 int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
359 vlc_value_t oldVal, vlc_value_t newVal,
362 VlcProc *pThis = (VlcProc*)pParam;
364 // Post a set equalizer bands command
365 CmdSetEqBands *pCmd = new CmdSetEqBands( pThis->getIntf(),
368 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
369 pQueue->push( CmdGenericPtr( pCmd ) );
375 int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
376 vlc_value_t oldVal, vlc_value_t newVal,
379 VlcProc *pThis = (VlcProc*)pParam;
380 EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());
382 // Post a set preamp command
383 CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,
384 (newVal.f_float + 20.0) / 40.0 );
385 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
386 pQueue->push( CmdGenericPtr( pCmd ) );
392 int VlcProc::onGenericCallback( vlc_object_t *pObj, const char *pVariable,
393 vlc_value_t oldVal, vlc_value_t newVal,
396 VlcProc *pThis = (VlcProc*)pParam;
397 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
399 CmdGeneric *pCmd = NULL;
401 #define ADD_CALLBACK_ENTRY( var, label ) \
403 if( strcmp( pVariable, var ) == 0 ) \
404 pCmd = new Cmd_##label( pThis->getIntf(), pObj, newVal ); \
407 ADD_CALLBACK_ENTRY( "item-current", item_current_changed )
408 ADD_CALLBACK_ENTRY( "volume-change", volume_changed )
410 ADD_CALLBACK_ENTRY( "intf-event", intf_event_changed )
411 ADD_CALLBACK_ENTRY( "bit-rate", bit_rate_changed )
412 ADD_CALLBACK_ENTRY( "sample-rate", sample_rate_changed )
413 ADD_CALLBACK_ENTRY( "can-record", can_record_changed )
415 ADD_CALLBACK_ENTRY( "random", random_changed )
416 ADD_CALLBACK_ENTRY( "loop", loop_changed )
417 ADD_CALLBACK_ENTRY( "repeat", repeat_changed )
419 ADD_CALLBACK_ENTRY( "audio-filter", audio_filter_changed )
421 ADD_CALLBACK_ENTRY( "intf-show", intf_show_changed )
423 #undef ADD_CALLBACK_ENTRY
426 pQueue->push( CmdGenericPtr( pCmd ), false );
428 msg_Err( pObj, "no Callback entry provided for %s", pVariable );
433 #define SET_BOOL(m,v) ((VarBoolImpl*)(m).get())->set(v)
434 #define SET_STREAMTIME(m,v,b) ((StreamTime*)(m).get())->set(v,b)
435 #define SET_TEXT(m,v) ((VarText*)(m).get())->set(v)
436 #define SET_VOLUME(m,v,b) ((Volume*)(m).get())->set(v,b)
438 void VlcProc::on_item_current_changed( vlc_object_t* p_obj, vlc_value_t newVal )
440 input_item_t *p_item = static_cast<input_item_t*>(newVal.p_address);
443 char *psz_name = input_item_GetName( p_item );
444 SET_TEXT( m_cVarStreamName, UString( getIntf(), psz_name ) );
448 char *psz_uri = input_item_GetURI( p_item );
449 SET_TEXT( m_cVarStreamURI, UString( getIntf(), psz_uri ) );
453 getPlaytreeVar().onUpdateCurrent( true );
456 void VlcProc::on_intf_event_changed( vlc_object_t* p_obj, vlc_value_t newVal )
458 input_thread_t* pInput = (input_thread_t*) p_obj;
460 assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
462 if( !getIntf()->p_sys->p_input )
464 msg_Dbg( getIntf(), "new input %p detected", pInput );
466 getIntf()->p_sys->p_input = pInput;
467 vlc_object_hold( pInput );
470 switch( newVal.i_int )
472 case INPUT_EVENT_STATE:
474 int state = var_GetInteger( pInput, "state" );
475 SET_BOOL( m_cVarStopped, false );
476 SET_BOOL( m_cVarPlaying, state != PAUSE_S );
477 SET_BOOL( m_cVarPaused, state == PAUSE_S );
481 case INPUT_EVENT_POSITION:
483 float pos = var_GetFloat( pInput, "position" );
484 SET_STREAMTIME( m_cVarTime, pos, false );
485 SET_BOOL( m_cVarSeekable, pos != 0.0 );
492 vlc_value_t audio_es;
493 var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
495 SET_BOOL( m_cVarHasAudio, audio_es.i_int > 0 );
499 case INPUT_EVENT_VOUT:
501 vout_thread_t* pVout = input_GetVout( pInput );
502 SET_BOOL( m_cVarHasVout, pVout != NULL );
505 SET_BOOL( m_cVarFullscreen,
506 var_GetBool( pVout, "fullscreen" ) );
507 vlc_object_release( pVout );
512 case INPUT_EVENT_AOUT:
514 aout_instance_t* pAout = input_GetAout( pInput );
516 // end of input or aout reuse (nothing to do)
517 if( !pAout || pAout == m_pAout )
520 vlc_object_release( pAout );
524 // remove previous Aout if any
527 var_DelCallback( m_pAout, "audio-filter",
528 onGenericCallback, this );
529 if( m_bEqualizer_started )
531 var_DelCallback( m_pAout, "equalizer-bands",
532 onEqBandsChange, this );
533 var_DelCallback( m_pAout, "equalizer-preamp",
534 onEqPreampChange, this );
536 vlc_object_release( m_pAout );
538 m_bEqualizer_started = false;
541 // New Aout (addCallbacks)
542 var_AddCallback( pAout, "audio-filter", onGenericCallback, this );
544 char *pFilters = var_GetNonEmptyString( pAout, "audio-filter" );
545 bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
547 SET_BOOL( m_cVarEqualizer, b_equalizer );
550 var_AddCallback( pAout, "equalizer-bands",
551 onEqBandsChange, this );
552 var_AddCallback( pAout, "equalizer-preamp",
553 onEqPreampChange, this );
554 m_bEqualizer_started = true;
560 case INPUT_EVENT_CHAPTER:
562 vlc_value_t chapters_count;
563 var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
564 &chapters_count, NULL );
565 SET_BOOL( m_cVarDvdActive, chapters_count.i_int > 0 );
569 case INPUT_EVENT_RECORD:
570 SET_BOOL( m_cVarRecording, var_GetBool( pInput, "record" ) );
573 case INPUT_EVENT_DEAD:
574 msg_Dbg( getIntf(), "end of input detected for %p", pInput );
576 var_DelCallback( pInput, "intf-event", onGenericCallback, this );
577 var_DelCallback( pInput, "bit-rate", onGenericCallback, this );
578 var_DelCallback( pInput, "sample-rate", onGenericCallback, this );
579 var_DelCallback( pInput, "can-record" , onGenericCallback, this );
580 vlc_object_release( pInput );
581 getIntf()->p_sys->p_input = NULL;
590 void VlcProc::on_bit_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal )
592 input_thread_t* pInput = (input_thread_t*) p_obj;
594 assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
596 int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
597 SET_TEXT( m_cVarStreamBitRate, UString::fromInt( getIntf(), bitrate ) );
600 void VlcProc::on_sample_rate_changed( vlc_object_t* p_obj, vlc_value_t newVal )
602 input_thread_t* pInput = (input_thread_t*) p_obj;
604 assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
606 int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
607 SET_TEXT( m_cVarStreamSampleRate, UString::fromInt(getIntf(),sampleRate) );
610 void VlcProc::on_can_record_changed( vlc_object_t* p_obj, vlc_value_t newVal )
612 input_thread_t* pInput = (input_thread_t*) p_obj;
614 assert( getIntf()->p_sys->p_input == NULL || getIntf()->p_sys->p_input == pInput );
616 SET_BOOL( m_cVarRecordable, var_GetBool( pInput, "can-record" ) );
619 void VlcProc::on_random_changed( vlc_object_t* p_obj, vlc_value_t newVal )
621 playlist_t* pPlaylist = (playlist_t*) p_obj;
623 SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
626 void VlcProc::on_loop_changed( vlc_object_t* p_obj, vlc_value_t newVal )
628 playlist_t* pPlaylist = (playlist_t*) p_obj;
630 SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
633 void VlcProc::on_repeat_changed( vlc_object_t* p_obj, vlc_value_t newVal )
635 playlist_t* pPlaylist = (playlist_t*) p_obj;
637 SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );
640 void VlcProc::on_volume_changed( vlc_object_t* p_obj, vlc_value_t newVal )
642 (void)p_obj; (void)newVal;
643 playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
645 audio_volume_t volume;
646 aout_VolumeGet( pPlaylist, &volume );
647 SET_VOLUME( m_cVarVolume, (double)volume / AOUT_VOLUME_MAX, false );
648 SET_BOOL( m_cVarMute, volume == 0 );
651 void VlcProc::on_audio_filter_changed( vlc_object_t* p_obj, vlc_value_t newVal )
653 aout_instance_t* pAout = (aout_instance_t*) p_obj;
655 char *pFilters = newVal.psz_string;
657 bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
658 SET_BOOL( m_cVarEqualizer, b_equalizer );
659 if( b_equalizer && !m_bEqualizer_started )
661 var_AddCallback( pAout, "equalizer-bands", onEqBandsChange, this );
662 var_AddCallback( pAout, "equalizer-preamp", onEqPreampChange, this );
663 m_bEqualizer_started = true;
667 void VlcProc::on_intf_show_changed( vlc_object_t* p_obj, vlc_value_t newVal )
670 bool b_fullscreen = getFullscreenVar().get();
676 // Create a raise all command
677 CmdRaiseAll *pCmd = new CmdRaiseAll( getIntf(),
678 getIntf()->p_sys->p_theme->getWindowManager() );
680 // Push the command in the asynchronous command queue
681 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
682 pQueue->push( CmdGenericPtr( pCmd ) );
687 Theme* pTheme = getIntf()->p_sys->p_theme;
688 TopWindow *pWin = pTheme->getWindowById( "fullscreenController" );
691 bool b_visible = pWin->getVisibleVar().get();
692 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
696 CmdShowWindow* pCmd = new CmdShowWindow( getIntf(),
697 getIntf()->p_sys->p_theme->getWindowManager(),
699 pQueue->push( CmdGenericPtr( pCmd ) );
703 CmdHideWindow* pCmd = new CmdHideWindow( getIntf(),
704 getIntf()->p_sys->p_theme->getWindowManager(),
706 pQueue->push( CmdGenericPtr( pCmd ) );
712 void VlcProc::reset_input()
714 SET_BOOL( m_cVarSeekable, false );
715 SET_BOOL( m_cVarRecordable, false );
716 SET_BOOL( m_cVarRecording, false );
717 SET_BOOL( m_cVarDvdActive, false );
718 SET_BOOL( m_cVarFullscreen, false );
719 SET_BOOL( m_cVarHasAudio, false );
720 SET_BOOL( m_cVarHasVout, false );
721 SET_BOOL( m_cVarStopped, true );
722 SET_BOOL( m_cVarPlaying, false );
723 SET_BOOL( m_cVarPaused, false );
725 SET_STREAMTIME( m_cVarTime, 0, false );
726 SET_TEXT( m_cVarStreamName, UString( getIntf(), "") );
727 SET_TEXT( m_cVarStreamURI, UString( getIntf(), "") );
728 SET_TEXT( m_cVarStreamBitRate, UString( getIntf(), "") );
729 SET_TEXT( m_cVarStreamSampleRate, UString( getIntf(), "") );
731 getPlaytreeVar().onUpdateCurrent( false );
734 void VlcProc::init_variables()
736 playlist_t* pPlaylist = getIntf()->p_sys->p_playlist;
738 SET_BOOL( m_cVarRandom, var_GetBool( pPlaylist, "random" ) );
739 SET_BOOL( m_cVarLoop, var_GetBool( pPlaylist, "loop" ) );
740 SET_BOOL( m_cVarRepeat, var_GetBool( pPlaylist, "repeat" ) );
742 audio_volume_t volume;
743 aout_VolumeGet( pPlaylist, &volume );
744 SET_VOLUME( m_cVarVolume, (double)volume / AOUT_VOLUME_MAX, false );
745 SET_BOOL( m_cVarMute, volume == 0 );
750 void VlcProc::update_equalizer()
755 pFilters = var_GetNonEmptyString( m_pAout, "audio-filter" );
757 pFilters = config_GetPsz( getIntf(), "audio-filter" );
759 bool b_equalizer = pFilters && strstr( pFilters, "equalizer" );
762 SET_BOOL( m_cVarEqualizer, b_equalizer );
765 void VlcProc::setFullscreenVar( bool b_fullscreen )
767 SET_BOOL( m_cVarFullscreen, b_fullscreen );
771 #undef SET_STREAMTIME