2008-07-31 15:55:06 +03:00
|
|
|
/*
|
|
|
|
* audio conversion
|
|
|
|
* Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
* Copyright (c) 2008 Peter Ross
|
|
|
|
*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* 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"
|
|
|
|
|
2010-11-03 00:08:02 +02:00
|
|
|
#if FF_API_OLD_SAMPLE_FMT
|
2008-07-31 15:55:06 +03:00
|
|
|
/**
|
2010-11-03 00:08:02 +02:00
|
|
|
* @deprecated Use av_get_sample_fmt_string() instead.
|
2008-07-31 15:55:06 +03:00
|
|
|
*/
|
2010-11-03 00:08:02 +02:00
|
|
|
attribute_deprecated
|
2008-07-31 15:55:06 +03:00
|
|
|
void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt);
|
|
|
|
|
|
|
|
/**
|
2010-11-03 00:08:02 +02:00
|
|
|
* @deprecated Use av_get_sample_fmt_name() instead.
|
2008-07-31 15:55:06 +03:00
|
|
|
*/
|
2010-11-03 00:08:02 +02:00
|
|
|
attribute_deprecated
|
2008-07-31 15:55:06 +03:00
|
|
|
const char *avcodec_get_sample_fmt_name(int sample_fmt);
|
|
|
|
|
|
|
|
/**
|
2010-11-03 00:08:02 +02:00
|
|
|
* @deprecated Use av_get_sample_fmt() instead.
|
2008-07-31 15:55:06 +03:00
|
|
|
*/
|
2010-11-03 00:08:02 +02:00
|
|
|
attribute_deprecated
|
2010-11-12 13:04:40 +02:00
|
|
|
enum AVSampleFormat avcodec_get_sample_fmt(const char* name);
|
2010-11-03 00:08:02 +02:00
|
|
|
#endif
|
2008-07-31 15:55:06 +03:00
|
|
|
|
2010-11-21 21:28:52 +02:00
|
|
|
#if FF_API_OLD_AUDIOCONVERT
|
2010-08-26 03:38:25 +03:00
|
|
|
/**
|
2010-11-21 21:28:52 +02:00
|
|
|
* @deprecated Use av_get_channel_layout() instead.
|
2010-08-26 03:38:25 +03:00
|
|
|
*/
|
2010-11-21 21:28:52 +02:00
|
|
|
attribute_deprecated
|
2010-08-26 03:38:25 +03:00
|
|
|
int64_t avcodec_get_channel_layout(const char *name);
|
|
|
|
|
2008-11-01 07:03:42 +02:00
|
|
|
/**
|
2010-11-21 21:28:52 +02:00
|
|
|
* @deprecated Use av_get_channel_layout_string() instead.
|
2008-11-01 07:03:42 +02:00
|
|
|
*/
|
2010-11-21 21:28:52 +02:00
|
|
|
attribute_deprecated
|
2008-11-01 07:03:42 +02:00
|
|
|
void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout);
|
|
|
|
|
2010-11-21 21:28:52 +02: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 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
|
|
|
|
*/
|
|
|
|
int64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char *fmt_name);
|
|
|
|
|
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 */
|