/*1* Copyright (c) 2012 Justin Ruggles <[email protected]>2*3* This file is part of FFmpeg.4*5* FFmpeg is free software; you can redistribute it and/or6* modify it under the terms of the GNU Lesser General Public7* License as published by the Free Software Foundation; either8* version 2.1 of the License, or (at your option) any later version.9*10* FFmpeg is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU13* Lesser General Public License for more details.14*15* You should have received a copy of the GNU Lesser General Public16* License along with FFmpeg; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920#ifndef AVRESAMPLE_AUDIO_MIX_H21#define AVRESAMPLE_AUDIO_MIX_H2223#include <stdint.h>2425#include "libavutil/samplefmt.h"26#include "avresample.h"27#include "internal.h"28#include "audio_data.h"2930typedef void (mix_func)(uint8_t **src, void **matrix, int len, int out_ch,31int in_ch);3233/**34* Set mixing function if the parameters match.35*36* This compares the parameters of the mixing function to the parameters in the37* AudioMix context. If the parameters do not match, no changes are made to the38* active functions. If the parameters do match and the alignment is not39* constrained, the function is set as the generic mixing function. If the40* parameters match and the alignment is constrained, the function is set as41* the optimized mixing function.42*43* @param am AudioMix context44* @param fmt input/output sample format45* @param coeff_type mixing coefficient type46* @param in_channels number of input channels, or 0 for any number of channels47* @param out_channels number of output channels, or 0 for any number of channels48* @param ptr_align buffer pointer alignment, in bytes49* @param samples_align buffer size alignment, in samples50* @param descr function type description (e.g. "C" or "SSE")51* @param mix_func mixing function pointer52*/53void ff_audio_mix_set_func(AudioMix *am, enum AVSampleFormat fmt,54enum AVMixCoeffType coeff_type, int in_channels,55int out_channels, int ptr_align, int samples_align,56const char *descr, void *mix_func);5758/**59* Allocate and initialize an AudioMix context.60*61* The parameters in the AVAudioResampleContext are used to initialize the62* AudioMix context.63*64* @param avr AVAudioResampleContext65* @return newly-allocated AudioMix context.66*/67AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr);6869/**70* Free an AudioMix context.71*/72void ff_audio_mix_free(AudioMix **am);7374/**75* Apply channel mixing to audio data using the current mixing matrix.76*/77int ff_audio_mix(AudioMix *am, AudioData *src);7879/**80* Get the current mixing matrix.81*/82int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride);8384/**85* Set the current mixing matrix.86*/87int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride);8889/* arch-specific initialization functions */9091void ff_audio_mix_init_x86(AudioMix *am);9293#endif /* AVRESAMPLE_AUDIO_MIX_H */949596