FFmpeg
samplefmt.h
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVUTIL_SAMPLEFMT_H
20 #define AVUTIL_SAMPLEFMT_H
21 
22 #include <stdint.h>
23 
24 /**
25  * @addtogroup lavu_audio
26  * @{
27  *
28  * @defgroup lavu_sampfmts Audio sample formats
29  *
30  * Audio sample format enumeration and related convenience functions.
31  * @{
32  */
33 
34 /**
35  * Audio sample formats
36  *
37  * - The data described by the sample format is always in native-endian order.
38  * Sample values can be expressed by native C types, hence the lack of a signed
39  * 24-bit sample format even though it is a common raw audio data format.
40  *
41  * - The floating-point formats are based on full volume being in the range
42  * [-1.0, 1.0]. Any values outside this range are beyond full volume level.
43  *
44  * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg
45  * (such as AVFrame in libavcodec) is as follows:
46  *
47  * @par
48  * For planar sample formats, each audio channel is in a separate data plane,
49  * and linesize is the buffer size, in bytes, for a single plane. All data
50  * planes must be the same size. For packed sample formats, only the first data
51  * plane is used, and samples for each channel are interleaved. In this case,
52  * linesize is the buffer size, in bytes, for the 1 plane.
53  *
54  */
57  AV_SAMPLE_FMT_U8, ///< unsigned 8 bits
58  AV_SAMPLE_FMT_S16, ///< signed 16 bits
59  AV_SAMPLE_FMT_S32, ///< signed 32 bits
60  AV_SAMPLE_FMT_FLT, ///< float
61  AV_SAMPLE_FMT_DBL, ///< double
62 
63  AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar
64  AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar
65  AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar
66  AV_SAMPLE_FMT_FLTP, ///< float, planar
67  AV_SAMPLE_FMT_DBLP, ///< double, planar
68  AV_SAMPLE_FMT_S64, ///< signed 64 bits
69  AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar
70 
71  AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically
72 };
73 
74 /**
75  * Return the name of sample_fmt, or NULL if sample_fmt is not
76  * recognized.
77  */
78 const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt);
79 
80 /**
81  * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE
82  * on error.
83  */
84 enum AVSampleFormat av_get_sample_fmt(const char *name);
85 
86 /**
87  * Return the planar<->packed alternative form of the given sample format, or
88  * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the
89  * requested planar/packed format, the format returned is the same as the
90  * input.
91  */
93 
94 /**
95  * Get the packed alternative form of the given sample format.
96  *
97  * If the passed sample_fmt is already in packed format, the format returned is
98  * the same as the input.
99  *
100  * @return the packed alternative form of the given sample format or
101  AV_SAMPLE_FMT_NONE on error.
102  */
104 
105 /**
106  * Get the planar alternative form of the given sample format.
107  *
108  * If the passed sample_fmt is already in planar format, the format returned is
109  * the same as the input.
110  *
111  * @return the planar alternative form of the given sample format or
112  AV_SAMPLE_FMT_NONE on error.
113  */
115 
116 /**
117  * Generate a string corresponding to the sample format with
118  * sample_fmt, or a header if sample_fmt is negative.
119  *
120  * @param buf the buffer where to write the string
121  * @param buf_size the size of buf
122  * @param sample_fmt the number of the sample format to print the
123  * corresponding info string, or a negative value to print the
124  * corresponding header.
125  * @return the pointer to the filled buffer or NULL if sample_fmt is
126  * unknown or in case of other errors
127  */
128 char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt);
129 
130 /**
131  * Return number of bytes per sample.
132  *
133  * @param sample_fmt the sample format
134  * @return number of bytes per sample or zero if unknown for the given
135  * sample format
136  */
137 int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt);
138 
139 /**
140  * Check if the sample format is planar.
141  *
142  * @param sample_fmt the sample format to inspect
143  * @return 1 if the sample format is planar, 0 if it is interleaved
144  */
145 int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt);
146 
147 /**
148  * Get the required buffer size for the given audio parameters.
149  *
150  * @param[out] linesize calculated linesize, may be NULL
151  * @param nb_channels the number of channels
152  * @param nb_samples the number of samples in a single channel
153  * @param sample_fmt the sample format
154  * @param align buffer size alignment (0 = default, 1 = no alignment)
155  * @return required buffer size, or negative error code on failure
156  */
157 int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
158  enum AVSampleFormat sample_fmt, int align);
159 
160 /**
161  * @}
162  *
163  * @defgroup lavu_sampmanip Samples manipulation
164  *
165  * Functions that manipulate audio samples
166  * @{
167  */
168 
169 /**
170  * Fill plane data pointers and linesize for samples with sample
171  * format sample_fmt.
172  *
173  * The audio_data array is filled with the pointers to the samples data planes:
174  * for planar, set the start point of each channel's data within the buffer,
175  * for packed, set the start point of the entire buffer only.
176  *
177  * The value pointed to by linesize is set to the aligned size of each
178  * channel's data buffer for planar layout, or to the aligned size of the
179  * buffer for all channels for packed layout.
180  *
181  * The buffer in buf must be big enough to contain all the samples
182  * (use av_samples_get_buffer_size() to compute its minimum size),
183  * otherwise the audio_data pointers will point to invalid data.
184  *
185  * @see enum AVSampleFormat
186  * The documentation for AVSampleFormat describes the data layout.
187  *
188  * @param[out] audio_data array to be filled with the pointer for each channel
189  * @param[out] linesize calculated linesize, may be NULL
190  * @param buf the pointer to a buffer containing the samples
191  * @param nb_channels the number of channels
192  * @param nb_samples the number of samples in a single channel
193  * @param sample_fmt the sample format
194  * @param align buffer size alignment (0 = default, 1 = no alignment)
195  * @return minimum size in bytes required for the buffer on success,
196  * or a negative error code on failure
197  */
198 int av_samples_fill_arrays(uint8_t **audio_data, int *linesize,
199  const uint8_t *buf,
200  int nb_channels, int nb_samples,
201  enum AVSampleFormat sample_fmt, int align);
202 
203 /**
204  * Allocate a samples buffer for nb_samples samples, and fill data pointers and
205  * linesize accordingly.
206  * The allocated samples buffer can be freed by using av_freep(&audio_data[0])
207  * Allocated data will be initialized to silence.
208  *
209  * @see enum AVSampleFormat
210  * The documentation for AVSampleFormat describes the data layout.
211  *
212  * @param[out] audio_data array to be filled with the pointer for each channel
213  * @param[out] linesize aligned size for audio buffer(s), may be NULL
214  * @param nb_channels number of audio channels
215  * @param nb_samples number of samples per channel
216  * @param align buffer size alignment (0 = default, 1 = no alignment)
217  * @return >=0 on success or a negative error code on failure
218  * @todo return the size of the allocated buffer in case of success at the next bump
219  * @see av_samples_fill_arrays()
220  * @see av_samples_alloc_array_and_samples()
221  */
222 int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
223  int nb_samples, enum AVSampleFormat sample_fmt, int align);
224 
225 /**
226  * Allocate a data pointers array, samples buffer for nb_samples
227  * samples, and fill data pointers and linesize accordingly.
228  *
229  * This is the same as av_samples_alloc(), but also allocates the data
230  * pointers array.
231  *
232  * @see av_samples_alloc()
233  */
234 int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
235  int nb_samples, enum AVSampleFormat sample_fmt, int align);
236 
237 /**
238  * Copy samples from src to dst.
239  *
240  * @param dst destination array of pointers to data planes
241  * @param src source array of pointers to data planes
242  * @param dst_offset offset in samples at which the data will be written to dst
243  * @param src_offset offset in samples at which the data will be read from src
244  * @param nb_samples number of samples to be copied
245  * @param nb_channels number of audio channels
246  * @param sample_fmt audio sample format
247  */
248 int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset,
249  int src_offset, int nb_samples, int nb_channels,
250  enum AVSampleFormat sample_fmt);
251 
252 /**
253  * Fill an audio buffer with silence.
254  *
255  * @param audio_data array of pointers to data planes
256  * @param offset offset in samples at which to start filling
257  * @param nb_samples number of samples to fill
258  * @param nb_channels number of audio channels
259  * @param sample_fmt audio sample format
260  */
261 int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples,
262  int nb_channels, enum AVSampleFormat sample_fmt);
263 
264 /**
265  * @}
266  * @}
267  */
268 #endif /* AVUTIL_SAMPLEFMT_H */
AV_SAMPLE_FMT_FLTP
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition: samplefmt.h:66
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
av_get_sample_fmt_string
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...
Definition: samplefmt.c:95
av_samples_fill_arrays
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.
Definition: samplefmt.c:153
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:65
av_samples_alloc
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.
Definition: samplefmt.c:182
AV_SAMPLE_FMT_S64P
@ AV_SAMPLE_FMT_S64P
signed 64 bits, planar
Definition: samplefmt.h:69
planar
uint8_t pi<< 24) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_U8,(uint64_t)((*(const uint8_t *) pi - 0x80U))<< 56) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16,(*(const int16_t *) pi >>8)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1<< 16)) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16,(uint64_t)(*(const int16_t *) pi)<< 48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32,(*(const int32_t *) pi >>24)+0x80) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S32,(uint64_t)(*(const int32_t *) pi)<< 32) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S64,(*(const int64_t *) pi >>56)+0x80) CONV_FUNC(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0f/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S64, *(const int64_t *) pi *(1.0/(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_FLT, llrintf(*(const float *) pi *(UINT64_C(1)<< 63))) CONV_FUNC(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_DBL, llrint(*(const double *) pi *(UINT64_C(1)<< 63))) #define FMT_PAIR_FUNC(out, in) static conv_func_type *const fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB *AV_SAMPLE_FMT_NB]={ FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_U8), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S16), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S32), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_FLT), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_DBL), FMT_PAIR_FUNC(AV_SAMPLE_FMT_U8, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_S64), FMT_PAIR_FUNC(AV_SAMPLE_FMT_S64, AV_SAMPLE_FMT_S64), };static void cpy1(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, len);} static void cpy2(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 2 *len);} static void cpy4(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 4 *len);} static void cpy8(uint8_t **dst, const uint8_t **src, int len){ memcpy(*dst, *src, 8 *len);} AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, const int *ch_map, int flags) { AudioConvert *ctx;conv_func_type *f=fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt)+AV_SAMPLE_FMT_NB *av_get_packed_sample_fmt(in_fmt)];if(!f) return NULL;ctx=av_mallocz(sizeof(*ctx));if(!ctx) return NULL;if(channels==1){ in_fmt=av_get_planar_sample_fmt(in_fmt);out_fmt=av_get_planar_sample_fmt(out_fmt);} ctx->channels=channels;ctx->conv_f=f;ctx->ch_map=ch_map;if(in_fmt==AV_SAMPLE_FMT_U8||in_fmt==AV_SAMPLE_FMT_U8P) memset(ctx->silence, 0x80, sizeof(ctx->silence));if(out_fmt==in_fmt &&!ch_map) { switch(av_get_bytes_per_sample(in_fmt)){ case 1:ctx->simd_f=cpy1;break;case 2:ctx->simd_f=cpy2;break;case 4:ctx->simd_f=cpy4;break;case 8:ctx->simd_f=cpy8;break;} } return ctx;} void swri_audio_convert_free(AudioConvert **ctx) { av_freep(ctx);} int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len) { int ch;int off=0;const int os=(out->planar ? 1 :out->ch_count) *out->bps;unsigned misaligned=0;av_assert0(ctx->channels==out->ch_count);if(ctx->in_simd_align_mask) { int planes=in->planar ? in->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) in->ch[ch];misaligned|=m &ctx->in_simd_align_mask;} if(ctx->out_simd_align_mask) { int planes=out->planar ? out->ch_count :1;unsigned m=0;for(ch=0;ch< planes;ch++) m|=(intptr_t) out->ch[ch];misaligned|=m &ctx->out_simd_align_mask;} if(ctx->simd_f &&!ctx->ch_map &&!misaligned){ off=len &~15;av_assert1(off >=0);av_assert1(off<=len);av_assert2(ctx->channels==SWR_CH_MAX||!in->ch[ctx->channels]);if(off >0){ if(out->planar==in->planar){ int planes=out->planar ? out->ch_count :1;for(ch=0;ch< planes;ch++){ ctx->simd_f(out->ch+ch,(const uint8_t **) in->ch+ch, off *(out-> planar
Definition: audioconvert.c:56
av_get_planar_sample_fmt
enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt)
Get the planar alternative form of the given sample format.
Definition: samplefmt.c:86
av_sample_fmt_is_planar
int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt)
Check if the sample format is planar.
Definition: samplefmt.c:114
av_get_sample_fmt_name
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: samplefmt.c:51
AV_SAMPLE_FMT_NB
@ AV_SAMPLE_FMT_NB
Number of sample formats. DO NOT USE if linking dynamically.
Definition: samplefmt.h:71
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:63
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:64
av_samples_copy
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.
Definition: samplefmt.c:222
av_get_bytes_per_sample
int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt)
Return number of bytes per sample.
Definition: samplefmt.c:108
AV_SAMPLE_FMT_U8
@ AV_SAMPLE_FMT_U8
unsigned 8 bits
Definition: samplefmt.h:57
av_get_sample_fmt
enum AVSampleFormat av_get_sample_fmt(const char *name)
Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE on error.
Definition: samplefmt.c:58
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:55
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
av_samples_get_buffer_size
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.
Definition: samplefmt.c:121
av_samples_set_silence
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.
Definition: samplefmt.c:246
av_get_packed_sample_fmt
enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt)
Get the packed alternative form of the given sample format.
Definition: samplefmt.c:77
AV_SAMPLE_FMT_DBLP
@ AV_SAMPLE_FMT_DBLP
double, planar
Definition: samplefmt.h:67
av_get_alt_sample_fmt
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 erro...
Definition: samplefmt.c:68
av_samples_alloc_array_and_samples
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 lin...
Definition: samplefmt.c:207
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
AV_SAMPLE_FMT_DBL
@ AV_SAMPLE_FMT_DBL
double
Definition: samplefmt.h:61
AV_SAMPLE_FMT_S32
@ AV_SAMPLE_FMT_S32
signed 32 bits
Definition: samplefmt.h:59
AV_SAMPLE_FMT_FLT
@ AV_SAMPLE_FMT_FLT
float
Definition: samplefmt.h:60
AV_SAMPLE_FMT_S64
@ AV_SAMPLE_FMT_S64
signed 64 bits
Definition: samplefmt.h:68