2008-07-31 15:55:06 +03:00
|
|
|
/*
|
|
|
|
* audio conversion
|
|
|
|
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
* Copyright (c) 2008 Peter Ross
|
|
|
|
*
|
2011-03-18 19:35:10 +02:00
|
|
|
* This file is part of Libav.
|
2008-07-31 15:55:06 +03:00
|
|
|
*
|
2011-03-18 19:35:10 +02:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2008-07-31 15:55:06 +03:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2011-03-18 19:35:10 +02:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2008-07-31 15:55:06 +03:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2011-03-18 19:35:10 +02:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2008-07-31 15:55:06 +03:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#ifndef AVCODEC_AUDIOCONVERT_H
|
|
|
|
#define AVCODEC_AUDIOCONVERT_H
|
2008-07-31 15:55:06 +03:00
|
|
|
|
|
|
|
/**
|
2010-04-20 17:45:34 +03:00
|
|
|
* @file
|
2008-07-31 15:55:06 +03:00
|
|
|
* Audio format conversion routines
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-09-04 12:59:08 +03:00
|
|
|
#include "libavutil/cpu.h"
|
2008-07-31 15:55:06 +03:00
|
|
|
#include "avcodec.h"
|
2011-02-07 15:37:08 +02:00
|
|
|
#include "libavutil/audioconvert.h"
|
2008-07-31 15:55:06 +03:00
|
|
|
|
2008-11-01 07:03:42 +02:00
|
|
|
/**
|
|
|
|
* Guess the channel layout
|
|
|
|
* @param nb_channels
|
|
|
|
* @param codec_id Codec identifier, or CODEC_ID_NONE if unknown
|
|
|
|
* @param fmt_name Format name, or NULL if unknown
|
|
|
|
* @return Channel layout mask
|
|
|
|
*/
|
2011-11-25 15:51:57 +03:00
|
|
|
uint64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name);
|
2008-11-01 07:03:42 +02:00
|
|
|
|
2008-08-01 16:53:18 +03:00
|
|
|
struct AVAudioConvert;
|
|
|
|
typedef struct AVAudioConvert AVAudioConvert;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an audio sample format converter context
|
|
|
|
* @param out_fmt Output sample format
|
|
|
|
* @param out_channels Number of output channels
|
|
|
|
* @param in_fmt Input sample format
|
|
|
|
* @param in_channels Number of input channels
|
|
|
|
* @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels). Set to NULL to ignore.
|
2010-09-04 12:59:08 +03:00
|
|
|
* @param flags See AV_CPU_FLAG_xx
|
2008-08-01 16:53:18 +03:00
|
|
|
* @return NULL on error
|
|
|
|
*/
|
2010-11-12 13:04:40 +02:00
|
|
|
AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
|
|
|
|
enum AVSampleFormat in_fmt, int in_channels,
|
2008-08-01 16:53:18 +03:00
|
|
|
const float *matrix, int flags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Free audio sample format converter context
|
|
|
|
*/
|
|
|
|
void av_audio_convert_free(AVAudioConvert *ctx);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert between audio sample formats
|
|
|
|
* @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel.
|
2010-05-24 13:11:21 +03:00
|
|
|
* @param[in] out_stride distance between consecutive output samples (measured in bytes)
|
2008-08-01 16:53:18 +03:00
|
|
|
* @param[in] in array of input buffers for each channel
|
2010-05-24 13:11:21 +03:00
|
|
|
* @param[in] in_stride distance between consecutive input samples (measured in bytes)
|
2008-08-01 16:53:18 +03:00
|
|
|
* @param len length of audio frame size (measured in samples)
|
|
|
|
*/
|
|
|
|
int av_audio_convert(AVAudioConvert *ctx,
|
|
|
|
void * const out[6], const int out_stride[6],
|
|
|
|
const void * const in[6], const int in_stride[6], int len);
|
|
|
|
|
2008-08-31 10:39:47 +03:00
|
|
|
#endif /* AVCODEC_AUDIOCONVERT_H */
|