| 214 | /* audio output */ |
| 215 | |
| 216 | static 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 | |
| 241 | static void open_audio(AVFormatContext *oc, const AVCodec *codec, |
| 242 | OutputStream *ost, AVDictionary *opt_arg) |
no test coverage detected