39#define LOC QString("ELDUTILS: ")
96 "DSD (One Bit Audio)",
144GRAB_BITS(
const char* buf,
size_t byte, uint8_t lowbit, uint8_t bits)
145 {
return (buf[
byte] >> lowbit) & ((1 << bits) - 1); };
174 for (
int i = 0; i < 7; i++)
175 if ((val & (1 << i)) != 0)
189 LOG(VB_AUDIO, LOG_INFO,
LOC +
"audio coding type 0 not expected");
231 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"audio coding xtype %1 not expected")
248 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"Unknown ELD version %1").arg(
m_e.
eld_ver));
265 m_e.
port_id = qFromLittleEndian<quint64>(buf + 8);
273 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"out of range MNL %1").arg(mnl));
284 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"out of range SAD %1").arg(i));
306 static const std::array<const uint32_t,12> rates {
307 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
308 96000, 176400, 192000 };
309 QString result = QString();
311 for (
size_t i = 0; i < rates.size(); i++)
313 if ((pcm & (1 << i)) != 0)
315 result += QString(
" %1").arg(rates[i]);
327 static const std::array<const uint8_t,3> bits { 16, 20, 24 };
328 QString result = QString();
330 for (
size_t i = 0; i < bits.size(); i++)
332 if ((pcm & (1 << i)) != 0)
334 result += QString(
" %1").arg(bits[i]);
347 QString buf2 =
", bits =";
352 buf2 = QString(
", max bitrate = %1").arg(a->
max_bitrate);
356 return QString(
"supports coding type %1:"
357 " channels = %2, rates =%3%4")
364 QString result = QString();
380 case 2:
return "CEA-861D or below";
381 case 31:
return "partial";
382 default:
return "reserved";
390 case 0:
return "no CEA EDID Timing Extension block present";
391 case 1:
return "CEA-861";
392 case 2:
return "CEA-861-A";
393 case 3:
return "CEA-861-B, C or D";
394 default:
return "reserved";
400 QString result = QString(
"manufacture_id\t\t0x%1\n")
402 result += QString(
"product_id\t\t0x%1\n").arg(
m_e.
product_id, 0, 16);
403 result += QString(
"port_id\t\t\t0x%1\n").arg((
long long)
m_e.
port_id);
407 result += QString(
"sad_count\t\t%1\n").arg(
m_e.
sad_count);
420 LOG(VB_AUDIO, LOG_INFO,
LOC +
"Invalid ELD");
423 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"Detected monitor %1 at connection type %2")
428 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"available speakers:%1")
433 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"supported codecs = %1").arg(
codecs_desc()));
458 channels = std::max(a->
channels, channels);
470 channels = std::max(a->
channels, channels);
477 QString result = QString();
478 bool found_one =
false;
eld & operator=(const eld &)
QString channel_allocation_desc() const
static QString print_pcm_bits(int pcm)
Print the supported PCM fmt bits to the string buffer.
QString codecs_desc() const
QString eld_version_name() const
QString edid_version_name() const
QString info_desc() const
QString connection_name() const
void update_sad(int index, const char *buf)
QString sad_desc(int index)
int update_eld(const char *buf, int size)
QString product_name() const
static QString print_pcm_rates(int pcm)
SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with hdmi-specific routine.
static const std::array< const QString, 18 > audiotype_names
static const std::array< const QString, 4 > eld_connection_type_names
static const std::array< const QString, 11 > cea_speaker_allocation_names
static int GRAB_BITS(const char *buf, size_t byte, uint8_t lowbit, uint8_t bits)
static const std::array< const int, 8 > cea_sampling_frequencies
static constexpr uint8_t ELD_FIXED_BYTES
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
struct cea_sad sad[ELD_MAX_SAD]