aboutsummaryrefslogtreecommitdiffstats
path: root/parse-cta-block.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-27 14:21:32 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-09-27 14:23:02 +0200
commit77c289146ec87087cb3fed1df9034ea6d92b269a (patch)
tree8dcc191667ca9e7b42546397e234aa14c6759778 /parse-cta-block.cpp
parentc3e175148a7a41f67fdf76700437d8d517c3a97a (diff)
edid-decode: replace data_block_o
This is a rather ugly macro with side-effects. Drop it and code it explicitly. Also add a new warning to the Makefile to detect implicit fallthroughs in switches. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'parse-cta-block.cpp')
-rw-r--r--parse-cta-block.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index b9f4312..cfc8d91 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -2028,21 +2028,12 @@ static void cta_hdmi_audio_block(const unsigned char *x, unsigned length)
}
}
-#define data_block_o(n) \
- do { \
- unsigned ouinum; \
- data_block_oui(n, x, length, &ouinum); \
- x += (length < 3) ? length : 3; \
- length -= (length < 3) ? length : 3; \
- dooutputname = false; \
- tag |= ouinum; \
- } while(0)
-
void edid_state::cta_block(const unsigned char *x, std::vector<unsigned> &found_tags)
{
unsigned length = x[0] & 0x1f;
- unsigned tag=(x[0] & 0xe0) >> 5;
+ unsigned tag = (x[0] & 0xe0) >> 5;
unsigned extended = (tag == 0x07) ? 1 : 0;
+
x++;
if (extended && length) {
tag <<= 8;
@@ -2058,14 +2049,14 @@ void edid_state::cta_block(const unsigned char *x, std::vector<unsigned> &found_
switch (tag) {
case 0x01: data_block = "Audio Data Block"; audio_block = true; break;
case 0x02: data_block = "Video Data Block"; break;
- case 0x03: data_block_o("Vendor-Specific Data Block"); break;
+ case 0x03: data_block = "Vendor-Specific Data Block"; break;
case 0x04: data_block = "Speaker Allocation Data Block"; audio_block = true; break;
case 0x05: data_block = "VESA Display Transfer Characteristics Data Block"; break;
case 0x07: data_block = "Unknown CTA-861 Data Block (extended tag truncated)"; break;
case 0x700: data_block = "Video Capability Data Block"; break;
- case 0x701: data_block_o("Vendor-Specific Video Data Block"); break;
+ case 0x701: data_block = "Vendor-Specific Video Data Block"; break;
case 0x702: data_block = "VESA Video Display Device Data Block"; break;
case 0x703: data_block = "VESA Video Timing Block Extension"; break;
case 0x704: data_block = "Reserved for HDMI Video Data Block"; break;
@@ -2077,7 +2068,7 @@ void edid_state::cta_block(const unsigned char *x, std::vector<unsigned> &found_
case 0x70e: data_block = "YCbCr 4:2:0 Video Data Block"; break;
case 0x70f: data_block = "YCbCr 4:2:0 Capability Map Data Block"; break;
case 0x710: data_block = "Reserved for CTA-861 Miscellaneous Audio Fields"; break;
- case 0x711: data_block_o("Vendor-Specific Audio Data Block"); audio_block = true; break;
+ case 0x711: data_block = "Vendor-Specific Audio Data Block"; audio_block = true; break;
case 0x712: data_block = "HDMI Audio Data Block"; audio_block = true; break;
case 0x713: data_block = "Room Configuration Data Block"; audio_block = true; break;
case 0x714: data_block = "Speaker Location Data Block"; audio_block = true; break;
@@ -2102,6 +2093,22 @@ void edid_state::cta_block(const unsigned char *x, std::vector<unsigned> &found_
unknown_name += std::string(" (") + (extended ? "extended " : "") + "tag " + utohex(tag & 0xff) + ")";
printf(" %s:\n", unknown_name.c_str());
warn("%s.\n", unknown_name.c_str());
+ break;
+ }
+
+ switch (tag) {
+ case 0x03:
+ case 0x701:
+ case 0x711: {
+ unsigned ouinum;
+
+ data_block_oui(data_block, x, length, &ouinum);
+ x += (length < 3) ? length : 3;
+ length -= (length < 3) ? length : 3;
+ dooutputname = false;
+ tag |= ouinum;
+ break;
+ }
}
if (dooutputname && data_block.length())

Privacy Policy