/*1* audio conversion2* Copyright (c) 2006 Michael Niedermayer <[email protected]>3* Copyright (c) 2008 Peter Ross4*5* This file is part of FFmpeg.6*7* FFmpeg is free software; you can redistribute it and/or8* modify it under the terms of the GNU Lesser General Public9* License as published by the Free Software Foundation; either10* version 2.1 of the License, or (at your option) any later version.11*12* FFmpeg is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU15* Lesser General Public License for more details.16*17* You should have received a copy of the GNU Lesser General Public18* License along with FFmpeg; if not, write to the Free Software19* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA20*/2122#ifndef SWRESAMPLE_AUDIOCONVERT_H23#define SWRESAMPLE_AUDIOCONVERT_H2425/**26* @file27* Audio format conversion routines28*/293031#include "swresample_internal.h"32#include "libavutil/cpu.h"333435typedef void (conv_func_type)(uint8_t *po, const uint8_t *pi, int is, int os, uint8_t *end);36typedef void (simd_func_type)(uint8_t **dst, const uint8_t **src, int len);3738typedef struct AudioConvert {39int channels;40int in_simd_align_mask;41int out_simd_align_mask;42conv_func_type *conv_f;43simd_func_type *simd_f;44const int *ch_map;45uint8_t silence[8]; ///< silence input sample46}AudioConvert;4748/**49* Create an audio sample format converter context50* @param out_fmt Output sample format51* @param in_fmt Input sample format52* @param channels Number of channels53* @param flags See AV_CPU_FLAG_xx54* @param ch_map list of the channels id to pick from the source stream, NULL55* if all channels must be selected56* @return NULL on error57*/58AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,59enum AVSampleFormat in_fmt,60int channels, const int *ch_map,61int flags);6263/**64* Free audio sample format converter context.65* and set the pointer to NULL66*/67void swri_audio_convert_free(AudioConvert **ctx);6869/**70* Convert between audio sample formats71* @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel.72* @param[in] in array of input buffers for each channel73* @param len length of audio frame size (measured in samples)74*/75int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len);7677#endif /* SWRESAMPLE_AUDIOCONVERT_H */787980