#include "cmd_audio.hpp"
#include "../src/vlcproc.hpp"
+#include <vlc_playlist.h>
+#include <vlc_input.h>
#include <vlc_aout.h>
#include <string>
void CmdSetEqualizer::execute()
{
- // Get the audio output
- aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
- VLC_OBJECT_AOUT, FIND_ANYWHERE );
+ aout_instance_t *pAout = NULL;
+
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
+ if( pInput )
+ pAout = input_GetAout( pInput );
// XXX
string filters;
{
pAout->pp_inputs[i]->b_restart = true;
}
- vlc_object_release( pAout );
}
else
{
config_PutPsz( getIntf(), "audio-filter", filters.c_str() );
}
+
+ if( pAout )
+ vlc_object_release( pAout );
+ if( pInput )
+ vlc_object_release( pInput );
}
void CmdVolumeChanged::execute()
#include "cmd_dvd.hpp"
#include <vlc_input.h>
+#include <vlc_playlist.h>
void CmdDvdNextTitle::execute()
{
- input_thread_t *p_input =
- (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *p_input = playlist_CurrentInput( pPlaylist );
+
if( p_input )
{
var_TriggerCallback( p_input, "next-title" );
void CmdDvdPreviousTitle::execute()
{
- input_thread_t *p_input =
- (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *p_input = playlist_CurrentInput( pPlaylist );
+
if( p_input )
{
var_TriggerCallback( p_input, "prev-title" );
void CmdDvdNextChapter::execute()
{
- input_thread_t *p_input =
- (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *p_input = playlist_CurrentInput( pPlaylist );
+
if( p_input )
{
var_TriggerCallback( p_input, "next-chapter" );
void CmdDvdPreviousChapter::execute()
{
- input_thread_t *p_input =
- (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *p_input = playlist_CurrentInput( pPlaylist );
+
if( p_input )
{
var_TriggerCallback( p_input, "prev-chapter" );
void CmdDvdRootMenu::execute()
{
- input_thread_t *p_input =
- (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *p_input = playlist_CurrentInput( pPlaylist );
+
if( p_input )
{
vlc_value_t val;
void CmdSlower::execute()
{
- input_thread_t *pInput =
- (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
+
if( pInput )
{
vlc_value_t val;
void CmdFaster::execute()
{
- input_thread_t *pInput =
- (input_thread_t *)vlc_object_find( getIntf(), VLC_OBJECT_INPUT,
- FIND_ANYWHERE );
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
+
if( pInput )
{
vlc_value_t val;
void VlcProc::refreshAudio()
{
char *pFilters;
+ aout_instance_t *pAout = NULL;
+
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
+ if( pInput )
+ pAout = input_GetAout( pInput );
- // Check if the audio output has changed
- aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
- VLC_OBJECT_AOUT, FIND_ANYWHERE );
if( pAout )
{
+ // Check if the audio output has changed
if( pAout != m_pAout )
{
// Register the equalizer callbacks
}
// Get the audio filters
pFilters = var_GetNonEmptyString( pAout, "audio-filter" );
- vlc_object_release( pAout );
}
else
{
VarBoolImpl *pVarEqualizer = (VarBoolImpl*)m_cVarEqualizer.get();
pVarEqualizer->set( pFilters && strstr( pFilters, "equalizer" ) );
free( pFilters );
+
+ if( pAout )
+ vlc_object_release( pAout );
+ if( pInput )
+ vlc_object_release( pInput );
}
void VlcProc::refreshVolume()
#endif
#include <vlc_common.h>
+#include <vlc_playlist.h>
+#include <vlc_input.h>
#include <vlc_aout.h>
#include "equalizer.hpp"
#include "../utils/var_percent.hpp"
void EqualizerBands::onUpdate( Subject<VarPercent> &rBand, void *arg )
{
+ aout_instance_t *pAout = NULL;
+
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
+ if( pInput )
+ pAout = input_GetAout( pInput );
+
// Make sure we are not called from set()
if (!m_isUpdating)
{
ss << " " << val;
}
-
string bands = ss.str();
- aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
- VLC_OBJECT_AOUT, FIND_ANYWHERE );
+
config_PutPsz( getIntf(), "equalizer-bands", bands.c_str() );
if( pAout )
{
// Update the audio output
var_SetString( pAout, "equalizer-bands", (char*)bands.c_str() );
- vlc_object_release( pAout );
}
}
+
+ if( pAout )
+ vlc_object_release( pAout );
+ if( pInput )
+ vlc_object_release( pInput );
}
void EqualizerPreamp::set( float percentage, bool updateVLC )
{
+ aout_instance_t *pAout = NULL;
+
+ playlist_t *pPlaylist = getIntf()->p_sys->p_playlist;
+ input_thread_t *pInput = playlist_CurrentInput( pPlaylist );
+ if( pInput )
+ pAout = input_GetAout( pInput );
+
VarPercent::set( percentage );
// Avoid infinite loop
{
float val = 40 * percentage - 20;
- aout_instance_t *pAout = (aout_instance_t *)vlc_object_find( getIntf(),
- VLC_OBJECT_AOUT, FIND_ANYWHERE );
config_PutFloat( getIntf(), "equalizer-preamp", val );
if( pAout )
{
// Update the audio output
var_SetFloat( pAout, "equalizer-preamp", val );
- vlc_object_release( pAout );
}
}
+
+ if( pAout )
+ vlc_object_release( pAout );
+ if( pInput )
+ vlc_object_release( pInput );
}