VLC 4.0.0-dev
Loading...
Searching...
No Matches
common.c File Reference
Include dependency graph for common.c:

Macros

#define REORDER_TYPE(type)
 
#define INTERLEAVE_TYPE(type)
 
#define DEINTERLEAVE_TYPE(type)
 

Functions

unsigned int aout_BitsPerSample (vlc_fourcc_t i_format)
 
void aout_FormatPrepare (audio_sample_format_t *p_format)
 
const char * aout_FormatPrintChannels (const audio_sample_format_t *p_format)
 
void aout_FormatPrint (vlc_object_t *obj, const char *psz_text, const audio_sample_format_t *p_format)
 Prints an audio sample format in a human-readable form.
 
void aout_FormatsPrint (vlc_object_t *obj, const char *psz_text, const audio_sample_format_t *p_format1, const audio_sample_format_t *p_format2)
 Prints two formats in a human-readable form.
 
unsigned aout_CheckChannelReorder (const uint32_t *chans_in, const uint32_t *chans_out, uint32_t mask, uint8_t *restrict table)
 
void aout_ChannelReorder (void *ptr, size_t bytes, uint8_t channels, const uint8_t *restrict chans_table, vlc_fourcc_t fourcc)
 
void aout_Interleave (void *restrict dst, const void *const *srcv, unsigned samples, unsigned chans, vlc_fourcc_t fourcc)
 Interleaves audio samples within a block of samples.
 
void aout_Deinterleave (void *restrict dst, const void *restrict src, unsigned samples, unsigned chans, vlc_fourcc_t fourcc)
 Deinterleaves audio samples within a block of samples.
 
static void ExtractChannel (uint8_t *pi_dst, int i_dst_channels, const uint8_t *pi_src, int i_src_channels, int i_sample_count, const int *pi_selection, int i_bytes)
 
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.
 
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 function 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.
 
static int FilterOrder (const char *psz_name)
 
int aout_EnableFilter (audio_output_t *p_aout, const char *psz_name, bool b_add)
 Enable or disable an audio filter ("audio-filter")
 

Macro Definition Documentation

◆ DEINTERLEAVE_TYPE

#define DEINTERLEAVE_TYPE (   type)
Value:
do { \
type *d = dst; \
const type *s = src; \
for( size_t i = 0; i < chans; i++ ) { \
for( size_t j = 0, k = 0; j < samples; j++, k += chans ) \
*(d++) = s[k]; \
s++; \
} \
} while(0)

◆ INTERLEAVE_TYPE

#define INTERLEAVE_TYPE (   type)
Value:
do { \
type *d = dst; \
for( size_t i = 0; i < chans; i++ ) { \
const type *s = srcv[i]; \
for( size_t j = 0, k = 0; j < samples; j++, k += chans ) \
d[k] = *(s++); \
d++; \
} \
} while(0)

◆ REORDER_TYPE

#define REORDER_TYPE (   type)
Value:
do { \
const size_t frames = (bytes / sizeof (type)) / channels; \
type *buf = ptr; \
\
for( size_t i = 0; i < frames; i++ ) \
{ \
type tmp[AOUT_CHAN_MAX]; \
\
for( size_t j = 0; j < channels; j++ ) \
tmp[chans_table[j]] = buf[j]; \
memcpy( buf, tmp, sizeof (type) * channels ); \
buf += channels; \
} \
} while(0)
#define AOUT_CHAN_MAX
Definition vlc_es.h:154

Function Documentation

◆ aout_ChannelReorder()

void aout_ChannelReorder ( void *  ptr,
size_t  bytes,
uint8_t  channels,
const uint8_t *restrict  chans_table,
vlc_fourcc_t  fourcc 
)

◆ aout_CheckChannelReorder()

unsigned aout_CheckChannelReorder ( const uint32_t *  chans_in,
const uint32_t *  chans_out,
uint32_t  mask,
uint8_t *restrict  table 
)

References AOUT_CHAN_MAX, and pi_vlc_chan_order_wg4.

Referenced by rtp_pcm_open().

◆ aout_Deinterleave()

void aout_Deinterleave ( void *restrict  dst,
const void *restrict  src,
unsigned  samples,
unsigned  chans,
vlc_fourcc_t  fourcc 
)

Deinterleaves audio samples within a block of samples.

Parameters
dstdestination buffer for planar samples
srcsource buffer with interleaved samples
samplesnumber of samples (per channel/per plane)
chanschannels/planes count
fourccsample format (must be a linear sample format)
Note
The samples must be naturally aligned in memory.
Warning
Destination and source buffers MUST NOT overlap.

References DEINTERLEAVE_TYPE, vlc_assert_unreachable, VLC_CODEC_FL32, VLC_CODEC_FL64, VLC_CODEC_S16N, VLC_CODEC_S32N, and VLC_CODEC_U8.

◆ aout_FormatsPrint()

void aout_FormatsPrint ( vlc_object_t obj,
const char *  psz_text,
const audio_sample_format_t p_format1,
const audio_sample_format_t p_format2 
)

Prints two formats in a human-readable form.

References aout_FormatPrintChannels(), audio_format_t::i_format, audio_format_t::i_rate, and msg_Dbg.

◆ aout_Interleave()

void aout_Interleave ( void *restrict  dst,
const void *const *  srcv,
unsigned  samples,
unsigned  chans,
vlc_fourcc_t  fourcc 
)

Interleaves audio samples within a block of samples.

Parameters
dstdestination buffer for interleaved samples
srcvsource buffers (one per plane) of uninterleaved samples
samplesnumber of samples (per channel/per plane)
chanschannels/planes count
fourccsample format (must be a linear sample format)
Note
The samples must be naturally aligned in memory.
Warning
Destination and source buffers MUST NOT overlap.

References INTERLEAVE_TYPE, vlc_assert_unreachable, VLC_CODEC_FL32, VLC_CODEC_FL64, VLC_CODEC_S16N, VLC_CODEC_S32N, and VLC_CODEC_U8.

◆ ExtractChannel()

static void ExtractChannel ( uint8_t *  pi_dst,
int  i_dst_channels,
const uint8_t *  pi_src,
int  i_src_channels,
int  i_sample_count,
const int *  pi_selection,
int  i_bytes 
)
inlinestatic

Referenced by aout_ChannelExtract().

◆ FilterOrder()

static int FilterOrder ( const char *  psz_name)
static

References ARRAY_SIZE, and psz_name.

Referenced by aout_EnableFilter().