예제 #1
0
void CActiveAESettings::SettingOptionsAudioDevicesFillerGeneral(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, bool passthrough)
{
  current = ((const CSettingString*)setting)->GetValue();
  std::string firstDevice;

  bool foundValue = false;
  AEDeviceList sinkList;
  CServiceBroker::GetActiveAE().EnumerateOutputDevices(sinkList, passthrough);
  if (sinkList.empty())
    list.push_back(std::make_pair("Error - no devices found", "error"));
  else
  {
    for (AEDeviceList::const_iterator sink = sinkList.begin(); sink != sinkList.end(); ++sink)
    {
      if (sink == sinkList.begin())
        firstDevice = sink->second;

      list.push_back(std::make_pair(sink->first, sink->second));

      if (StringUtils::EqualsNoCase(current, sink->second))
        foundValue = true;
    }
  }

  if (!foundValue)
    current = firstDevice;
}
예제 #2
0
파일: AEFactory.cpp 프로젝트: nremenda/xbmc
void CAEFactory::SettingOptionsAudioDevicesFillerGeneral(const CSetting *setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, bool passthrough)
{
  current = ((const CSettingString*)setting)->GetValue();
  std::string firstDevice;

  bool foundValue = false;
  AEDeviceList sinkList;
  EnumerateOutputDevices(sinkList, passthrough);
#if !defined(TARGET_DARWIN)
  if (sinkList.size() == 0)
    list.push_back(std::make_pair("Error - no devices found", "error"));
  else
  {
#endif
    for (AEDeviceList::const_iterator sink = sinkList.begin(); sink != sinkList.end(); sink++)
    {
      if (sink == sinkList.begin())
        firstDevice = sink->second;

#if defined(TARGET_DARWIN)
      list.push_back(std::make_pair(sink->first, sink->first));
#else
      list.push_back(std::make_pair(sink->first, sink->second));
#endif

      if (StringUtils::EqualsNoCase(current, sink->second))
        foundValue = true;
    }
#if !defined(TARGET_DARWIN)
  }
#endif

  if (!foundValue)
    current = firstDevice;
}
예제 #3
0
void CAEFactory::VerifyOutputDevice(std::string &device, bool passthrough)
{
  AEDeviceList devices;
  EnumerateOutputDevices(devices, passthrough);
  std::string firstDevice;

  for (AEDeviceList::const_iterator deviceIt = devices.begin(); deviceIt != devices.end(); deviceIt++)
  {
    std::string currentDevice = deviceIt->second;
    /* remember the first device so we can default to it if required */
    if (firstDevice.empty())
      firstDevice = deviceIt->second;

    if (deviceIt->second == device)
      return;
    else if (deviceIt->first == device)
    {
      device = deviceIt->second;
      return;
    }
  }

  /* if the device wasnt found, set it to the first viable output */
  device = firstDevice;
}
예제 #4
0
void CPiAudioAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
{
   if (!passthrough)
   {
     devices.push_back(AEDevice("Analogue", "Analogue"));
     devices.push_back(AEDevice("HDMI", "HDMI"));
   }
}
예제 #5
0
void CActiveAESink::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
{
  EnumerateSinkList(false);

  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;
      if (passthrough && devInfo.m_deviceType == AE_DEVTYPE_PCM)
        continue;

      std::string device = sinkInfo.m_sinkName + ":" + devInfo.m_deviceName;

      std::stringstream ss;

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

      ss << devInfo.m_displayName;
      if (!devInfo.m_displayNameExtra.empty())
        ss << ", " << devInfo.m_displayNameExtra;

      devices.push_back(AEDevice(ss.str(), device));
    }
  }
}
예제 #6
0
void CCoreAudioAEHALIOS::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
{
  IOSCoreAudioDeviceList deviceList;
  CIOSCoreAudioHardware::GetOutputDevices(&deviceList);

  // Add default output device if GetOutputDevices return nothing
  devices.push_back(AEDevice("Default", "IOSCoreAudio:default"));

  std::string deviceName;
  for (int i = 0; !deviceList.empty(); i++)
  {
    std::string deviceName_Internal = std::string("IOSCoreAudio:") + deviceName;
    devices.push_back(AEDevice(deviceName, deviceName_Internal));

    deviceList.pop_front();

  }
}
예제 #7
0
void CCoreAudioAEHALOSX::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
{
  CoreAudioDeviceList deviceList;
  CCoreAudioHardware::GetOutputDevices(&deviceList);

  devices.push_back(AEDevice("Default", "CoreAudio:default"));

  std::string deviceName;
  for (int i = 0; !deviceList.empty(); i++)
  {
    CCoreAudioDevice device(deviceList.front());
    deviceName = device.GetName();

    std::string deviceName_Internal = std::string("CoreAudio:");
    deviceName_Internal.append(deviceName);
    devices.push_back(AEDevice(deviceName, deviceName_Internal));

    deviceList.pop_front();
  }
}
예제 #8
0
파일: PulseAE.cpp 프로젝트: 2BReality/xbmc
void CPulseAE::EnumerateOutputDevices(AEDeviceList &devices, bool passthrough)
{
  if (!m_MainLoop || ! m_Context)
    return;

  pa_threaded_mainloop_lock(m_MainLoop);

  SinkInfoStruct sinkStruct;
  sinkStruct.passthrough = passthrough;
  sinkStruct.mainloop = m_MainLoop;
  sinkStruct.list = &devices;
  CStdString def;
  def.Format("%s (PulseAudio)",g_localizeStrings.Get(409).c_str());
  devices.push_back(AEDevice(def, "pulse:default@default"));
  WaitForOperation(pa_context_get_sink_info_list(m_Context,
                   SinkInfo, &sinkStruct), m_MainLoop, "EnumerateAudioSinks");

  pa_threaded_mainloop_unlock(m_MainLoop);
}
예제 #9
0
void CAESinkProfiler::EnumerateDevices (AEDeviceList &devices, bool passthrough)
{
  devices.push_back(AEDevice("Profiler", "Profiler"));
}