-#if HAVE_SWRESAMPLE
- if (_film->audio_stream() && _film->audio_stream()->channels() && _swr_context) {
-
- shared_ptr<AudioBuffers> out (new AudioBuffers (_film->audio_stream()->channels(), 256));
-
- while (1) {
- int const frames = swr_convert (_swr_context, (uint8_t **) out->data(), 256, 0, 0);
-
- if (frames < 0) {
- throw EncodeError (_("could not run sample-rate converter"));
- }
-
- if (frames == 0) {
- break;
- }
-
- out->set_frames (frames);
- write_audio (out);
- }
-
- swr_free (&_swr_context);
- }
-#endif
-
- if (_film->audio_channels() == 0 && _film->minimum_audio_channels() > 0) {
- /* Put audio in where there is none at all */
- int64_t af = video_frames_to_audio_frames (_video_frames_out, 48000, _film->dcp_frame_rate ());
- while (af) {
- int64_t const this_time = min (af, static_cast<int64_t> (24000));
- shared_ptr<AudioBuffers> out (new AudioBuffers (_film->minimum_audio_channels(), this_time));
- out->make_silent ();
- out->set_frames (this_time);
- write_audio (out);
-
- af -= this_time;
- }
- }
-