Mark formats requiring external libs with an 'E' in the format support tables.
[FFMpeg-mirror/ffmpeg-vdpau.git] / libavcodec / audioconvert.h
blobc391759ebe718d3f15c738f5cce893dd4ecc6751
1 /*
2 * audio conversion
3 * Copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
4 * Copyright (c) 2008 Peter Ross
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 #ifndef AVCODEC_AUDIOCONVERT_H
24 #define AVCODEC_AUDIOCONVERT_H
26 /**
27 * @file audioconvert.h
28 * Audio format conversion routines
32 #include "avcodec.h"
35 /**
36 * Generate string corresponding to the sample format with
37 * number sample_fmt, or a header if sample_fmt is negative.
39 * @param[in] buf the buffer where to write the string
40 * @param[in] buf_size the size of buf
41 * @param[in] sample_fmt the number of the sample format to print the corresponding info string, or
42 * a negative value to print the corresponding header.
43 * Meaningful values for obtaining a sample format info vary from 0 to SAMPLE_FMT_NB -1.
45 void avcodec_sample_fmt_string(char *buf, int buf_size, int sample_fmt);
47 /**
48 * @return NULL on error
50 const char *avcodec_get_sample_fmt_name(int sample_fmt);
52 /**
53 * @return SAMPLE_FMT_NONE on error
55 enum SampleFormat avcodec_get_sample_fmt(const char* name);
57 struct AVAudioConvert;
58 typedef struct AVAudioConvert AVAudioConvert;
60 /**
61 * Create an audio sample format converter context
62 * @param out_fmt Output sample format
63 * @param out_channels Number of output channels
64 * @param in_fmt Input sample format
65 * @param in_channels Number of input channels
66 * @param[in] matrix Channel mixing matrix (of dimension in_channel*out_channels). Set to NULL to ignore.
67 * @param flags See FF_MM_xx
68 * @return NULL on error
70 AVAudioConvert *av_audio_convert_alloc(enum SampleFormat out_fmt, int out_channels,
71 enum SampleFormat in_fmt, int in_channels,
72 const float *matrix, int flags);
74 /**
75 * Free audio sample format converter context
77 void av_audio_convert_free(AVAudioConvert *ctx);
79 /**
80 * Convert between audio sample formats
81 * @param[in] out array of output buffers for each channel. set to NULL to ignore processing of the given channel.
82 * @param[in] out_stride distance between consecutive input samples (measured in bytes)
83 * @param[in] in array of input buffers for each channel
84 * @param[in] in_stride distance between consecutive output samples (measured in bytes)
85 * @param len length of audio frame size (measured in samples)
87 int av_audio_convert(AVAudioConvert *ctx,
88 void * const out[6], const int out_stride[6],
89 const void * const in[6], const int in_stride[6], int len);
91 #endif /* AVCODEC_AUDIOCONVERT_H */