Skip to content

Commit

Permalink
ActiveAE: consider list of supported audio formats
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Feb 9, 2014
1 parent 40e06e7 commit 874e161
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
3 changes: 2 additions & 1 deletion system/settings/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2394,7 +2394,8 @@
<dependency type="visible">
<and>
<condition setting="audiooutput.passthrough" operator="is">true</condition>
<condition on="property" name="aesettingvisible" setting="audiooutput.config">audiooutput.passthrough</condition>
<condition on="property" name="aesettingvisible" setting="audiooutput.config">audiooutput.eac3passthrough</condition>
<condition on="property" name="aesettingvisible" setting="audiooutput.passthroughdevice">audiooutput.eac3passthrough</condition>

This comment has been minimized.

Copy link
@fritsch

fritsch Feb 12, 2014

That looks quite odd with the eac3 passthrough device

This comment has been minimized.

Copy link
@FernetMenta

FernetMenta Feb 13, 2014

Author Owner

why? what's wrong with it?

This comment has been minimized.

Copy link
@fritsch

fritsch Feb 13, 2014

It's okay - I searched the but here yesterday and was confused: http://forum.xbmc.org/showthread.php?tid=170338&pid=1626225#pid1626225

Don't know if you have seen it already, but I think some "string comparison" down there goes wrong.

</and>
</dependency>
</dependencies>
Expand Down
26 changes: 11 additions & 15 deletions xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2123,17 +2123,9 @@ void CActiveAE::OnSettingsChange(const std::string& setting)

bool CActiveAE::SupportsRaw(AEDataFormat format)
{
if (!m_sink.HasPassthroughDevice())
if (!m_sink.SupportsFormat(CSettings::Get().GetString("audiooutput.passthroughdevice"), format))
return false;

// those formats require HDMI
if (format == AE_FMT_DTSHD || format == AE_FMT_TRUEHD)
{
if(m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.passthroughdevice")) != AE_DEVTYPE_HDMI)
return false;
}

// TODO: check ELD?
return true;
}

Expand Down Expand Up @@ -2171,16 +2163,20 @@ bool CActiveAE::IsSettingVisible(const std::string &settingId)
}
else if (settingId == "audiooutput.truehdpassthrough")
{
if (m_sink.HasPassthroughDevice() &&
CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED &&
m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.passthroughdevice")) == AE_DEVTYPE_HDMI)
if (m_sink.SupportsFormat(CSettings::Get().GetString("audiooutput.passthroughdevice"), AE_FMT_TRUEHD) &&
CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED)
return true;
}
else if (settingId == "audiooutput.dtshdpassthrough")
{
if (m_sink.HasPassthroughDevice() &&
CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED &&
m_sink.GetDeviceType(CSettings::Get().GetString("audiooutput.passthroughdevice")) == AE_DEVTYPE_HDMI)
if (m_sink.SupportsFormat(CSettings::Get().GetString("audiooutput.passthroughdevice"), AE_FMT_DTSHD) &&
CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED)
return true;
}
else if (settingId == "audiooutput.eac3passthrough")
{
if (m_sink.SupportsFormat(CSettings::Get().GetString("audiooutput.passthroughdevice"), AE_FMT_EAC3) &&
CSettings::Get().GetInt("audiooutput.config") != AE_CONFIG_FIXED)
return true;
}
else if (settingId == "audiooutput.stereoupmix")
Expand Down
24 changes: 24 additions & 0 deletions xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,30 @@ bool CActiveAESink::HasPassthroughDevice()
return false;
}

bool CActiveAESink::SupportsFormat(const std::string &device, AEDataFormat format)
{
std::string dev = device;
std::string dri;
CAESinkFactory::ParseDevice(dev, dri);
for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt)
{
for (AEDeviceInfoList::iterator itt2 = itt->m_deviceInfoList.begin(); itt2 != itt->m_deviceInfoList.end(); ++itt2)
{
CAEDeviceInfo& info = *itt2;
if (info.m_deviceName == dev)

This comment has been minimized.

Copy link
@fritsch

fritsch Feb 13, 2014

On Windows WASAPI and DirectSound have the same name for specific Sinks. We need to loop over the first loop and compare dri and then when this matches go into the second loop to compare dev

This comment has been minimized.

Copy link
@fritsch

fritsch Feb 13, 2014

fritsch@16897aa <- okay to PR?

{
AEDataFormatList::iterator itt3;
itt3 = find(info.m_dataFormats.begin(), info.m_dataFormats.end(), format);
if (itt3 != info.m_dataFormats.end())
return true;
else
return false;
}
}
}
return false;
}

enum SINK_STATES
{
S_TOP = 0, // 0
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class CActiveAESink : private CThread
void Dispose();
AEDeviceType GetDeviceType(const std::string &device);
bool HasPassthroughDevice();
bool SupportsFormat(const std::string &device, AEDataFormat format);
CSinkControlProtocol m_controlPort;
CSinkDataProtocol m_dataPort;

Expand Down

0 comments on commit 874e161

Please sign in to comment.