+2012-09-12 Carl Hetherington <cth@carlh.net>
+
+ * Fix crash when FFmpeg doesn't set up the audio channel
+ layout for some reason.
+
2012-09-01 Carl Hetherington <cth@carlh.net>
* Add 1.66-within-flat format.
if (_audio_codec == 0) {
throw DecodeError ("could not find audio decoder");
}
-
+
if (avcodec_open2 (_audio_codec_context, _audio_codec, 0) < 0) {
throw DecodeError ("could not open audio decoder");
}
+
+ /* This is a hack; sometimes it seems that _audio_codec_context->channel_layout isn't set up,
+ so bodge it here. No idea why we should have to do this.
+ */
+
+ if (_audio_codec_context->channel_layout == 0) {
+ _audio_codec_context->channel_layout = av_get_default_channel_layout (audio_channels ());
+ }
}
bool
if (_audio_codec_context == 0) {
return 0;
}
-
+
return _audio_codec_context->channels;
}