VLC  2.1.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
output.c File Reference
Include dependency graph for output.c:

Functions

static void aout_OutputAssertLocked (audio_output_t *aout)
static void aout_Destructor (vlc_object_t *obj)
 Destroys the audio output lock used (asynchronously) by interface functions.
static int var_Copy (vlc_object_t *src, const char *name, vlc_value_t prev, vlc_value_t value, void *data)
static void aout_VolumeNotify (audio_output_t *aout, float volume)
 Supply or update the current custom ("hardware") volume.
static void aout_MuteNotify (audio_output_t *aout, bool mute)
static void aout_PolicyNotify (audio_output_t *aout, bool cork)
static void aout_DeviceNotify (audio_output_t *aout, const char *id)
static void aout_RestartNotify (audio_output_t *aout, unsigned mode)
static int aout_GainNotify (audio_output_t *aout, float gain)
audio_output_taout_New (((vlc_object_t *)(vlc_object_t *parent)))
 Creates an audio output object and initializes an output module.
void aout_Destroy (audio_output_t *aout)
 Deinitializes an audio output module and destroys an audio output object.
int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt)
 Starts an audio output stream.
void aout_OutputDelete (audio_output_t *aout)
 Stops the audio output stream (undoes aout_OutputNew()).
int aout_OutputTimeGet (audio_output_t *aout, mtime_t *delay)
void aout_OutputPlay (audio_output_t *aout, block_t *block)
 Plays a decoded audio buffer.
static void PauseDefault (audio_output_t *aout, bool pause, mtime_t date)
void aout_OutputPause (audio_output_t *aout, bool pause, mtime_t date)
 Notifies the audio output (if any) of pause/resume events.
void aout_OutputFlush (audio_output_t *aout, bool wait)
 Flushes or drains the audio output buffers.
static int aout_OutputVolumeSet (audio_output_t *aout, float vol)
static int aout_OutputMuteSet (audio_output_t *aout, bool mute)
static int aout_OutputDeviceSet (audio_output_t *aout, const char *id)
static int aout_OutputDevicesEnum (audio_output_t *aout, char ***ids, char ***names)
void aout_OutputLock (audio_output_t *aout)
static int aout_OutputTryLock (audio_output_t *aout)
void aout_OutputUnlock (audio_output_t *aout)
float aout_VolumeGet (audio_output_t *aout)
 Gets the volume of the audio output stream (independent of mute).
int aout_VolumeSet (audio_output_t *aout, float vol)
 Sets the volume of the audio output stream.
int aout_MuteGet (audio_output_t *aout)
 Gets the audio output stream mute flag.
int aout_MuteSet (audio_output_t *aout, bool mute)
 Sets the audio output stream mute flag.
char * aout_DeviceGet (audio_output_t *aout)
 Gets the currently selected device.
int aout_DeviceSet (audio_output_t *aout, const char *id)
 Selects an audio output device.
int aout_DevicesList (audio_output_t *aout, char ***ids, char ***names)
 Enumerates possible audio output devices.

Variables

static const char unset_str [1] = ""

Function Documentation

void aout_Destroy ( audio_output_t aout)
static void aout_Destructor ( vlc_object_t p_this)
static

Destroys the audio output lock used (asynchronously) by interface functions.

References aout_owner(), aout_owner_t::device, aout_owner_t::lock, aout_owner_t::req, unset_str, and vlc_mutex_destroy().

Referenced by aout_New().

char* aout_DeviceGet ( audio_output_t aout)

Gets the currently selected device.

Returns
the selected device ID (caller must free() it) NULL if no device is selected or in case of error.

References var_GetNonEmptyString.

static void aout_DeviceNotify ( audio_output_t aout,
const char *  id 
)
static

References var_SetString.

Referenced by aout_New().

int aout_DeviceSet ( audio_output_t aout,
const char *  id 
)

Selects an audio output device.

Parameters
iddevice ID to select, or NULL for the default device
Returns
zero on success, non-zero on error (TODO).

References aout_OutputTryLock(), aout_OutputUnlock(), aout_owner(), aout_owner_t::device, aout_owner_t::lock, aout_owner_t::req, strdup(), unlikely, unset_str, vlc_mutex_lock(), and vlc_mutex_unlock().

int aout_DevicesList ( audio_output_t aout,
char ***  ids,
char ***  names 
)

Enumerates possible audio output devices.

The function will heap-allocate two tables of heap-allocated strings; the caller is responsible for freeing all strings and both tables.

Parameters
idspointer to a table of device identifiers [OUT]
namespointer to a table of device human-readable descriptions [OUT]
Returns
the number of devices, or negative on error.
Note
In case of error, *ids and *names are undefined.

References aout_OutputDevicesEnum(), aout_OutputLock(), and aout_OutputUnlock().

static int aout_GainNotify ( audio_output_t aout,
float  gain 
)
static
int aout_MuteGet ( audio_output_t aout)

Gets the audio output stream mute flag.

Returns
0 if not muted, 1 if muted, -1 if undefined.

References var_InheritBool.

Referenced by playlist_MuteGet().

static void aout_MuteNotify ( audio_output_t aout,
bool  mute 
)
static

References var_SetBool.

Referenced by aout_New().

int aout_MuteSet ( audio_output_t aout,
bool  mute 
)

Sets the audio output stream mute flag.

Returns
0 on success, -1 on failure (TODO).

References aout_OutputTryLock(), aout_OutputUnlock(), aout_owner(), aout_owner_t::lock, aout_owner_t::mute, aout_owner_t::req, vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by playlist_MuteSet().

audio_output_t* aout_New ( ((vlc_object_t *)(vlc_object_t *parent))  )
static void aout_OutputAssertLocked ( audio_output_t aout)
static
void aout_OutputDelete ( audio_output_t aout)

Stops the audio output stream (undoes aout_OutputNew()).

Note
This can only be called after a succesful aout_OutputNew().
Warning
The caller must hold the audio output lock.

References aout_ChannelsRestart(), aout_OutputAssertLocked(), audio_output::stop, and var_DelCallback.

Referenced by aout_CheckReady(), aout_DecDelete(), and aout_DecNew().

static int aout_OutputDevicesEnum ( audio_output_t aout,
char ***  ids,
char ***  names 
)
static
static int aout_OutputDeviceSet ( audio_output_t aout,
const char *  id 
)
static
void aout_OutputFlush ( audio_output_t aout,
bool  wait 
)

Flushes or drains the audio output buffers.

This enables the output to expedite seek and stop.

Parameters
waitif true, wait for buffer playback (i.e. drain), if false, discard the buffers immediately (i.e. flush)
Note
This can only be called after a succesful aout_OutputNew().
Warning
The caller must hold the audio output lock.

References aout_OutputAssertLocked(), and audio_output::flush.

Referenced by aout_DecFlush(), aout_DecIsEmpty(), aout_DecSynchronize(), and PauseDefault().

void aout_OutputLock ( audio_output_t aout)
static int aout_OutputMuteSet ( audio_output_t aout,
bool  mute 
)
static
int aout_OutputNew ( audio_output_t aout,
audio_sample_format_t *restrict  fmt 
)
void aout_OutputPause ( audio_output_t aout,
bool  pause,
mtime_t  date 
)

Notifies the audio output (if any) of pause/resume events.

This enables the output to expedite pause, instead of waiting for its buffers to drain.

Note
This can only be called after a succesful aout_OutputNew().
Warning
The caller must hold the audio output lock.

References aout_OutputAssertLocked(), audio_output::pause, and PauseDefault().

Referenced by aout_DecChangePause().

void aout_OutputPlay ( audio_output_t aout,
block_t block 
)

Plays a decoded audio buffer.

Note
This can only be called after a succesful aout_OutputNew().
Warning
The caller must hold the audio output lock.

References aout_OutputAssertLocked(), and audio_output::play.

Referenced by aout_DecPlay(), and aout_DecSilence().

int aout_OutputTimeGet ( audio_output_t aout,
mtime_t delay 
)
static int aout_OutputTryLock ( audio_output_t aout)
static
void aout_OutputUnlock ( audio_output_t aout)
static int aout_OutputVolumeSet ( audio_output_t aout,
float  vol 
)
static
static void aout_PolicyNotify ( audio_output_t aout,
bool  cork 
)
static
static void aout_RestartNotify ( audio_output_t aout,
unsigned  mode 
)
static

References aout_RequestRestart().

Referenced by aout_New().

float aout_VolumeGet ( audio_output_t aout)

Gets the volume of the audio output stream (independent of mute).

Returns
Current audio volume (0. = silent, 1. = nominal), or a strictly negative value if undefined.

References var_GetFloat.

Referenced by playlist_VolumeGet(), and playlist_VolumeUp().

static void aout_VolumeNotify ( audio_output_t aout,
float  volume 
)
static

Supply or update the current custom ("hardware") volume.

Note
This only makes sense after calling aout_VolumeHardInit().
Parameters
volumecurrent custom volume
Warning
The caller (i.e. the audio output plug-in) is responsible for interlocking and synchronizing call to this function and to the audio_output_t.volume_set callback. This ensures that VLC gets correct volume information (possibly with a latency).

References var_SetFloat.

Referenced by aout_New().

int aout_VolumeSet ( audio_output_t aout,
float  vol 
)

Sets the volume of the audio output stream.

Note
The mute status is not changed.
Returns
0 on success, -1 on failure (TODO).

References aout_OutputTryLock(), aout_OutputUnlock(), aout_owner(), aout_owner_t::lock, aout_owner_t::req, vlc_mutex_lock(), vlc_mutex_unlock(), and aout_owner_t::volume.

Referenced by playlist_VolumeSet(), and playlist_VolumeUp().

static void PauseDefault ( audio_output_t aout,
bool  pause,
mtime_t  date 
)
static

References aout_OutputFlush().

Referenced by aout_OutputPause().

static int var_Copy ( vlc_object_t src,
const char *  name,
vlc_value_t  prev,
vlc_value_t  value,
void *  data 
)
static

References var_Set.

Referenced by aout_Destroy(), and aout_New().

Variable Documentation

const char unset_str[1] = ""
static