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");
223 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"audio coding xtype %1 not expected")
244 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"Unknown ELD version %1").arg(
m_e.
eld_ver));
261 m_e.
port_id = qFromLittleEndian<quint64>(buf + 8);
269 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"out of range MNL %1").arg(mnl));
280 LOG(VB_AUDIO, LOG_INFO,
LOC + 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);
416 LOG(VB_AUDIO, LOG_INFO,
LOC +
"Invalid ELD");
419 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"Detected monitor %1 at connection type %2")
424 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"available speakers:%1")
429 LOG(VB_AUDIO, LOG_INFO,
LOC + QString(
"supported codecs = %1").arg(
codecs_desc()));
454 channels = std::max(a->
channels, channels);
466 channels = std::max(a->
channels, channels);
473 QString result = QString();
474 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]