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

audio_output_tvlc_player_aout_Hold (vlc_player_t *player)
 Get the audio output. More...
 
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...
 
void vlc_player_aout_RemoveListener (vlc_player_t *player, vlc_player_aout_listener_id *listener_id)
 Remove a aout listener callback. More...
 
float vlc_player_aout_GetVolume (vlc_player_t *player)
 Get the audio volume. More...
 
int vlc_player_aout_SetVolume (vlc_player_t *player, float volume)
 Set the audio volume. More...
 
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...
 
int vlc_player_aout_IsMuted (vlc_player_t *player)
 Check if the audio output is muted. More...
 
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...
 
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_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_API, vlc_player_aout_IncrementVolume(), vlc_player_aout_IsMuted(), and vlc_player_aout_Mute().

◆ vlc_player_aout_EnableFilter()

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(), and vlc_player_aout_Hold().

Referenced by vlc_player_aout_ToggleMute().

◆ vlc_player_aout_GetVolume()

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()

audio_output_t* vlc_player_aout_Hold ( vlc_player_t player)

Get the audio output.

Warning
The returned pointer must be released with aout_Release().
Parameters
playerplayer instance
Returns
a valid audio_output_t * or NULL (if there is no aouts)

References input_resource_HoldAout(), and vlc_player_t::resource.

Referenced by vlc_player_aout_AddCallbacks(), vlc_player_aout_DelCallbacks(), vlc_player_aout_EnableFilter(), vlc_player_aout_GetVolume(), vlc_player_aout_IncrementVolume(), vlc_player_aout_IsMuted(), vlc_player_aout_Mute(), vlc_player_aout_SetVolume(), and vlc_strfplayer().

◆ vlc_player_aout_IncrementVolume()

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()

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_DecrementVolume(), vlc_player_aout_ToggleMute(), and vlc_player_osd_Volume().

◆ vlc_player_aout_Mute()

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_DecrementVolume(), and vlc_player_aout_ToggleMute().

◆ vlc_player_aout_RemoveListener()

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_SetVolume()

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 name, VLC_API, vlc_player_aout_EnableFilter(), vlc_player_aout_IsMuted(), and vlc_player_aout_Mute().