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 // Get the status of the playlist
304 VarBoolImpl *pVarPlaying = (VarBoolImpl*)m_cVarPlaying.get();
305 VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
306 VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
307 playlist_status_t status =
308 getIntf()->p_sys->p_playlist->status.i_status;
310 pVarPlaying->set( status == PLAYLIST_RUNNING );
311 pVarStopped->set( status == PLAYLIST_STOPPED );
312 pVarPaused->set( status == PLAYLIST_PAUSED );
314 // Refresh the random variable
315 VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
317 var_Get( getIntf()->p_sys->p_playlist, "random", &val );
318 pVarRandom->set( val.b_bool != 0 );
320 // Refresh the loop variable
321 VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
322 var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
323 pVarLoop->set( val.b_bool != 0 );
325 // Refresh the repeat variable
326 VarBoolImpl *pVarRepeat = (VarBoolImpl*)m_cVarRepeat.get();
327 var_Get( getIntf()->p_sys->p_playlist, "repeat", &val );
328 pVarRepeat->set( val.b_bool != 0 );
331 void VlcProc::refreshInput()
333 StreamTime *pTime = (StreamTime*)m_cVarTime.get();
334 VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
335 VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
336 VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
337 VarBoolImpl *pVarHasAudio = (VarBoolImpl*)m_cVarHasAudio.get();
338 VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
339 VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get();
340 VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
343 if( getIntf()->p_sys->p_input == NULL )
345 getIntf()->p_sys->p_input = getIntf()->p_sys->p_playlist->p_input;
346 if( getIntf()->p_sys->p_input )
347 vlc_object_yield( getIntf()->p_sys->p_input );
349 else if( getIntf()->p_sys->p_input->b_dead )
351 vlc_object_release( getIntf()->p_sys->p_input );
352 getIntf()->p_sys->p_input = NULL;
355 input_thread_t *pInput = getIntf()->p_sys->p_input;
357 if( pInput && !pInput->b_die )
359 // Refresh time variables
361 var_Get( pInput, "position", &pos );
362 pTime->set( pos.f_float, false );
363 pVarSeekable->set( pos.f_float != 0.0 );
365 // Refresh DVD detection
366 vlc_value_t chapters_count;
367 var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
368 &chapters_count, NULL );
369 pVarDvdActive->set( chapters_count.i_int > 0 );
371 // Get the input bitrate
372 int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
373 pBitrate->set( UString::fromInt( getIntf(), bitrate ) );
375 // Get the audio sample rate
376 int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
377 pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );
380 vlc_value_t audio_es;
381 var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
383 pVarHasAudio->set( audio_es.i_int > 0 );
385 // Refresh fullscreen status
386 vout_thread_t *pVout = (vout_thread_t *)vlc_object_find( pInput,
387 VLC_OBJECT_VOUT, FIND_CHILD );
388 pVarHasVout->set( pVout != NULL );
391 pVarFullscreen->set( pVout->b_fullscreen );
392 vlc_object_release( pVout );
397 pVarSeekable->set( false );
398 pVarDvdActive->set( false );
399 pTime->set( 0, false );
400 pVarFullscreen->set( false );
401 pVarHasAudio->set( false );
402 pVarHasVout->set( false );
406 int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
407 vlc_value_t oldVal, vlc_value_t newVal,
410 VlcProc *pThis = (VlcProc*)pParam;
412 // Update the stream variable
413 playlist_t *p_playlist = (playlist_t*)pObj;
414 pThis->updateStreamName(p_playlist);
416 // Create a playlist notify command (for old style playlist)
417 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
418 // Create a playtree notify command (for new style playtree)
419 CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
421 // Push the command in the asynchronous command queue
422 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
423 pQueue->push( CmdGenericPtr( pCmd ) );
424 pQueue->push( CmdGenericPtr( pCmdTree ) );
430 int VlcProc::onIntfShow( vlc_object_t *pObj, const char *pVariable,
431 vlc_value_t oldVal, vlc_value_t newVal,
436 VlcProc *pThis = (VlcProc*)pParam;
438 // Create a raise all command
439 CmdRaiseAll *pCmd = new CmdRaiseAll( pThis->getIntf(),
440 pThis->getIntf()->p_sys->p_theme->getWindowManager() );
442 // Push the command in the asynchronous command queue
443 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
444 pQueue->push( CmdGenericPtr( pCmd ) );
451 int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
452 vlc_value_t oldVal, vlc_value_t newVal,
455 VlcProc *pThis = (VlcProc*)pParam;
457 // Update the stream variable
458 playlist_t *p_playlist = (playlist_t*)pObj;
459 pThis->updateStreamName(p_playlist);
461 // Create a playlist notify command
462 // TODO: selective update
463 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
464 // Create a playtree notify command
465 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
468 // Push the command in the asynchronous command queue
469 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
470 pQueue->push( CmdGenericPtr( pCmd ) );
471 pQueue->push( CmdGenericPtr( pCmdTree ), true );
476 int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
477 vlc_value_t oldVal, vlc_value_t newVal,
480 VlcProc *pThis = (VlcProc*)pParam;
482 playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(
485 memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
487 CmdGenericPtr ptrTree;
488 CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),
490 ptrTree = CmdGenericPtr( pCmdTree );
492 // Create a playlist notify command (for old style playlist)
493 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
495 // Push the command in the asynchronous command queue
496 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
497 pQueue->push( CmdGenericPtr( pCmd ) );
498 pQueue->push( ptrTree , false );
503 int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
504 vlc_value_t oldVal, vlc_value_t newVal,
507 VlcProc *pThis = (VlcProc*)pParam;
509 int i_id = newVal.i_int;
511 CmdGenericPtr ptrTree;
512 CmdPlaytreeDelete *pCmdTree = new CmdPlaytreeDelete( pThis->getIntf(),
514 ptrTree = CmdGenericPtr( pCmdTree );
516 // Create a playlist notify command (for old style playlist)
517 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
519 // Push the command in the asynchronous command queue
520 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
521 pQueue->push( CmdGenericPtr( pCmd ) );
522 pQueue->push( ptrTree , false );
530 int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
531 vlc_value_t oldVal, vlc_value_t newVal,
534 VlcProc *pThis = (VlcProc*)pParam;
536 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
538 // Update the stream variable
539 playlist_t *p_playlist = (playlist_t*)pObj;
540 pThis->updateStreamName(p_playlist);
542 // Create a playlist notify command (old style playlist)
543 // TODO: selective update
544 CmdNotifyPlaylist *pCmd = new CmdNotifyPlaylist( pThis->getIntf() );
545 pQueue->push( CmdGenericPtr( pCmd ) );
546 // Create two playtree notify commands: one for old item, one for new
547 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
549 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
550 pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );
551 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
557 int VlcProc::onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
558 vlc_value_t oldVal, vlc_value_t newVal,
561 VlcProc *pThis = (VlcProc*)pParam;
563 // Create a playlist notify command
564 CmdChangeSkin *pCmd =
565 new CmdChangeSkin( pThis->getIntf(), newVal.psz_string );
567 // Push the command in the asynchronous command queue
568 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
569 pQueue->push( CmdGenericPtr( pCmd ) );
574 int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
575 vlc_value_t oldVal, vlc_value_t newVal,
578 VlcProc *pThis = (VlcProc*)pParam;
579 interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);
581 CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );
582 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
583 pQueue->push( CmdGenericPtr( pCmd ) );
588 void VlcProc::updateStreamName( playlist_t *p_playlist )
590 if( p_playlist && p_playlist->p_input )
592 // Get playlist item information
593 input_item_t *pItem = p_playlist->p_input->input.p_item;
595 VarText &rStreamName = getStreamNameVar();
596 VarText &rStreamURI = getStreamURIVar();
597 // XXX: we should not need to access p_input->psz_source directly, a
598 // getter should be provided by VLC core
599 string name = pItem->psz_name;
600 // XXX: This should be done in VLC core, not here...
601 // Remove path information if any
602 OSFactory *pFactory = OSFactory::instance( getIntf() );
603 string::size_type pos = name.rfind( pFactory->getDirSeparator() );
604 if( pos != string::npos )
606 name = name.substr( pos + 1, name.size() - pos + 1 );
608 UString srcName( getIntf(), name.c_str() );
609 UString srcURI( getIntf(), pItem->psz_uri );
611 // Create commands to update the stream variables
612 CmdSetText *pCmd1 = new CmdSetText( getIntf(), rStreamName, srcName );
613 CmdSetText *pCmd2 = new CmdSetText( getIntf(), rStreamURI, srcURI );
614 // Push the commands in the asynchronous command queue
615 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
616 pQueue->push( CmdGenericPtr( pCmd1 ), false );
617 pQueue->push( CmdGenericPtr( pCmd2 ), false );
622 void *VlcProc::getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
623 int *pXHint, int *pYHint,
624 unsigned int *pWidthHint,
625 unsigned int *pHeightHint )
627 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
628 if( pThis->m_handleSet.empty() )
634 pThis->m_pVout = pVout;
635 // Get the window handle
636 void *pWindow = *pThis->m_handleSet.begin();
637 // Post a resize vout command
638 CmdResizeVout *pCmd = new CmdResizeVout( pThis->getIntf(), pWindow,
639 *pWidthHint, *pHeightHint );
640 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
641 pQueue->push( CmdGenericPtr( pCmd ) );
647 void VlcProc::releaseWindow( intf_thread_t *pIntf, void *pWindow )
649 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
650 pThis->m_pVout = NULL;
654 int VlcProc::controlWindow( intf_thread_t *pIntf, void *pWindow,
655 int query, va_list args )
657 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
665 unsigned int i_width = va_arg( args, unsigned int );
666 unsigned int i_height = va_arg( args, unsigned int );
667 if( !i_width ) i_width = pThis->m_pVout->i_window_width;
668 if( !i_height ) i_height = pThis->m_pVout->i_window_height;
670 // Post a resize vout command
671 CmdResizeVout *pCmd =
672 new CmdResizeVout( pThis->getIntf(), pWindow,
674 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
675 pQueue->push( CmdGenericPtr( pCmd ) );
680 msg_Dbg( pIntf, "control query not supported" );
688 int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
689 vlc_value_t oldVal, vlc_value_t newVal,
692 VlcProc *pThis = (VlcProc*)pParam;
694 // Post a set equalizer bands command
695 CmdSetEqBands *pCmd = new CmdSetEqBands( pThis->getIntf(),
698 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
699 pQueue->push( CmdGenericPtr( pCmd ) );
705 int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
706 vlc_value_t oldVal, vlc_value_t newVal,
709 VlcProc *pThis = (VlcProc*)pParam;
710 EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());
712 // Post a set preamp command
713 CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,
714 (newVal.f_float + 20.0) / 40.0 );
715 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
716 pQueue->push( CmdGenericPtr( pCmd ) );