FFmpeg
Data Structures | Functions | Variables
samplefmt.c File Reference
#include "common.h"
#include "samplefmt.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  SampleFmtInfo
 

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. More...
 
enum AVSampleFormat av_get_sample_fmt (const char *name)
 Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error. More...
 
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. More...
 
enum AVSampleFormat av_get_packed_sample_fmt (enum AVSampleFormat sample_fmt)
 Get the packed alternative form of the given sample format. More...
 
enum AVSampleFormat av_get_planar_sample_fmt (enum AVSampleFormat sample_fmt)
 Get the planar alternative form of the given sample format. More...
 
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. More...
 
int av_get_bytes_per_sample (enum AVSampleFormat sample_fmt)
 Return number of bytes per sample. More...
 
int av_sample_fmt_is_planar (enum AVSampleFormat sample_fmt)
 Check if the sample format is planar. More...
 
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. More...
 
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. More...
 
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. More...
 
int av_samples_alloc_array_and_samples (uint8_t ***audio_data, int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
 Allocate a data pointers array, samples buffer for nb_samples samples, and fill data pointers and linesize accordingly. More...
 
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. More...
 
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. More...
 

Variables

static const SampleFmtInfo sample_fmt_info [AV_SAMPLE_FMT_NB]
 this table gives more information about formats More...
 

Variable Documentation

◆ sample_fmt_info

const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB]
static
Initial value:
= {
[AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8, .planar = 0, .altform = AV_SAMPLE_FMT_U8P },
[AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16, .planar = 0, .altform = AV_SAMPLE_FMT_S16P },
[AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_S32P },
[AV_SAMPLE_FMT_S64] = { .name = "s64", .bits = 64, .planar = 0, .altform = AV_SAMPLE_FMT_S64P },
[AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_FLTP },
[AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0, .altform = AV_SAMPLE_FMT_DBLP },
[AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1, .altform = AV_SAMPLE_FMT_U8 },
[AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1, .altform = AV_SAMPLE_FMT_S16 },
[AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_S32 },
[AV_SAMPLE_FMT_S64P] = { .name = "s64p", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_S64 },
[AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_FLT },
[AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_DBL },
}

this table gives more information about formats

Definition at line 34 of file samplefmt.c.

Referenced by av_get_alt_sample_fmt(), av_get_bytes_per_sample(), av_get_packed_sample_fmt(), av_get_planar_sample_fmt(), av_get_sample_fmt(), av_get_sample_fmt_name(), av_get_sample_fmt_string(), and av_sample_fmt_is_planar().

AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:69
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:68
AV_SAMPLE_FMT_S64P
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:72
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:66
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:60
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:70
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:64
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:62
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:63
AV_SAMPLE_FMT_S64
@ AV_SAMPLE_FMT_S64
signed 64 bits
Definition: samplefmt.h:71