FFmpeg  4.0
Typedefs | Functions
audio_mix.h File Reference
#include <stdint.h>
#include "libavutil/samplefmt.h"
#include "avresample.h"
#include "internal.h"
#include "audio_data.h"

Go to the source code of this file.

Typedefs

typedef void() mix_func(uint8_t **src, void **matrix, int len, int out_ch, int in_ch)
 

Functions

void ff_audio_mix_set_func (AudioMix *am, enum AVSampleFormat fmt, enum AVMixCoeffType coeff_type, int in_channels, int out_channels, int ptr_align, int samples_align, const char *descr, void *mix_func)
 Set mixing function if the parameters match. More...
 
AudioMixff_audio_mix_alloc (AVAudioResampleContext *avr)
 Allocate and initialize an AudioMix context. More...
 
void ff_audio_mix_free (AudioMix **am)
 Free an AudioMix context. More...
 
int ff_audio_mix (AudioMix *am, AudioData *src)
 Apply channel mixing to audio data using the current mixing matrix. More...
 
int ff_audio_mix_get_matrix (AudioMix *am, double *matrix, int stride)
 Get the current mixing matrix. More...
 
int ff_audio_mix_set_matrix (AudioMix *am, const double *matrix, int stride)
 Set the current mixing matrix. More...
 
void ff_audio_mix_init_x86 (AudioMix *am)
 

Typedef Documentation

◆ mix_func

typedef void() mix_func(uint8_t **src, void **matrix, int len, int out_ch, int in_ch)

Definition at line 31 of file audio_mix.h.

Function Documentation

◆ ff_audio_mix_set_func()

void ff_audio_mix_set_func ( AudioMix am,
enum AVSampleFormat  fmt,
enum AVMixCoeffType  coeff_type,
int  in_channels,
int  out_channels,
int  ptr_align,
int  samples_align,
const char *  descr,
void mix_func 
)

Set mixing function if the parameters match.

This compares the parameters of the mixing function to the parameters in the AudioMix context. If the parameters do not match, no changes are made to the active functions. If the parameters do match and the alignment is not constrained, the function is set as the generic mixing function. If the parameters match and the alignment is constrained, the function is set as the optimized mixing function.

Parameters
amAudioMix context
fmtinput/output sample format
coeff_typemixing coefficient type
in_channelsnumber of input channels, or 0 for any number of channels
out_channelsnumber of output channels, or 0 for any number of channels
ptr_alignbuffer pointer alignment, in bytes
samples_alignbuffer size alignment, in samples
descrfunction type description (e.g. "C" or "SSE")
mix_funcmixing function pointer

Definition at line 61 of file audio_mix.c.

Referenced by ff_audio_mix_init_x86(), and mix_function_init().

◆ ff_audio_mix_alloc()

AudioMix* ff_audio_mix_alloc ( AVAudioResampleContext avr)

Allocate and initialize an AudioMix context.

The parameters in the AVAudioResampleContext are used to initialize the AudioMix context.

Parameters
avrAVAudioResampleContext
Returns
newly-allocated AudioMix context.

Definition at line 341 of file audio_mix.c.

Referenced by avresample_open().

◆ ff_audio_mix_free()

void ff_audio_mix_free ( AudioMix **  am)

Free an AudioMix context.

Definition at line 409 of file audio_mix.c.

Referenced by avresample_close().

◆ ff_audio_mix()

int ff_audio_mix ( AudioMix am,
AudioData src 
)

Apply channel mixing to audio data using the current mixing matrix.

Definition at line 428 of file audio_mix.c.

Referenced by avresample_convert().

◆ ff_audio_mix_get_matrix()

int ff_audio_mix_get_matrix ( AudioMix am,
double *  matrix,
int  stride 
)

Get the current mixing matrix.

Definition at line 483 of file audio_mix.c.

Referenced by avresample_get_matrix().

◆ ff_audio_mix_set_matrix()

int ff_audio_mix_set_matrix ( AudioMix am,
const double *  matrix,
int  stride 
)

Set the current mixing matrix.

Definition at line 653 of file audio_mix.c.

Referenced by avresample_set_matrix(), and ff_audio_mix_alloc().

◆ ff_audio_mix_init_x86()

void ff_audio_mix_init_x86 ( AudioMix am)

Definition at line 174 of file audio_mix_init.c.

Referenced by mix_function_init().