libgpac
Documentation of the core library of GPAC
audio_mixer.c File Reference
+ Include dependency graph for audio_mixer.c:

Data Structures

struct  MixerInput
 
struct  GF_AudioMixer
 

Macros

#define swap_16(x)   (( (x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff))
 
#define swap_32(x)   (swap_16(x) << 16 | swap_16((x) >> 16))
 
#define swap_64(x)   ( swap_32(x) << 32 | swap_32((x) >> 32))
 
#define GF_S24_MAX   8388607
 
#define GF_S24_MIN   -8388608
 
#define MIX_S16_SCALE   65535
 
#define MIX_S24_SCALE   255
 
#define MIX_U8_SCALE   16777215
 
#define TRUNC_FLT_DBL(_a)
 
#define RESAMPLE_SCALER   1000
 

Functions

GF_EXPORT GF_AudioMixer * gf_mixer_new (struct _audio_render *ar)
 
Bool gf_mixer_must_reconfig (GF_AudioMixer *am)
 
void gf_mixer_set_max_speed (GF_AudioMixer *am, Double max_speed)
 
GF_EXPORT void gf_mixer_del (GF_AudioMixer *am)
 
void gf_mixer_remove_all (GF_AudioMixer *am)
 
Bool gf_mixer_is_src_present (GF_AudioMixer *am, GF_AudioInterface *ifce)
 
u32 gf_mixer_get_src_count (GF_AudioMixer *am)
 
GF_Err gf_mixer_force_channel_out (GF_AudioMixer *am, u32 num_channels)
 
u32 gf_mixer_get_block_align (GF_AudioMixer *am)
 
GF_EXPORT void gf_mixer_lock (GF_AudioMixer *am, Bool lockIt)
 
GF_EXPORT Bool gf_mixer_empty (GF_AudioMixer *am)
 
GF_EXPORT Bool gf_mixer_buffering (GF_AudioMixer *am)
 
GF_EXPORT Bool gf_mixer_is_eos (GF_AudioMixer *am)
 
GF_EXPORT void gf_mixer_add_input (GF_AudioMixer *am, GF_AudioInterface *src)
 
void gf_mixer_remove_input (GF_AudioMixer *am, GF_AudioInterface *src)
 
static GF_Err get_best_samplerate (GF_AudioMixer *am, u32 *out_sr, u32 *out_ch, u32 *out_fmt)
 
GF_EXPORT void gf_mixer_get_config (GF_AudioMixer *am, u32 *outSR, u32 *outCH, u32 *outFMT, u64 *outChCfg)
 
GF_EXPORT GF_Err gf_mixer_set_config (GF_AudioMixer *am, u32 outSR, u32 outCH, u32 outFMT, u64 outChCfg)
 
static GFINLINE s32 make_s24_int (u8 *ptr)
 
static GFINLINE s32 make_s24_be_int (u8 *ptr)
 
s32 input_sample_s32 (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s32p (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s32_be (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s24 (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s24p (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s24_be (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_flt (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_fltp (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_flt_be (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_dbl (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_dblp (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_dbl_be (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s16 (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s16_be (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_s16p (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_u8 (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_u8p (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
s32 input_sample_null (u8 *data, u32 nb_ch, u32 sample_offset, u32 channel, u32 planar_stride)
 
static void gf_am_configure_source (MixerInput *in)
 
GF_EXPORT Bool gf_mixer_reconfig (GF_AudioMixer *am)
 
static GFINLINE u32 get_channel_out_pos (u32 in_ch, u64 out_ch_layout)
 
static GFINLINE void gf_mixer_map_channels (s32 *inChan, u32 nb_in, u64 in_ch_layout, Bool forced_layout, u32 nb_out, u64 out_ch_layout)
 
static void gf_mixer_fetch_input (GF_AudioMixer *am, MixerInput *in, u32 audio_delay)
 
GF_EXPORT u32 gf_mixer_get_output (GF_AudioMixer *am, void *buffer, u32 buffer_size, u32 delay)
 

Data Structure Documentation

◆ __audiomix

struct __audiomix
Data Fields
GF_List * sources
u32 sample_rate
u32 nb_channels
u32 afmt
u32 bit_depth
u64 channel_layout
GF_Mutex * mx
Bool force_channel_out
Bool must_reconfig
Bool isEmpty
Bool source_buffering
u32 nb_eos
struct _audio_render * ar
Fixed max_speed
s32 * output
u32 output_size

Macro Definition Documentation

◆ swap_16

#define swap_16 (   x)    (( (x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff))

◆ swap_32

#define swap_32 (   x)    (swap_16(x) << 16 | swap_16((x) >> 16))

◆ swap_64

#define swap_64 (   x)    ( swap_32(x) << 32 | swap_32((x) >> 32))

◆ GF_S24_MAX

#define GF_S24_MAX   8388607

◆ GF_S24_MIN

#define GF_S24_MIN   -8388608

◆ MIX_S16_SCALE

#define MIX_S16_SCALE   65535

◆ MIX_S24_SCALE

#define MIX_S24_SCALE   255

◆ MIX_U8_SCALE

#define MIX_U8_SCALE   16777215

◆ TRUNC_FLT_DBL

#define TRUNC_FLT_DBL (   _a)
Value:
if (_a<-1.0) return GF_INT_MIN;\
else if (_a>1.0) return GF_INT_MAX;\
return (s32) (_a * GF_INT_MAX);\
int32_t s32
Definition: setup.h:328
#define GF_INT_MAX
Definition: setup.h:443
#define GF_INT_MIN
Definition: setup.h:445

◆ RESAMPLE_SCALER

#define RESAMPLE_SCALER   1000

Function Documentation

◆ gf_mixer_new()

GF_EXPORT GF_AudioMixer* gf_mixer_new ( struct _audio_render *  ar)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_must_reconfig()

Bool gf_mixer_must_reconfig ( GF_AudioMixer *  am)
+ Here is the caller graph for this function:

◆ gf_mixer_set_max_speed()

void gf_mixer_set_max_speed ( GF_AudioMixer *  am,
Double  max_speed 
)
+ Here is the caller graph for this function:

◆ gf_mixer_del()

GF_EXPORT void gf_mixer_del ( GF_AudioMixer *  am)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_remove_all()

void gf_mixer_remove_all ( GF_AudioMixer *  am)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_is_src_present()

Bool gf_mixer_is_src_present ( GF_AudioMixer *  am,
GF_AudioInterface ifce 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_get_src_count()

u32 gf_mixer_get_src_count ( GF_AudioMixer *  am)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_force_channel_out()

GF_Err gf_mixer_force_channel_out ( GF_AudioMixer *  am,
u32  num_channels 
)
+ Here is the caller graph for this function:

◆ gf_mixer_get_block_align()

u32 gf_mixer_get_block_align ( GF_AudioMixer *  am)
+ Here is the caller graph for this function:

◆ gf_mixer_lock()

GF_EXPORT void gf_mixer_lock ( GF_AudioMixer *  am,
Bool  lockIt 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_empty()

GF_EXPORT Bool gf_mixer_empty ( GF_AudioMixer *  am)
+ Here is the caller graph for this function:

◆ gf_mixer_buffering()

GF_EXPORT Bool gf_mixer_buffering ( GF_AudioMixer *  am)
+ Here is the caller graph for this function:

◆ gf_mixer_is_eos()

GF_EXPORT Bool gf_mixer_is_eos ( GF_AudioMixer *  am)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_add_input()

GF_EXPORT void gf_mixer_add_input ( GF_AudioMixer *  am,
GF_AudioInterface src 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_remove_input()

void gf_mixer_remove_input ( GF_AudioMixer *  am,
GF_AudioInterface src 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_best_samplerate()

static GF_Err get_best_samplerate ( GF_AudioMixer *  am,
u32 out_sr,
u32 out_ch,
u32 out_fmt 
)
static
+ Here is the caller graph for this function:

◆ gf_mixer_get_config()

GF_EXPORT void gf_mixer_get_config ( GF_AudioMixer *  am,
u32 outSR,
u32 outCH,
u32 outFMT,
u64 outChCfg 
)
+ Here is the caller graph for this function:

◆ gf_mixer_set_config()

GF_EXPORT GF_Err gf_mixer_set_config ( GF_AudioMixer *  am,
u32  outSR,
u32  outCH,
u32  outFMT,
u64  outChCfg 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_s24_int()

static GFINLINE s32 make_s24_int ( u8 ptr)
static
+ Here is the caller graph for this function:

◆ make_s24_be_int()

static GFINLINE s32 make_s24_be_int ( u8 ptr)
static
+ Here is the caller graph for this function:

◆ input_sample_s32()

s32 input_sample_s32 ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_s32p()

s32 input_sample_s32p ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_s32_be()

s32 input_sample_s32_be ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_s24()

s32 input_sample_s24 ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ input_sample_s24p()

s32 input_sample_s24p ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ input_sample_s24_be()

s32 input_sample_s24_be ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ input_sample_flt()

s32 input_sample_flt ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_fltp()

s32 input_sample_fltp ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_flt_be()

s32 input_sample_flt_be ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_dbl()

s32 input_sample_dbl ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_dblp()

s32 input_sample_dblp ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_dbl_be()

s32 input_sample_dbl_be ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_s16()

s32 input_sample_s16 ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_s16_be()

s32 input_sample_s16_be ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_s16p()

s32 input_sample_s16p ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_u8()

s32 input_sample_u8 ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_u8p()

s32 input_sample_u8p ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ input_sample_null()

s32 input_sample_null ( u8 data,
u32  nb_ch,
u32  sample_offset,
u32  channel,
u32  planar_stride 
)
+ Here is the caller graph for this function:

◆ gf_am_configure_source()

static void gf_am_configure_source ( MixerInput in)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_reconfig()

GF_EXPORT Bool gf_mixer_reconfig ( GF_AudioMixer *  am)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_channel_out_pos()

static GFINLINE u32 get_channel_out_pos ( u32  in_ch,
u64  out_ch_layout 
)
static
+ Here is the caller graph for this function:

◆ gf_mixer_map_channels()

static GFINLINE void gf_mixer_map_channels ( s32 inChan,
u32  nb_in,
u64  in_ch_layout,
Bool  forced_layout,
u32  nb_out,
u64  out_ch_layout 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_fetch_input()

static void gf_mixer_fetch_input ( GF_AudioMixer *  am,
MixerInput in,
u32  audio_delay 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_mixer_get_output()

GF_EXPORT u32 gf_mixer_get_output ( GF_AudioMixer *  am,
void *  buffer,
u32  buffer_size,
u32  delay 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function: