- if (_film->audio_stream() && _film->audio_stream()->sample_rate() != _film->target_audio_sample_rate()) {
-#ifdef HAVE_SWRESAMPLE
-
- stringstream s;
- s << String::compose (N_("Will resample audio from %1 to %2"), _film->audio_stream()->sample_rate(), _film->target_audio_sample_rate());
- _film->log()->log (s.str ());
-
- /* We will be using planar float data when we call the resampler */
- _swr_context = swr_alloc_set_opts (
- 0,
- _film->audio_stream()->channel_layout(),
- AV_SAMPLE_FMT_FLTP,
- _film->target_audio_sample_rate(),
- _film->audio_stream()->channel_layout(),
- AV_SAMPLE_FMT_FLTP,
- _film->audio_stream()->sample_rate(),
- 0, 0
- );
-
- swr_init (_swr_context);
-#else
- throw EncodeError (_("Cannot resample audio as libswresample is not present"));
-#endif
- } else {
-#ifdef HAVE_SWRESAMPLE
- _swr_context = 0;
-#endif
- }
-