From 17cb181f88f3f5651a19aa972572ee3d3a0787f4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 1 Nov 2014 19:37:54 +0100 Subject: [PATCH] Use av_get_default_channel_layout for unknown channel layouts --- apps/openmw/mwsound/ffmpeg_decoder.cpp | 14 +------------- extern/ogre-ffmpeg-videoplayer/audiodecoder.cpp | 14 +------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index f724d523c7..2884b9d3ac 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -307,19 +307,7 @@ void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType * int64_t ch_layout = (*mStream)->codec->channel_layout; if(ch_layout == 0) - { - /* Unknown channel layout. Try to guess. */ - if((*mStream)->codec->channels == 1) - ch_layout = AV_CH_LAYOUT_MONO; - else if((*mStream)->codec->channels == 2) - ch_layout = AV_CH_LAYOUT_STEREO; - else - { - std::stringstream sstr("Unsupported raw channel count: "); - sstr << (*mStream)->codec->channels; - fail(sstr.str()); - } - } + ch_layout = av_get_default_channel_layout((*mStream)->codec->channels); mOutputChannelLayout = ch_layout; if (ch_layout == AV_CH_LAYOUT_5POINT1 || ch_layout == AV_CH_LAYOUT_7POINT1 diff --git a/extern/ogre-ffmpeg-videoplayer/audiodecoder.cpp b/extern/ogre-ffmpeg-videoplayer/audiodecoder.cpp index 41313d5d5d..cfc6c17b91 100644 --- a/extern/ogre-ffmpeg-videoplayer/audiodecoder.cpp +++ b/extern/ogre-ffmpeg-videoplayer/audiodecoder.cpp @@ -94,19 +94,7 @@ void MovieAudioDecoder::setupFormat() uint64_t inputChannelLayout = mAVStream->codec->channel_layout; if (inputChannelLayout == 0) - { - /* Unknown channel layout. Try to guess. */ - if(mAVStream->codec->channels == 1) - inputChannelLayout = AV_CH_LAYOUT_MONO; - else if(mAVStream->codec->channels == 2) - inputChannelLayout = AV_CH_LAYOUT_STEREO; - else - { - std::stringstream sstr("Unsupported raw channel count: "); - sstr << mAVStream->codec->channels; - fail(sstr.str()); - } - } + inputChannelLayout = av_get_default_channel_layout(mAVStream->codec->channels); int inputSampleRate = mAVStream->codec->sample_rate;