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 );
82 REGISTER_VAR( m_cVarRandom, VarBoolImpl, "playlist.isRandom" )
83 REGISTER_VAR( m_cVarLoop, VarBoolImpl, "playlist.isLoop" )
84 REGISTER_VAR( m_cVarRepeat, VarBoolImpl, "playlist.isRepeat" )
85 REGISTER_VAR( m_cPlaytree, Playtree, "playtree" )
86 pVarManager->registerVar( getPlaytreeVar().getPositionVarPtr(),
88 pVarManager->registerVar( m_cVarRandom, "playtree.isRandom" );
89 pVarManager->registerVar( m_cVarLoop, "playtree.isLoop" );
91 REGISTER_VAR( m_cVarPlaying, VarBoolImpl, "vlc.isPlaying" )
92 REGISTER_VAR( m_cVarStopped, VarBoolImpl, "vlc.isStopped" )
93 REGISTER_VAR( m_cVarPaused, VarBoolImpl, "vlc.isPaused" )
96 pVarManager->registerVar( m_cVarRepeat, "playtree.isRepeat" );
97 REGISTER_VAR( m_cVarTime, StreamTime, "time" )
98 REGISTER_VAR( m_cVarSeekable, VarBoolImpl, "vlc.isSeekable" )
99 REGISTER_VAR( m_cVarDvdActive, VarBoolImpl, "dvd.isActive" )
102 REGISTER_VAR( m_cVarFullscreen, VarBoolImpl, "vlc.isFullscreen" )
103 REGISTER_VAR( m_cVarHasVout, VarBoolImpl, "vlc.hasVout" )
106 REGISTER_VAR( m_cVarHasAudio, VarBoolImpl, "vlc.hasAudio" )
107 REGISTER_VAR( m_cVarVolume, Volume, "volume" )
108 REGISTER_VAR( m_cVarMute, VarBoolImpl, "vlc.isMute" )
109 REGISTER_VAR( m_cVarEqualizer, VarBoolImpl, "equalizer.isEnabled" )
110 REGISTER_VAR( m_cVarEqPreamp, EqualizerPreamp, "equalizer.preamp" )
113 m_cVarStreamName = VariablePtr( new VarText( getIntf(), false ) );
114 pVarManager->registerVar( m_cVarStreamName, "streamName" );
115 m_cVarStreamURI = VariablePtr( new VarText( getIntf(), false ) );
116 pVarManager->registerVar( m_cVarStreamURI, "streamURI" );
117 m_cVarStreamBitRate = VariablePtr( new VarText( getIntf(), false ) );
118 pVarManager->registerVar( m_cVarStreamBitRate, "bitrate" );
119 m_cVarStreamSampleRate = VariablePtr( new VarText( getIntf(), false ) );
120 pVarManager->registerVar( m_cVarStreamSampleRate, "samplerate" );
122 // Register the equalizer bands
123 for( int i = 0; i < EqualizerBands::kNbBands; i++)
126 ss << "equalizer.band(" << i << ")";
127 pVarManager->registerVar( m_varEqBands.getBand( i ), ss.str() );
131 // The object variable callbacks are called from other VLC threads,
132 // so they must put commands in the queue and NOT do anything else
133 // (X11 calls are not reentrant)
135 // Called when the playlist changes
136 var_AddCallback( pIntf->p_sys->p_playlist, "intf-change",
137 onIntfChange, this );
138 // Called when a playlist item is added
139 var_AddCallback( pIntf->p_sys->p_playlist, "item-append",
140 onItemAppend, this );
141 // Called when a playlist item is deleted
142 // TODO: properly handle item-deleted
143 var_AddCallback( pIntf->p_sys->p_playlist, "item-deleted",
144 onItemDelete, this );
145 // Called when the "interface shower" wants us to show the skin
146 var_AddCallback( pIntf->p_sys->p_playlist, "intf-show",
148 // Called when the current played item changes
149 var_AddCallback( pIntf->p_sys->p_playlist, "playlist-current",
150 onPlaylistChange, this );
151 // Called when a playlist item changed
152 var_AddCallback( pIntf->p_sys->p_playlist, "item-change",
153 onItemChange, this );
154 // Called when our skins2 demux wants us to load a new skin
155 var_AddCallback( pIntf, "skin-to-load", onSkinToLoad, this );
157 // Called when we have an interaction dialog to display
158 var_Create( pIntf, "interaction", VLC_VAR_ADDRESS );
159 var_AddCallback( pIntf, "interaction", onInteraction, this );
160 pIntf->b_interaction = VLC_TRUE;
162 // Callbacks for vout requests
163 getIntf()->pf_request_window = &getWindow;
164 getIntf()->pf_release_window = &releaseWindow;
165 getIntf()->pf_control_window = &controlWindow;
167 getIntf()->p_sys->p_input = NULL;
175 if( getIntf()->p_sys->p_input )
177 vlc_object_release( getIntf()->p_sys->p_input );
180 // Callbacks for vout requests
181 getIntf()->pf_request_window = NULL;
182 getIntf()->pf_release_window = NULL;
183 getIntf()->pf_control_window = NULL;
185 var_DelCallback( getIntf()->p_sys->p_playlist, "intf-change",
186 onIntfChange, this );
187 var_DelCallback( getIntf()->p_sys->p_playlist, "item-append",
188 onItemAppend, this );
189 var_DelCallback( getIntf()->p_sys->p_playlist, "item-deleted",
190 onItemDelete, this );
191 var_DelCallback( getIntf()->p_sys->p_playlist, "intf-show",
193 var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-current",
194 onPlaylistChange, this );
195 var_DelCallback( getIntf()->p_sys->p_playlist, "item-change",
196 onItemChange, this );
197 var_DelCallback( getIntf(), "skin-to-load", onSkinToLoad, this );
201 void VlcProc::registerVoutWindow( void *pVoutWindow )
203 m_handleSet.insert( pVoutWindow );
204 // Reparent the vout window
207 if( vout_Control( m_pVout, VOUT_REPARENT, 0 ) != VLC_SUCCESS )
208 vout_Control( m_pVout, VOUT_CLOSE );
213 void VlcProc::unregisterVoutWindow( void *pVoutWindow )
215 m_handleSet.erase( pVoutWindow );
219 void VlcProc::dropVout()
223 if( vout_Control( m_pVout, VOUT_REPARENT, 0 ) != VLC_SUCCESS )
224 vout_Control( m_pVout, VOUT_CLOSE );
230 void VlcProc::manage()
232 // Did the user request to quit vlc ?
233 if( getIntf()->b_die || getIntf()->p_vlc->b_die )
235 CmdQuit *pCmd = new CmdQuit( getIntf() );
236 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
237 pQueue->push( CmdGenericPtr( pCmd ) );
244 void VlcProc::CmdManage::execute()
246 // Just forward to VlcProc
250 void VlcProc::refreshAudio()
252 char *pFilters = NULL;
254 // Check if the audio output has changed
255 aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
256 VLC_OBJECT_AOUT, FIND_ANYWHERE );
259 if( pAout != m_pAout )
261 // Register the equalizer callbacks
262 if( !var_AddCallback( pAout, "equalizer-bands",
263 onEqBandsChange, this ) &&
264 !var_AddCallback( pAout, "equalizer-preamp",
265 onEqPreampChange, this ) )
268 //char * psz_bands = var_GetString( p_aout, "equalizer-bands" );
271 // Get the audio filters
272 pFilters = var_GetString( pAout, "audio-filter" );
273 vlc_object_release( pAout );
277 // Get the audio filters
278 pFilters = config_GetPsz( getIntf(), "audio-filter" );
281 // Refresh sound volume
282 audio_volume_t volume;
283 aout_VolumeGet( getIntf(), &volume );
284 Volume *pVolume = (Volume*)m_cVarVolume.get();
285 pVolume->set( (double)volume * 2.0 / AOUT_VOLUME_MAX );
287 // Set the mute variable
288 VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
289 pVarMute->set( volume == 0 );
291 // Refresh the equalizer variable
292 VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
293 pVarEqualizer->set( pFilters && strstr( pFilters, "equalizer" ) );
296 void VlcProc::refreshPlaylist()
298 // Refresh the random variable
299 VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
301 var_Get( getIntf()->p_sys->p_playlist, "random", &val );
302 pVarRandom->set( val.b_bool != 0 );
304 // Refresh the loop variable
305 VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
306 var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
307 pVarLoop->set( val.b_bool != 0 );
309 // Refresh the repeat variable
310 VarBoolImpl *pVarRepeat = (VarBoolImpl*)m_cVarRepeat.get();
311 var_Get( getIntf()->p_sys->p_playlist, "repeat", &val );
312 pVarRepeat->set( val.b_bool != 0 );
315 void VlcProc::refreshInput()
317 StreamTime *pTime = (StreamTime*)m_cVarTime.get();
318 VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
319 VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
320 VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
321 VarBoolImpl *pVarHasAudio = (VarBoolImpl*)m_cVarHasAudio.get();
322 VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
323 VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get();
324 VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
325 VarBoolImpl *pVarPlaying = (VarBoolImpl*)m_cVarPlaying.get();
326 VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
327 VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
329 input_thread_t *pInput = getIntf()->p_sys->p_input;
332 if( getIntf()->p_sys->p_input == NULL )
334 getIntf()->p_sys->p_input = getIntf()->p_sys->p_playlist->p_input;
335 if( getIntf()->p_sys->p_input )
336 vlc_object_yield( getIntf()->p_sys->p_input );
338 else if( getIntf()->p_sys->p_input->b_dead )
340 vlc_object_release( getIntf()->p_sys->p_input );
341 getIntf()->p_sys->p_input = NULL;
345 if( pInput && !pInput->b_die )
347 // Refresh time variables
349 var_Get( pInput, "position", &pos );
350 pTime->set( pos.f_float, false );
351 pVarSeekable->set( pos.f_float != 0.0 );
353 // Refresh DVD detection
354 vlc_value_t chapters_count;
355 var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
356 &chapters_count, NULL );
357 pVarDvdActive->set( chapters_count.i_int > 0 );
359 // Get the input bitrate
360 int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
361 pBitrate->set( UString::fromInt( getIntf(), bitrate ) );
363 // Get the audio sample rate
364 int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
365 pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );
368 vlc_value_t audio_es;
369 var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
371 pVarHasAudio->set( audio_es.i_int > 0 );
373 // Refresh fullscreen status
374 vout_thread_t *pVout = (vout_thread_t *)vlc_object_find( pInput,
375 VLC_OBJECT_VOUT, FIND_CHILD );
376 pVarHasVout->set( pVout != NULL );
379 pVarFullscreen->set( pVout->b_fullscreen );
380 vlc_object_release( pVout );
383 // Refresh play/pause status
384 int state = var_GetInteger( pInput, "state" );
385 pVarStopped->set( false );
386 pVarPlaying->set( state != PAUSE_S );
387 pVarPaused->set( state == PAUSE_S );
391 pVarSeekable->set( false );
392 pVarDvdActive->set( false );
393 pTime->set( 0, false );
394 pVarFullscreen->set( false );
395 pVarHasAudio->set( false );
396 pVarHasVout->set( false );
397 pVarStopped->set( true );
398 pVarPlaying->set( false );
399 pVarPaused->set( false );
403 int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
404 vlc_value_t oldVal, vlc_value_t newVal,
407 VlcProc *pThis = (VlcProc*)pParam;
409 // Update the stream variable
410 playlist_t *p_playlist = (playlist_t*)pObj;
411 pThis->updateStreamName(p_playlist);
413 // Create a playtree notify command (for new style playtree)
414 CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
416 // Push the command in the asynchronous command queue
417 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
418 pQueue->push( CmdGenericPtr( pCmdTree ) );
424 int VlcProc::onIntfShow( vlc_object_t *pObj, const char *pVariable,
425 vlc_value_t oldVal, vlc_value_t newVal,
430 VlcProc *pThis = (VlcProc*)pParam;
432 // Create a raise all command
433 CmdRaiseAll *pCmd = new CmdRaiseAll( pThis->getIntf(),
434 pThis->getIntf()->p_sys->p_theme->getWindowManager() );
436 // Push the command in the asynchronous command queue
437 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
438 pQueue->push( CmdGenericPtr( pCmd ) );
445 int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
446 vlc_value_t oldVal, vlc_value_t newVal,
449 VlcProc *pThis = (VlcProc*)pParam;
451 // Update the stream variable
452 playlist_t *p_playlist = (playlist_t*)pObj;
453 pThis->updateStreamName(p_playlist);
455 // Create a playtree notify command
456 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
459 // Push the command in the asynchronous command queue
460 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
461 pQueue->push( CmdGenericPtr( pCmdTree ), true );
466 int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
467 vlc_value_t oldVal, vlc_value_t newVal,
470 VlcProc *pThis = (VlcProc*)pParam;
472 playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(
475 memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
477 CmdGenericPtr ptrTree;
478 CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),
480 ptrTree = CmdGenericPtr( pCmdTree );
482 // Push the command in the asynchronous command queue
483 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
484 pQueue->push( ptrTree , false );
489 int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
490 vlc_value_t oldVal, vlc_value_t newVal,
493 VlcProc *pThis = (VlcProc*)pParam;
495 int i_id = newVal.i_int;
497 CmdGenericPtr ptrTree;
498 CmdPlaytreeDelete *pCmdTree = new CmdPlaytreeDelete( pThis->getIntf(),
500 ptrTree = CmdGenericPtr( pCmdTree );
502 // Push the command in the asynchronous command queue
503 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
504 pQueue->push( ptrTree , false );
510 int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
511 vlc_value_t oldVal, vlc_value_t newVal,
514 VlcProc *pThis = (VlcProc*)pParam;
516 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
518 // Update the stream variable
519 playlist_t *p_playlist = (playlist_t*)pObj;
520 pThis->updateStreamName(p_playlist);
522 // Create two playtree notify commands: one for old item, one for new
523 CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
525 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
526 pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), newVal.i_int );
527 pQueue->push( CmdGenericPtr( pCmdTree ) , true );
533 int VlcProc::onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
534 vlc_value_t oldVal, vlc_value_t newVal,
537 VlcProc *pThis = (VlcProc*)pParam;
539 // Create a playlist notify command
540 CmdChangeSkin *pCmd =
541 new CmdChangeSkin( pThis->getIntf(), newVal.psz_string );
543 // Push the command in the asynchronous command queue
544 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
545 pQueue->push( CmdGenericPtr( pCmd ) );
550 int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
551 vlc_value_t oldVal, vlc_value_t newVal,
554 VlcProc *pThis = (VlcProc*)pParam;
555 interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);
557 CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );
558 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
559 pQueue->push( CmdGenericPtr( pCmd ) );
564 void VlcProc::updateStreamName( playlist_t *p_playlist )
566 if( p_playlist && p_playlist->p_input )
568 // Get playlist item information
569 input_item_t *pItem = p_playlist->p_input->input.p_item;
571 VarText &rStreamName = getStreamNameVar();
572 VarText &rStreamURI = getStreamURIVar();
573 // XXX: we should not need to access p_input->psz_source directly, a
574 // getter should be provided by VLC core
575 string name = pItem->psz_name;
576 // XXX: This should be done in VLC core, not here...
577 // Remove path information if any
578 OSFactory *pFactory = OSFactory::instance( getIntf() );
579 string::size_type pos = name.rfind( pFactory->getDirSeparator() );
580 if( pos != string::npos )
582 name = name.substr( pos + 1, name.size() - pos + 1 );
584 UString srcName( getIntf(), name.c_str() );
585 UString srcURI( getIntf(), pItem->psz_uri );
587 // Create commands to update the stream variables
588 CmdSetText *pCmd1 = new CmdSetText( getIntf(), rStreamName, srcName );
589 CmdSetText *pCmd2 = new CmdSetText( getIntf(), rStreamURI, srcURI );
590 // Push the commands in the asynchronous command queue
591 AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
592 pQueue->push( CmdGenericPtr( pCmd1 ), false );
593 pQueue->push( CmdGenericPtr( pCmd2 ), false );
598 void *VlcProc::getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
599 int *pXHint, int *pYHint,
600 unsigned int *pWidthHint,
601 unsigned int *pHeightHint )
603 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
604 if( pThis->m_handleSet.empty() )
610 pThis->m_pVout = pVout;
611 // Get the window handle
612 void *pWindow = *pThis->m_handleSet.begin();
613 // Post a resize vout command
614 CmdResizeVout *pCmd = new CmdResizeVout( pThis->getIntf(), pWindow,
615 *pWidthHint, *pHeightHint );
616 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
617 pQueue->push( CmdGenericPtr( pCmd ) );
623 void VlcProc::releaseWindow( intf_thread_t *pIntf, void *pWindow )
625 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
626 pThis->m_pVout = NULL;
630 int VlcProc::controlWindow( intf_thread_t *pIntf, void *pWindow,
631 int query, va_list args )
633 VlcProc *pThis = pIntf->p_sys->p_vlcProc;
641 unsigned int i_width = va_arg( args, unsigned int );
642 unsigned int i_height = va_arg( args, unsigned int );
643 if( !i_width ) i_width = pThis->m_pVout->i_window_width;
644 if( !i_height ) i_height = pThis->m_pVout->i_window_height;
646 // Post a resize vout command
647 CmdResizeVout *pCmd =
648 new CmdResizeVout( pThis->getIntf(), pWindow,
650 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
651 pQueue->push( CmdGenericPtr( pCmd ) );
656 msg_Dbg( pIntf, "control query not supported" );
664 int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
665 vlc_value_t oldVal, vlc_value_t newVal,
668 VlcProc *pThis = (VlcProc*)pParam;
670 // Post a set equalizer bands command
671 CmdSetEqBands *pCmd = new CmdSetEqBands( pThis->getIntf(),
674 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
675 pQueue->push( CmdGenericPtr( pCmd ) );
681 int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
682 vlc_value_t oldVal, vlc_value_t newVal,
685 VlcProc *pThis = (VlcProc*)pParam;
686 EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());
688 // Post a set preamp command
689 CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,
690 (newVal.f_float + 20.0) / 40.0 );
691 AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
692 pQueue->push( CmdGenericPtr( pCmd ) );