MythTV master
eldutils.h
Go to the documentation of this file.
1/*
2 * Universal Interface for Intel High Definition Audio Codec
3 *
4 * Local helper functions
5 *
6 * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * more details.
17 *
18 * You should have received a copy of the GNU General Public License along with
19 * this program; if not, write to the Free Software Foundation, Inc., 51
20 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef ELDUTILS_H
24#define ELDUTILS_H
25
26#include <cstdint>
27#include <QString>
28
29#include "libmythtv/mythtvexp.h"
30
31static constexpr uint8_t ELD_FIXED_BYTES { 20 };
32static constexpr size_t ELD_MAX_SAD { 16 };
33
34static constexpr uint8_t PRINT_RATES_ADVISED_BUFSIZE { 80 };
35static constexpr uint8_t PRINT_BITS_ADVISED_BUFSIZE { 16 };
36static constexpr uint8_t PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE { 80 };
37
39{
40 public:
41 eld(const char *buf, int size);
42 eld(const eld& rhs) = default;
43 eld();
44 ~eld()= default;
45 eld& operator=(const eld& /*rhs*/);
46 void show();
47 QString eld_version_name() const;
48 QString edid_version_name() const;
49 QString info_desc() const;
50 QString channel_allocation_desc() const;
51 QString product_name() const;
52 QString connection_name() const;
53 bool isValid() const;
54 int maxLPCMChannels();
55 int maxChannels();
56 QString codecs_desc() const;
57
58 enum cea_audio_coding_types : std::uint8_t {
59 TYPE_REF_STREAM_HEADER = 0,
60 TYPE_LPCM = 1,
61 TYPE_AC3 = 2,
62 TYPE_MPEG1 = 3,
63 TYPE_MP3 = 4,
64 TYPE_MPEG2 = 5,
65 TYPE_AACLC = 6,
66 TYPE_DTS = 7,
67 TYPE_ATRAC = 8,
68 TYPE_SACD = 9,
69 TYPE_EAC3 = 10,
70 TYPE_DTS_HD = 11,
71 TYPE_MLP = 12,
72 TYPE_DST = 13,
73 TYPE_WMAPRO = 14,
74 TYPE_REF_CXT = 15,
75 /* also include valid xtypes below */
76 TYPE_HE_AAC = 15,
77 TYPE_HE_AAC2 = 16,
78 TYPE_MPEG_SURROUND = 17,
79 };
80
81 private:
82
83 // private methods
84 int update_eld(const char *buf, int size);
85 void update_sad(int index, const char *buf);
86 QString sad_desc(int index);
87 static QString print_pcm_rates(int pcm);
88 static QString print_pcm_bits(int pcm);
89
90 /*
91 * CEA Short Audio Descriptor data
92 */
93 struct cea_sad {
95 int format; /* (format == 0) indicates invalid SAD */
96 int rates;
97 int sample_bits; /* for LPCM */
98 int max_bitrate; /* for AC3...ATRAC */
99 int profile; /* for WMAPRO */
100 };
101
102 /*
103 * ELD: EDID Like Data
104 */
105 struct eld_data {
106 bool eld_valid { false };
107 int eld_size { 0 };
108 int baseline_len { 0 };
109 int eld_ver { 0 };
110 int cea_edid_ver { 0 };
112 int manufacture_id { 0 };
113 int product_id { 0 };
114 uint64_t port_id { 0 };
115 uint64_t formats { 0 };
116 int support_hdcp { 0 };
117 int support_ai { 0 };
118 int conn_type { 0 };
119 int aud_synch_delay { 0 };
120 int spk_alloc { 0 };
121 int sad_count { 0 };
122 // NOLINTNEXTLINE(modernize-avoid-c-arrays)
123 struct cea_sad sad[ELD_MAX_SAD] {};
124 eld_data() = default;
125 };
127};
128
129#endif /* ELDUTILS_H */
static const std::array< const std::string, 8 > formats
Definition: eldutils.h:39
cea_audio_coding_types
Definition: eldutils.h:58
~eld()=default
eld_data m_e
Definition: eldutils.h:126
eld(const eld &rhs)=default
static constexpr uint8_t ELD_FIXED_BYTES
Definition: eldutils.h:31
static constexpr uint8_t PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE
Definition: eldutils.h:36
static constexpr size_t ELD_MAX_SAD
Definition: eldutils.h:32
static constexpr uint8_t PRINT_BITS_ADVISED_BUFSIZE
Definition: eldutils.h:35
static constexpr uint8_t PRINT_RATES_ADVISED_BUFSIZE
Definition: eldutils.h:34
#define MTV_PUBLIC
Definition: mythtvexp.h:11
static void show(uint8_t *buf, int length)
Definition: ringbuffer.cpp:341
int channels
Definition: eldutils.h:94
int profile
Definition: eldutils.h:99
int sample_bits
Definition: eldutils.h:97
int max_bitrate
Definition: eldutils.h:98
int format
Definition: eldutils.h:95
QString monitor_name
Definition: eldutils.h:111
eld_data()=default