]> git.sesse.net Git - vlc/blob - modules/gui/skins2/src/vlcproc.cpp
f02d6a42123e8fb2c8e1898dfb3720ec1a717a6e
[vlc] / modules / gui / skins2 / src / vlcproc.cpp
1 /*****************************************************************************
2  * vlcproc.cpp
3  *****************************************************************************
4  * Copyright (C) 2003-2009 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
8  *          Olivier Teulière <ipkiss@via.ecp.fr>
9  *
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.
14  *
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.
19  *
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  *****************************************************************************/
24
25 #ifdef HAVE_CONFIG_H
26 # include "config.h"
27 #endif
28
29 #include <vlc_common.h>
30 #include <vlc_aout.h>
31 #include <vlc_vout.h>
32 #include <vlc_playlist.h>
33
34 #include "vlcproc.hpp"
35 #include "os_factory.hpp"
36 #include "os_loop.hpp"
37 #include "os_timer.hpp"
38 #include "var_manager.hpp"
39 #include "vout_manager.hpp"
40 #include "theme.hpp"
41 #include "window_manager.hpp"
42 #include "../commands/async_queue.hpp"
43 #include "../commands/cmd_change_skin.hpp"
44 #include "../commands/cmd_show_window.hpp"
45 #include "../commands/cmd_quit.hpp"
46 #include "../commands/cmd_resize.hpp"
47 #include "../commands/cmd_vars.hpp"
48 #include "../commands/cmd_dialogs.hpp"
49 #include "../commands/cmd_update_item.hpp"
50 #include "../utils/var_bool.hpp"
51 #include <sstream>
52
53
54 VlcProc *VlcProc::instance( intf_thread_t *pIntf )
55 {
56     if( pIntf->p_sys->p_vlcProc == NULL )
57     {
58         pIntf->p_sys->p_vlcProc = new VlcProc( pIntf );
59     }
60
61     return pIntf->p_sys->p_vlcProc;
62 }
63
64
65 void VlcProc::destroy( intf_thread_t *pIntf )
66 {
67     delete pIntf->p_sys->p_vlcProc;
68     pIntf->p_sys->p_vlcProc = NULL;
69 }
70
71
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 )
75 {
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 );
80
81     // Create and register VLC variables
82     VarManager *pVarManager = VarManager::instance( getIntf() );
83
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(),
92                               "playtree.slider" );
93     pVarManager->registerVar( m_cVarRandom, "playtree.isRandom" );
94     pVarManager->registerVar( m_cVarLoop, "playtree.isLoop" );
95
96     REGISTER_VAR( m_cVarPlaying, VarBoolImpl, "vlc.isPlaying" )
97     REGISTER_VAR( m_cVarStopped, VarBoolImpl, "vlc.isStopped" )
98     REGISTER_VAR( m_cVarPaused, VarBoolImpl, "vlc.isPaused" )
99
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" )
105
106     /* Vout variables */
107     REGISTER_VAR( m_cVarFullscreen, VarBoolImpl, "vlc.isFullscreen" )
108     REGISTER_VAR( m_cVarHasVout, VarBoolImpl, "vlc.hasVout" )
109
110     /* Aout variables */
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" )
116
117 #undef REGISTER_VAR
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" );
126
127     // Register the equalizer bands
128     for( int i = 0; i < EqualizerBands::kNbBands; i++)
129     {
130         stringstream ss;
131         ss << "equalizer.band(" << i << ")";
132         pVarManager->registerVar( m_varEqBands.getBand( i ), ss.str() );
133     }
134
135     // XXX WARNING XXX
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)
139
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, "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, "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",
152                      onIntfShow, this );
153     // Called when the current played item changes
154     var_AddCallback( pIntf->p_sys->p_playlist, "item-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 );
161
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     interaction_Register( pIntf );
166
167     getIntf()->p_sys->p_input = NULL;
168 }
169
170
171 VlcProc::~VlcProc()
172 {
173     m_pTimer->stop();
174     delete( m_pTimer );
175     if( getIntf()->p_sys->p_input )
176     {
177         vlc_object_release( getIntf()->p_sys->p_input );
178         getIntf()->p_sys->p_input = NULL;
179     }
180
181     interaction_Unregister( getIntf() );
182
183     var_DelCallback( getIntf()->p_sys->p_playlist, "intf-change",
184                      onIntfChange, this );
185     var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-append",
186                      onItemAppend, this );
187     var_DelCallback( getIntf()->p_sys->p_playlist, "playlist-item-deleted",
188                      onItemDelete, this );
189     var_DelCallback( getIntf()->p_libvlc, "intf-show",
190                      onIntfShow, this );
191     var_DelCallback( getIntf()->p_sys->p_playlist, "item-current",
192                      onPlaylistChange, this );
193     var_DelCallback( getIntf()->p_sys->p_playlist, "item-change",
194                      onItemChange, this );
195     var_DelCallback( getIntf(), "skin-to-load", onSkinToLoad, this );
196     var_DelCallback( getIntf(), "interaction", onInteraction, this );
197 }
198
199 void VlcProc::manage()
200 {
201     // Did the user request to quit vlc ?
202     if( !vlc_object_alive( getIntf() ) )
203     {
204         // Get the instance of OSFactory
205         OSFactory *pOsFactory = OSFactory::instance( getIntf() );
206
207         // Exit the main OS loop
208         pOsFactory->getOSLoop()->exit();
209
210         return;
211     }
212
213     refreshPlaylist();
214     refreshAudio();
215     refreshInput();
216 }
217
218 void VlcProc::CmdManage::execute()
219 {
220     // Just forward to VlcProc
221     m_pParent->manage();
222 }
223
224 void VlcProc::refreshAudio()
225 {
226     char *pFilters;
227
228     // Check if the audio output has changed
229     aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
230             VLC_OBJECT_AOUT, FIND_ANYWHERE );
231     if( pAout )
232     {
233         if( pAout != m_pAout )
234         {
235             // Register the equalizer callbacks
236             if( !var_AddCallback( pAout, "equalizer-bands",
237                                   onEqBandsChange, this ) &&
238                 !var_AddCallback( pAout, "equalizer-preamp",
239                                   onEqPreampChange, this ) )
240             {
241                 m_pAout = pAout;
242                 //char * psz_bands = var_GetString( p_aout, "equalizer-bands" );
243             }
244         }
245         // Get the audio filters
246         pFilters = var_GetNonEmptyString( pAout, "audio-filter" );
247         vlc_object_release( pAout );
248     }
249     else
250     {
251         // Get the audio filters
252         pFilters = config_GetPsz( getIntf(), "audio-filter" );
253     }
254
255     // Refresh sound volume
256     audio_volume_t volume;
257     aout_VolumeGet( getIntf()->p_sys->p_playlist, &volume );
258     Volume *pVolume = (Volume*)m_cVarVolume.get();
259     pVolume->set( (double)volume * 2.0 / AOUT_VOLUME_MAX );
260
261     // Set the mute variable
262     VarBoolImpl *pVarMute = (VarBoolImpl*)m_cVarMute.get();
263     pVarMute->set( volume == 0 );
264
265     // Refresh the equalizer variable
266     VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
267     pVarEqualizer->set( pFilters && strstr( pFilters, "equalizer" ) );
268     free( pFilters );
269 }
270
271 void VlcProc::refreshPlaylist()
272 {
273     // Refresh the random variable
274     VarBoolImpl *pVarRandom = (VarBoolImpl*)m_cVarRandom.get();
275     vlc_value_t val;
276     var_Get( getIntf()->p_sys->p_playlist, "random", &val );
277     pVarRandom->set( val.b_bool != 0 );
278
279     // Refresh the loop variable
280     VarBoolImpl *pVarLoop = (VarBoolImpl*)m_cVarLoop.get();
281     var_Get( getIntf()->p_sys->p_playlist, "loop", &val );
282     pVarLoop->set( val.b_bool != 0 );
283
284     // Refresh the repeat variable
285     VarBoolImpl *pVarRepeat = (VarBoolImpl*)m_cVarRepeat.get();
286     var_Get( getIntf()->p_sys->p_playlist, "repeat", &val );
287     pVarRepeat->set( val.b_bool != 0 );
288 }
289
290 void VlcProc::refreshInput()
291 {
292     StreamTime *pTime = (StreamTime*)m_cVarTime.get();
293     VarBoolImpl *pVarSeekable = (VarBoolImpl*)m_cVarSeekable.get();
294     VarBoolImpl *pVarDvdActive = (VarBoolImpl*)m_cVarDvdActive.get();
295     VarBoolImpl *pVarHasVout = (VarBoolImpl*)m_cVarHasVout.get();
296     VarBoolImpl *pVarHasAudio = (VarBoolImpl*)m_cVarHasAudio.get();
297     VarText *pBitrate = (VarText*)m_cVarStreamBitRate.get();
298     VarText *pSampleRate = (VarText*)m_cVarStreamSampleRate.get();
299     VarBoolImpl *pVarFullscreen = (VarBoolImpl*)m_cVarFullscreen.get();
300     VarBoolImpl *pVarPlaying = (VarBoolImpl*)m_cVarPlaying.get();
301     VarBoolImpl *pVarStopped = (VarBoolImpl*)m_cVarStopped.get();
302     VarBoolImpl *pVarPaused = (VarBoolImpl*)m_cVarPaused.get();
303
304     // Update the input
305     if( getIntf()->p_sys->p_input == NULL )
306     {
307         getIntf()->p_sys->p_input =
308             playlist_CurrentInput( getIntf()->p_sys->p_playlist );
309     }
310     else if( getIntf()->p_sys->p_input->b_dead )
311     {
312         vlc_object_release( getIntf()->p_sys->p_input );
313         getIntf()->p_sys->p_input = NULL;
314     }
315
316     input_thread_t *pInput = getIntf()->p_sys->p_input;
317
318     if( pInput && vlc_object_alive (pInput) )
319     {
320         // Refresh time variables
321         vlc_value_t pos;
322         var_Get( pInput, "position", &pos );
323         pTime->set( pos.f_float, false );
324         pVarSeekable->set( pos.f_float != 0.0 );
325
326         // Refresh DVD detection
327         vlc_value_t chapters_count;
328         var_Change( pInput, "chapter", VLC_VAR_CHOICESCOUNT,
329                         &chapters_count, NULL );
330         pVarDvdActive->set( chapters_count.i_int > 0 );
331
332         // Get the input bitrate
333         int bitrate = var_GetInteger( pInput, "bit-rate" ) / 1000;
334         pBitrate->set( UString::fromInt( getIntf(), bitrate ) );
335
336         // Get the audio sample rate
337         int sampleRate = var_GetInteger( pInput, "sample-rate" ) / 1000;
338         pSampleRate->set( UString::fromInt( getIntf(), sampleRate ) );
339
340         // Do we have audio
341         vlc_value_t audio_es;
342         var_Change( pInput, "audio-es", VLC_VAR_CHOICESCOUNT,
343                         &audio_es, NULL );
344         pVarHasAudio->set( audio_es.i_int > 0 );
345
346         // Refresh fullscreen status
347         vout_thread_t *pVout = input_GetVout( pInput );
348         pVarHasVout->set( pVout != NULL );
349         if( pVout )
350         {
351             pVarFullscreen->set( var_GetBool( pVout, "fullscreen" ) );
352             vlc_object_release( pVout );
353         }
354
355         // Refresh play/pause status
356         int state = var_GetInteger( pInput, "state" );
357         pVarStopped->set( false );
358         pVarPlaying->set( state != PAUSE_S );
359         pVarPaused->set( state == PAUSE_S );
360     }
361     else
362     {
363         pVarSeekable->set( false );
364         pVarDvdActive->set( false );
365         pTime->set( 0, false );
366         pVarFullscreen->set( false );
367         pVarHasAudio->set( false );
368         pVarHasVout->set( false );
369         pVarStopped->set( true );
370         pVarPlaying->set( false );
371         pVarPaused->set( false );
372     }
373 }
374
375 int VlcProc::onIntfChange( vlc_object_t *pObj, const char *pVariable,
376                            vlc_value_t oldVal, vlc_value_t newVal,
377                            void *pParam )
378 {
379     VlcProc *pThis = (VlcProc*)pParam;
380
381     // Update the stream variable
382     pThis->updateStreamName();
383
384     // Create a playtree notify command (for new style playtree)
385     CmdPlaytreeChanged *pCmdTree = new CmdPlaytreeChanged( pThis->getIntf() );
386
387     // Push the command in the asynchronous command queue
388     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
389     pQueue->push( CmdGenericPtr( pCmdTree ) );
390
391     return VLC_SUCCESS;
392 }
393
394
395 int VlcProc::onIntfShow( vlc_object_t *pObj, const char *pVariable,
396                          vlc_value_t oldVal, vlc_value_t newVal,
397                          void *pParam )
398 {
399     if (newVal.b_bool)
400     {
401         VlcProc *pThis = (VlcProc*)pParam;
402
403         // Create a raise all command
404         CmdRaiseAll *pCmd = new CmdRaiseAll( pThis->getIntf(),
405             pThis->getIntf()->p_sys->p_theme->getWindowManager() );
406
407         // Push the command in the asynchronous command queue
408         AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
409         pQueue->push( CmdGenericPtr( pCmd ) );
410     }
411
412     return VLC_SUCCESS;
413 }
414
415
416 int VlcProc::onItemChange( vlc_object_t *pObj, const char *pVariable,
417                            vlc_value_t oldval, vlc_value_t newval,
418                            void *pParam )
419 {
420     VlcProc *pThis = (VlcProc*)pParam;
421     input_item_t *p_item = static_cast<input_item_t*>(newval.p_address);
422
423     // Update the stream variable
424     pThis->updateStreamName();
425
426     // Create a playtree notify command
427     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
428                                                          p_item->i_id );
429
430     // Push the command in the asynchronous command queue
431     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
432     pQueue->push( CmdGenericPtr( pCmdTree ), true );
433
434     return VLC_SUCCESS;
435 }
436
437 int VlcProc::onItemAppend( vlc_object_t *pObj, const char *pVariable,
438                            vlc_value_t oldVal, vlc_value_t newVal,
439                            void *pParam )
440 {
441     VlcProc *pThis = (VlcProc*)pParam;
442
443     playlist_add_t *p_add = (playlist_add_t*)malloc( sizeof(
444                                                 playlist_add_t ) ) ;
445
446     memcpy( p_add, newVal.p_address, sizeof( playlist_add_t ) ) ;
447
448     CmdGenericPtr ptrTree;
449     CmdPlaytreeAppend *pCmdTree = new CmdPlaytreeAppend( pThis->getIntf(),
450                                                              p_add );
451     ptrTree = CmdGenericPtr( pCmdTree );
452
453     // Push the command in the asynchronous command queue
454     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
455     pQueue->push( ptrTree , false );
456
457     return VLC_SUCCESS;
458 }
459
460 int VlcProc::onItemDelete( vlc_object_t *pObj, const char *pVariable,
461                            vlc_value_t oldVal, vlc_value_t newVal,
462                            void *pParam )
463 {
464     VlcProc *pThis = (VlcProc*)pParam;
465
466     int i_id = newVal.i_int;
467
468     CmdGenericPtr ptrTree;
469     CmdPlaytreeDelete *pCmdTree = new CmdPlaytreeDelete( pThis->getIntf(),
470                                                          i_id);
471     ptrTree = CmdGenericPtr( pCmdTree );
472
473     // Push the command in the asynchronous command queue
474     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
475     pQueue->push( ptrTree , false );
476
477     return VLC_SUCCESS;
478 }
479
480
481 int VlcProc::onPlaylistChange( vlc_object_t *pObj, const char *pVariable,
482                                vlc_value_t oldval, vlc_value_t newval,
483                                void *pParam )
484 {
485     VlcProc *pThis = (VlcProc*)pParam;
486     input_item_t *p_item = static_cast<input_item_t*>(newval.p_address);
487
488     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
489
490     // Update the stream variable
491     pThis->updateStreamName();
492
493     // Create two playtree notify commands: one for old item, one for new
494 #if 0 /* FIXME: Heck, no! You cannot do that.
495          There is no warranty that the old item is still valid. */
496     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(),
497                                                          oldVal.i_int );
498     pQueue->push( CmdGenericPtr( pCmdTree ) , true );
499 #endif
500     CmdPlaytreeUpdate *pCmdTree = new CmdPlaytreeUpdate( pThis->getIntf(), p_item->i_id );
501     pQueue->push( CmdGenericPtr( pCmdTree ) , true );
502
503     return VLC_SUCCESS;
504 }
505
506
507 int VlcProc::onSkinToLoad( vlc_object_t *pObj, const char *pVariable,
508                            vlc_value_t oldVal, vlc_value_t newVal,
509                            void *pParam )
510 {
511     VlcProc *pThis = (VlcProc*)pParam;
512
513     // Create a playlist notify command
514     CmdChangeSkin *pCmd =
515         new CmdChangeSkin( pThis->getIntf(), newVal.psz_string );
516
517     // Push the command in the asynchronous command queue
518     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
519     pQueue->push( CmdGenericPtr( pCmd ) );
520
521     return VLC_SUCCESS;
522 }
523
524 int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
525                             vlc_value_t oldVal, vlc_value_t newVal,
526                             void *pParam )
527 {
528     VlcProc *pThis = (VlcProc*)pParam;
529     interaction_dialog_t *p_dialog = (interaction_dialog_t *)(newVal.p_address);
530
531     CmdInteraction *pCmd = new CmdInteraction( pThis->getIntf(), p_dialog );
532     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
533     pQueue->push( CmdGenericPtr( pCmd ) );
534     return VLC_SUCCESS;
535 }
536
537
538 void VlcProc::updateStreamName()
539 {
540     // Create a update item command
541     CmdUpdateItem *pCmdItem = new CmdUpdateItem( getIntf(), getStreamNameVar(), getStreamURIVar() );
542
543     // Push the command in the asynchronous command queue
544     AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
545     pQueue->push( CmdGenericPtr( pCmdItem ) );
546 }
547
548 int VlcProc::onEqBandsChange( vlc_object_t *pObj, const char *pVariable,
549                               vlc_value_t oldVal, vlc_value_t newVal,
550                               void *pParam )
551 {
552     VlcProc *pThis = (VlcProc*)pParam;
553
554     // Post a set equalizer bands command
555     CmdSetEqBands *pCmd = new CmdSetEqBands( pThis->getIntf(),
556                                              pThis->m_varEqBands,
557                                              newVal.psz_string );
558     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
559     pQueue->push( CmdGenericPtr( pCmd ) );
560
561     return VLC_SUCCESS;
562 }
563
564
565 int VlcProc::onEqPreampChange( vlc_object_t *pObj, const char *pVariable,
566                                vlc_value_t oldVal, vlc_value_t newVal,
567                                void *pParam )
568 {
569     VlcProc *pThis = (VlcProc*)pParam;
570     EqualizerPreamp *pVarPreamp = (EqualizerPreamp*)(pThis->m_cVarEqPreamp.get());
571
572     // Post a set preamp command
573     CmdSetEqPreamp *pCmd = new CmdSetEqPreamp( pThis->getIntf(), *pVarPreamp,
574                                               (newVal.f_float + 20.0) / 40.0 );
575     AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
576     pQueue->push( CmdGenericPtr( pCmd ) );
577
578     return VLC_SUCCESS;
579 }
580