Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use more information from AE in GUI #1643

Closed
wants to merge 9 commits into from
10 changes: 8 additions & 2 deletions language/English/strings.po
Expand Up @@ -10816,8 +10816,14 @@ msgctxt "#34110"
msgid "7.1"
msgstr ""

#34111-34119 reserved for future use
#empty strings from id 34111 to 34119
#34111-34118 reserved for future use
#empty strings from id 34111 to 34118

#. output device; passthrough device
#: xbmc/settings/GUIWindowSettingsCategory.cpp
msgctxt "#34119"
msgid "Error - no devices found"
msgstr ""

#: xbmc/settings/GUISettings.cpp
msgctxt "#34120"
Expand Down
1 change: 1 addition & 0 deletions project/VS2010Express/XBMC.vcxproj
Expand Up @@ -1009,6 +1009,7 @@
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEChannelInfo.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEConvert.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEDeviceInfo.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEDeviceType.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEPackIEC61937.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AERemap.h" />
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEStreamInfo.h" />
Expand Down
7 changes: 6 additions & 1 deletion project/VS2010Express/XBMC.vcxproj.filters
Expand Up @@ -5737,9 +5737,14 @@
<ClInclude Include="..\..\xbmc\dialogs\GUIDialogMediaFilter.h">
<Filter>dialogs</Filter>
</ClInclude>


<ClInclude Include="..\..\xbmc\interfaces\json-rpc\PVROperations.h">
<Filter>interfaces\json-rpc</Filter>
</ClInclude>
<ClInclude Include="..\..\xbmc\cores\AudioEngine\Utils\AEDeviceType.h">
<Filter>cores\AudioEngine\Utils</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\xbmc\win32\XBMC_PC.rc">
Expand Down Expand Up @@ -5771,4 +5776,4 @@
<Filter>interfaces\swig</Filter>
</None>
</ItemGroup>
</Project>
</Project>
8 changes: 8 additions & 0 deletions xbmc/cores/AudioEngine/AEFactory.cpp
Expand Up @@ -197,6 +197,14 @@ void CAEFactory::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
AE->EnumerateOutputDevices(devices, passthrough);
}

bool CAEFactory::EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough)
{
if(AE)
return AE->EnumerateOutputDevicesEx(devices, passthrough);

return false;
}

std::string CAEFactory::GetDefaultDevice(bool passthrough)
{
if(AE)
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/AudioEngine/AEFactory.h
Expand Up @@ -46,6 +46,7 @@ class CAEFactory
static void SetSoundMode(const int mode);
static void OnSettingsChange(std::string setting);
static void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough);
static bool EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough);
static std::string GetDefaultDevice(bool passthrough);
static bool SupportsRaw();
static void SetMute(const bool enabled);
Expand Down
34 changes: 34 additions & 0 deletions xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.cpp
Expand Up @@ -521,6 +521,9 @@ void CSoftAE::OnSettingsChange(std::string setting)
setting == "audiooutput.mode" ||
setting == "audiooutput.ac3passthrough" ||
setting == "audiooutput.dtspassthrough" ||
setting == "audiooutput.passthroughaac" ||
setting == "audiooutput.truehdpassthrough" ||
setting == "audiooutput.dtshdpassthrough" ||
setting == "audiooutput.channellayout" ||
setting == "audiooutput.useexclusivemode" ||
setting == "audiooutput.multichannellpcm" ||
Expand Down Expand Up @@ -688,6 +691,37 @@ void CSoftAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
}
}

bool CSoftAE::EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough)
{
for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt)
{
AESinkInfo& sinkInfo = *itt;
for (AEDeviceInfoList::iterator itt2 = sinkInfo.m_deviceInfoList.begin(); itt2 != sinkInfo.m_deviceInfoList.end(); ++itt2)
{
CAEDeviceInfo& devInfo = *itt2;
AEDeviceEx dev;
if (passthrough && !devInfo.SupportsRaw())
continue;

dev.m_DeviceType = devInfo.m_deviceType;
dev.m_DeviceName = devInfo.GetAEDeviceName();
dev.m_SupportedDataFormats = devInfo.m_dataFormats;

/* add the sink name if we have more then one sink type */
if (m_sinkInfoList.size() > 1)
dev.m_DisplayName = sinkInfo.m_sinkName + ":";

dev.m_DisplayName += devInfo.m_displayName;

if (!devInfo.m_displayNameExtra.empty())
dev.m_DisplayName += ", " + devInfo.m_displayNameExtra;

devices.push_back(dev);
}
}
return true;
}

std::string CSoftAE::GetDefaultDevice(bool passthrough)
{
for (AESinkInfoList::iterator itt = m_sinkInfoList.begin(); itt != m_sinkInfoList.end(); ++itt)
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/AudioEngine/Engines/SoftAE/SoftAE.h
Expand Up @@ -99,6 +99,7 @@ class CSoftAE : public IThreadedAE
double GetCacheTotal();

virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough);
virtual bool EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough);
virtual std::string GetDefaultDevice(bool passthrough);
virtual bool SupportsRaw();

Expand Down
16 changes: 16 additions & 0 deletions xbmc/cores/AudioEngine/Interfaces/AE.h
Expand Up @@ -26,9 +26,17 @@
#include "threads/CriticalSection.h"

#include "../AEAudioFormat.h"
#include "../Utils/AEDeviceType.h"

typedef std::pair<std::string, std::string> AEDevice;
typedef std::vector<AEDevice> AEDeviceList;
struct AEDeviceEx
{
std::string m_DeviceName;
std::string m_DisplayName;
enum AEDeviceType m_DeviceType;
std::vector<AEDataFormat> m_SupportedDataFormats;
};

/* forward declarations */
class IAEStream;
Expand Down Expand Up @@ -170,6 +178,14 @@ class IAE
*/
virtual void EnumerateOutputDevices(AEDeviceList &devices, bool passthrough) = 0;

/**
* Enumerate the supported audio output devices with extended information
* @param devices The device list to append supported devices to
* @param passthrough True if only passthrough devices are wanted
* @return false if not supported, true if succeed
*/
virtual bool EnumerateOutputDevicesEx(std::vector<AEDeviceEx> &devices, bool passthrough) { return false; }

/**
* Returns the default audio device
* @param passthrough True if the default passthrough device is wanted
Expand Down
6 changes: 3 additions & 3 deletions xbmc/cores/AudioEngine/Sinks/AESinkDirectSound.cpp
Expand Up @@ -75,17 +75,17 @@ struct winEndpointsToAEDeviceType

static const winEndpointsToAEDeviceType winEndpoints[EndpointFormFactor_enum_count] =
{
{"Network Device - ", AE_DEVTYPE_PCM},
{"Network Device - ", AE_DEVTYPE_NETWORK},
{"Speakers - ", AE_DEVTYPE_PCM},
{"LineLevel - ", AE_DEVTYPE_PCM},
{"Headphones - ", AE_DEVTYPE_PCM},
{"Microphone - ", AE_DEVTYPE_PCM},
{"Headset - ", AE_DEVTYPE_PCM},
{"Handset - ", AE_DEVTYPE_PCM},
{"Digital Passthrough - ", AE_DEVTYPE_IEC958},
{"Digital Passthrough - ", AE_DEVTYPE_DIGITALOUT},
{"SPDIF - ", AE_DEVTYPE_IEC958},
{"HDMI - ", AE_DEVTYPE_HDMI},
{"Unknown - ", AE_DEVTYPE_PCM},
{"Unknown - ", AE_DEVTYPE_UNKNOWN},
};

// implemented in AESinkWASAPI.cpp
Expand Down
6 changes: 3 additions & 3 deletions xbmc/cores/AudioEngine/Sinks/AESinkWASAPI.cpp
Expand Up @@ -124,17 +124,17 @@ struct winEndpointsToAEDeviceType

static const winEndpointsToAEDeviceType winEndpoints[EndpointFormFactor_enum_count] =
{
{"Network Device - ", AE_DEVTYPE_PCM},
{"Network Device - ", AE_DEVTYPE_NETWORK},
{"Speakers - ", AE_DEVTYPE_PCM},
{"LineLevel - ", AE_DEVTYPE_PCM},
{"Headphones - ", AE_DEVTYPE_PCM},
{"Microphone - ", AE_DEVTYPE_PCM},
{"Headset - ", AE_DEVTYPE_PCM},
{"Handset - ", AE_DEVTYPE_PCM},
{"Digital Passthrough - ", AE_DEVTYPE_IEC958},
{"Digital Passthrough - ", AE_DEVTYPE_DIGITALOUT},
{"SPDIF - ", AE_DEVTYPE_IEC958},
{"HDMI - ", AE_DEVTYPE_HDMI},
{"Unknown - ", AE_DEVTYPE_PCM},
{"Unknown - ", AE_DEVTYPE_UNKNOWN},
};

AEDeviceInfoList DeviceInfoList;
Expand Down
11 changes: 7 additions & 4 deletions xbmc/cores/AudioEngine/Utils/AEDeviceInfo.cpp
Expand Up @@ -56,10 +56,13 @@ std::string CAEDeviceInfo::DeviceTypeToString(enum AEDeviceType deviceType)
{
switch (deviceType)
{
case AE_DEVTYPE_PCM : return "AE_DEVTYPE_PCM" ; break;
case AE_DEVTYPE_IEC958: return "AE_DEVTYPE_IEC958"; break;
case AE_DEVTYPE_HDMI : return "AE_DEVTYPE_HDMI" ; break;
case AE_DEVTYPE_DP : return "AE_DEVTYPE_DP" ; break;
case AE_DEVTYPE_UNKNOWN : return "AE_DEVTYPE_UNKNOWN" ; break;
case AE_DEVTYPE_PCM : return "AE_DEVTYPE_PCM" ; break;
case AE_DEVTYPE_DIGITALOUT: return "AE_DEVTYPE_DIGITALOUT"; break;
case AE_DEVTYPE_IEC958 : return "AE_DEVTYPE_IEC958" ; break;
case AE_DEVTYPE_HDMI : return "AE_DEVTYPE_HDMI" ; break;
case AE_DEVTYPE_DP : return "AE_DEVTYPE_DP" ; break;
case AE_DEVTYPE_NETWORK : return "AE_DEVTYPE_NETWORK" ; break;
}
return "INVALID";
}
8 changes: 1 addition & 7 deletions xbmc/cores/AudioEngine/Utils/AEDeviceInfo.h
Expand Up @@ -23,17 +23,11 @@
#include <vector>
#include "AEAudioFormat.h"
#include "Utils/AEChannelInfo.h"
#include "Utils/AEDeviceType.h"

typedef std::vector<unsigned int > AESampleRateList;
typedef std::vector<enum AEDataFormat> AEDataFormatList;

enum AEDeviceType {
AE_DEVTYPE_PCM,
AE_DEVTYPE_IEC958,
AE_DEVTYPE_HDMI,
AE_DEVTYPE_DP
};

/**
* This classt provides the details of what the audio output hardware is capable of
*/
Expand Down
32 changes: 32 additions & 0 deletions xbmc/cores/AudioEngine/Utils/AEDeviceType.h
@@ -0,0 +1,32 @@
#pragma once
/*
* Copyright (C) 2012 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/

enum AEDeviceType
{
AE_DEVTYPE_UNKNOWN, /* Unknown or undetermined device */
AE_DEVTYPE_PCM, /* PCM-only capable device, usually audio with analog output */
AE_DEVTYPE_DIGITALOUT, /* Some digital output */
AE_DEVTYPE_IEC958, /* IEC958 (S/PDIF) output */
AE_DEVTYPE_HDMI, /* HDMI output */
AE_DEVTYPE_DP, /* DisplayPort output */
AE_DEVTYPE_NETWORK /* Networked audio output */
};