From patchwork Mon Jan 30 17:22:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Ser X-Patchwork-Id: 648821 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 3133EC54EED for ; Mon, 30 Jan 2023 17:22:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237655AbjA3RWp (ORCPT ); Mon, 30 Jan 2023 12:22:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236037AbjA3RWn (ORCPT ); Mon, 30 Jan 2023 12:22:43 -0500 Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7A342BE2 for ; Mon, 30 Jan 2023 09:22:41 -0800 (PST) Date: Mon, 30 Jan 2023 17:22:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emersion.fr; s=protonmail; t=1675099358; x=1675358558; bh=pmo4z0XPK0vRFYh8pWRCLi7NtxRhKqwfiEQHTG4Av6c=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=Gm4N0z1QraydmYL1+18obnSdKX2963mMQeLVnDU84lwyZpJowkRJSoNFR0saWh8q2 HyXm6zb+cmd4UdQscCIRy3ocbh+anQd73XngE3BvinG/eT/y6RgO0bXJ3e+XBqYZfS 3k1GrpeNfm8i3eDeByjPM3/7YeqMUhy0Pa1U60QHUjzmDhkl86oahluFTuRgJo1x99 n2Xzvhn8pGru9J59/bTOb4d7NQl1v/SNwKaadMBLO7/w20cyg293tDq0HCRZZT/IuD iD16fuhBzr8IGLTb1bqPBsqja6I8Z7/SK8HUFIASiSWoF7DjI8uU90i9r7z6YoqbZr a+PQtQ/pTNw+w== To: linux-media@vger.kernel.org From: Simon Ser Subject: [PATCH] edid-decode: print human-readable CTA infoframe types Message-ID: <20230130172224.65193-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 Instead of printing the code, print the human-readable infoframe type. This is more informative. Signed-off-by: Simon Ser --- parse-cta-block.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) base-commit: e052f5f9fdf74ca11aa1a8edfa62eff8d0aa3d0d diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp index 02730a9eafb1..3a6be3972e50 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,24 @@ 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) + printf(" %s InfoFrame", name); + else + printf(" Unknown InfoFrame (%u)", 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--; }