VLC  4.0.0-dev
Data Structures | Typedefs | Functions
Collaboration diagram for Audio output control:

Data Structures

struct  vlc_player_aout_cbs
 Player aout callbacks. More...
 

Typedefs

typedef struct vlc_player_aout_listener_id vlc_player_aout_listener_id
 Player aout listener opaque structure. More...
 

Functions

VLC_EXPORT audio_output_tvlc_player_aout_Hold (vlc_player_t *player)
 Get the audio output. More...
 
VLC_EXPORT void vlc_player_aout_Reset (vlc_player_t *player)
 Reset the main audio output. More...
 
VLC_EXPORT vlc_player_aout_listener_idvlc_player_aout_AddListener (vlc_player_t *player, const struct vlc_player_aout_cbs *cbs, void *cbs_data)
 Add a listener callback for audio output events. More...
 
VLC_EXPORT void vlc_player_aout_RemoveListener (vlc_player_t *player, vlc_player_aout_listener_id *listener_id)
 Remove a aout listener callback. More...
 
VLC_EXPORT float vlc_player_aout_GetVolume (vlc_player_t *player)
 Get the audio volume. More...
 
VLC_EXPORT int vlc_player_aout_SetVolume (vlc_player_t *player, float volume)
 Set the audio volume. More...
 
VLC_EXPORT int vlc_player_aout_IncrementVolume (vlc_player_t *player, int steps, float *result)
 Increment the audio volume. More...
 
static int vlc_player_aout_DecrementVolume (vlc_player_t *player, int steps, float *result)
 Helper to decrement the audio volume. More...
 
VLC_EXPORT int vlc_player_aout_IsMuted (vlc_player_t *player)
 Check if the audio output is muted. More...
 
VLC_EXPORT int vlc_player_aout_Mute (vlc_player_t *player, bool mute)
 Mute or unmute the audio output. More...
 
static int vlc_player_aout_ToggleMute (vlc_player_t *player)
 Helper to toggle the mute state. More...
 
VLC_EXPORT int vlc_player_aout_EnableFilter (vlc_player_t *player, const char *name, bool add)
 Enable or disable an audio filter. More...
 

Detailed Description

Typedef Documentation

◆ vlc_player_aout_listener_id

Player aout listener opaque structure.

This opaque structure is returned by vlc_player_aout_AddListener() and can be used to remove the listener via vlc_player_aout_RemoveListener().

Function Documentation

◆ vlc_player_aout_AddListener()

VLC_EXPORT vlc_player_aout_listener_id* vlc_player_aout_AddListener ( vlc_player_t player,
const struct vlc_player_aout_cbs cbs,
void *  cbs_data 
)

Add a listener callback for audio output events.

Note
The player instance doesn't need to be locked for vlc_player_aout_*() functions.
Every registered callbacks need to be removed by the caller with vlc_player_aout_RemoveListener().
Parameters
playerplayer instance
cbspointer to a vlc_player_aout_cbs structure, the structure must be valid during the lifetime of the player
cbs_dataopaque pointer used by the callbacks
Returns
a valid listener id, or NULL in case of allocation error

References vlc_player_t::aout_listeners, vlc_player_t::aout_listeners_lock, vlc_player_aout_listener_id::cbs, vlc_player_aout_listener_id::cbs_data, vlc_player_aout_listener_id::node, vlc_list_append(), vlc_mutex_lock(), and vlc_mutex_unlock().

◆ vlc_player_aout_DecrementVolume()

static int vlc_player_aout_DecrementVolume ( vlc_player_t player,
int  steps,
float *  result 
)
inlinestatic

Helper to decrement the audio volume.

References vlc_player_aout_IncrementVolume().

◆ vlc_player_aout_EnableFilter()

VLC_EXPORT int vlc_player_aout_EnableFilter ( vlc_player_t player,
const char *  name,
bool  add 
)

Enable or disable an audio filter.

See also
aout_EnableFilter()
Returns
VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs

References aout_EnableFilter(), aout_Release(), name, and vlc_player_aout_Hold().

◆ vlc_player_aout_GetVolume()

VLC_EXPORT float vlc_player_aout_GetVolume ( vlc_player_t player)

Get the audio volume.

Note
The player instance doesn't need to be locked for vlc_player_aout_*() functions.
See also
vlc_player_aout_cbs.on_volume_changed
Parameters
playerplayer instance
Returns
volume in the range [0;2.f] or -1.f if there is no audio outputs (independent of mute)

References aout_Release(), aout_VolumeGet(), and vlc_player_aout_Hold().

Referenced by vlc_player_osd_Volume().

◆ vlc_player_aout_Hold()

VLC_EXPORT audio_output_t* vlc_player_aout_Hold ( vlc_player_t player)

◆ vlc_player_aout_IncrementVolume()

VLC_EXPORT int vlc_player_aout_IncrementVolume ( vlc_player_t player,
int  steps,
float *  result 
)

Increment the audio volume.

See also
vlc_player_aout_SetVolume()
Parameters
playerplayer instance
stepsnumber of "volume-step"
resultpointer to store the resulting volume (can be NULL)
Returns
VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs

References aout_Release(), aout_VolumeUpdate(), and vlc_player_aout_Hold().

Referenced by vlc_player_aout_DecrementVolume().

◆ vlc_player_aout_IsMuted()

VLC_EXPORT int vlc_player_aout_IsMuted ( vlc_player_t player)

Check if the audio output is muted.

Note
The player instance doesn't need to be locked for vlc_player_aout_*() functions.
See also
vlc_player_aout_cbs.on_mute_changed
Parameters
playerplayer instance
Returns
0 if not muted, 1 if muted, -1 if there is no audio outputs

References aout_MuteGet(), aout_Release(), and vlc_player_aout_Hold().

Referenced by vlc_player_aout_ToggleMute(), and vlc_player_osd_Volume().

◆ vlc_player_aout_Mute()

VLC_EXPORT int vlc_player_aout_Mute ( vlc_player_t player,
bool  mute 
)

Mute or unmute the audio output.

Note
The player instance doesn't need to be locked for vlc_player_aout_*() functions.
A successful call will trigger the vlc_player_aout_cbs.on_mute_changed event.
Parameters
playerplayer instance
mutetrue to mute
Returns
VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs

References aout_MuteSet(), aout_Release(), and vlc_player_aout_Hold().

Referenced by vlc_player_aout_ToggleMute().

◆ vlc_player_aout_RemoveListener()

VLC_EXPORT void vlc_player_aout_RemoveListener ( vlc_player_t player,
vlc_player_aout_listener_id listener_id 
)

Remove a aout listener callback.

Parameters
playerplayer instance
listener_idlistener id returned by vlc_player_aout_AddListener()

References vlc_player_t::aout_listeners_lock, vlc_player_aout_listener_id::node, vlc_list_remove(), vlc_mutex_lock(), and vlc_mutex_unlock().

◆ vlc_player_aout_Reset()

VLC_EXPORT void vlc_player_aout_Reset ( vlc_player_t player)

Reset the main audio output.

Warning
The main aout can only by reset if it is not currently used by any decoders (before any play).
Parameters
playerplayer instance

References input_resource_ResetAout(), vlc_player_t::resource, vlc_player_aout_Deinit(), and vlc_player_aout_Init().

◆ vlc_player_aout_SetVolume()

VLC_EXPORT int vlc_player_aout_SetVolume ( vlc_player_t player,
float  volume 
)

Set the audio volume.

Note
The player instance doesn't need to be locked for vlc_player_aout_*() functions.
A successful call will trigger the vlc_player_vout_cbs.on_volume_changed event.
Parameters
playerplayer instance
volumevolume in the range [0;2.f]
Returns
VLC_SUCCESS or VLC_EGENERIC if there is no audio outputs

References aout_Release(), aout_VolumeSet(), and vlc_player_aout_Hold().

◆ vlc_player_aout_ToggleMute()

static int vlc_player_aout_ToggleMute ( vlc_player_t player)
inlinestatic

Helper to toggle the mute state.

References vlc_player_aout_IsMuted(), and vlc_player_aout_Mute().