1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-29 04:20:29 +00:00

Don't include al.h in decoder classes, format support check will need to be redone later. For now, resample all formats that might not be supported on any hardware.

This commit is contained in:
scrawl 2014-10-25 20:50:41 +02:00
parent dc6a99d32a
commit ac067564ea
2 changed files with 8 additions and 14 deletions

View File

@ -5,8 +5,6 @@
#include <stdexcept> #include <stdexcept>
#include "al.h"
extern "C" { extern "C" {
#ifndef HAVE_LIBSWRESAMPLE #ifndef HAVE_LIBSWRESAMPLE
// FIXME: remove this section once libswresample is packaged for Debian // FIXME: remove this section once libswresample is packaged for Debian
@ -287,9 +285,8 @@ void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *
if(!mStream) if(!mStream)
fail("No audio stream info"); fail("No audio stream info");
if(((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_FLT || (*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_FLTP) if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_FLT || (*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_FLTP)
&& alIsExtensionPresent("AL_EXT_FLOAT32")) mOutputSampleFormat = AV_SAMPLE_FMT_S16; // FIXME: Check for AL_EXT_FLOAT32 support
mOutputSampleFormat = AV_SAMPLE_FMT_FLT;
else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_U8P) else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_U8P)
mOutputSampleFormat = AV_SAMPLE_FMT_U8; mOutputSampleFormat = AV_SAMPLE_FMT_U8;
else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_S16P) else if((*mStream)->codec->sample_fmt == AV_SAMPLE_FMT_S16P)
@ -322,8 +319,8 @@ void FFmpeg_Decoder::getInfo(int *samplerate, ChannelConfig *chans, SampleType *
} }
mOutputChannelLayout = ch_layout; mOutputChannelLayout = ch_layout;
if ((ch_layout == AV_CH_LAYOUT_5POINT1 || ch_layout == AV_CH_LAYOUT_7POINT1 if (ch_layout == AV_CH_LAYOUT_5POINT1 || ch_layout == AV_CH_LAYOUT_7POINT1
|| ch_layout == AV_CH_LAYOUT_QUAD) && !alIsExtensionPresent("AL_EXT_MCFORMATS")) || ch_layout == AV_CH_LAYOUT_QUAD) // FIXME: check for AL_EXT_MCFORMATS support
mOutputChannelLayout = AV_CH_LAYOUT_STEREO; mOutputChannelLayout = AV_CH_LAYOUT_STEREO;
else if (ch_layout != AV_CH_LAYOUT_MONO else if (ch_layout != AV_CH_LAYOUT_MONO
&& ch_layout != AV_CH_LAYOUT_STEREO) && ch_layout != AV_CH_LAYOUT_STEREO)

View File

@ -6,8 +6,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "al.h"
#include "sound_decoder.hpp" #include "sound_decoder.hpp"
#include "sound.hpp" #include "sound.hpp"
@ -70,14 +68,13 @@ namespace MWSound
sampleFormat = AV_SAMPLE_FMT_U8; sampleFormat = AV_SAMPLE_FMT_U8;
else if (sampleFormat == AV_SAMPLE_FMT_S16P || sampleFormat == AV_SAMPLE_FMT_S16) else if (sampleFormat == AV_SAMPLE_FMT_S16P || sampleFormat == AV_SAMPLE_FMT_S16)
sampleFormat = AV_SAMPLE_FMT_S16; sampleFormat = AV_SAMPLE_FMT_S16;
else if ((sampleFormat == AV_SAMPLE_FMT_FLTP || sampleFormat == AV_SAMPLE_FMT_FLT) else if (sampleFormat == AV_SAMPLE_FMT_FLTP || sampleFormat == AV_SAMPLE_FMT_FLT)
&& alIsExtensionPresent("AL_EXT_FLOAT32")) sampleFormat = AV_SAMPLE_FMT_S16; // FIXME: check for AL_EXT_FLOAT32 support
sampleFormat = AV_SAMPLE_FMT_FLT;
else else
sampleFormat = AV_SAMPLE_FMT_S16; sampleFormat = AV_SAMPLE_FMT_S16;
if ((channelLayout == AV_CH_LAYOUT_5POINT1 || channelLayout == AV_CH_LAYOUT_7POINT1 if (channelLayout == AV_CH_LAYOUT_5POINT1 || channelLayout == AV_CH_LAYOUT_7POINT1
|| channelLayout == AV_CH_LAYOUT_QUAD) && !alIsExtensionPresent("AL_EXT_MCFORMATS")) || channelLayout == AV_CH_LAYOUT_QUAD) // FIXME: check for AL_EXT_MCFORMATS support
channelLayout = AV_CH_LAYOUT_STEREO; channelLayout = AV_CH_LAYOUT_STEREO;
else if (channelLayout != AV_CH_LAYOUT_MONO else if (channelLayout != AV_CH_LAYOUT_MONO
&& channelLayout != AV_CH_LAYOUT_STEREO) && channelLayout != AV_CH_LAYOUT_STEREO)