本文整理汇总了C++中AEDeviceInfoList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ AEDeviceInfoList::push_back方法的具体用法?C++ AEDeviceInfoList::push_back怎么用?C++ AEDeviceInfoList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEDeviceInfoList
的用法示例。
在下文中一共展示了AEDeviceInfoList::push_back方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumerateDevicesEx
void CAESinkPi::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_HDMI;
m_info.m_deviceName = "HDMI";
m_info.m_displayName = "HDMI";
m_info.m_displayNameExtra = "";
m_info.m_channels += AE_CH_FL;
m_info.m_channels += AE_CH_FR;
m_info.m_sampleRates.push_back(48000);
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
list.push_back(m_info);
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_PCM;
m_info.m_deviceName = "Analogue";
m_info.m_displayName = "Analogue";
m_info.m_displayNameExtra = "";
m_info.m_channels += AE_CH_FL;
m_info.m_channels += AE_CH_FR;
m_info.m_sampleRates.push_back(48000);
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
list.push_back(m_info);
}
示例2: EnumerateDevicesEx
void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_PCM;
#if defined(HAS_LIBAMCODEC)
// AML devices can do passthough
if (aml_present())
{
m_info.m_deviceType = AE_DEVTYPE_HDMI;
m_info.m_dataFormats.push_back(AE_FMT_AC3);
m_info.m_dataFormats.push_back(AE_FMT_DTS);
}
#endif
m_info.m_deviceName = "AudioTrack";
m_info.m_displayName = "android";
m_info.m_displayNameExtra = "audiotrack";
m_info.m_channels += AE_CH_FL;
m_info.m_channels += AE_CH_FR;
m_info.m_sampleRates.push_back(44100);
m_info.m_sampleRates.push_back(48000);
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
#if 0 //defined(__ARM_NEON__)
if (g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_NEON)
m_info.m_dataFormats.push_back(AE_FMT_FLOAT);
#endif
list.push_back(m_info);
}
示例3: EnumerateDevicesEx
void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_PCM;
m_info.m_deviceName = "AudioTrack";
m_info.m_displayName = "android";
m_info.m_displayNameExtra = "audiotrack";
#ifdef LIMIT_TO_STEREO_AND_5POINT1_AND_7POINT1
if (Has71Support())
m_info.m_channels = AE_CH_LAYOUT_7_1;
else
m_info.m_channels = AE_CH_LAYOUT_5_1;
#else
m_info.m_channels = KnownChannels;
#endif
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
m_info.m_sampleRates.push_back(CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC));
if (!CXBMCApp::IsHeadsetPlugged())
{
m_info.m_deviceType = AE_DEVTYPE_HDMI;
int test_sample[] = { 44100, 48000, 96000, 192000 };
int test_sample_sz = sizeof(test_sample) / sizeof(int);
for (int i=0; i<test_sample_sz; ++i)
{
if (IsSupported(test_sample[i], CJNIAudioFormat::CHANNEL_OUT_STEREO, CJNIAudioFormat::ENCODING_PCM_16BIT))
{
m_info.m_sampleRates.push_back(test_sample[i]);
CLog::Log(LOGDEBUG, "AESinkAUDIOTRACK - %d supported", test_sample[i]);
}
}
m_info.m_dataFormats.push_back(AE_FMT_AC3);
m_info.m_dataFormats.push_back(AE_FMT_DTS);
}
#if 0 //defined(__ARM_NEON__)
if (g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_NEON)
m_info.m_dataFormats.push_back(AE_FMT_FLOAT);
#endif
list.push_back(m_info);
}
示例4: EnumerateDevicesEx
void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
// Clear everything
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_streamTypes.clear();
m_sink_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_PCM;
m_info.m_deviceName = "AudioTrack";
m_info.m_displayName = "android";
m_info.m_displayNameExtra = "audiotrack";
UpdateAvailablePCMCapabilities();
if (!CXBMCApp::IsHeadsetPlugged())
{
UpdateAvailablePassthroughCapabilities();
}
list.push_back(m_info);
}
示例5: EnumerateDevicesEx
void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_HDMI;
m_info.m_deviceName = "AudioTrack";
m_info.m_displayName = "android";
m_info.m_displayNameExtra = "audiotrack";
#ifdef LIMIT_TO_STEREO_AND_5POINT1
m_info.m_channels = AE_CH_LAYOUT_5_1;
#else
m_info.m_channels = KnownChannels;
#endif
// MSTAR PATCH BEGIN
//m_info.m_sampleRates.push_back(CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC));
m_info.m_sampleRates.push_back(44100);
m_info.m_sampleRates.push_back(48000);
// MSTAR PATCH END
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
m_info.m_dataFormats.push_back(AE_FMT_AC3);
m_info.m_dataFormats.push_back(AE_FMT_DTS);
// MSTAR PATCH BEGIN
m_info.m_dataFormats.push_back(AE_FMT_EAC3);
m_info.m_dataFormats.push_back(AE_FMT_TRUEHD);
m_info.m_dataFormats.push_back(AE_FMT_DTSHD);
m_info.m_sampleRates.push_back(192000);
// MSTAR PATCH END
#if 0 //defined(__ARM_NEON__)
if (g_cpuInfo.GetCPUFeatures() & CPU_FEATURE_NEON)
m_info.m_dataFormats.push_back(AE_FMT_FLOAT);
#endif
list.push_back(m_info);
}
示例6: EnumerateDevicesEx
//.........这里部分代码省略.........
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Retrieval of DirectSound endpoint properties failed.");
SAFE_RELEASE(pDevice);
goto failed;
}
hr = pProperty->GetValue(PKEY_Device_FriendlyName, &varName);
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Retrieval of DirectSound endpoint device name failed.");
SAFE_RELEASE(pDevice);
SAFE_RELEASE(pProperty);
goto failed;
}
std::string strFriendlyName = localWideToUtf(varName.pwszVal);
PropVariantClear(&varName);
hr = pProperty->GetValue(PKEY_AudioEndpoint_GUID, &varName);
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Retrieval of DirectSound endpoint GUID failed.");
SAFE_RELEASE(pDevice);
SAFE_RELEASE(pProperty);
goto failed;
}
std::string strDevName = localWideToUtf(varName.pwszVal);
PropVariantClear(&varName);
hr = pProperty->GetValue(PKEY_AudioEndpoint_FormFactor, &varName);
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Retrieval of DirectSound endpoint form factor failed.");
SAFE_RELEASE(pDevice);
SAFE_RELEASE(pProperty);
goto failed;
}
std::string strWinDevType = winEndpoints[(EndpointFormFactor)varName.uiVal].winEndpointType;
AEDeviceType aeDeviceType = winEndpoints[(EndpointFormFactor)varName.uiVal].aeDeviceType;
PropVariantClear(&varName);
/* In shared mode Windows tells us what format the audio must be in. */
IAudioClient *pClient;
hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pClient);
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Activate device failed (%s)", WASAPIErrToStr(hr));
goto failed;
}
//hr = pClient->GetMixFormat(&pwfxex);
hr = pProperty->GetValue(PKEY_AudioEngine_DeviceFormat, &varName);
if (SUCCEEDED(hr) && varName.blob.cbSize > 0)
{
WAVEFORMATEX* smpwfxex = (WAVEFORMATEX*)varName.blob.pBlobData;
deviceInfo.m_channels = layoutsByChCount[std::max(std::min(smpwfxex->nChannels, (WORD) DS_SPEAKER_COUNT), (WORD) 2)];
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_FLOAT));
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_AC3));
deviceInfo.m_sampleRates.push_back(std::min(smpwfxex->nSamplesPerSec, (DWORD) 192000));
}
else
{
CLog::Log(LOGERROR, __FUNCTION__": Getting DeviceFormat failed (%s)", WASAPIErrToStr(hr));
}
pClient->Release();
SAFE_RELEASE(pDevice);
SAFE_RELEASE(pProperty);
deviceInfo.m_deviceName = strDevName;
deviceInfo.m_displayName = strWinDevType.append(strFriendlyName);
deviceInfo.m_displayNameExtra = std::string("DirectSound: ").append(strFriendlyName);
deviceInfo.m_deviceType = aeDeviceType;
deviceInfoList.push_back(deviceInfo);
// add the default device with m_deviceName = default
if(strDD == strDevName)
{
deviceInfo.m_deviceName = std::string("default");
deviceInfo.m_displayName = std::string("default");
deviceInfo.m_displayNameExtra = std::string("");
deviceInfoList.push_back(deviceInfo);
}
}
return;
failed:
if (FAILED(hr))
CLog::Log(LOGERROR, __FUNCTION__": Failed to enumerate WASAPI endpoint devices (%s).", WASAPIErrToStr(hr));
SAFE_RELEASE(pEnumDevices);
SAFE_RELEASE(pEnumerator);
}
示例7: EnumerateDevicesEx
void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_PCM;
m_info.m_deviceName = "AudioTrack";
m_info.m_displayName = "android";
m_info.m_displayNameExtra = "audiotrack";
#ifdef LIMIT_TO_STEREO_AND_5POINT1_AND_7POINT1
if (Has71Support())
m_info.m_channels = AE_CH_LAYOUT_7_1;
else
m_info.m_channels = AE_CH_LAYOUT_5_1;
#else
m_info.m_channels = KnownChannels;
#endif
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
m_sink_sampleRates.clear();
m_sink_sampleRates.insert(CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC));
m_info.m_wantsIECPassthrough = true;
if (!CXBMCApp::IsHeadsetPlugged())
{
m_info.m_deviceType = AE_DEVTYPE_HDMI;
m_info.m_dataFormats.push_back(AE_FMT_RAW);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_AC3);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD_CORE);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTS_1024);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTS_2048);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTS_512);
#if defined(HAS_LIBAMCODEC)
if (aml_present())
{
// passthrough
m_info.m_wantsIECPassthrough = true;
m_sink_sampleRates.insert(44100);
m_sink_sampleRates.insert(48000);
if (HasAmlHD())
{
m_sink_sampleRates.insert(96000);
m_sink_sampleRates.insert(192000);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_EAC3);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_TRUEHD);
}
}
else
#endif
{
int test_sample[] = { 32000, 44100, 48000, 96000, 192000 };
int test_sample_sz = sizeof(test_sample) / sizeof(int);
int encoding = CJNIAudioFormat::ENCODING_PCM_16BIT;
if (CJNIAudioManager::GetSDKVersion() >= 21)
encoding = CJNIAudioFormat::ENCODING_PCM_FLOAT;
for (int i=0; i<test_sample_sz; ++i)
{
if (IsSupported(test_sample[i], CJNIAudioFormat::CHANNEL_OUT_STEREO, encoding))
{
m_sink_sampleRates.insert(test_sample[i]);
CLog::Log(LOGDEBUG, "AESinkAUDIOTRACK - %d supported", test_sample[i]);
}
}
if (CJNIAudioManager::GetSDKVersion() >= 23)
{
m_info.m_wantsIECPassthrough = false;
// here only 5.1 would work but we cannot correctly distinguish
// m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_EAC3);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD);
}
if (StringUtils::StartsWithNoCase(CJNIBuild::DEVICE, "foster")) // SATV is ahead of API
{
m_info.m_wantsIECPassthrough = false;
if (CJNIAudioManager::GetSDKVersion() == 22)
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_TRUEHD);
}
}
std::copy(m_sink_sampleRates.begin(), m_sink_sampleRates.end(), std::back_inserter(m_info.m_sampleRates));
}
list.push_back(m_info);
}
示例8: EnumerateDevicesEx
void CAESinkDirectSound::EnumerateDevicesEx(AEDeviceInfoList &deviceInfoList, bool force)
{
CAEDeviceInfo deviceInfo;
IMMDeviceEnumerator* pEnumerator = NULL;
IMMDeviceCollection* pEnumDevices = NULL;
HRESULT hr;
/* See if we are on Windows XP */
if (!g_sysinfo.IsWindowsVersionAtLeast(CSysInfo::WindowsVersionVista))
{
/* We are on XP - WASAPI not supported - enumerate using DS devices */
LPGUID deviceGUID = NULL;
RPC_CSTR cszGUID;
std::string szGUID;
std::list<DSDevice> DSDeviceList;
DirectSoundEnumerate(DSEnumCallback, &DSDeviceList);
for(std::list<DSDevice>::iterator itt = DSDeviceList.begin(); itt != DSDeviceList.end(); ++itt)
{
if (UuidToString((*itt).lpGuid, &cszGUID) != RPC_S_OK)
continue; /* could not convert GUID to string - skip device */
deviceInfo.m_channels.Reset();
deviceInfo.m_dataFormats.clear();
deviceInfo.m_sampleRates.clear();
szGUID = (LPSTR)cszGUID;
deviceInfo.m_deviceName = "{" + szGUID + "}";
deviceInfo.m_displayName = (*itt).name;
deviceInfo.m_displayNameExtra = std::string("DirectSound: ") + (*itt).name;
deviceInfo.m_deviceType = AE_DEVTYPE_PCM;
deviceInfo.m_channels = layoutsByChCount[2];
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_FLOAT));
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_AC3));
deviceInfo.m_sampleRates.push_back((DWORD) 96000);
deviceInfoList.push_back(deviceInfo);
}
RpcStringFree(&cszGUID);
return;
}
/* Windows Vista or later - supporting WASAPI device probing */
hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, IID_IMMDeviceEnumerator, (void**)&pEnumerator);
EXIT_ON_FAILURE(hr, __FUNCTION__": Could not allocate WASAPI device enumerator. CoCreateInstance error code: %li", hr)
UINT uiCount = 0;
hr = pEnumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &pEnumDevices);
EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of audio endpoint enumeration failed.")
hr = pEnumDevices->GetCount(&uiCount);
EXIT_ON_FAILURE(hr, __FUNCTION__": Retrieval of audio endpoint count failed.")
for (UINT i = 0; i < uiCount; i++)
{
IMMDevice *pDevice = NULL;
IPropertyStore *pProperty = NULL;
PROPVARIANT varName;
PropVariantInit(&varName);
deviceInfo.m_channels.Reset();
deviceInfo.m_dataFormats.clear();
deviceInfo.m_sampleRates.clear();
hr = pEnumDevices->Item(i, &pDevice);
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Retrieval of DirectSound endpoint failed.");
goto failed;
}
hr = pDevice->OpenPropertyStore(STGM_READ, &pProperty);
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Retrieval of DirectSound endpoint properties failed.");
SAFE_RELEASE(pDevice);
goto failed;
}
hr = pProperty->GetValue(PKEY_Device_FriendlyName, &varName);
if (FAILED(hr))
{
CLog::Log(LOGERROR, __FUNCTION__": Retrieval of DirectSound endpoint device name failed.");
SAFE_RELEASE(pDevice);
SAFE_RELEASE(pProperty);
goto failed;
}
std::string strFriendlyName = localWideToUtf(varName.pwszVal);
PropVariantClear(&varName);
hr = pProperty->GetValue(PKEY_AudioEndpoint_GUID, &varName);
//.........这里部分代码省略.........
示例9: EnumerateDevicesEx
//.........这里部分代码省略.........
SAFE_RELEASE(pDevice);
SAFE_RELEASE(pProperty);
goto failed;
}
unsigned int uiChannelMask = std::max(varName.uintVal, (unsigned int) KSAUDIO_SPEAKER_STEREO);
deviceChannels.Reset();
for (unsigned int c = 0; c < WASAPI_SPEAKER_COUNT; c++)
{
if (uiChannelMask & WASAPIChannelOrder[c])
deviceChannels += AEChannelNames[c];
}
PropVariantClear(&varName);
IAudioClient *pClient;
hr = pDevice->Activate(IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&pClient);
if (SUCCEEDED(hr))
{
/* Test format DTS-HD */
wfxex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE)-sizeof(WAVEFORMATEX);
wfxex.Format.nSamplesPerSec = 192000;
wfxex.dwChannelMask = KSAUDIO_SPEAKER_7POINT1_SURROUND;
wfxex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfxex.SubFormat = KSDATAFORMAT_SUBTYPE_IEC61937_DTS_HD;
wfxex.Format.wBitsPerSample = 16;
wfxex.Samples.wValidBitsPerSample = 16;
wfxex.Format.nChannels = 8;
wfxex.Format.nBlockAlign = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
wfxex.Format.nAvgBytesPerSec = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;
hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
if (SUCCEEDED(hr))
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_DTSHD));
/* Test format Dolby TrueHD */
wfxex.SubFormat = KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_MLP;
hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
if (SUCCEEDED(hr))
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_TRUEHD));
/* Test format Dolby EAC3 */
wfxex.SubFormat = KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL_PLUS;
wfxex.Format.nChannels = 2;
wfxex.Format.nBlockAlign = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
wfxex.Format.nAvgBytesPerSec = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;
hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
if (SUCCEEDED(hr))
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_EAC3));
/* Test format DTS */
wfxex.Format.nSamplesPerSec = 48000;
wfxex.dwChannelMask = KSAUDIO_SPEAKER_5POINT1;
wfxex.SubFormat = KSDATAFORMAT_SUBTYPE_IEC61937_DTS;
wfxex.Format.nBlockAlign = wfxex.Format.nChannels * (wfxex.Format.wBitsPerSample >> 3);
wfxex.Format.nAvgBytesPerSec = wfxex.Format.nSamplesPerSec * wfxex.Format.nBlockAlign;
hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
if (SUCCEEDED(hr))
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_DTS));
/* Test format Dolby AC3 */
wfxex.SubFormat = KSDATAFORMAT_SUBTYPE_IEC61937_DOLBY_DIGITAL;
hr = pClient->IsFormatSupported(AUDCLNT_SHAREMODE_EXCLUSIVE, &wfxex.Format, NULL);
if (SUCCEEDED(hr))
deviceInfo.m_dataFormats.push_back(AEDataFormat(AE_FMT_AC3));
示例10: EnumerateDevicesEx
void CAESinkAUDIOTRACK::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
m_info.m_channels.Reset();
m_info.m_dataFormats.clear();
m_info.m_sampleRates.clear();
m_info.m_deviceType = AE_DEVTYPE_PCM;
m_info.m_deviceName = "AudioTrack";
m_info.m_displayName = "android";
m_info.m_displayNameExtra = "audiotrack";
#ifdef LIMIT_TO_STEREO_AND_5POINT1_AND_7POINT1
if (Has71Support())
m_info.m_channels = AE_CH_LAYOUT_7_1;
else
m_info.m_channels = AE_CH_LAYOUT_5_1;
#else
m_info.m_channels = KnownChannels;
#endif
m_info.m_dataFormats.push_back(AE_FMT_S16LE);
m_sink_sampleRates.clear();
m_sink_sampleRates.insert(CJNIAudioTrack::getNativeOutputSampleRate(CJNIAudioManager::STREAM_MUSIC));
m_info.m_wantsIECPassthrough = true;
if (!CXBMCApp::IsHeadsetPlugged())
{
m_info.m_deviceType = AE_DEVTYPE_HDMI;
m_info.m_wantsIECPassthrough = false;
m_info.m_dataFormats.push_back(AE_FMT_RAW);
if (CJNIAudioFormat::ENCODING_AC3 != -1)
{
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_AC3);
CLog::Log(LOGDEBUG, "Firmware implements AC3 RAW");
}
// EAC3 working on shield, broken on FireTV
if (CJNIAudioFormat::ENCODING_E_AC3 != -1)
{
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_EAC3);
CLog::Log(LOGDEBUG, "Firmware implements EAC3 RAW");
}
if (CJNIAudioFormat::ENCODING_DTS != -1)
{
CLog::Log(LOGDEBUG, "Firmware implements DTS RAW");
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD_CORE);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTS_1024);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTS_2048);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTS_512);
}
if (aml_present() && CJNIAudioManager::GetSDKVersion() < 23)
{
// passthrough
m_info.m_wantsIECPassthrough = true;
m_sink_sampleRates.insert(44100);
m_sink_sampleRates.insert(48000);
if (HasAmlHD())
{
m_sink_sampleRates.insert(96000);
m_sink_sampleRates.insert(192000);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_EAC3);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD);
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_TRUEHD);
}
}
else
{
bool supports_192khz = false;
int test_sample[] = { 32000, 44100, 48000, 88200, 96000, 176400, 192000 };
int test_sample_sz = sizeof(test_sample) / sizeof(int);
int encoding = CJNIAudioFormat::ENCODING_PCM_16BIT;
if (CJNIAudioManager::GetSDKVersion() >= 21)
encoding = CJNIAudioFormat::ENCODING_PCM_FLOAT;
for (int i=0; i<test_sample_sz; ++i)
{
if (IsSupported(test_sample[i], CJNIAudioFormat::CHANNEL_OUT_STEREO, encoding))
{
m_sink_sampleRates.insert(test_sample[i]);
if (test_sample[i] == 192000)
supports_192khz = true;
CLog::Log(LOGDEBUG, "AESinkAUDIOTRACK - %d supported", test_sample[i]);
}
}
if (CJNIAudioManager::GetSDKVersion() >= 23)
{
if (CJNIAudioFormat::ENCODING_DTS_HD != -1)
{
CLog::Log(LOGDEBUG, "Firmware implements DTS-HD RAW");
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_DTSHD);
}
if (CJNIAudioFormat::ENCODING_DOLBY_TRUEHD != -1)
{
CLog::Log(LOGDEBUG, "Firmware implements TrueHD RAW");
m_info.m_streamTypes.push_back(CAEStreamInfo::STREAM_TYPE_TRUEHD);
}
}
// Android v24 and backports can do real IEC API
if (CJNIAudioFormat::ENCODING_IEC61937 != -1)
{
//.........这里部分代码省略.........
示例11: EnumerateDevicesEx
void CAESinkSNDIO::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
struct sio_hdl *hdl;
struct sio_cap cap;
if ((hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0)) == nullptr)
{
CLog::Log(LOGERROR, "CAESinkSNDIO::EnumerateDevicesEx - sio_open");
return;
}
if (!sio_getcap(hdl, &cap))
{
CLog::Log(LOGERROR, "CAESinkSNDIO::EnumerateDevicesEx - sio_getcap");
return;
}
sio_close(hdl);
hdl = nullptr;
for (unsigned int i = 0; i < cap.nconf; i++)
{
CAEDeviceInfo info;
sio_cap::sio_conf conf = cap.confs[i];
info.m_deviceName = SIO_DEVANY;
info.m_displayName = "sndio";
info.m_displayNameExtra = "#" + std::to_string(i);
info.m_deviceType = AE_DEVTYPE_PCM;
info.m_wantsIECPassthrough = false;
unsigned int maxchan = 0;
for (unsigned int j = 0; j < SIO_NCHAN; j++)
{
if (conf.pchan & (1 << j))
maxchan = MAX(maxchan, cap.pchan[j]);
}
maxchan = MIN(maxchan, nitems(channelMap));
for (unsigned int j = 0; j < maxchan; j++)
info.m_channels += channelMap[j];
for (unsigned int j = 0; j < SIO_NRATE; j++)
{
if (conf.rate & (1 << j))
{
info.m_sampleRates.push_back(cap.rate[j]);
}
}
for (unsigned int j = 0; j < SIO_NENC; j++)
{
if (conf.enc & (1 << j))
{
AEDataFormat format = lookupDataFormat(cap.enc[j].bits, cap.enc[j].bps, cap.enc[j].sig, cap.enc[j].le, cap.enc[j].msb);
if (format != AE_FMT_INVALID)
info.m_dataFormats.push_back(format);
}
}
list.push_back(info);
}
}
示例12: EnumerateDevice
//.........这里部分代码省略.........
if (!info.m_displayNameExtra.empty())
info.m_displayNameExtra += ' ';
info.m_displayNameExtra += "S/PDIF";
}
else if (info.m_displayNameExtra.empty())
{
/* for USB audio, it gets a bit confusing as there is
* - "SB Live! 24-bit External"
* - "SB Live! 24-bit External, S/PDIF"
* so add "Analog" qualifier to the first one */
info.m_displayNameExtra = "Analog";
}
/* "default" is a device that will be used for all inputs, while
* "@" will be mangled to front/default/surroundXX as necessary */
if (device == "@" || device == "default")
{
/* Make it "Default (whatever)" */
info.m_displayName = "Default (" + info.m_displayName + (info.m_displayNameExtra.empty() ? "" : " " + info.m_displayNameExtra + ")");
info.m_displayNameExtra = "";
}
}
else
{
/* virtual devices: "default", "pulse", ... */
/* description can be e.g. "PulseAudio Sound Server" - for hw devices it is
* normally uninteresting, like "HDMI Audio Output" or "Default Audio Device",
* so we only use it for virtual devices that have no better display name */
info.m_displayName = description;
}
snd_pcm_hw_params_t *hwparams;
snd_pcm_hw_params_alloca(&hwparams);
memset(hwparams, 0, snd_pcm_hw_params_sizeof());
/* ensure we can get a playback configuration for the device */
if (snd_pcm_hw_params_any(pcmhandle, hwparams) < 0)
{
CLog::Log(LOGINFO, "CAESinkALSA - No playback configurations available for device \"%s\"", device.c_str());
snd_pcm_close(pcmhandle);
return;
}
/* detect the available sample rates */
for (unsigned int *rate = ALSASampleRateList; *rate != 0; ++rate)
if (snd_pcm_hw_params_test_rate(pcmhandle, hwparams, *rate, 0) >= 0)
info.m_sampleRates.push_back(*rate);
/* detect the channels available */
int channels = 0;
for (int i = ALSA_MAX_CHANNELS; i >= 1; --i)
{
/* Reopen the device if needed on the special "surroundXX" cases */
if (info.m_deviceType == AE_DEVTYPE_PCM && (i == 8 || i == 6 || i == 4))
OpenPCMDevice(device, "", i, &pcmhandle, config);
if (snd_pcm_hw_params_test_channels(pcmhandle, hwparams, i) >= 0)
{
channels = i;
break;
}
}
if (device == "default" && channels == 2)
{
/* This looks like the ALSA standard default stereo dmix device, we
* probably want to use "@" instead to get surroundXX. */
snd_pcm_close(pcmhandle);
EnumerateDevice(list, "@", description, config);
return;
}
CAEChannelInfo alsaChannels;
for (int i = 0; i < channels; ++i)
{
if (!info.m_channels.HasChannel(ALSAChannelMap[i]))
info.m_channels += ALSAChannelMap[i];
alsaChannels += ALSAChannelMap[i];
}
/* remove the channels from m_channels that we cant use */
info.m_channels.ResolveChannels(alsaChannels);
/* detect the PCM sample formats that are available */
for (enum AEDataFormat i = AE_FMT_MAX; i > AE_FMT_INVALID; i = (enum AEDataFormat)((int)i - 1))
{
if (AE_IS_RAW(i) || i == AE_FMT_MAX)
continue;
snd_pcm_format_t fmt = AEFormatToALSAFormat(i);
if (fmt == SND_PCM_FORMAT_UNKNOWN)
continue;
if (snd_pcm_hw_params_test_format(pcmhandle, hwparams, fmt) >= 0)
info.m_dataFormats.push_back(i);
}
snd_pcm_close(pcmhandle);
list.push_back(info);
}
示例13: EnumerateDevicesEx
void CAESinkOSS::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
int mixerfd;
const char * mixerdev = "/dev/mixer";
if ((mixerfd = open(mixerdev, O_RDWR, 0)) == -1)
{
CLog::Log(LOGNOTICE,
"CAESinkOSS::EnumerateDevicesEx - No OSS mixer device present: %s", mixerdev);
return;
}
#if defined(SNDCTL_SYSINFO) && defined(SNDCTL_CARDINFO)
oss_sysinfo sysinfo;
if (ioctl(mixerfd, SNDCTL_SYSINFO, &sysinfo) == -1)
{
// hardware not supported
// OSSv4 required ?
close(mixerfd);
return;
}
for (int i = 0; i < sysinfo.numcards; ++i)
{
std::stringstream devicepath;
std::stringstream devicename;
CAEDeviceInfo info;
oss_card_info cardinfo;
devicepath << "/dev/dsp" << i;
info.m_deviceName = devicepath.str();
cardinfo.card = i;
if (ioctl(mixerfd, SNDCTL_CARDINFO, &cardinfo) == -1)
break;
devicename << cardinfo.shortname << " " << cardinfo.longname;
info.m_displayName = devicename.str();
if (info.m_displayName.find("HDMI") != std::string::npos)
info.m_deviceType = AE_DEVTYPE_HDMI;
else if (info.m_displayName.find("Digital") != std::string::npos)
info.m_deviceType = AE_DEVTYPE_IEC958;
else
info.m_deviceType = AE_DEVTYPE_PCM;
oss_audioinfo ainfo;
memset(&ainfo, 0, sizeof(ainfo));
ainfo.dev = i;
if (ioctl(mixerfd, SNDCTL_AUDIOINFO, &ainfo) != -1) {
#if 0
if (ainfo.oformats & AFMT_S32_LE)
info.m_dataFormats.push_back(AE_FMT_S32LE);
if (ainfo.oformats & AFMT_S16_LE)
info.m_dataFormats.push_back(AE_FMT_S16LE);
#endif
for (int j = 0;
j < ainfo.max_channels && AE_CH_NULL != OSSChannelMap[j];
++j)
info.m_channels += OSSChannelMap[j];
for (int *rate = OSSSampleRateList; *rate != 0; ++rate)
if (*rate >= ainfo.min_rate && *rate <= ainfo.max_rate)
info.m_sampleRates.push_back(*rate);
}
list.push_back(info);
}
#endif
close(mixerfd);
}
示例14: EnumerateDevicesEx
void CAESinkIntelSMD::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
VERBOSE();
LoadEDID();
int maxChannels;
std::vector<AEDataFormat> formats;
std::vector<unsigned int> rates;
GetEDIDInfo(maxChannels, formats, rates);
// most likely TODO(q)- now messed up by quasar?
// And now even more messed up by Keyser :)
CAEDeviceInfo info;
info.m_channels.Reset();
info.m_dataFormats.clear();
info.m_sampleRates.clear();
info.m_deviceType = AE_DEVTYPE_PCM;
info.m_deviceName = "All";
info.m_displayName = "All Outputs";
info.m_displayNameExtra = "HDMI/SPDIF/Analog";
info.m_channels += AE_CH_FL;
info.m_channels += AE_CH_FR;
// support the rates available on HDMI, SPDIF and Analog will already support them
std::vector<unsigned int>::const_iterator it, itEnd = rates.end();
for (it = rates.begin(); it != itEnd; ++it)
info.m_sampleRates.push_back(*it);
info.m_dataFormats.push_back(AE_FMT_S16LE);
list.push_back(info);
info.m_channels.Reset();
info.m_dataFormats.clear();
//info.m_sampleRates.clear();
info.m_deviceType = AE_DEVTYPE_HDMI;
info.m_deviceName = "HDMI";
info.m_displayName = "HDMI";
info.m_displayNameExtra = "HDMI Output";
for (int i = 0; i < maxChannels; ++i)
info.m_channels += s_chMap[i];
//info.m_sampleRates.push_back(48000);
std::vector<AEDataFormat>::const_iterator itFormat, itFormatEnd = formats.end();
for (itFormat = formats.begin(); itFormat != itFormatEnd; ++itFormat)
info.m_dataFormats.push_back(*itFormat);
list.push_back(info);
info.m_channels.Reset();
info.m_dataFormats.clear();
info.m_sampleRates.clear();
info.m_deviceType = AE_DEVTYPE_IEC958;
info.m_deviceName = "SPDIF";
info.m_displayName = "SPDIF";
info.m_displayNameExtra = "Toslink Output";
info.m_channels += AE_CH_FL;
info.m_channels += AE_CH_FR;
//info.m_sampleRates.push_back(12000);
//info.m_sampleRates.push_back(24000);
info.m_sampleRates.push_back(32000);
info.m_sampleRates.push_back(44100);
info.m_sampleRates.push_back(48000);
info.m_sampleRates.push_back(88200);
info.m_sampleRates.push_back(96000);
info.m_sampleRates.push_back(176400);
info.m_sampleRates.push_back(192000);
info.m_dataFormats.push_back(AE_FMT_S24NE4);
info.m_dataFormats.push_back(AE_FMT_LPCM);
info.m_dataFormats.push_back(AE_FMT_S16LE);
info.m_dataFormats.push_back(AE_FMT_AC3);
info.m_dataFormats.push_back(AE_FMT_DTS);
info.m_dataFormats.push_back(AE_FMT_EAC3);
list.push_back(info);
info.m_channels.Reset();
info.m_dataFormats.clear();
info.m_sampleRates.clear();
info.m_deviceType = AE_DEVTYPE_PCM;
info.m_deviceName = "Analog";
info.m_displayName = "Analog";
info.m_displayNameExtra = "RCA Outputs";
info.m_channels += AE_CH_FL;
info.m_channels += AE_CH_FR;
//info.m_sampleRates.push_back(12000);
//info.m_sampleRates.push_back(24000);
info.m_sampleRates.push_back(32000);
info.m_sampleRates.push_back(44100);
info.m_sampleRates.push_back(48000);
info.m_sampleRates.push_back(88200);
info.m_sampleRates.push_back(96000);
info.m_sampleRates.push_back(176400);
info.m_sampleRates.push_back(192000);
info.m_dataFormats.push_back(AE_FMT_S16LE);
list.push_back(info);
}