annotate ffmpeg/libswresample/audioconvert.h @ 13:844d341cf643 tip

Back up before ISMIR
author Yading Song <yading.song@eecs.qmul.ac.uk>
date Thu, 31 Oct 2013 13:17:06 +0000
parents f445c3017523
children
rev   line source
yading@11 1 /*
yading@11 2 * audio conversion
yading@11 3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
yading@11 4 * Copyright (c) 2008 Peter Ross
yading@11 5 *
yading@11 6 * This file is part of FFmpeg.
yading@11 7 *
yading@11 8 * FFmpeg is free software; you can redistribute it and/or
yading@11 9 * modify it under the terms of the GNU Lesser General Public
yading@11 10 * License as published by the Free Software Foundation; either
yading@11 11 * version 2.1 of the License, or (at your option) any later version.
yading@11 12 *
yading@11 13 * FFmpeg is distributed in the hope that it will be useful,
yading@11 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 16 * Lesser General Public License for more details.
yading@11 17 *
yading@11 18 * You should have received a copy of the GNU Lesser General Public
yading@11 19 * License along with FFmpeg; if not, write to the Free Software
yading@11 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 21 */
yading@11 22
yading@11 23 #ifndef SWR_AUDIOCONVERT_H
yading@11 24 #define SWR_AUDIOCONVERT_H
yading@11 25
yading@11 26 /**
yading@11 27 * @file
yading@11 28 * Audio format conversion routines
yading@11 29 */
yading@11 30
yading@11 31
yading@11 32 #include "swresample_internal.h"
yading@11 33 #include "libavutil/cpu.h"
yading@11 34
yading@11 35
yading@11 36 typedef void (conv_func_type)(uint8_t *po, const uint8_t *pi, int is, int os, uint8_t *end);
yading@11 37 typedef void (simd_func_type)(uint8_t **dst, const uint8_t **src, int len);
yading@11 38
yading@11 39 typedef struct AudioConvert {
yading@11 40 int channels;
yading@11 41 int in_simd_align_mask;
yading@11 42 int out_simd_align_mask;
yading@11 43 conv_func_type *conv_f;
yading@11 44 simd_func_type *simd_f;
yading@11 45 const int *ch_map;
yading@11 46 uint8_t silence[8]; ///< silence input sample
yading@11 47 }AudioConvert;
yading@11 48
yading@11 49 /**
yading@11 50 * Create an audio sample format converter context
yading@11 51 * @param out_fmt Output sample format
yading@11 52 * @param in_fmt Input sample format
yading@11 53 * @param channels Number of channels
yading@11 54 * @param flags See AV_CPU_FLAG_xx
yading@11 55 * @param ch_map list of the channels id to pick from the source stream, NULL
yading@11 56 * if all channels must be selected
yading@11 57 * @return NULL on error
yading@11 58 */
yading@11 59 AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,
yading@11 60 enum AVSampleFormat in_fmt,
yading@11 61 int channels, const int *ch_map,
yading@11 62 int flags);
yading@11 63
yading@11 64 /**
yading@11 65 * Free audio sample format converter context.
yading@11 66 * and set the pointer to NULL
yading@11 67 */
yading@11 68 void swri_audio_convert_free(AudioConvert **ctx);
yading@11 69
yading@11 70 /**
yading@11 71 * Convert between audio sample formats
yading@11 72 * @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel.
yading@11 73 * @param[in] in array of input buffers for each channel
yading@11 74 * @param len length of audio frame size (measured in samples)
yading@11 75 */
yading@11 76 int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len);
yading@11 77
yading@11 78 #endif /* AUDIOCONVERT_H */