aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrent Nelson <trent.a.b.nelson@gmail.com>2014-03-28 11:03:57 -0600
committerTrent Nelson <trent.a.b.nelson@gmail.com>2014-03-28 11:06:03 -0600
commite2cff35c794a7b7a6be6d22eb56ca8c45eda5665 (patch)
tree8ca720e63bc4496b682deef63bd1301f7fab975f
parent204b6a38a7a25e29eac0a65e315b44145ac0aea4 (diff)
Merge pull request #4467 from Memphiz/osxnosamplerate
[osxsink] - for devices which report samplerate 0hz - allow user overrid...
-rw-r--r--xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp
index 9d82b87c02..b539244af6 100644
--- a/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkDARWINOSX.cpp
@@ -199,6 +199,18 @@ static void EnumerateDevices(CADeviceList &list)
}
// add sample rate info
+ // quirk devices which don't report a valid samplerate
+ // add 44.1khz and 48khz in that case - user can use
+ // the "fixed" audio config to force one of them
+ if (desc.mSampleRate == 0)
+ {
+ CLog::Log(LOGWARNING, "%s no valid samplerate - adding 44.1khz and 48khz quirk", __FUNCTION__);
+ desc.mSampleRate = 44100;
+ if (!HasSampleRate(device.m_sampleRates, desc.mSampleRate))
+ device.m_sampleRates.push_back(desc.mSampleRate);
+ desc.mSampleRate = 48000;
+ }
+
if (!HasSampleRate(device.m_sampleRates, desc.mSampleRate))
device.m_sampleRates.push_back(desc.mSampleRate);
}
@@ -463,7 +475,14 @@ bool CAESinkDARWINOSX::Initialize(AEAudioFormat &format, std::string &device)
CCoreAudioStream::GetAvailablePhysicalFormats(*i, &formats);
for (StreamFormatList::const_iterator j = formats.begin(); j != formats.end(); ++j)
{
- const AudioStreamBasicDescription &desc = j->mFormat;
+ AudioStreamBasicDescription desc = j->mFormat;
+
+ // quirk devices with invalid sample rate
+ // assume that the user uses a fixed config
+ // and knows what he is doing - so we use
+ // the requested samplerate here
+ if (desc.mSampleRate == 0)
+ desc.mSampleRate = format.m_sampleRate;
float score = ScoreStream(desc, format);