From patchwork Tue Jan 31 09:38:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 650791 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97538C636CC for ; Tue, 31 Jan 2023 09:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbjAaJjG (ORCPT ); Tue, 31 Jan 2023 04:39:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229608AbjAaJjF (ORCPT ); Tue, 31 Jan 2023 04:39:05 -0500 Received: from mail-4317.proton.ch (mail-4317.proton.ch [185.70.43.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B0A3AE for ; Tue, 31 Jan 2023 01:39:04 -0800 (PST) Date: Tue, 31 Jan 2023 09:38:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1675157942; x=1675417142; bh=KlGCAXBfuCeFG1nmtUQ7+OyVp5igprJ278meQway26c=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=ZdnVqJUdmP9pqrvKZqA/O2gWuTNn0WZV3kayz6WerkGQdvYxpboeFhbVG6+XfdvOJ RxDASnwi+EIP7wBIxQ3LkXxaDHUxSUOKd/OiUktvzpnwXdghbI2RJ7cjO5+32sQUkQ XvhBcUQId05AqNFN3vG0ednsYKFn3GFYJ2St4014IIegtMqgKJptKh9j0ZCFyUxs5D uG5meYRv8/cIDV4k3VmAP6AgnsCfYUoF8ap34GC3XScmI3sQOuKrTRsxhp7pLU4V84 YyEnDe0k9DE5xyBdPmWtQzBU84ttel33l4sIHD+akMpD20Q1Ro0ipsCOYJNfLRxK6N x9Zlm+eaO5Gug== To: linux-media@vger.kernel.org From: Simon Ser Subject: [PATCH v2] edid-decode: print human-readable CTA infoframe types Message-ID: <20230131093827.88551-1-contact@emersion.fr> Feedback-ID: 1358184:user:proton MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org In addition to the raw type value, also print the human-readable infoframe type. Signed-off-by: Simon Ser --- v2: keep printing raw code. parse-cta-block.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) base-commit: e052f5f9fdf74ca11aa1a8edfa62eff8d0aa3d0d diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp index 02730a9eafb1..7eb4c51ad833 100644 --- a/parse-cta-block.cpp +++ b/parse-cta-block.cpp @@ -2203,6 +2203,17 @@ static void cta_hdr_dyn_metadata_block(const unsigned char *x, unsigned length) } } +static const char *infoframe_types[] = { + NULL, + "Vendor-Specific", + "Auxiliary Video Information", + "Source Product Description", + "Audio", + "MPEG Source", + "NTSC VBI", + "Dynamic Range and Mastering", +}; + static void cta_ifdb(const unsigned char *x, unsigned length) { unsigned len_hdr = x[0] >> 5; @@ -2218,16 +2229,23 @@ static void cta_ifdb(const unsigned char *x, unsigned length) x += len_hdr + 2; while (length > 0) { int payload_len = x[0] >> 5; + unsigned char type = x[0] & 0x1f; + + const char *name = NULL; + if (type < ARRAY_SIZE(infoframe_types)) + name = infoframe_types[type]; + if (!name) + name = "Unknown"; + printf(" %s InfoFrame (%u)", name, type); - if ((x[0] & 0x1f) == 1 && length >= 4) { + if (type == 1 && length >= 4) { unsigned oui = (x[3] << 16) | (x[2] << 8) | x[1]; - printf(" InfoFrame Type Code %u, OUI %s\n", - x[0] & 0x1f, ouitohex(oui).c_str()); + printf(", OUI %s\n", ouitohex(oui).c_str()); x += 4; length -= 4; } else { - printf(" InfoFrame Type Code %u\n", x[0] & 0x1f); + printf("\n"); x++; length--; }