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 *****************************************************************************/
29 #include <vlc_common.h>
32 #include <vlc_playlist.h>
34 #include "vlcproc.hpp"
35 #include "os_factory.hpp"
36 #include "os_timer.hpp"
37 #include "var_manager.hpp"
39 #include "window_manager.hpp"
40 #include "../commands/async_queue.hpp"
41 #include "../commands/cmd_change_skin.hpp"
42 #include "../commands/cmd_show_window.hpp"
43 #include "../commands/cmd_quit.hpp"
44 #include "../commands/cmd_resize.hpp"
45 #include "../commands/cmd_vars.hpp"
46 #include "../commands/cmd_dialogs.hpp"
47 #include "../utils/var_bool.hpp"
51 VlcProc *VlcProc::instance( intf_thread_t *pIntf )
53 if( pIntf->p_sys->p_vlcProc == NULL )
55 pIntf->p_sys->p_vlcProc = new VlcProc( pIntf );
58 return pIntf->p_sys->p_vlcProc;
62 void VlcProc::destroy( intf_thread_t *pIntf )
64 if( pIntf->p_sys->p_vlcProc )
66 delete pIntf->p_sys->p_vlcProc;
67 pIntf->p_sys->p_vlcProc = NULL;
72 VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
73 m_varVoutSize( pIntf ), m_varEqBands( pIntf ),
74 m_pVout( NULL ), m_pAout( NULL ), m_cmdManage( this )
76 // Create a timer to poll the status of the vlc
77 OSFactory *pOsFactory = OSFactory::instance( pIntf );
78 m_pTimer = pOsFactory->createOSTimer( m_cmdManage );
79 m_pTimer->start( 100, false );
81 // Create and register VLC variables
82 VarManager *pVarManager = VarManager::instance( getIntf() );
84 #define REGISTER_VAR( var, type, name ) \
85 var = VariablePtr( new type( getIntf() ) ); \
86 pVarManager->registerVar( var, name );
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_libvlc, "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 = 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_libvlc, "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, 0 ) != 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, 0 ) != VLC_SUCCESS )
229 vout_Control( m_pVout, VOUT_CLOSE );
235 void VlcProc::manage()
237 // Did the user request to quit vlc ?
238 if( intf_ShouldDie( getIntf() ) )
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()
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_GetNonEmptyString( 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" ) );
302 void VlcProc::refreshPlaylist()
304 // Refresh the random variable
305 VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
307 var_Get( getIntf()->p_sys->p_playlist, "random", &val );
308 pVarRandom->set( val.b_bool != 0 );
310 // Refresh the loop variable
311 VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
312 var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
313 pVarLoop->set( val.b_bool != 0 );
315 // Refresh the repeat variable
316 VarBoolImpl *pVarRepeat = (VarBoolImpl*)m_cVarRepeat.get();
317 var_Get( getIntf()->p_sys->p_playlist, "repeat", &val );
318 pVarRepeat->set( val.b_bool != 0 );
321 void VlcProc::refreshInput()
323 StreamTime *pTime = (StreamTime*)m_cVarTime.get();
324 VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
325 VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
326 VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
327 VarBoolImpl *pVarHasAudio = (VarBoolImpl*)m_cVarHasAudio.get();
328 VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
329 VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get();
330 VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
331 VarBoolImpl *pVarPlaying = (VarBoolImpl*)m_cVarPlaying.get();
332 VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
333 VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
335 input_thread_t *pInput = getIntf()->p_sys->p_input;
338 if( getIntf()->p_sys->p_input == NULL )
340 getIntf()->p_sys->p_input = getIntf()->p_sys->p_playlist->p_input;
341 if( getIntf()->p_sys->p_input )
342 vlc_object_yield( getIntf()->p_sys->p_input );
344 else if( getIntf()->p_sys->p_input->b_dead )
346 vlc_object_release( getIntf()->p_sys->p_input );
347 getIntf()->p_sys->p_input = NULL;
351 if( pInput && !pInput->b_die )
353 // Refresh time variables
355 var_Get( pInput, "position", &pos );
356 pTime->set( pos.f_float, false );
357 pVarSeekable->set( pos.f_float != 0.0 );
359 // Refresh DVD detection
360 vlc_value_t chapters_count;
361 var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
362 &chapters_count, NULL );
363 pVarDvdActive->set( chapters_count.i_int > 0 );
365 // Get the input bitrate
366 int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
367 pBitrate->set( UString::fromInt( getIntf(), bitrate ) );
369 // Get the audio sample rate
370 int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
371 pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );
374 vlc_value_t audio_es;
375 var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
377 pVarHasAudio->set( audio_es.i_int > 0 );
379 // Refresh fullscreen status
380 vout_thread_t *pVout = (vout_thread_t *)vlc_object_find( pInput,
381 VLC_OBJECT_VOUT, FIND_CHILD );
382 pVarHasVout->set( pVout != NULL );
385 pVarFullscreen->set( pVout->b_fullscreen );
386 vlc_object_release( pVout );
389 // Refresh play/pause status
390 int state = var_GetInteger( pInput, "state" );
391 pVarStopped->set( false );
392 pVarPlaying->set( state != PAUSE_S );
393 pVarPaused->set( state == PAUSE_S );
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 );
403 pVarStopped->set( true );
404 pVarPlaying->set( false );
405 pVarPaused->set( false );
409 int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
410 vlc_value_t oldVal, vlc_value_t newVal,
413 VlcProc *pThis = (VlcProc*)pParam;
415 // Update the stream variable
416 playlist_t *p_playlist = (playlist_t*)pObj;
417 pThis->updateStreamName(p_playlist);
419 // Create a playtree notify command (for new style playtree)
420 CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
422 // Push the command in the asynchronous command queue
423 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
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 playtree notify command
462 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
465 // Push the command in the asynchronous command queue
466 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
467 pQueue->push( CmdGenericPtr( pCmdTree ), true );
472 int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
473 vlc_value_t oldVal, vlc_value_t newVal,
476 VlcProc *pThis = (VlcProc*)pParam;
478 playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(
481 memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
483 CmdGenericPtr ptrTree;
484 CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),
486 ptrTree = CmdGenericPtr( pCmdTree );
488 // Push the command in the asynchronous command queue
489 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
490 pQueue->push( ptrTree , false );
495 int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
496 vlc_value_t oldVal, vlc_value_t newVal,
499 VlcProc *pThis = (VlcProc*)pParam;
501 int i_id = newVal.i_int;
503 CmdGenericPtr ptrTree;
504 CmdPlaytreeDelete *pCmdTree = new CmdPlaytreeDelete( pThis->getIntf(),
506 ptrTree = CmdGenericPtr( pCmdTree );
508 // Push the command in the asynchronous command queue
509 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
510 pQueue->push( ptrTree , false );
516 int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
517 vlc_value_t oldVal, vlc_value_t newVal,
520 VlcProc *pThis = (VlcProc*)pParam;
522 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
524 // Update the stream variable
525 playlist_t *p_playlist = (playlist_t*)pObj;
526 pThis->updateStreamName(p_playlist);
528 // Create two playtree notify commands: one for old item, one for new
529 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
531 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
532 pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );
533 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
539 int VlcProc::onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
540 vlc_value_t oldVal, vlc_value_t newVal,
543 VlcProc *pThis = (VlcProc*)pParam;
545 // Create a playlist notify command
546 CmdChangeSkin *pCmd =
547 new CmdChangeSkin( pThis->getIntf(), newVal.psz_string );
549 // Push the command in the asynchronous command queue
550 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
551 pQueue->push( CmdGenericPtr( pCmd ) );
556 int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
557 vlc_value_t oldVal, vlc_value_t newVal,
560 VlcProc *pThis = (VlcProc*)pParam;
561 interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);
563 CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );
564 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
565 pQueue->push( CmdGenericPtr( pCmd ) );
570 void VlcProc::updateStreamName( playlist_t *p_playlist )
572 if( p_playlist && p_playlist->p_input )
574 // Get playlist item information
575 input_item_t *pItem = input_GetItem(p_playlist->p_input);
577 VarText &rStreamName = getStreamNameVar();
578 VarText &rStreamURI = getStreamURIVar();
579 // XXX: we should not need to access p_input->psz_source directly, a
580 // getter should be provided by VLC core
581 string name = pItem->psz_name;
582 // XXX: This should be done in VLC core, not here...
583 // Remove path information if any
584 OSFactory *pFactory = OSFactory::instance( getIntf() );
585 string::size_type pos = name.rfind( pFactory->getDirSeparator() );
586 if( pos != string::npos )
588 name = name.substr( pos + 1, name.size() - pos + 1 );
590 UString srcName( getIntf(), name.c_str() );
591 UString srcURI( getIntf(), pItem->psz_uri );
593 // Create commands to update the stream variables
594 CmdSetText *pCmd1 = new CmdSetText( getIntf(), rStreamName, srcName );
595 CmdSetText *pCmd2 = new CmdSetText( getIntf(), rStreamURI, srcURI );
596 // Push the commands in the asynchronous command queue
597 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
598 pQueue->push( CmdGenericPtr( pCmd1 ), false );
599 pQueue->push( CmdGenericPtr( pCmd2 ), false );
604 void *VlcProc::getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
605 int *pXHint, int *pYHint,
606 unsigned int *pWidthHint,
607 unsigned int *pHeightHint )
609 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
610 if( pThis->m_handleSet.empty() )
616 pThis->m_pVout = pVout;
617 // Get the window handle
618 void *pWindow = *pThis->m_handleSet.begin();
619 // Post a resize vout command
620 CmdResizeVout *pCmd = new CmdResizeVout( pThis->getIntf(), pWindow,
621 *pWidthHint, *pHeightHint );
622 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
623 pQueue->push( CmdGenericPtr( pCmd ) );
629 void VlcProc::releaseWindow( intf_thread_t *pIntf, void *pWindow )
631 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
632 pThis->m_pVout = NULL;
636 int VlcProc::controlWindow( intf_thread_t *pIntf, void *pWindow,
637 int query, va_list args )
639 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
647 unsigned int i_width = va_arg( args, unsigned int );
648 unsigned int i_height = va_arg( args, unsigned int );
649 if( !i_width ) i_width = pThis->m_pVout->i_window_width;
650 if( !i_height ) i_height = pThis->m_pVout->i_window_height;
652 // Post a resize vout command
653 CmdResizeVout *pCmd =
654 new CmdResizeVout( pThis->getIntf(), pWindow,
656 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
657 pQueue->push( CmdGenericPtr( pCmd ) );
662 msg_Dbg( pIntf, "control query not supported" );
670 int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
671 vlc_value_t oldVal, vlc_value_t newVal,
674 VlcProc *pThis = (VlcProc*)pParam;
676 // Post a set equalizer bands command
677 CmdSetEqBands *pCmd = new CmdSetEqBands( pThis->getIntf(),
680 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
681 pQueue->push( CmdGenericPtr( pCmd ) );
687 int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
688 vlc_value_t oldVal, vlc_value_t newVal,
691 VlcProc *pThis = (VlcProc*)pParam;
692 EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());
694 // Post a set preamp command
695 CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,
696 (newVal.f_float + 20.0) / 40.0 );
697 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
698 pQueue->push( CmdGenericPtr( pCmd ) );