From patchwork Wed Nov 13 10:20:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Qi X-Patchwork-Id: 21882 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 72293BE173 for ; Wed, 13 Nov 2024 10:21:11 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1DF636580A; Wed, 13 Nov 2024 11:21:11 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="SkBCi3F6"; dkim-atps=neutral Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20617.outbound.protection.outlook.com [IPv6:2a01:111:f403:2606::617]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A046605B5 for ; Wed, 13 Nov 2024 11:21:09 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eakXXfffP77Fm1fDC6WxKaPo4rBSpmbHC1bEzaO+dOKZgZ26PUd90l2pyB1oSsFFY+xVziOwWBs+945oKMDax2qnatMJgutQNj4jH8qjOm9RwJDOKRUA/V17KGcuhI3IsyXoIwEoS7ez5BemoB/nfADpCgK8vox22aGgJyqVHfINwfF0rn3jPvqixsxKWZ+ax9bLGp0LZCo05vYlbeqXZGcjt/custIn4nwEsDYngut5UwRue0bLaR3IqchZyks2TXFZQ0O9ZURZ+g8YBVFaf9tJde0I18pN4oiDnltKTuxzn77WXUJ+I6ECiYMYZ0XArV3Ff1FY4xF5rOqa10OCHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h8PQktvii70jedGxrV4cJnyDtdxwfky2XR3VjSDfRD4=; b=Cscxw85dgLouw/xnyrIpLtLkKlmZ8Es245WjwVYxjbJmcycTp8rleTooPZTHJqM+sZ6rCTZe9ImjtGe3kKuHGI7nh+OVe06FAwZcFTFwfj+e9E9//94vFTvBHeuhjagT+luVeGswbuIlcEpPqyXKnUpG7u4QApspigBARlSIK9w4EtAE8V8v/M4sh7rNf3Ocssj5PgM572exnGhrwzSsAM+WbNi2fCMLWsteycMTBkoh6Bwzi1Ay7GQj9K9MdmlgSPpUgM2e6laNtSVgYsGCU+RUxIo+Kxmm0zSof5cslGKDAqf9UjnQZXuAV217dv/b3I/Y0sjZKQYY2hbfgPgy+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h8PQktvii70jedGxrV4cJnyDtdxwfky2XR3VjSDfRD4=; b=SkBCi3F6Wdqasn/tKiehJLHfhzbfmImiGh+KwVS55rnNRl8WrfkXCxM1ZGkqf+pC6VE6217Si1zD8rGa8F7qcdDIcTiXBp92/eNiflhReFg2zVgEPac76R+bQ7AOFKb4MD5eic3LvftcvZJiNb/Q9bBZk8biJKEPBX86fXD+ur0WDH17I9rt7b86WuWJMLwioFd/Eg5eH7c7TgyXqITkSOjRxzfrBgJ4fQQ7DM59d87ZIrXUvlknjqdhTVFcK53VebkcjeMsRCev5ia41K2sZVz28GNkxeXP7+hkyHvZ4j3agNfKj9g+uP99kDBe2X1fRZBH010/pdk6AdeWwLVckg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB8285.eurprd04.prod.outlook.com (2603:10a6:102:1ca::15) by PAXPR04MB8428.eurprd04.prod.outlook.com (2603:10a6:102:1ce::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.17; Wed, 13 Nov 2024 10:21:04 +0000 Received: from PAXPR04MB8285.eurprd04.prod.outlook.com ([fe80::e003:8fb:64ea:acfd]) by PAXPR04MB8285.eurprd04.prod.outlook.com ([fe80::e003:8fb:64ea:acfd%3]) with mapi id 15.20.8158.013; Wed, 13 Nov 2024 10:21:04 +0000 From: Hou Qi To: libcamera-devel@lists.libcamera.org Cc: jared.hu@nxp.com, qi.hou@nxp.com, julien.vuillaumier@nxp.com Subject: [PATCH v2] gstreamer: Read correct colorimetry from caps into the stream configuration Date: Wed, 13 Nov 2024 19:20:43 +0900 Message-Id: <20241113102043.1900034-1-qi.hou@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR02CA0131.apcprd02.prod.outlook.com (2603:1096:4:188::6) To PAXPR04MB8285.eurprd04.prod.outlook.com (2603:10a6:102:1ca::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB8285:EE_|PAXPR04MB8428:EE_ X-MS-Office365-Filtering-Correlation-Id: 197a9b20-b07a-4ee4-c246-08dd03cce130 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|52116014|376014|366016|38350700014; X-Microsoft-Antispam-Message-Info: 1uowkaUPYM6n/eg6iNQjftUgiLxNGc9NcurVWQSbTCQyI0xL9CF8WZIOGpHbyX9PPQems9t253evd5oWMTpspdMsxMJCwjycgQ4H6WVkMYITddfH6W3GjRL1qJ1nYnapjTsfGe80GwasfBsRsH4/FbRW+DMov2LCRyl8G+4QbaXYZFYR3Evhf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7Q9HgX4Qa4lJc1TsdEtChyEe0xWkSDO/GX7FCuDbdEfoqXHI0POT/+xNRr6asB9CeX3oC7/fqoXNYdncs87ZL3ScSCzJb8h1JtSmky5wX+BuxAFNDXFsrjBm493NO11GCXpLnGf1ZSoDM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB8285.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(52116014)(376014)(366016)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Sx1WrdB6Bu1MdQlBIiC2648xZ13IOt32HveFQyBoOmqfkQweMbTwoOuzSChNrJn9l8w8FHAUxduszfhSVeYnXgAszehpHdrW8XXBpKe5ewHexP+zsnU4PNpJzY6/pL4M+XIBklSo2Sdw4bsH0f2UiTPrLCf9KZQ4kSHoTzdWvI3iEcMhJU34+ajZ5+/D8JK7ZSr/W2F/50UdWZgwTBQSUG3khA/+g9ViOSP6JyQq+ld+zWezOCOiybXpRo/BynuCJW4s8Olq4Cv7KIqONcFbSbScbpZ1gzAwopWzJEUH9W+LUKyjW/xgyxMLFGlnbxdGHBDLDMLl9xsV3QsShcwxlX29FeAhPaiaLW+4iuVCuZMrYbqX+OJypG363vqka9lJ4NghsaDF3p6jT7BcyOpNaLsi7V0gjfuqkI5Tu8y8gOPs0fn9TOfydYFY1UvzDG2aJQ+8OHBs8wbbSDRgJpQYulhEMHE32qRHlKLH0HmDwYeH6cyedATfVb4xeLasuyNU7EZ6wZGOZdE7IrcmetpnQS0AZ0cUWbM4vudh0BbcHpsKZngfYgSbmi3Q1yCIQTq7lbjfjvNHKax0XjVHvetHLNzuClC/VT4g6hbJ8eb7cYz61I7kuGn7q8o2k+Y+8TJOs20FOB7o5tT9ysy01aYspGCxE4XG9XgyadZv3oVEJ3Rw1gbGmsOrpYYA+UdUQ6wVBBqIGIlPfGQvDsIzD3sV3a8ARUJAPzJmFsKEGFouL7D0zf4O7/uMS2+mI9sZeJ6Z4wNVQS2ZVhHogJJObcRhIDlu+G8lzr+wpICYhZB1CVrmalN/cyErDKYYR7NZcvYdqoHt0lT8Tohc84iyGwElaPme8XQAwZY/7s7czWW1vIrqBxamDnDG4U++EzbBKqb/C47us7NQjVrECX7YrHvnBWdevp7cu1aGSMoK0nHKo1zGj8QsAXbJaN4bG0GkPoPQa16oJCkCAsha5F03iCIY/WaQX6iNfNWxH+xj4JIPyXSGun1d7W7FZ9xb8KedPMDE469VFh6SrsvwWYMkDH2KJSWuIvxrUx77Md1XPlQhtC3gJ5JvIJg1uI4nQegkNVO6NZI68A5Ib2HbWqTWrhfX+roC0IfLqYcTAbeTyj0/OuyJQRTG4M3Hbv3CmfRw6tTX8gA5QtLhlPq1x1Mxea1mTOmBdYpo4+HdxmHWlDf/rMjMNUSiXfAlNvYtB1ilinnm5noSWi7dmle/vEAUwUvhwFIBqMblxM9l2tj6sYO1m7ZPtFK17JG0Tg0nGS0z8GHdZwRfVyYqmIIMEyyw6agXBtQ6+nt4xD2TgVPW9zgi84Csoq/0iLEmIZ5YI4T86YFDznN03z0SFA6v5ty+6gWFamcFWLqDaemj0SaZsH/sf///PP4qKBmDVLMC8GR0l5KTOPcxSLQzNI/ZysMwUXcMdOgYmTlVHhvvK40xhuKYzid8pWbnEfpFzYKzKlgczwsuFJ7llNCvKtdo+6/b1JchMXKvxhYnXfNhmSgjpKbjq116+vlNg+Vp6xWM1XopkPIlP8Y9mV4kCiET0OgAnhCdQdT0e/9Hc7s89M+IRASYglg= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 197a9b20-b07a-4ee4-c246-08dd03cce130 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8285.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2024 10:21:04.4574 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: G8saV214nVbX83+tcQj5spGQ2hFdl7CFSlVsV785stZRzxAymx1OU93qOJrrfXxI X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8428 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When libcamerasrc is negotiating with downstream element, it first extracts colorimetry field from downstream supported caps, then set this colorimetry to its stream configuration and propagates the colorimetry downstream. Currently libamerasrc only considers the case there is one colorimetry in colorimetry field of downstream caps. But the issue is that downstream caps may report a list of supported colorimetry, which causes libcamerasrc to set unknown colorimetry to stream configuration and negotiate fail with downstream element. In order to fix the issue, get the first string if colorimetry field holds string list to set it to stream configuration. Signed-off-by: Hou Qi --- src/gstreamer/gstlibcamera-utils.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp index 732987ef..340a43a8 100644 --- a/src/gstreamer/gstlibcamera-utils.cpp +++ b/src/gstreamer/gstlibcamera-utils.cpp @@ -489,9 +489,17 @@ gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg, /* Configure colorimetry */ if (gst_structure_has_field(s, "colorimetry")) { - const gchar *colorimetry_str = gst_structure_get_string(s, "colorimetry"); + const GValue *value; + const gchar *colorimetry_str = NULL; GstVideoColorimetry colorimetry; + value = gst_structure_get_value(s, "colorimetry"); + + if (GST_VALUE_HOLDS_LIST(value)) + value = gst_value_list_get_value(value, 0); + if (G_VALUE_HOLDS_STRING(value)) + colorimetry_str = g_value_get_string(value); + if (!gst_video_colorimetry_from_string(&colorimetry, colorimetry_str)) g_critical("Invalid colorimetry %s", colorimetry_str);