2008-07-31 12:55:06 +00:00
|
|
|
/*
|
|
|
|
* audio conversion
|
|
|
|
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
* Copyright (c) 2008 Peter Ross
|
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* This file is part of Libav.
|
2008-07-31 12:55:06 +00:00
|
|
|
*
|
2011-03-18 17:35:10 +00:00
|
|
|
* Libav is free software; you can redistribute it and/or
|
2008-07-31 12:55:06 +00: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 17:35:10 +00:00
|
|
|
* Libav is distributed in the hope that it will be useful,
|
2008-07-31 12:55:06 +00: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 17:35:10 +00:00
|
|
|
* License along with Libav; if not, write to the Free Software
|
2008-07-31 12:55:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2008-08-31 07:39:47 +00:00
|
|
|
#ifndef AVCODEC_AUDIOCONVERT_H
|
|
|
|
#define AVCODEC_AUDIOCONVERT_H
|
2008-07-31 12:55:06 +00:00
|
|
|
|
|
|
|
/**
|
2010-04-20 14:45:34 +00:00
|
|
|
* @file
|
2008-07-31 12:55:06 +00:00
|
|
|
* Audio format conversion routines
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-09-04 09:59:08 +00:00
|
|
|
#include "libavutil/cpu.h"
|
2008-07-31 12:55:06 +00:00
|
|
|
#include "avcodec.h"
|
2011-02-07 13:37:08 +00:00
|
|
|
#include "libavutil/audioconvert.h"
|
2008-07-31 12:55:06 +00:00
|
|
|
|
2010-11-02 22:08:02 +00:00
|
|
|
#if FF_API_OLD_SAMPLE_FMT
|
2008-07-31 12:55:06 +00:00
|
|
|
/**
|
2010-11-02 22:08:02 +00:00
|
|
|
* @deprecated Use av_get_sample_fmt_string() instead.
|
2008-07-31 12:55:06 +00:00
|
|
|
*/
|
2010-11-02 22:08:02 +00:00
|
|
|
attribute_deprecated
|
2008-07-31 12:55:06 +00:00
|
|
|
void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt);
|
|
|
|
|
|
|
|
/**
|
2010-11-02 22:08:02 +00:00
|
|
|
* @deprecated Use av_get_sample_fmt_name() instead.
|
2008-07-31 12:55:06 +00:00
|
|
|
*/
|
2010-11-02 22:08:02 +00:00
|
|
|
attribute_deprecated
|
2008-07-31 12:55:06 +00:00
|
|
|
const char *avcodec_get_sample_fmt_name(int sample_fmt);
|
|
|
|
|
|
|
|
/**
|
2010-11-02 22:08:02 +00:00
|
|
|
* @deprecated Use av_get_sample_fmt() instead.
|
2008-07-31 12:55:06 +00:00
|
|
|
*/
|
2010-11-02 22:08:02 +00:00
|
|
|
attribute_deprecated
|
2010-11-12 11:04:40 +00:00
|
|
|
enum AVSampleFormat avcodec_get_sample_fmt(const char* name);
|
2010-11-02 22:08:02 +00:00
|
|
|
#endif
|
2008-07-31 12:55:06 +00:00
|
|
|
|
2010-11-21 19:28:52 +00:00
|
|
|
#if FF_API_OLD_AUDIOCONVERT
|
2010-08-26 00:38:25 +00:00
|
|
|
/**
|
2010-11-21 19:28:52 +00:00
|
|
|
* @deprecated Use av_get_channel_layout() instead.
|
2010-08-26 00:38:25 +00:00
|
|
|
*/
|
2010-11-21 19:28:52 +00:00
|
|
|
attribute_deprecated
|
2010-08-26 00:38:25 +00:00
|
|
|
int64_t avcodec_get_channel_layout(const char *name);
|
|
|
|
|
2008-11-01 05:03:42 +00:00
|
|
|
/**
|
2010-11-21 19:28:52 +00:00
|
|
|
* @deprecated Use av_get_channel_layout_string() instead.
|
2008-11-01 05:03:42 +00:00
|
|
|
*/
|
2010-11-21 19:28:52 +00:00
|
|
|
attribute_deprecated
|
2008-11-01 05:03:42 +00:00
|
|
|
void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout);
|
|
|
|
|
2010-11-21 19:28:52 +00:00
|
|
|
/**
|
|
|
|
* @deprecated Use av_get_channel_layout_nb_channels() instead.
|
|
|
|
*/
|
|
|
|
attribute_deprecated
|
|
|
|
int avcodec_channel_layout_num_channels(int64_t channel_layout);
|
|
|
|
#endif
|
|
|
|
|
2008-11-01 05:03:42 +00: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
|
|
|
|
*/
|
|
|
|
int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name);
|
|
|
|
|
2008-08-01 13:53:18 +00: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 09:59:08 +00:00
|
|
|
* @param flags See AV_CPU_FLAG_xx
|
2008-08-01 13:53:18 +00:00
|
|
|
* @return NULL on error
|
|
|
|
*/
|
2010-11-12 11:04:40 +00:00
|
|
|
AVAudioConvert *av_audio_convert_alloc(enum AVSampleFormat out_fmt, int out_channels,
|
|
|
|
enum AVSampleFormat in_fmt, int in_channels,
|
2008-08-01 13:53:18 +00: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 10:11:21 +00:00
|
|
|
* @param[in] out_stride distance between consecutive output samples (measured in bytes)
|
2008-08-01 13:53:18 +00:00
|
|
|
* @param[in] in array of input buffers for each channel
|
2010-05-24 10:11:21 +00:00
|
|
|
* @param[in] in_stride distance between consecutive input samples (measured in bytes)
|
2008-08-01 13:53:18 +00: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 07:39:47 +00:00
|
|
|
#endif /* AVCODEC_AUDIOCONVERT_H */
|