annotate ffmpeg/libavresample/audio_mix.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 * Copyright (c) 2012 Justin Ruggles <justin.ruggles@gmail.com>
yading@11 3 *
yading@11 4 * This file is part of Libav.
yading@11 5 *
yading@11 6 * Libav is free software; you can redistribute it and/or
yading@11 7 * modify it under the terms of the GNU Lesser General Public
yading@11 8 * License as published by the Free Software Foundation; either
yading@11 9 * version 2.1 of the License, or (at your option) any later version.
yading@11 10 *
yading@11 11 * Libav is distributed in the hope that it will be useful,
yading@11 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
yading@11 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
yading@11 14 * Lesser General Public License for more details.
yading@11 15 *
yading@11 16 * You should have received a copy of the GNU Lesser General Public
yading@11 17 * License along with Libav; if not, write to the Free Software
yading@11 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
yading@11 19 */
yading@11 20
yading@11 21 #ifndef AVRESAMPLE_AUDIO_MIX_H
yading@11 22 #define AVRESAMPLE_AUDIO_MIX_H
yading@11 23
yading@11 24 #include <stdint.h>
yading@11 25
yading@11 26 #include "libavutil/samplefmt.h"
yading@11 27 #include "avresample.h"
yading@11 28 #include "internal.h"
yading@11 29 #include "audio_data.h"
yading@11 30
yading@11 31 typedef void (mix_func)(uint8_t **src, void **matrix, int len, int out_ch,
yading@11 32 int in_ch);
yading@11 33
yading@11 34 /**
yading@11 35 * Set mixing function if the parameters match.
yading@11 36 *
yading@11 37 * This compares the parameters of the mixing function to the parameters in the
yading@11 38 * AudioMix context. If the parameters do not match, no changes are made to the
yading@11 39 * active functions. If the parameters do match and the alignment is not
yading@11 40 * constrained, the function is set as the generic mixing function. If the
yading@11 41 * parameters match and the alignment is constrained, the function is set as
yading@11 42 * the optimized mixing function.
yading@11 43 *
yading@11 44 * @param am AudioMix context
yading@11 45 * @param fmt input/output sample format
yading@11 46 * @param coeff_type mixing coefficient type
yading@11 47 * @param in_channels number of input channels, or 0 for any number of channels
yading@11 48 * @param out_channels number of output channels, or 0 for any number of channels
yading@11 49 * @param ptr_align buffer pointer alignment, in bytes
yading@11 50 * @param samples_align buffer size alignment, in samples
yading@11 51 * @param descr function type description (e.g. "C" or "SSE")
yading@11 52 * @param mix_func mixing function pointer
yading@11 53 */
yading@11 54 void ff_audio_mix_set_func(AudioMix *am, enum AVSampleFormat fmt,
yading@11 55 enum AVMixCoeffType coeff_type, int in_channels,
yading@11 56 int out_channels, int ptr_align, int samples_align,
yading@11 57 const char *descr, void *mix_func);
yading@11 58
yading@11 59 /**
yading@11 60 * Allocate and initialize an AudioMix context.
yading@11 61 *
yading@11 62 * The parameters in the AVAudioResampleContext are used to initialize the
yading@11 63 * AudioMix context.
yading@11 64 *
yading@11 65 * @param avr AVAudioResampleContext
yading@11 66 * @return newly-allocated AudioMix context.
yading@11 67 */
yading@11 68 AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr);
yading@11 69
yading@11 70 /**
yading@11 71 * Free an AudioMix context.
yading@11 72 */
yading@11 73 void ff_audio_mix_free(AudioMix **am);
yading@11 74
yading@11 75 /**
yading@11 76 * Apply channel mixing to audio data using the current mixing matrix.
yading@11 77 */
yading@11 78 int ff_audio_mix(AudioMix *am, AudioData *src);
yading@11 79
yading@11 80 /**
yading@11 81 * Get the current mixing matrix.
yading@11 82 */
yading@11 83 int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride);
yading@11 84
yading@11 85 /**
yading@11 86 * Set the current mixing matrix.
yading@11 87 */
yading@11 88 int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride);
yading@11 89
yading@11 90 /* arch-specific initialization functions */
yading@11 91
yading@11 92 void ff_audio_mix_init_x86(AudioMix *am);
yading@11 93
yading@11 94 #endif /* AVRESAMPLE_AUDIO_MIX_H */