30
30
typedef void (mix_func)(uint8_t **src, void **matrix, int len, int out_ch,
33
typedef struct AudioMix {
34
AVAudioResampleContext *avr;
35
enum AVSampleFormat fmt;
36
enum AVMixCoeffType coeff_type;
44
int has_optimized_func;
45
const char *func_descr;
46
const char *func_descr_generic;
48
mix_func *mix_generic;
50
int16_t *matrix_q8[AVRESAMPLE_MAX_CHANNELS];
51
int32_t *matrix_q15[AVRESAMPLE_MAX_CHANNELS];
52
float *matrix_flt[AVRESAMPLE_MAX_CHANNELS];
33
typedef struct AudioMix AudioMix;
57
36
* Set mixing function if the parameters match.
79
58
const char *descr, void *mix_func);
82
* Initialize the AudioMix context in the AVAudioResampleContext.
61
* Allocate and initialize an AudioMix context.
84
63
* The parameters in the AVAudioResampleContext are used to initialize the
85
* AudioMix context and set the mixing matrix.
87
66
* @param avr AVAudioResampleContext
88
* @return 0 on success, negative AVERROR code on failure
67
* @return newly-allocated AudioMix context.
90
int ff_audio_mix_init(AVAudioResampleContext *avr);
69
AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr);
93
* Close an AudioMix context.
95
* This clears and frees the mixing matrix arrays.
72
* Free an AudioMix context.
97
void ff_audio_mix_close(AudioMix *am);
74
void ff_audio_mix_free(AudioMix **am);
100
77
* Apply channel mixing to audio data using the current mixing matrix.
102
79
int ff_audio_mix(AudioMix *am, AudioData *src);
82
* Get the current mixing matrix.
84
int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride);
87
* Set the current mixing matrix.
89
int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride);
104
91
/* arch-specific initialization functions */
106
93
void ff_audio_mix_init_x86(AudioMix *am);