int libvlc_media_player_set_equalizer( libvlc_media_player_t *p_mi, libvlc_equalizer_t *p_equalizer ) { char bands[EQZ_BANDS_MAX * EQZ_BAND_VALUE_SIZE + 1]; if( p_equalizer != NULL ) { for( unsigned i = 0, c = 0; i < EQZ_BANDS_MAX; i++ ) { c += snprintf( bands + c, sizeof(bands) - c, " %.07f", p_equalizer->f_amp[i] ); if( unlikely(c >= sizeof(bands)) ) return -1; } var_SetFloat( p_mi, "equalizer-preamp", p_equalizer->f_preamp ); var_SetString( p_mi, "equalizer-bands", bands ); } var_SetString( p_mi, "audio-filter", p_equalizer ? "equalizer" : "" ); audio_output_t *p_aout = input_resource_HoldAout( p_mi->input.p_resource ); if( p_aout != NULL ) { if( p_equalizer != NULL ) { var_SetFloat( p_aout, "equalizer-preamp", p_equalizer->f_preamp ); var_SetString( p_aout, "equalizer-bands", bands ); } var_SetString( p_aout, "audio-filter", p_equalizer ? "equalizer" : "" ); vlc_object_release( p_aout ); } return 0; }
audio_output_t *playlist_GetAout(playlist_t *pl) { /* NOTE: it is assumed that the input resource exists. In practice, * the playlist must have been activated. This is automatic when calling * pl_Get(). FIXME: input resources are deleted at deactivation, this can * be too early. */ playlist_private_t *sys = pl_priv(pl); return input_resource_HoldAout(sys->p_input_resource); }
/* * Remember to release the returned audio_output_t since it is locked at * the end of this function. */ static audio_output_t *GetAOut( libvlc_media_player_t *mp ) { assert( mp != NULL ); audio_output_t *p_aout = input_resource_HoldAout( mp->input.p_resource ); if( p_aout == NULL ) libvlc_printerr( "No active audio output" ); return p_aout; }