, _channels (channels)
{
_swr_context = swr_alloc ();
+ if (!_swr_context) {
+ throw StringError (N_("could not allocate resampler contexct"));
+ }
/* Sample formats */
av_opt_set_int (_swr_context, "isf", AV_SAMPLE_FMT_FLTP, 0);
av_opt_set (_swr_context, "resampler", "soxr", 0);
- swr_init (_swr_context);
+ int const r = swr_init (_swr_context);
+ if (r) {
+ char buf[256];
+ av_strerror (r, buf, sizeof(buf));
+ throw StringError (String::compose (N_ ("could not initialise sample-rate converter (%1)"), r));
+ }
}
Resampler::~Resampler ()