diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-09-28 23:09:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-09-28 23:09:15 +0100 |
| commit | c0ed407fb02891f0dd364e78b6192f0e6dbe1d8d (patch) | |
| tree | cfa1abb09f891f220f15886b4cad2d1562f4a79c /src/lib/ffmpeg_decoder.cc | |
| parent | d50fe6707c973d4a1397aa40b67ae753744ce748 (diff) | |
| parent | c252cb33a3ca8088fbe091af903a77ad8a098969 (diff) | |
Merge branch 'master' of /home/carl/git/dvdomatic
Diffstat (limited to 'src/lib/ffmpeg_decoder.cc')
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index c12e6728d..3471ffaab 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -142,10 +142,18 @@ FFmpegDecoder::setup_audio () 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 @@ -200,7 +208,7 @@ FFmpegDecoder::audio_channels () const if (_audio_codec_context == 0) { return 0; } - + return _audio_codec_context->channels; } |
