Data Structures | Defines | Typedefs | Functions | Variables

vlc_aout.h File Reference

This file defines functions, structures and macros for audio output object. More...

Include dependency graph for vlc_aout.h:

Go to the source code of this file.

Data Structures

struct  audio_output
 Audio output object. More...
struct  aout_fifo_t
 Audio output buffer FIFO. More...
struct  aout_packet_t

Defines

#define AOUT_MAX_FILTERS   10
#define AOUT_MAX_ADVANCE_TIME   (AOUT_MAX_PREPARE_TIME + CLOCK_FREQ)
#define AOUT_MAX_PREPARE_TIME   (2 * CLOCK_FREQ)
#define AOUT_MIN_PREPARE_TIME   AOUT_MAX_PTS_ADVANCE
#define AOUT_MAX_PTS_ADVANCE   (CLOCK_FREQ / 25)
 Maximum advance of actual audio playback time to coded PTS, above which downsampling will be performed.
#define AOUT_MAX_PTS_DELAY   (3 * CLOCK_FREQ / 50)
 Maximum delay of actual audio playback time from coded PTS, above which upsampling will be performed.
#define AOUT_MAX_RESAMPLING   10
#define AOUT_FMTS_IDENTICAL(p_first, p_second)
#define AOUT_FMTS_SIMILAR(p_first, p_second)
#define AOUT_FMT_LINEAR(p_format)   (aout_BitsPerSample((p_format)->i_format) != 0)
#define VLC_CODEC_SPDIFL   VLC_FOURCC('s','p','d','i')
#define VLC_CODEC_SPDIFB   VLC_FOURCC('s','p','d','b')
#define AOUT_FMT_SPDIF(p_format)
#define FIXED32_FRACBITS   28
#define FIXED32_MIN   ((vlc_fixed_t) -0x80000000L)
#define FIXED32_MAX   ((vlc_fixed_t) +0x7fffffffL)
#define FIXED32_ONE   ((vlc_fixed_t) 0x10000000)
#define AOUT_CHAN_CENTER   0x1
#define AOUT_CHAN_LEFT   0x2
#define AOUT_CHAN_RIGHT   0x4
#define AOUT_CHAN_REARCENTER   0x10
#define AOUT_CHAN_REARLEFT   0x20
#define AOUT_CHAN_REARRIGHT   0x40
#define AOUT_CHAN_MIDDLELEFT   0x100
#define AOUT_CHAN_MIDDLERIGHT   0x200
#define AOUT_CHAN_LFE   0x1000
#define AOUT_CHAN_DOLBYSTEREO   0x10000
#define AOUT_CHAN_DUALMONO   0x20000
#define AOUT_CHAN_REVERSESTEREO   0x40000
#define AOUT_CHAN_PHYSMASK   0xFFFF
#define AOUT_CHAN_MAX   9
#define AOUT_VAR_MONO   1
#define AOUT_VAR_STEREO   2
#define AOUT_VAR_2F2R   4
#define AOUT_VAR_3F2R   5
#define AOUT_VAR_5_1   6
#define AOUT_VAR_6_1   7
#define AOUT_VAR_7_1   8
#define AOUT_VAR_SPDIF   10
#define AOUT_VAR_CHAN_STEREO   1
#define AOUT_VAR_CHAN_RSTEREO   2
#define AOUT_VAR_CHAN_LEFT   3
#define AOUT_VAR_CHAN_RIGHT   4
#define AOUT_VAR_CHAN_DOLBYS   5
#define aout_BufferFree(buffer)   block_Release( buffer )
#define AOUT_SPDIF_SIZE   6144
#define A52_FRAME_NB   1536
#define aout_FormatPrint(o, t, f)   aout_FormatPrint(VLC_OBJECT(o), t, f)

Typedefs

typedef int32_t vlc_fixed_t
typedef int(* aout_volume_cb )(audio_output_t *, float, bool)

Functions

int aout_CheckChannelReorder (const uint32_t *pi_chan_order_in, const uint32_t *pi_chan_order_out, uint32_t i_channel_mask, int i_channels, int *pi_chan_table)
 This function computes the reordering needed to go from pi_chan_order_in to pi_chan_order_out.
void aout_ChannelReorder (uint8_t *, int, int, const int *, int)
bool aout_CheckChannelExtraction (int *pi_selection, uint32_t *pi_layout, int *pi_channels, const uint32_t pi_order_dst[9], const uint32_t *pi_order_src, int i_channels)
 This fonction will compute the extraction parameter into pi_selection to go from i_channels with their type given by pi_order_src[] into the order describe by pi_order_dst.
void aout_ChannelExtract (void *p_dst, int i_dst_channels, const void *p_src, int i_src_channels, int i_sample_count, const int *pi_selection, int i_bits_per_sample)
 Do the actual channels extraction using the parameters created by aout_CheckChannelExtraction.
static unsigned aout_FormatNbChannels (const audio_sample_format_t *fmt)
unsigned int aout_BitsPerSample (vlc_fourcc_t i_format)
void aout_FormatPrepare (audio_sample_format_t *p_format)
void aout_FormatPrint (vlc_object_t *, const char *, const audio_sample_format_t *)
 Prints an audio sample format in a human-readable form.
const char * aout_FormatPrintChannels (const audio_sample_format_t *)
void aout_VolumeNoneInit (audio_output_t *)
 Configures the dummy volume setter.
void aout_VolumeSoftInit (audio_output_t *)
 Configures the volume setter for software mixing and apply the default volume.
void aout_VolumeHardInit (audio_output_t *, aout_volume_cb)
 Configures a custom volume setter.
void aout_VolumeHardSet (audio_output_t *, float, bool)
 Supply or update the current custom ("hardware") volume.
void aout_TimeReport (audio_output_t *, mtime_t)
 Notifies the audio input of the drift from the requested audio playback timestamp (block_t::i_pts) to the anticipated playback time as reported by the audio output hardware.
int aout_ChannelsRestart (vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void *)
vout_thread_taout_filter_RequestVout (filter_t *, vout_thread_t *p_vout, video_format_t *p_fmt)
void aout_PacketInit (audio_output_t *, aout_packet_t *, unsigned)
void aout_PacketDestroy (audio_output_t *)
void aout_PacketPlay (audio_output_t *, block_t *)
void aout_PacketPause (audio_output_t *, bool, mtime_t)
void aout_PacketFlush (audio_output_t *, bool)
block_taout_PacketNext (audio_output_t *, mtime_t)
 Dequeues the next audio packet (a.k.a.

Variables

static const uint32_t pi_vlc_chan_order_wg4 []
 It describes the audio channel order VLC expect.

Detailed Description

This file defines functions, structures and macros for audio output object.


Define Documentation

#define A52_FRAME_NB   1536
#define aout_BufferFree (   buffer  )     block_Release( buffer )
#define AOUT_CHAN_CENTER   0x1
#define AOUT_CHAN_DOLBYSTEREO   0x10000
#define AOUT_CHAN_DUALMONO   0x20000
#define AOUT_CHAN_LEFT   0x2
#define AOUT_CHAN_LFE   0x1000
#define AOUT_CHAN_MAX   9
#define AOUT_CHAN_MIDDLELEFT   0x100
#define AOUT_CHAN_MIDDLERIGHT   0x200
#define AOUT_CHAN_PHYSMASK   0xFFFF
#define AOUT_CHAN_REARCENTER   0x10
#define AOUT_CHAN_REARLEFT   0x20
#define AOUT_CHAN_REARRIGHT   0x40
#define AOUT_CHAN_REVERSESTEREO   0x40000
#define AOUT_CHAN_RIGHT   0x4
#define AOUT_FMT_LINEAR (   p_format  )     (aout_BitsPerSample((p_format)->i_format) != 0)
#define AOUT_FMT_SPDIF (   p_format  ) 
Value:
( ((p_format)->i_format == VLC_CODEC_SPDIFL)       \
       || ((p_format)->i_format == VLC_CODEC_SPDIFB)   \
       || ((p_format)->i_format == VLC_CODEC_A52)       \
       || ((p_format)->i_format == VLC_CODEC_DTS) )
#define AOUT_FMTS_IDENTICAL (   p_first,
  p_second 
)
Value:
(                          \
    ((p_first)->i_format == (p_second)->i_format)                           \
      && AOUT_FMTS_SIMILAR(p_first, p_second) )

Referenced by aout_DecNew(), aout_FiltersCreatePipeline(), aout_InputNew(), and SplitConversion().

#define AOUT_FMTS_SIMILAR (   p_first,
  p_second 
)
Value:
(                            \
    ((p_first)->i_rate == (p_second)->i_rate)                               \
      && ((p_first)->i_physical_channels == (p_second)->i_physical_channels)\
      && ((p_first)->i_original_channels == (p_second)->i_original_channels) )
#define aout_FormatPrint (   o,
  t,
  f 
)    aout_FormatPrint(VLC_OBJECT(o), t, f)

Referenced by aout_InputNew(), and aout_OutputNew().

#define AOUT_MAX_ADVANCE_TIME   (AOUT_MAX_PREPARE_TIME + CLOCK_FREQ)

Referenced by DecoderPlayAudio().

#define AOUT_MAX_FILTERS   10

Referenced by aout_InputNew().

#define AOUT_MAX_PREPARE_TIME   (2 * CLOCK_FREQ)

Referenced by DecoderPlayAudio().

#define AOUT_MAX_PTS_ADVANCE   (CLOCK_FREQ / 25)

Maximum advance of actual audio playback time to coded PTS, above which downsampling will be performed.

Referenced by aout_InputPlay(), aout_PacketNext(), and aout_TimeReport().

#define AOUT_MAX_PTS_DELAY   (3 * CLOCK_FREQ / 50)

Maximum delay of actual audio playback time from coded PTS, above which upsampling will be performed.

Referenced by aout_InputPlay(), aout_PacketNext(), and aout_TimeReport().

#define AOUT_MAX_RESAMPLING   10
#define AOUT_MIN_PREPARE_TIME   AOUT_MAX_PTS_ADVANCE

Referenced by aout_InputPlay().

#define AOUT_SPDIF_SIZE   6144
#define AOUT_VAR_2F2R   4
#define AOUT_VAR_3F2R   5
#define AOUT_VAR_5_1   6
#define AOUT_VAR_6_1   7
#define AOUT_VAR_7_1   8
#define AOUT_VAR_CHAN_DOLBYS   5

Referenced by aout_OutputNew().

#define AOUT_VAR_CHAN_LEFT   3

Referenced by aout_OutputNew().

#define AOUT_VAR_CHAN_RIGHT   4

Referenced by aout_OutputNew().

#define AOUT_VAR_CHAN_RSTEREO   2

Referenced by aout_OutputNew().

#define AOUT_VAR_CHAN_STEREO   1

Referenced by aout_OutputNew().

#define AOUT_VAR_MONO   1
#define AOUT_VAR_SPDIF   10
#define AOUT_VAR_STEREO   2
#define FIXED32_FRACBITS   28
#define FIXED32_MAX   ((vlc_fixed_t) +0x7fffffffL)
#define FIXED32_MIN   ((vlc_fixed_t) -0x80000000L)
#define FIXED32_ONE   ((vlc_fixed_t) 0x10000000)
#define VLC_CODEC_SPDIFB   VLC_FOURCC('s','p','d','b')
#define VLC_CODEC_SPDIFL   VLC_FOURCC('s','p','d','i')

Typedef Documentation

typedef int(* aout_volume_cb)(audio_output_t *, float, bool)
typedef int32_t vlc_fixed_t

Function Documentation

unsigned int aout_BitsPerSample ( vlc_fourcc_t  i_format  ) 
void aout_ChannelExtract ( void *  p_dst,
int  i_dst_channels,
const void *  p_src,
int  i_src_channels,
int  i_sample_count,
const int *  pi_selection,
int  i_bits_per_sample 
)

Do the actual channels extraction using the parameters created by aout_CheckChannelExtraction.

XXX this function does not work in place (p_dst and p_src must not overlap). XXX Only 8, 16, 24, 32, 64 bits per sample are supported.

References ExtractChannel().

void aout_ChannelReorder ( uint8_t *  ,
int  ,
int  ,
const int *  ,
int   
)

References AOUT_CHAN_MAX.

int aout_ChannelsRestart ( vlc_object_t ,
const char *  ,
vlc_value_t  ,
vlc_value_t  ,
void *   
)

References aout_RequestRestart(), and var_Destroy.

Referenced by aout_OutputNew().

bool aout_CheckChannelExtraction ( int *  pi_selection,
uint32_t *  pi_layout,
int *  pi_channels,
const uint32_t  pi_order_dst[9],
const uint32_t *  pi_order_src,
int  i_channels 
)

This fonction will compute the extraction parameter into pi_selection to go from i_channels with their type given by pi_order_src[] into the order describe by pi_order_dst.

It will also set :

  • *pi_channels as the number of channels that will be extracted which is lower (in case of non understood channels type) or equal to i_channels.
  • the layout of the channels (*pi_layout).

It will return true if channel extraction is really needed, in which case aout_ChannelExtract must be used

XXX It must be used when the source may have channel type not understood by VLC. In this case the channel type pi_order_src[] must be set to 0. XXX It must also be used if multiple channels have the same type.

References AOUT_CHAN_CENTER, AOUT_CHAN_RIGHT, and pi_vlc_chan_order_wg4.

int aout_CheckChannelReorder ( const uint32_t *  pi_chan_order_in,
const uint32_t *  pi_chan_order_out,
uint32_t  i_channel_mask,
int  i_channels,
int *  pi_chan_table 
)

This function computes the reordering needed to go from pi_chan_order_in to pi_chan_order_out.

If pi_chan_order_in or pi_chan_order_out is NULL, it will assume that vlc internal (WG4) order is requested.

References AOUT_CHAN_MAX, and pi_vlc_chan_order_wg4.

vout_thread_t* aout_filter_RequestVout ( filter_t ,
vout_thread_t p_vout,
video_format_t p_fmt 
)
static unsigned aout_FormatNbChannels ( const audio_sample_format_t fmt  )  [inline, static]
void aout_FormatPrepare ( audio_sample_format_t p_format  ) 
void aout_FormatPrint ( vlc_object_t ,
const char *  ,
const audio_sample_format_t  
)
const char* aout_FormatPrintChannels ( const audio_sample_format_t  ) 
void aout_PacketDestroy ( audio_output_t  ) 
void aout_PacketFlush ( audio_output_t ,
bool   
)
void aout_PacketInit ( audio_output_t ,
aout_packet_t ,
unsigned   
)
block_t* aout_PacketNext ( audio_output_t p_aout,
mtime_t  start_date 
)

Dequeues the next audio packet (a.k.a.

audio fragment). The audio output plugin must first call aout_PacketPlay() to queue the decoded audio samples. Typically, audio_output_t.pf_play is set to, or calls aout_PacketPlay().

Note:
This function is considered legacy. Please do not use this function in new audio output plugins.
Parameters:
p_aout audio output instance
start_date expected PTS of the audio packet

References aout_FifoMoveDates(), aout_FifoPop(), AOUT_FMT_LINEAR, AOUT_MAX_PTS_ADVANCE, AOUT_MAX_PTS_DELAY, aout_packet(), block_Release(), aout_packet_t::fifo, audio_output::format, block_t::i_length, block_t::i_pts, aout_packet_t::lock, mdate(), msg_Dbg, msg_Warn, aout_fifo_t::p_first, aout_packet_t::partial, aout_packet_t::pause_date, aout_packet_t::starving, aout_packet_t::time_report, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_TS_INVALID.

void aout_PacketPause ( audio_output_t ,
bool  ,
mtime_t   
)
void aout_PacketPlay ( audio_output_t ,
block_t  
)
void aout_TimeReport ( audio_output_t aout,
mtime_t  ideal 
)

Notifies the audio input of the drift from the requested audio playback timestamp (block_t::i_pts) to the anticipated playback time as reported by the audio output hardware.

Depending on the drift amplitude, the input core may ignore the drift trigger upsampling or downsampling, or even discard samples. Future VLC versions may instead adjust the input decoding speed.

The audio output plugin is responsible for estimating the ideal current playback time defined as follows: ideal time = buffer timestamp - (output latency + pending buffer duration)

Practically, this is the PTS (block_t.i_pts) of the current buffer minus the latency reported by the output programming interface. Computing the estimated drift directly would probably be more intuitive. However the use of an absolute time value does not introduce extra measurement errors due to the CPU scheduling jitter and clock resolution. Furthermore, the ideal while it is an abstract value, is easy for most audio output plugins to compute. The following definition is equivalent but depends on the clock time: ideal time = real time + drift

Note:
If aout_LatencyReport() is never called, the core will assume that there is no drift.
Parameters:
ideal estimated ideal time as defined above.

References aout_assert_locked, AOUT_MAX_PTS_ADVANCE, AOUT_MAX_PTS_DELAY, aout_owner(), aout_owner_t::date, date_Get(), date_Move(), mdate(), msg_Warn, aout_owner_t::sync, and VLC_TS_INVALID.

Referenced by aout_PacketPlay().

void aout_VolumeHardInit ( audio_output_t aout,
aout_volume_cb  setter 
)

Configures a custom volume setter.

This is used by audio outputs that can control the hardware volume directly and/or emulate it internally.

Parameters:
setter volume setter callback

References aout_assert_locked, audio_output::pf_volume_set, var_Create, VLC_VAR_BOOL, VLC_VAR_DOINHERIT, and VLC_VAR_INTEGER.

void aout_VolumeHardSet ( audio_output_t aout,
float  volume,
bool  mute 
)

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

Note:
This only makes sense after calling aout_VolumeHardInit().
Parameters:
setter volume setter callback
volume current custom volume
mute current mute flag
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.pf_volume_set callback. This ensures that VLC gets correct volume information (possibly with a latency).

References AOUT_VOLUME_DEFAULT, var_SetBool, var_SetInteger, and var_TriggerCallback.

void aout_VolumeNoneInit ( audio_output_t aout  ) 

Configures the dummy volume setter.

Note:
Audio output plugins for which volume is irrelevant should call this function during activation.

References audio_output::pf_volume_set, and var_Destroy.

Referenced by aout_New(), and aout_OutputDelete().

void aout_VolumeSoftInit ( audio_output_t aout  ) 

Configures the volume setter for software mixing and apply the default volume.

Note:
Audio output plugins that cannot apply the volume should call this function during activation.

References aout_assert_locked, AOUT_VOLUME_DEFAULT, aout_VolumeSoftSet(), audio_output::pf_volume_set, var_InheritBool, and var_InheritInteger.


Variable Documentation

const uint32_t pi_vlc_chan_order_wg4[] [static]
Initial value:
{
     0x2 ,  0x4 ,
     0x100 ,  0x200 ,
     0x20 ,  0x40 ,  0x10 ,
     0x1 ,  0x1000 , 0
}

It describes the audio channel order VLC expect.

Referenced by aout_CheckChannelExtraction(), and aout_CheckChannelReorder().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines