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

Function alloc_audio_frame

doc/examples/mux.c:216–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214/* audio output */
215
216static AVFrame *alloc_audio_frame(enum AVSampleFormat sample_fmt,
217 const AVChannelLayout *channel_layout,
218 int sample_rate, int nb_samples)
219{
220 AVFrame *frame = av_frame_alloc();
221 if (!frame) {
222 fprintf(stderr, "Error allocating an audio frame\n");
223 exit(1);
224 }
225
226 frame->format = sample_fmt;
227 av_channel_layout_copy(&frame->ch_layout, channel_layout);
228 frame->sample_rate = sample_rate;
229 frame->nb_samples = nb_samples;
230
231 if (nb_samples) {
232 if (av_frame_get_buffer(frame, 0) < 0) {
233 fprintf(stderr, "Error allocating an audio buffer\n");
234 exit(1);
235 }
236 }
237
238 return frame;
239}
240
241static void open_audio(AVFormatContext *oc, const AVCodec *codec,
242 OutputStream *ost, AVDictionary *opt_arg)

Callers 1

open_audioFunction · 0.85

Calls 3

av_frame_allocFunction · 0.85
av_channel_layout_copyFunction · 0.85
av_frame_get_bufferFunction · 0.85

Tested by

no test coverage detected