#include "libavutil/avstring.h"
#include "libavutil/libm.h"
#include "avcodec.h"
#include "audioconvert.h"
Go to the source code of this file.
Data Structures | |
struct | SampleFmtInfo |
struct | AVAudioConvert |
Defines | |
#define | CONV(ofmt, otype, ifmt, expr) |
Functions | |
const char * | avcodec_get_sample_fmt_name (int sample_fmt) |
enum SampleFormat | avcodec_get_sample_fmt (const char *name) |
void | avcodec_sample_fmt_string (char *buf, int buf_size, int sample_fmt) |
Generate string corresponding to the sample format with number sample_fmt, or a header if sample_fmt is negative. | |
static const char * | get_channel_name (int channel_id) |
int64_t | avcodec_guess_channel_layout (int nb_channels, enum CodecID codec_id, const char *fmt_name) |
Guess the channel layout. | |
void | avcodec_get_channel_layout_string (char *buf, int buf_size, int nb_channels, int64_t channel_layout) |
Return description of channel layout. | |
int | avcodec_channel_layout_num_channels (int64_t channel_layout) |
AVAudioConvert * | av_audio_convert_alloc (enum SampleFormat out_fmt, int out_channels, enum SampleFormat in_fmt, int in_channels, const float *matrix, int flags) |
Create an audio sample format converter context. | |
void | av_audio_convert_free (AVAudioConvert *ctx) |
Free audio sample format converter context. | |
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) |
Convert between audio sample formats. | |
Variables | |
static const SampleFmtInfo | sample_fmt_info [SAMPLE_FMT_NB] |
this table gives more information about formats | |
static const char *const | channel_names [] |
struct { | |
const char * name | |
int nb_channels | |
int64_t layout | |
} | channel_layout_map [] |
Definition in file audioconvert.c.
#define CONV | ( | ofmt, | |||
otype, | |||||
ifmt, | |||||
expr | ) |
Value:
if(ctx->fmt_pair == ofmt + SAMPLE_FMT_NB*ifmt){\ do{\ *(otype*)po = expr; pi += is; po += os;\ }while(po < end);\ }
Referenced by av_audio_convert().
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 | |||
) |
Convert between audio sample formats.
[in] | out | array of output buffers for each channel. set to NULL to ignore processing of the given channel. |
[in] | out_stride | distance between consecutive output samples (measured in bytes) |
[in] | in | array of input buffers for each channel |
[in] | in_stride | distance between consecutive input samples (measured in bytes) |
len | length of audio frame size (measured in samples) |
Definition at line 188 of file audioconvert.c.
Referenced by audio_decode_frame(), audio_resample(), and do_audio_out().
AVAudioConvert* av_audio_convert_alloc | ( | enum SampleFormat | out_fmt, | |
int | out_channels, | |||
enum SampleFormat | in_fmt, | |||
int | in_channels, | |||
const float * | matrix, | |||
int | flags | |||
) |
Create an audio sample format converter context.
out_fmt | Output sample format | |
out_channels | Number of output channels | |
in_fmt | Input sample format | |
in_channels | Number of input channels | |
[in] | matrix | Channel mixing matrix (of dimension in_channel*out_channels). Set to NULL to ignore. |
flags | See FF_MM_xx |
Definition at line 167 of file audioconvert.c.
Referenced by audio_decode_frame(), av_audio_resample_init(), and do_audio_out().
void av_audio_convert_free | ( | AVAudioConvert * | ctx | ) |
Free audio sample format converter context.
Definition at line 183 of file audioconvert.c.
Referenced by audio_decode_frame(), audio_resample_close(), av_audio_resample_init(), do_audio_out(), and stream_component_close().
int avcodec_channel_layout_num_channels | ( | int64_t | channel_layout | ) |
Definition at line 153 of file audioconvert.c.
Referenced by new_audio_stream(), and set_channel_info().
void avcodec_get_channel_layout_string | ( | char * | buf, | |
int | buf_size, | |||
int | nb_channels, | |||
int64_t | channel_layout | |||
) |
Return description of channel layout.
Definition at line 124 of file audioconvert.c.
Referenced by avcodec_string().
enum SampleFormat avcodec_get_sample_fmt | ( | const char * | name | ) |
Definition at line 54 of file audioconvert.c.
Referenced by opt_audio_sample_fmt().
const char* avcodec_get_sample_fmt_name | ( | int | sample_fmt | ) |
Definition at line 47 of file audioconvert.c.
Referenced by audio_decode_frame(), av_audio_resample_init(), avcodec_string(), and do_audio_out().
int64_t avcodec_guess_channel_layout | ( | int | nb_channels, | |
enum CodecID | codec_id, | |||
const char * | fmt_name | |||
) |
Guess the channel layout.
nb_channels | ||
codec_id | Codec identifier, or CODEC_ID_NONE if unknown | |
fmt_name | Format name, or NULL if unknown |
Definition at line 90 of file audioconvert.c.
Referenced by set_channel_info().
void avcodec_sample_fmt_string | ( | char * | buf, | |
int | buf_size, | |||
int | sample_fmt | |||
) |
Generate string corresponding to the sample format with number sample_fmt, or a header if sample_fmt is negative.
[in] | buf | the buffer where to write the string |
[in] | buf_size | the size of buf |
[in] | sample_fmt | the number of the sample format to print the corresponding info string, or a negative value to print the corresponding header. Meaningful values for obtaining a sample format info vary from 0 to SAMPLE_FMT_NB -1. |
Definition at line 64 of file audioconvert.c.
Referenced by opt_audio_sample_fmt().
static const char* get_channel_name | ( | int | channel_id | ) | [static] |
struct { ... } channel_layout_map[] [static] |
Referenced by avcodec_get_channel_layout_string().
const char* const channel_names[] [static] |
Initial value:
{ "FL", "FR", "FC", "LFE", "BL", "BR", "FLC", "FRC", "BC", "SL", "SR", "TC", "TFL", "TFC", "TFR", "TBL", "TBC", "TBR", [29] = "DL", [30] = "DR", }
Definition at line 75 of file audioconvert.c.
Referenced by get_channel_name().
int64_t layout |
const char* name |
Definition at line 105 of file audioconvert.c.
Referenced by asf_read_header(), av_next_option(), avcodec_get_channel_layout_string(), avcodec_pix_fmt_string(), color_table_compare(), decode_info_header(), dump_format(), ff_metadata_mux_compat(), main(), matroska_convert_tag(), opt_loglevel(), parse_filter(), parse_inputs(), parse_link_name(), parse_outputs(), sdt_cb(), show_formats(), and sws_format_name().
int nb_channels |
Definition at line 106 of file audioconvert.c.
const SampleFmtInfo sample_fmt_info[SAMPLE_FMT_NB] [static] |
Initial value:
{ [SAMPLE_FMT_U8] = { .name = "u8", .bits = 8 }, [SAMPLE_FMT_S16] = { .name = "s16", .bits = 16 }, [SAMPLE_FMT_S32] = { .name = "s32", .bits = 32 }, [SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32 }, [SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64 }, }
Definition at line 39 of file audioconvert.c.