49 return sample_fmt_info[sample_fmt].
name;
57 if (!strcmp(sample_fmt_info[i].name, name))
66 snprintf(buf, buf_size,
"name " " depth");
69 snprintf (buf, buf_size,
"%-6s" " %2d ", info.
name, info.
bits);
78 0 : sample_fmt_info[sample_fmt].
bits >> 3;
81 #if FF_API_GET_BITS_PER_SAMPLE_FMT
85 0 : sample_fmt_info[sample_fmt].
bits;
93 return sample_fmt_info[sample_fmt].
planar;
104 if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
109 if (nb_samples > INT_MAX - 31)
115 if (nb_channels > INT_MAX / align ||
116 (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
119 line_size = planar ?
FFALIGN(nb_samples * sample_size, align) :
120 FFALIGN(nb_samples * sample_size * nb_channels, align);
122 *linesize = line_size;
124 return planar ? line_size * nb_channels : line_size;
131 int ch, planar, buf_size;
141 audio_data[ch] = audio_data[ch-1] + *linesize;
160 nb_samples, sample_fmt, align);
Number of sample formats. DO NOT USE if linking dynamically.
int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align)
Fill channel data pointers and linesize for samples with sample format sample_fmt.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
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.
struct SampleFmtInfo SampleFmtInfo
static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB]
this table gives more information about formats
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
attribute_deprecated int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt)
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.
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
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...
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 ne...
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
AVSampleFormat
all in native-endian format
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.