本文整理汇总了C++中AEDeviceInfoList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ AEDeviceInfoList::empty方法的具体用法?C++ AEDeviceInfoList::empty怎么用?C++ AEDeviceInfoList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AEDeviceInfoList
的用法示例。
在下文中一共展示了AEDeviceInfoList::empty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EnumerateDevicesEx
void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
{
/* ensure that ALSA has been initialized */
snd_lib_error_set_handler(sndLibErrorHandler);
if(!snd_config || force)
{
if(force)
snd_config_update_free_global();
snd_config_update();
}
snd_config_t *config;
snd_config_copy(&config, snd_config);
/* Always enumerate the default device.
* Note: If "default" is a stereo device, EnumerateDevice()
* will automatically add "@" instead to enable surroundXX mangling.
* We don't want to do that if "default" can handle multichannel
* itself (e.g. in case of a pulseaudio server). */
EnumerateDevice(list, "default", "", config);
void **hints;
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
{
CLog::Log(LOGINFO, "CAESinkALSA - Unable to get a list of devices");
return;
}
std::string defaultDescription;
for (void** hint = hints; *hint != NULL; ++hint)
{
char *io = snd_device_name_get_hint(*hint, "IOID");
char *name = snd_device_name_get_hint(*hint, "NAME");
char *desc = snd_device_name_get_hint(*hint, "DESC");
if ((!io || strcmp(io, "Output") == 0) && name
&& strcmp(name, "null") != 0)
{
std::string baseName = std::string(name);
baseName = baseName.substr(0, baseName.find(':'));
if (strcmp(name, "default") == 0)
{
/* added already, but lets get the description if we have one */
if (desc)
defaultDescription = desc;
}
else if (baseName == "front")
{
/* Enumerate using the surroundXX mangling */
/* do not enumerate basic "front", it is already handled
* by the default "@" entry added in the very beginning */
if (strcmp(name, "front") != 0)
EnumerateDevice(list, std::string("@") + (name+5), desc ? desc : name, config);
}
/* Do not enumerate "default", it is already enumerated above. */
/* Do not enumerate the sysdefault or surroundXX devices, those are
* always accompanied with a "front" device and it is handled above
* as "@". The below devices will be automatically used if available
* for a "@" device. */
/* Ubuntu has patched their alsa-lib so that "defaults.namehint.extended"
* defaults to "on" instead of upstream "off", causing lots of unwanted
* extra devices (many of which are not actually routed properly) to be
* found by the enumeration process. Skip them as well ("hw", "dmix",
* "plughw", "dsnoop"). */
else if (baseName != "default"
&& baseName != "sysdefault"
&& baseName != "surround40"
&& baseName != "surround41"
&& baseName != "surround50"
&& baseName != "surround51"
&& baseName != "surround71"
&& baseName != "hw"
&& baseName != "dmix"
&& baseName != "plughw"
&& baseName != "dsnoop")
{
EnumerateDevice(list, name, desc ? desc : name, config);
}
}
free(io);
free(name);
free(desc);
}
snd_device_name_free_hint(hints);
/* set the displayname for default device */
if (!list.empty() && list[0].m_deviceName == "default")
{
/* If we have one from a hint (DESC), use it */
if (!defaultDescription.empty())
list[0].m_displayName = defaultDescription;
/* Otherwise use the discovered name or (unlikely) "Default" */
else if (list[0].m_displayName.empty())
//.........这里部分代码省略.........