#include <stdint.h>
#include "avutil.h"
#include "attributes.h"
Go to the source code of this file.
Enumerations | |
enum | AVSampleFormat { AV_SAMPLE_FMT_NONE = -1, AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8P, AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S32P, AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_DBLP, AV_SAMPLE_FMT_NB } |
Audio Sample Formats. More... | |
Functions | |
const char * | av_get_sample_fmt_name (enum AVSampleFormat sample_fmt) |
Return the name of sample_fmt, or NULL if sample_fmt is not recognized. | |
enum AVSampleFormat | av_get_sample_fmt (const char *name) |
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error. | |
enum AVSampleFormat | av_get_alt_sample_fmt (enum AVSampleFormat sample_fmt, int planar) |
Return the planar<->packed alternative form of the given sample format, or AV_SAMPLE_FMT_NONE on error. | |
enum AVSampleFormat | av_get_packed_sample_fmt (enum AVSampleFormat sample_fmt) |
Get the packed alternative form of the given sample format. | |
enum AVSampleFormat | av_get_planar_sample_fmt (enum AVSampleFormat sample_fmt) |
Get the planar alternative form of the given sample format. | |
char * | av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt) |
Generate a string corresponding to the sample format with sample_fmt, or a header if sample_fmt is negative. | |
attribute_deprecated int | av_get_bits_per_sample_fmt (enum AVSampleFormat sample_fmt) |
int | av_get_bytes_per_sample (enum AVSampleFormat sample_fmt) |
Return number of bytes per sample. | |
int | av_sample_fmt_is_planar (enum AVSampleFormat sample_fmt) |
Check if the sample format is planar. | |
int | av_samples_get_buffer_size (int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) |
Get the required buffer size for the given audio parameters. | |
int | av_samples_fill_arrays (uint8_t **audio_data, int *linesize, const uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) |
Fill plane data pointers and linesize for samples with sample format sample_fmt. | |
int | av_samples_alloc (uint8_t **audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) |
Allocate a samples buffer for nb_samples samples, and fill data pointers and linesize accordingly. | |
int | av_samples_copy (uint8_t **dst, uint8_t *const *src, int dst_offset, int src_offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt) |
Copy samples from src to dst. | |
int | av_samples_set_silence (uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt) |
Fill an audio buffer with silence. |
enum AVSampleFormat |
Audio Sample Formats.
Definition at line 49 of file samplefmt.h.
enum AVSampleFormat av_get_alt_sample_fmt | ( | enum AVSampleFormat | sample_fmt, | |
int | planar | |||
) |
Return the planar<->packed alternative form of the given sample format, or AV_SAMPLE_FMT_NONE on error.
If the passed sample_fmt is already in the requested planar/packed format, the format returned is the same as the input.
Definition at line 64 of file samplefmt.c.
attribute_deprecated int av_get_bits_per_sample_fmt | ( | enum AVSampleFormat | sample_fmt | ) |
int av_get_bytes_per_sample | ( | enum AVSampleFormat | sample_fmt | ) |
Return number of bytes per sample.
sample_fmt | the sample format |
Definition at line 104 of file samplefmt.c.
Referenced by audio_decode_frame(), audio_resample(), av_asrc_buffer_add_buffer(), av_audio_resample_init(), av_samples_copy(), av_samples_get_buffer_size(), av_samples_set_silence(), avresample_open(), buffer_offset(), config_output(), decode_frame(), decode_init(), ff_audio_data_alloc(), ff_audio_data_init(), ff_audio_resample_init(), filter_samples(), flac_set_bps(), lavfi_read_packet(), mkv_write_tracks(), mp3lame_encode_init(), open_audio(), sdl_audio_callback(), set_audiodata_fmt(), setup_array(), shift(), swap_sample_fmts_on_filter(), swri_rematrix(), swri_resample_init(), vmdaudio_decode_init(), wavpack_decode_block(), write_audio_frame(), and yae_reset().
enum AVSampleFormat av_get_packed_sample_fmt | ( | enum AVSampleFormat | sample_fmt | ) |
Get the packed alternative form of the given sample format.
If the passed sample_fmt is already in packed format, the format returned is the same as the input.
Definition at line 73 of file samplefmt.c.
Referenced by auto_matrix(), ff_audio_convert_set_func(), PUT_FUNC(), swap_sample_fmts_on_filter(), and swri_get_dither().
enum AVSampleFormat av_get_planar_sample_fmt | ( | enum AVSampleFormat | sample_fmt | ) |
Get the planar alternative form of the given sample format.
If the passed sample_fmt is already in planar format, the format returned is the same as the input.
Definition at line 82 of file samplefmt.c.
Referenced by avresample_open(), swap_sample_fmts_on_filter(), and swr_init().
enum AVSampleFormat av_get_sample_fmt | ( | const char * | name | ) |
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
Definition at line 54 of file samplefmt.c.
Referenced by ff_parse_sample_format(), init(), init_audio(), and new_audio_stream().
const char* av_get_sample_fmt_name | ( | enum AVSampleFormat | sample_fmt | ) |
Return the name of sample_fmt, or NULL if sample_fmt is not recognized.
Definition at line 47 of file samplefmt.c.
Referenced by audio_decode_frame(), audio_encode_example(), av_audio_resample_init(), avcodec_string(), avresample_open(), choose_sample_fmt(), config_output(), config_props(), configure_input_audio_filter(), decode_audio(), dprint_options(), ff_audio_convert_set_func(), ff_audio_mix_init(), ff_audio_mix_set_func(), ff_audio_resample_init(), ff_tlog_link(), filter_samples(), get_format_from_sample_fmt(), init_filters(), lavfi_read_header(), main(), mix_function_init(), print_digraph(), print_link_prop(), show_frame(), show_stream(), and swr_init().
char* av_get_sample_fmt_string | ( | char * | buf, | |
int | buf_size, | |||
enum AVSampleFormat | sample_fmt | |||
) |
Generate a string corresponding to the sample format with sample_fmt, or a header if sample_fmt is negative.
buf | the buffer where to write the string | |
buf_size | the size of buf | |
sample_fmt | the number of the sample format to print the corresponding info string, or a negative value to print the corresponding header. |
Definition at line 91 of file samplefmt.c.
Referenced by show_sample_fmts().
int av_sample_fmt_is_planar | ( | enum AVSampleFormat | sample_fmt | ) |
Check if the sample format is planar.
sample_fmt | the sample format to inspect |
Definition at line 118 of file samplefmt.c.
Referenced by alac_decode_init(), allocate_buffers(), av_audio_fifo_alloc(), av_samples_copy(), av_samples_fill_arrays(), av_samples_get_buffer_size(), av_samples_set_silence(), avcodec_decode_audio3(), avcodec_encode_audio2(), avcodec_fill_audio_frame(), avfilter_copy_buf_props(), avfilter_get_audio_buffer_ref_from_arrays(), buffer_offset(), calc_ptr_alignment(), config_output(), decode_element(), ff_audio_data_alloc(), ff_audio_data_init(), ff_default_get_audio_buffer(), ff_planar_sample_fmts(), filter_samples(), flac_set_bps(), get(), main(), set(), set_audiodata_fmt(), setup_array(), and shift().
int av_samples_alloc | ( | uint8_t ** | audio_data, | |
int * | linesize, | |||
int | nb_channels, | |||
int | nb_samples, | |||
enum AVSampleFormat | sample_fmt, | |||
int | align | |||
) |
Allocate a samples buffer for nb_samples samples, and fill data pointers and linesize accordingly.
The allocated samples buffer can be freed by using av_freep(&audio_data[0])
[out] | audio_data | array to be filled with the pointer for each channel |
[out] | linesize | aligned size for audio buffer(s), may be NULL |
nb_channels | number of audio channels | |
nb_samples | number of samples per channel | |
align | buffer size alignment (0 = default, 1 = no alignment) |
Definition at line 177 of file samplefmt.c.
Referenced by decode_packet(), ff_audio_data_realloc(), and ff_default_get_audio_buffer().
int av_samples_copy | ( | uint8_t ** | dst, | |
uint8_t *const * | src, | |||
int | dst_offset, | |||
int | src_offset, | |||
int | nb_samples, | |||
int | nb_channels, | |||
enum AVSampleFormat | sample_fmt | |||
) |
Copy samples from src to dst.
dst | destination array of pointers to data planes | |
src | source array of pointers to data planes | |
dst_offset | offset in samples at which the data will be written to dst | |
src_offset | offset in samples at which the data will be read from src | |
nb_samples | number of samples to be copied | |
nb_channels | number of audio channels | |
sample_fmt | audio sample format |
Definition at line 199 of file samplefmt.c.
Referenced by av_buffersink_read_samples(), avcodec_decode_audio4(), decode_packet(), ff_copy_buffer_ref(), ff_filter_samples(), ff_filter_samples_framed(), pad_last_frame(), and return_audio_frame().
int av_samples_fill_arrays | ( | uint8_t ** | audio_data, | |
int * | linesize, | |||
const uint8_t * | buf, | |||
int | nb_channels, | |||
int | nb_samples, | |||
enum AVSampleFormat | sample_fmt, | |||
int | align | |||
) |
Fill plane data pointers and linesize for samples with sample format sample_fmt.
The audio_data array is filled with the pointers to the samples data planes: for planar, set the start point of each channel's data within the buffer, for packed, set the start point of the entire buffer only.
The value pointed to by linesize is set to the aligned size of each channel's data buffer for planar layout, or to the aligned size of the buffer for all channels for packed layout.
The buffer in buf must be big enough to contain all the samples (use av_samples_get_buffer_size() to compute its minimum size), otherwise the audio_data pointers will point to invalid data.
[out] | audio_data | array to be filled with the pointer for each channel |
[out] | linesize | calculated linesize, may be NULL |
buf | the pointer to a buffer containing the samples | |
nb_channels | the number of channels | |
nb_samples | the number of samples in a single channel | |
sample_fmt | the sample format | |
align | buffer size alignment (0 = default, 1 = no alignment) |
Definition at line 155 of file samplefmt.c.
Referenced by av_asrc_buffer_add_buffer(), av_samples_alloc(), avcodec_fill_audio_frame(), ff_audio_data_realloc(), and main().
int av_samples_get_buffer_size | ( | int * | linesize, | |
int | nb_channels, | |||
int | nb_samples, | |||
enum AVSampleFormat | sample_fmt, | |||
int | align | |||
) |
Get the required buffer size for the given audio parameters.
[out] | linesize | calculated linesize, may be NULL |
nb_channels | the number of channels | |
nb_samples | the number of samples in a single channel | |
sample_fmt | the sample format | |
align | buffer size alignment (0 = default, 1 = no alignment) |
Definition at line 125 of file samplefmt.c.
Referenced by audio_decode_example(), audio_decode_frame(), audio_encode_example(), audio_get_buffer(), av_audio_fifo_alloc(), av_audio_fifo_realloc(), av_samples_alloc(), av_samples_fill_arrays(), avcodec_decode_audio3(), avcodec_encode_audio(), avcodec_fill_audio_frame(), decode_packet(), ff_audio_data_realloc(), main(), pad_last_frame(), sdl_audio_callback(), and stream_component_open().
int av_samples_set_silence | ( | uint8_t ** | audio_data, | |
int | offset, | |||
int | nb_samples, | |||
int | nb_channels, | |||
enum AVSampleFormat | sample_fmt | |||
) |
Fill an audio buffer with silence.
audio_data | array of pointers to data planes | |
offset | offset in samples at which to start filling | |
nb_samples | number of samples to fill | |
nb_channels | number of audio channels | |
sample_fmt | audio sample format |
Definition at line 223 of file samplefmt.c.
Referenced by filter_samples(), pad_last_frame(), push_samples(), return_audio_frame(), and send_silence().