29 #include <sys/types.h>
36 #define LOC QString("ELDUTILS: ")
93 "DSD (One Bit Audio)",
113 #define SNDRV_PCM_RATE_5512 (1<<0)
114 #define SNDRV_PCM_RATE_8000 (1<<1)
115 #define SNDRV_PCM_RATE_11025 (1<<2)
116 #define SNDRV_PCM_RATE_16000 (1<<3)
117 #define SNDRV_PCM_RATE_22050 (1<<4)
118 #define SNDRV_PCM_RATE_32000 (1<<5)
119 #define SNDRV_PCM_RATE_44100 (1<<6)
120 #define SNDRV_PCM_RATE_48000 (1<<7)
121 #define SNDRV_PCM_RATE_64000 (1<<8)
122 #define SNDRV_PCM_RATE_88200 (1<<9)
123 #define SNDRV_PCM_RATE_96000 (1<<10)
124 #define SNDRV_PCM_RATE_176400 (1<<11)
125 #define SNDRV_PCM_RATE_192000 (1<<12)
139 GRAB_BITS(
const char* buf,
size_t byte, uint8_t lowbit, uint8_t bits)
140 {
return (buf[
byte] >> lowbit) & ((1 << bits) - 1); };
169 for (
int i = 0; i < 7; i++)
170 if ((val & (1 << i)) != 0)
184 VBAUDIO(
"audio coding type 0 not expected");
218 VBAUDIO(QString(
"audio coding xtype %1 not expected")
255 m_e.
port_id = qFromLittleEndian<quint64>(buf + 8);
263 VBAUDIO(QString(
"out of range MNL %1").arg(mnl));
276 VBAUDIO(QString(
"out of range SAD %1").arg(i));
302 static const std::array<const uint32_t,12> rates {
303 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
304 96000, 176400, 192000 };
305 QString result = QString();
307 for (
size_t i = 0; i < rates.size(); i++)
309 if ((pcm & (1 << i)) != 0)
311 result += QString(
" %1").arg(rates[i]);
323 static const std::array<const uint8_t,3> bits { 16, 20, 24 };
324 QString result = QString();
326 for (
size_t i = 0; i < bits.size(); i++)
328 if ((pcm & (1 << i)) != 0)
330 result += QString(
" %1").arg(bits[i]);
343 QString buf2 =
", bits =";
348 buf2 = QString(
", max bitrate = %1").arg(a->
max_bitrate);
352 return QString(
"supports coding type %1:"
353 " channels = %2, rates =%3%4")
360 QString result = QString();
376 case 2:
return "CEA-861D or below";
377 case 31:
return "partial";
378 default:
return "reserved";
386 case 0:
return "no CEA EDID Timing Extension block present";
387 case 1:
return "CEA-861";
388 case 2:
return "CEA-861-A";
389 case 3:
return "CEA-861-B, C or D";
390 default:
return "reserved";
396 QString result = QString(
"manufacture_id\t\t0x%1\n")
398 result += QString(
"product_id\t\t0x%1\n").arg(
m_e.
product_id, 0, 16);
399 result += QString(
"port_id\t\t\t0x%1\n").arg((
long long)
m_e.
port_id);
403 result += QString(
"sad_count\t\t%1\n").arg(
m_e.
sad_count);
419 VBAUDIO(QString(
"Detected monitor %1 at connection type %2")
424 VBAUDIO(QString(
"available speakers:%1")
475 QString result = QString();
476 bool found_one =
false;