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

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_t * | aout_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_t * | aout_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. | |
This file defines functions, structures and macros for audio output object.
| #define A52_FRAME_NB 1536 |
| #define aout_BufferFree | ( | buffer | ) | block_Release( buffer ) |
| #define AOUT_CHAN_CENTER 0x1 |
Referenced by aout_CheckChannelExtraction(), aout_FormatPrintChannels(), and aout_OutputNew().
| #define AOUT_CHAN_DOLBYSTEREO 0x10000 |
Referenced by aout_FormatPrintChannels(), and aout_OutputNew().
| #define AOUT_CHAN_DUALMONO 0x20000 |
Referenced by aout_FormatPrintChannels(), and aout_OutputNew().
| #define AOUT_CHAN_LEFT 0x2 |
Referenced by aout_FormatPrintChannels(), aout_new_buffer(), and aout_OutputNew().
| #define AOUT_CHAN_LFE 0x1000 |
Referenced by aout_FormatPrintChannels().
| #define AOUT_CHAN_MAX 9 |
Referenced by aout_ChannelReorder(), and aout_CheckChannelReorder().
| #define AOUT_CHAN_MIDDLELEFT 0x100 |
Referenced by aout_FormatPrintChannels().
| #define AOUT_CHAN_MIDDLERIGHT 0x200 |
Referenced by aout_FormatPrintChannels().
| #define AOUT_CHAN_PHYSMASK 0xFFFF |
Referenced by aout_FormatNbChannels(), aout_FormatPrintChannels(), aout_new_buffer(), aout_OutputNew(), and EsOutUpdateInfo().
| #define AOUT_CHAN_REARCENTER 0x10 |
Referenced by aout_FormatPrintChannels().
| #define AOUT_CHAN_REARLEFT 0x20 |
Referenced by aout_FormatPrintChannels().
| #define AOUT_CHAN_REARRIGHT 0x40 |
Referenced by aout_FormatPrintChannels().
| #define AOUT_CHAN_REVERSESTEREO 0x40000 |
Referenced by aout_FormatPrintChannels().
| #define AOUT_CHAN_RIGHT 0x4 |
Referenced by aout_CheckChannelExtraction(), aout_FormatPrintChannels(), aout_new_buffer(), and aout_OutputNew().
| #define AOUT_FMT_LINEAR | ( | p_format | ) | (aout_BitsPerSample((p_format)->i_format) != 0) |
Referenced by aout_InputNew(), aout_OutputNew(), aout_OutputSlice(), aout_PacketNext(), and SplitConversion().
| #define AOUT_FMT_SPDIF | ( | p_format | ) |
( ((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 | ||||
| ) |
( \
((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 | ||||
| ) |
( \
((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 int(* aout_volume_cb)(audio_output_t *, float, bool) |
| typedef int32_t vlc_fixed_t |
| unsigned int aout_BitsPerSample | ( | vlc_fourcc_t | i_format | ) |
References AUDIO_ES, VLC_CODEC_ALAW, VLC_CODEC_F32B, VLC_CODEC_F32L, VLC_CODEC_F64B, VLC_CODEC_F64L, VLC_CODEC_FI32, VLC_CODEC_MULAW, VLC_CODEC_S16B, VLC_CODEC_S16L, VLC_CODEC_S24B, VLC_CODEC_S24L, VLC_CODEC_S32B, VLC_CODEC_S32L, VLC_CODEC_S8, VLC_CODEC_U16B, VLC_CODEC_U16L, VLC_CODEC_U24B, VLC_CODEC_U24L, VLC_CODEC_U8, and vlc_fourcc_GetCodec().
Referenced by aout_FormatPrepare(), and EsOutUpdateInfo().
| 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 :
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] |
References AOUT_CHAN_PHYSMASK, audio_format_t::i_physical_channels, and popcount().
Referenced by aout_DecNew(), and aout_FormatPrepare().
| void aout_FormatPrepare | ( | audio_sample_format_t * | p_format | ) |
References aout_BitsPerSample(), aout_FormatNbChannels(), audio_format_t::i_bitspersample, audio_format_t::i_bytes_per_frame, audio_format_t::i_channels, audio_format_t::i_format, and audio_format_t::i_frame_length.
Referenced by aout_InputNew(), aout_new_buffer(), aout_OutputNew(), and SplitConversion().
| void aout_FormatPrint | ( | vlc_object_t * | , | |
| const char * | , | |||
| const audio_sample_format_t * | ||||
| ) |
Prints an audio sample format in a human-readable form.
References aout_FormatPrintChannels(), audio_format_t::i_bytes_per_frame, audio_format_t::i_format, audio_format_t::i_frame_length, audio_format_t::i_rate, and msg_Dbg.
| const char* aout_FormatPrintChannels | ( | const audio_sample_format_t * | ) |
References AOUT_CHAN_CENTER, AOUT_CHAN_DOLBYSTEREO, AOUT_CHAN_DUALMONO, AOUT_CHAN_LEFT, AOUT_CHAN_LFE, AOUT_CHAN_MIDDLELEFT, AOUT_CHAN_MIDDLERIGHT, AOUT_CHAN_PHYSMASK, AOUT_CHAN_REARCENTER, AOUT_CHAN_REARLEFT, AOUT_CHAN_REARRIGHT, AOUT_CHAN_REVERSESTEREO, AOUT_CHAN_RIGHT, audio_format_t::i_original_channels, and audio_format_t::i_physical_channels.
Referenced by aout_FormatPrint(), aout_FormatsPrint(), and EsOutUpdateInfo().
| 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().
| 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
| 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.
| 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.
| setter | volume setter callback | |
| volume | current custom volume | |
| mute | current mute flag |
References AOUT_VOLUME_DEFAULT, var_SetBool, var_SetInteger, and var_TriggerCallback.
| void aout_VolumeNoneInit | ( | audio_output_t * | aout | ) |
Configures the dummy volume setter.
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.
References aout_assert_locked, AOUT_VOLUME_DEFAULT, aout_VolumeSoftSet(), audio_output::pf_volume_set, var_InheritBool, and var_InheritInteger.
const uint32_t pi_vlc_chan_order_wg4[] [static] |
{
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().
1.7.1