MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / av_samples_alloc

Function av_samples_alloc

libavutil/samplefmt.c:182–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180}
181
182int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels,
183 int nb_samples, enum AVSampleFormat sample_fmt, int align)
184{
185 uint8_t *buf;
186 int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples,
187 sample_fmt, align);
188 if (size < 0)
189 return size;
190
191 buf = av_malloc(size);
192 if (!buf)
193 return AVERROR(ENOMEM);
194
195 size = av_samples_fill_arrays(audio_data, linesize, buf, nb_channels,
196 nb_samples, sample_fmt, align);
197 if (size < 0) {
198 av_free(buf);
199 return size;
200 }
201
202 av_samples_set_silence(audio_data, 0, nb_samples, nb_channels, sample_fmt);
203
204 return size;
205}
206
207int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels,
208 int nb_samples, enum AVSampleFormat sample_fmt, int align)

Callers 2

mainFunction · 0.85

Calls 5

av_samples_fill_arraysFunction · 0.85
av_samples_set_silenceFunction · 0.85
av_mallocFunction · 0.70
av_freeFunction · 0.70

Tested by

no test coverage detected