1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2003 the VideoLAN team
7 * Authors: Cyril Deguet <asmax@via.ecp.fr>
8 * Olivier Teuli�e <ipkiss@via.ecp.fr>
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
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
27 #include <aout_internal.h>
29 #include "vlcproc.hpp"
30 #include "os_factory.hpp"
31 #include "os_timer.hpp"
32 #include "var_manager.hpp"
34 #include "window_manager.hpp"
35 #include "../commands/async_queue.hpp"
36 #include "../commands/cmd_change_skin.hpp"
37 #include "../commands/cmd_show_window.hpp"
38 #include "../commands/cmd_quit.hpp"
39 #include "../commands/cmd_resize.hpp"
40 #include "../commands/cmd_vars.hpp"
41 #include "../commands/cmd_dialogs.hpp"
42 #include "../utils/var_bool.hpp"
46 VlcProc *VlcProc::instance( intf_thread_t *pIntf )
48 if( pIntf->p_sys->p_vlcProc == NULL )
50 pIntf->p_sys->p_vlcProc = new VlcProc( pIntf );
53 return pIntf->p_sys->p_vlcProc;
57 void VlcProc::destroy( intf_thread_t *pIntf )
59 if( pIntf->p_sys->p_vlcProc )
61 delete pIntf->p_sys->p_vlcProc;
62 pIntf->p_sys->p_vlcProc = NULL;
67 VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
68 m_varVoutSize( pIntf ), m_varEqBands( pIntf ),
69 m_pVout( NULL ), m_pAout( NULL ), m_cmdManage( this )
71 // Create a timer to poll the status of the vlc
72 OSFactory *pOsFactory = OSFactory::instance( pIntf );
73 m_pTimer = pOsFactory->createOSTimer( m_cmdManage );
74 m_pTimer->start( 100, false );
76 // Create and register VLC variables
77 VarManager *pVarManager = VarManager::instance( getIntf() );
79 #define REGISTER_VAR( var, type, name ) \
80 var = VariablePtr( new type( getIntf() ) ); \
81 pVarManager->registerVar( var, name );
83 /* Playlist variables */
84 REGISTER_VAR( m_cPlaylist, Playlist, "playlist" )
85 pVarManager->registerVar( getPlaylistVar().getPositionVarPtr(),
87 REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
88 REGISTER_VAR( m_cVarLoop, VarBoolImpl, "playlist.isLoop" )
89 REGISTER_VAR( m_cVarRepeat, VarBoolImpl, "playlist.isRepeat" )
90 REGISTER_VAR( m_cPlaytree, Playtree, "playtree" )
91 pVarManager->registerVar( getPlaytreeVar().getPositionVarPtr(),
93 pVarManager->registerVar( m_cVarRandom, "playtree.isRandom" );
94 pVarManager->registerVar( m_cVarLoop, "playtree.isLoop" );
96 REGISTER_VAR( m_cVarPlaying, VarBoolImpl, "vlc.isPlaying" )
97 REGISTER_VAR( m_cVarStopped, VarBoolImpl, "vlc.isStopped" )
98 REGISTER_VAR( m_cVarPaused, VarBoolImpl, "vlc.isPaused" )
100 /* Input variables */
101 pVarManager->registerVar( m_cVarRepeat, "playtree.isRepeat" );
102 REGISTER_VAR( m_cVarTime, StreamTime, "time" )
103 REGISTER_VAR( m_cVarSeekable, VarBoolImpl, "vlc.isSeekable" )
104 REGISTER_VAR( m_cVarDvdActive, VarBoolImpl, "dvd.isActive" )
107 REGISTER_VAR( m_cVarFullscreen, VarBoolImpl, "vlc.isFullscreen" )
108 REGISTER_VAR( m_cVarHasVout, VarBoolImpl, "vlc.hasVout" )
111 REGISTER_VAR( m_cVarHasAudio, VarBoolImpl, "vlc.hasAudio" )
112 REGISTER_VAR( m_cVarVolume, Volume, "volume" )
113 REGISTER_VAR( m_cVarMute, VarBoolImpl, "vlc.isMute" )
114 REGISTER_VAR( m_cVarEqualizer, VarBoolImpl, "equalizer.isEnabled" )
115 REGISTER_VAR( m_cVarEqPreamp, EqualizerPreamp, "equalizer.preamp" )
118 m_cVarStreamName = VariablePtr( new VarText( getIntf(), false ) );
119 pVarManager->registerVar( m_cVarStreamName, "streamName" );
120 m_cVarStreamURI = VariablePtr( new VarText( getIntf(), false ) );
121 pVarManager->registerVar( m_cVarStreamURI, "streamURI" );
122 m_cVarStreamBitRate = VariablePtr( new VarText( getIntf(), false ) );
123 pVarManager->registerVar( m_cVarStreamBitRate, "bitrate" );
124 m_cVarStreamSampleRate = VariablePtr( new VarText( getIntf(), false ) );
125 pVarManager->registerVar( m_cVarStreamSampleRate, "samplerate" );
127 // Register the equalizer bands
128 for( int i = 0; i < EqualizerBands::kNbBands; i++)
131 ss << "equalizer.band(" << i << ")";
132 pVarManager->registerVar( m_varEqBands.getBand( i ), ss.str() );
136 // The object variable callbacks are called from other VLC threads,
137 // so they must put commands in the queue and NOT do anything else
138 // (X11 calls are not reentrant)
140 // Called when the playlist changes
141 var_AddCallback( pIntf->p_sys->p_playlist, "intf-change",
142 onIntfChange, this );
143 // Called when a playlist item is added
144 var_AddCallback( pIntf->p_sys->p_playlist, "item-append",
145 onItemAppend, this );
146 // Called when a playlist item is deleted
147 // TODO: properly handle item-deleted
148 var_AddCallback( pIntf->p_sys->p_playlist, "item-deleted",
149 onItemDelete, this );
150 // Called when the "interface shower" wants us to show the skin
151 var_AddCallback( pIntf->p_sys->p_playlist, "intf-show",
153 // Called when the current played item changes
154 var_AddCallback( pIntf->p_sys->p_playlist, "playlist-current",
155 onPlaylistChange, this );
156 // Called when a playlist item changed
157 var_AddCallback( pIntf->p_sys->p_playlist, "item-change",
158 onItemChange, this );
159 // Called when our skins2 demux wants us to load a new skin
160 var_AddCallback( pIntf, "skin-to-load", onSkinToLoad, this );
162 // Called when we have an interaction dialog to display
163 var_Create( pIntf, "interaction", VLC_VAR_ADDRESS );
164 var_AddCallback( pIntf, "interaction", onInteraction, this );
165 pIntf->b_interaction = VLC_TRUE;
167 // Callbacks for vout requests
168 getIntf()->pf_request_window = &getWindow;
169 getIntf()->pf_release_window = &releaseWindow;
170 getIntf()->pf_control_window = &controlWindow;
172 getIntf()->p_sys->p_input = NULL;
180 if( getIntf()->p_sys->p_input )
182 vlc_object_release( getIntf()->p_sys->p_input );
185 // Callbacks for vout requests
186 getIntf()->pf_request_window = NULL;
187 getIntf()->pf_release_window = NULL;
188 getIntf()->pf_control_window = NULL;
190 var_DelCallback( getIntf()->p_sys->p_playlist, "intf-change",
191 onIntfChange, this );
192 var_DelCallback( getIntf()->p_sys->p_playlist, "item-append",
193 onItemAppend, this );
194 var_DelCallback( getIntf()->p_sys->p_playlist, "item-deleted",
195 onItemDelete, this );
196 var_DelCallback( getIntf()->p_sys->p_playlist, "intf-show",
198 var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-current",
199 onPlaylistChange, this );
200 var_DelCallback( getIntf()->p_sys->p_playlist, "item-change",
201 onItemChange, this );
202 var_DelCallback( getIntf(), "skin-to-load", onSkinToLoad, this );
206 void VlcProc::registerVoutWindow( void *pVoutWindow )
208 m_handleSet.insert( pVoutWindow );
209 // Reparent the vout window
212 if( vout_Control( m_pVout, VOUT_REPARENT ) != VLC_SUCCESS )
213 vout_Control( m_pVout, VOUT_CLOSE );
218 void VlcProc::unregisterVoutWindow( void *pVoutWindow )
220 m_handleSet.erase( pVoutWindow );
224 void VlcProc::dropVout()
228 if( vout_Control( m_pVout, VOUT_REPARENT ) != VLC_SUCCESS )
229 vout_Control( m_pVout, VOUT_CLOSE );
235 void VlcProc::manage()
237 // Did the user request to quit vlc ?
238 if( getIntf()->b_die || getIntf()->p_vlc->b_die )
240 CmdQuit *pCmd = new CmdQuit( getIntf() );
241 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
242 pQueue->push( CmdGenericPtr( pCmd ) );
249 void VlcProc::CmdManage::execute()
251 // Just forward to VlcProc
255 void VlcProc::refreshAudio()
257 char *pFilters = NULL;
259 // Check if the audio output has changed
260 aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
261 VLC_OBJECT_AOUT, FIND_ANYWHERE );
264 if( pAout != m_pAout )
266 // Register the equalizer callbacks
267 if( !var_AddCallback( pAout, "equalizer-bands",
268 onEqBandsChange, this ) &&
269 !var_AddCallback( pAout, "equalizer-preamp",
270 onEqPreampChange, this ) )
273 //char * psz_bands = var_GetString( p_aout, "equalizer-bands" );
276 // Get the audio filters
277 pFilters = var_GetString( pAout, "audio-filter" );
278 vlc_object_release( pAout );
282 // Get the audio filters
283 pFilters = config_GetPsz( getIntf(), "audio-filter" );
286 // Refresh sound volume
287 audio_volume_t volume;
288 aout_VolumeGet( getIntf(), &volume );
289 Volume *pVolume = (Volume*)m_cVarVolume.get();
290 pVolume->set( (double)volume * 2.0 / AOUT_VOLUME_MAX );
292 // Set the mute variable
293 VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
294 pVarMute->set( volume == 0 );
296 // Refresh the equalizer variable
297 VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
298 pVarEqualizer->set( pFilters && strstr( pFilters, "equalizer" ) );
301 void VlcProc::refreshPlaylist()
303 // Refresh the random variable
304 VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
306 var_Get( getIntf()->p_sys->p_playlist, "random", &val );
307 pVarRandom->set( val.b_bool != 0 );
309 // Refresh the loop variable
310 VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
311 var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
312 pVarLoop->set( val.b_bool != 0 );
314 // Refresh the repeat variable
315 VarBoolImpl *pVarRepeat = (VarBoolImpl*)m_cVarRepeat.get();
316 var_Get( getIntf()->p_sys->p_playlist, "repeat", &val );
317 pVarRepeat->set( val.b_bool != 0 );
320 void VlcProc::refreshInput()
322 StreamTime *pTime = (StreamTime*)m_cVarTime.get();
323 VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
324 VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
325 VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
326 VarBoolImpl *pVarHasAudio = (VarBoolImpl*)m_cVarHasAudio.get();
327 VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
328 VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get();
329 VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
330 VarBoolImpl *pVarPlaying = (VarBoolImpl*)m_cVarPlaying.get();
331 VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
332 VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
334 input_thread_t *pInput = getIntf()->p_sys->p_input;
337 if( getIntf()->p_sys->p_input == NULL )
339 getIntf()->p_sys->p_input = getIntf()->p_sys->p_playlist->p_input;
340 if( getIntf()->p_sys->p_input )
341 vlc_object_yield( getIntf()->p_sys->p_input );
343 else if( getIntf()->p_sys->p_input->b_dead )
345 vlc_object_release( getIntf()->p_sys->p_input );
346 getIntf()->p_sys->p_input = NULL;
350 if( pInput && !pInput->b_die )
352 // Refresh time variables
354 var_Get( pInput, "position", &pos );
355 pTime->set( pos.f_float, false );
356 pVarSeekable->set( pos.f_float != 0.0 );
358 // Refresh DVD detection
359 vlc_value_t chapters_count;
360 var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
361 &chapters_count, NULL );
362 pVarDvdActive->set( chapters_count.i_int > 0 );
364 // Get the input bitrate
365 int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
366 pBitrate->set( UString::fromInt( getIntf(), bitrate ) );
368 // Get the audio sample rate
369 int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
370 pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );
373 vlc_value_t audio_es;
374 var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
376 pVarHasAudio->set( audio_es.i_int > 0 );
378 // Refresh fullscreen status
379 vout_thread_t *pVout = (vout_thread_t *)vlc_object_find( pInput,
380 VLC_OBJECT_VOUT, FIND_CHILD );
381 pVarHasVout->set( pVout != NULL );
384 pVarFullscreen->set( pVout->b_fullscreen );
385 vlc_object_release( pVout );
388 // Refresh play/pause status
389 int state = var_GetInteger( pInput, "state" );
390 pVarStopped->set( false );
391 pVarPlaying->set( state != PAUSE_S );
392 pVarPaused->set( state == PAUSE_S );
396 pVarSeekable->set( false );
397 pVarDvdActive->set( false );
398 pTime->set( 0, false );
399 pVarFullscreen->set( false );
400 pVarHasAudio->set( false );
401 pVarHasVout->set( false );
402 pVarStopped->set( true );
403 pVarPlaying->set( false );
404 pVarPaused->set( false );
408 int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
409 vlc_value_t oldVal, vlc_value_t newVal,
412 VlcProc *pThis = (VlcProc*)pParam;
414 // Update the stream variable
415 playlist_t *p_playlist = (playlist_t*)pObj;
416 pThis->updateStreamName(p_playlist);
418 // Create a playlist notify command (for old style playlist)
419 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
420 // Create a playtree notify command (for new style playtree)
421 CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
423 // Push the command in the asynchronous command queue
424 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
425 pQueue->push( CmdGenericPtr( pCmd ) );
426 pQueue->push( CmdGenericPtr( pCmdTree ) );
432 int VlcProc::onIntfShow( vlc_object_t *pObj, const char *pVariable,
433 vlc_value_t oldVal, vlc_value_t newVal,
438 VlcProc *pThis = (VlcProc*)pParam;
440 // Create a raise all command
441 CmdRaiseAll *pCmd = new CmdRaiseAll( pThis->getIntf(),
442 pThis->getIntf()->p_sys->p_theme->getWindowManager() );
444 // Push the command in the asynchronous command queue
445 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
446 pQueue->push( CmdGenericPtr( pCmd ) );
453 int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
454 vlc_value_t oldVal, vlc_value_t newVal,
457 VlcProc *pThis = (VlcProc*)pParam;
459 // Update the stream variable
460 playlist_t *p_playlist = (playlist_t*)pObj;
461 pThis->updateStreamName(p_playlist);
463 // Create a playlist notify command
464 // TODO: selective update
465 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
466 // Create a playtree notify command
467 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
470 // Push the command in the asynchronous command queue
471 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
472 pQueue->push( CmdGenericPtr( pCmd ) );
473 pQueue->push( CmdGenericPtr( pCmdTree ), true );
478 int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
479 vlc_value_t oldVal, vlc_value_t newVal,
482 VlcProc *pThis = (VlcProc*)pParam;
484 playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(
487 memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
489 CmdGenericPtr ptrTree;
490 CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),
492 ptrTree = CmdGenericPtr( pCmdTree );
494 // Create a playlist notify command (for old style playlist)
495 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
497 // Push the command in the asynchronous command queue
498 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
499 pQueue->push( CmdGenericPtr( pCmd ) );
500 pQueue->push( ptrTree , false );
505 int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
506 vlc_value_t oldVal, vlc_value_t newVal,
509 VlcProc *pThis = (VlcProc*)pParam;
511 int i_id = newVal.i_int;
513 CmdGenericPtr ptrTree;
514 CmdPlaytreeDelete *pCmdTree = new CmdPlaytreeDelete( pThis->getIntf(),
516 ptrTree = CmdGenericPtr( pCmdTree );
518 // Create a playlist notify command (for old style playlist)
519 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
521 // Push the command in the asynchronous command queue
522 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
523 pQueue->push( CmdGenericPtr( pCmd ) );
524 pQueue->push( ptrTree , false );
532 int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
533 vlc_value_t oldVal, vlc_value_t newVal,
536 VlcProc *pThis = (VlcProc*)pParam;
538 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
540 // Update the stream variable
541 playlist_t *p_playlist = (playlist_t*)pObj;
542 pThis->updateStreamName(p_playlist);
544 // Create a playlist notify command (old style playlist)
545 // TODO: selective update
546 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
547 pQueue->push( CmdGenericPtr( pCmd ) );
548 // Create two playtree notify commands: one for old item, one for new
549 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
551 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
552 pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );
553 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
559 int VlcProc::onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
560 vlc_value_t oldVal, vlc_value_t newVal,
563 VlcProc *pThis = (VlcProc*)pParam;
565 // Create a playlist notify command
566 CmdChangeSkin *pCmd =
567 new CmdChangeSkin( pThis->getIntf(), newVal.psz_string );
569 // Push the command in the asynchronous command queue
570 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
571 pQueue->push( CmdGenericPtr( pCmd ) );
576 int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
577 vlc_value_t oldVal, vlc_value_t newVal,
580 VlcProc *pThis = (VlcProc*)pParam;
581 interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);
583 CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );
584 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
585 pQueue->push( CmdGenericPtr( pCmd ) );
590 void VlcProc::updateStreamName( playlist_t *p_playlist )
592 if( p_playlist && p_playlist->p_input )
594 // Get playlist item information
595 input_item_t *pItem = p_playlist->p_input->input.p_item;
597 VarText &rStreamName = getStreamNameVar();
598 VarText &rStreamURI = getStreamURIVar();
599 // XXX: we should not need to access p_input->psz_source directly, a
600 // getter should be provided by VLC core
601 string name = pItem->psz_name;
602 // XXX: This should be done in VLC core, not here...
603 // Remove path information if any
604 OSFactory *pFactory = OSFactory::instance( getIntf() );
605 string::size_type pos = name.rfind( pFactory->getDirSeparator() );
606 if( pos != string::npos )
608 name = name.substr( pos + 1, name.size() - pos + 1 );
610 UString srcName( getIntf(), name.c_str() );
611 UString srcURI( getIntf(), pItem->psz_uri );
613 // Create commands to update the stream variables
614 CmdSetText *pCmd1 = new CmdSetText( getIntf(), rStreamName, srcName );
615 CmdSetText *pCmd2 = new CmdSetText( getIntf(), rStreamURI, srcURI );
616 // Push the commands in the asynchronous command queue
617 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
618 pQueue->push( CmdGenericPtr( pCmd1 ), false );
619 pQueue->push( CmdGenericPtr( pCmd2 ), false );
624 void *VlcProc::getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
625 int *pXHint, int *pYHint,
626 unsigned int *pWidthHint,
627 unsigned int *pHeightHint )
629 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
630 if( pThis->m_handleSet.empty() )
636 pThis->m_pVout = pVout;
637 // Get the window handle
638 void *pWindow = *pThis->m_handleSet.begin();
639 // Post a resize vout command
640 CmdResizeVout *pCmd = new CmdResizeVout( pThis->getIntf(), pWindow,
641 *pWidthHint, *pHeightHint );
642 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
643 pQueue->push( CmdGenericPtr( pCmd ) );
649 void VlcProc::releaseWindow( intf_thread_t *pIntf, void *pWindow )
651 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
652 pThis->m_pVout = NULL;
656 int VlcProc::controlWindow( intf_thread_t *pIntf, void *pWindow,
657 int query, va_list args )
659 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
667 unsigned int i_width = va_arg( args, unsigned int );
668 unsigned int i_height = va_arg( args, unsigned int );
669 if( !i_width ) i_width = pThis->m_pVout->i_window_width;
670 if( !i_height ) i_height = pThis->m_pVout->i_window_height;
672 // Post a resize vout command
673 CmdResizeVout *pCmd =
674 new CmdResizeVout( pThis->getIntf(), pWindow,
676 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
677 pQueue->push( CmdGenericPtr( pCmd ) );
682 msg_Dbg( pIntf, "control query not supported" );
690 int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
691 vlc_value_t oldVal, vlc_value_t newVal,
694 VlcProc *pThis = (VlcProc*)pParam;
696 // Post a set equalizer bands command
697 CmdSetEqBands *pCmd = new CmdSetEqBands( pThis->getIntf(),
700 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
701 pQueue->push( CmdGenericPtr( pCmd ) );
707 int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
708 vlc_value_t oldVal, vlc_value_t newVal,
711 VlcProc *pThis = (VlcProc*)pParam;
712 EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());
714 // Post a set preamp command
715 CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,
716 (newVal.f_float + 20.0) / 40.0 );
717 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
718 pQueue->push( CmdGenericPtr( pCmd ) );