Merge pull request #1129 from jmarshallnz/remove_smb_auth_details_in_add_source
[vuplus_xbmc] / xbmc / cores / AudioEngine / Utils / AEDeviceInfo.cpp
1 /*
2  *      Copyright (C) 2012 Team XBMC
3  *      http://xbmc.org
4  *
5  *  This Program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This Program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with XBMC; see the file COPYING.  If not, write to
17  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18  *  http://www.gnu.org/copyleft/gpl.html
19  *
20  */
21
22 #include <sstream>
23 #include "AEDeviceInfo.h"
24 #include "AEUtil.h"
25
26 CAEDeviceInfo::operator std::string()
27 {
28   std::stringstream ss;
29   ss << "m_deviceName      : " << m_deviceName << '\n';
30   ss << "m_displayName     : " << m_displayName << '\n';
31   ss << "m_displayNameExtra: " << m_displayNameExtra << '\n';
32   ss << "m_deviceType      : " << DeviceTypeToString(m_deviceType) + '\n';
33   ss << "m_channels        : " << (std::string)m_channels << '\n';
34
35   ss << "m_sampleRates     : ";
36   for (AESampleRateList::iterator itt = m_sampleRates.begin(); itt != m_sampleRates.end(); ++itt)
37   {
38     if (itt != m_sampleRates.begin())
39       ss << ',';
40     ss << *itt;
41   }
42   ss << '\n';
43
44   ss << "m_dataFormats     : ";
45   for (AEDataFormatList::iterator itt = m_dataFormats.begin(); itt != m_dataFormats.end(); ++itt)
46   {
47     if (itt != m_dataFormats.begin())
48       ss << ',';
49     ss << CAEUtil::DataFormatToStr(*itt);
50   }
51   ss << '\n';
52
53   return ss.str();
54 }
55
56 std::string CAEDeviceInfo::DeviceTypeToString(enum AEDeviceType deviceType)
57 {
58   switch (deviceType)
59   {
60     case AE_DEVTYPE_PCM   : return "AE_DEVTYPE_PCM"   ; break;
61     case AE_DEVTYPE_IEC958: return "AE_DEVTYPE_IEC958"; break;
62     case AE_DEVTYPE_HDMI  : return "AE_DEVTYPE_HDMI"  ; break;
63     case AE_DEVTYPE_DP    : return "AE_DEVTYPE_DP"    ; break;
64   }
65   return "INVALID";
66 }