[{"id":32850,"web_url":"https://patchwork.libcamera.org/comment/32850/","msgid":"<d459b6cf1bfce996e7a0b37b9e57a92567bce483.camel@ndufresne.ca>","date":"2024-12-17T18:37:12","subject":"Re: [PATCH v3] gstreamer: Read correct colorimetry from caps into\n\tthe stream configuration","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Hi,\n\nThe object should perhaps be:\n\ngstreamer: Fixate colorimetry field during caps negotiation\n\nLe mardi 17 décembre 2024 à 11:24 +0900, Hou Qi a écrit :\n> When libcamerasrc is negotiating with downstream element, it first\n> extracts colorimetry field from downstream supported caps, then set\n> this colorimetry to its stream configuration and propagates the\n> colorimetry downstream.\n> \n> Currently libamerasrc only considers the case there is one colorimetry\n> in colorimetry field of downstream caps. But the issue is that\n> downstream caps may report a list of supported colorimetry, which\n> causes libcamerasrc to set unknown colorimetry to stream configuration\n> and negotiate fail with downstream element.\n> \n> In order to fix the issue, need to fixate colorimetry field before\n> getting colorimetry string.\n> \n> Signed-off-by: Hou Qi <qi.hou@nxp.com>\n\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n> ---\n>  src/gstreamer/gstlibcamera-utils.cpp | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> index a466b305..7b34c759 100644\n> --- a/src/gstreamer/gstlibcamera-utils.cpp\n> +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> @@ -493,9 +493,12 @@ void gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n>  \n>  \t/* Configure colorimetry */\n>  \tif (gst_structure_has_field(s, \"colorimetry\")) {\n> -\t\tconst gchar *colorimetry_str = gst_structure_get_string(s, \"colorimetry\");\n> +\t\tconst gchar *colorimetry_str;\n>  \t\tGstVideoColorimetry colorimetry;\n>  \n> +\t\tgst_structure_fixate_field(s, \"colorimetry\");\n> +\t\tcolorimetry_str = gst_structure_get_string(s, \"colorimetry\");\n> +\n>  \t\tif (!gst_video_colorimetry_from_string(&colorimetry, colorimetry_str))\n>  \t\t\tg_critical(\"Invalid colorimetry %s\", colorimetry_str);\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 73303C3301\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 18:37:17 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B88D67FFF;\n\tTue, 17 Dec 2024 19:37:16 +0100 (CET)","from mail-qt1-x832.google.com (mail-qt1-x832.google.com\n\t[IPv6:2607:f8b0:4864:20::832])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A70D67FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 19:37:14 +0100 (CET)","by mail-qt1-x832.google.com with SMTP id\n\td75a77b69052e-46741855f9bso48694931cf.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 10:37:14 -0800 (PST)","from nicolas-tpx395.localdomain ([2606:6d00:15:862e::7a9])\n\tby smtp.gmail.com with ESMTPSA id\n\td75a77b69052e-467b2ed1a0asm41780071cf.87.2024.12.17.10.37.12\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 17 Dec 2024 10:37:12 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=ndufresne-ca.20230601.gappssmtp.com\n\theader.i=@ndufresne-ca.20230601.gappssmtp.com\n\theader.b=\"bIwr6Aqv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1734460633;\n\tx=1735065433; darn=lists.libcamera.org; \n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject\n\t:date:message-id:reply-to;\n\tbh=0tBimhAHAvnrZB3lbbH6km3eycyutQCbzLshcZCEf54=;\n\tb=bIwr6Aqv254Y+LJvbd/qp0m6mqjSZiMxqriPGdulqiiI55bHqAnyZPowkfk7uJX3BZ\n\t4/swP/Vwr8vF36LCBzFFtE+Tx6RIKL7S3S0FeFagb7DyyBFZ1jpPd3ih3WTpaI6tF4nH\n\tL53CxkfiazzqHI0S++A+RgzAAYqRz2VlkZ3lttRTsHY85HYkFNxIQPiXeuLbxEe1J6MS\n\tUCJRJHJWmv75bdsCwj661NIp/vJO3UPyMvAcv9DzgicQRKK8m7sI5BKsUTuLgUh8vq+e\n\t3i24bmde7dB7df805Ejv4o3PzF0std6CMjzCibfRj/+W0srCckxNNIXl0TCgei1L3wbS\n\tzAPA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1734460633; x=1735065433;\n\th=mime-version:user-agent:content-transfer-encoding:references\n\t:in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state\n\t:from:to:cc:subject:date:message-id:reply-to;\n\tbh=0tBimhAHAvnrZB3lbbH6km3eycyutQCbzLshcZCEf54=;\n\tb=r6OyIAC4xuiF7uDb0JAy6OkpTT2I2UuEJmbAZL5H6aH/AHKOHSY657I4XzGPyXPqfQ\n\tT6JpR2D2o5O6b+aomTd38JJDgst23l2yZIY30fpq4IGNJqL+v7urvwtkp6/tA6LBfa3R\n\tIYBtStAarznnb5zDT4CDB8LMtpLg9kfgRko1dq+X0z2ml5mYWsynJBxqb8eVOHxzVFwB\n\t9hh2+ZFQmFtrjmPNx2d5K4iAcYMLiwNimf7XInvSMDEQeJFFQxhLEYnhP1W0POLyjw8K\n\tr06NerZYDxajAUtnGKbPB84+J5dS7wPYqrYJ3ISj3MmIoqX0r67eFAqakZfQte4dQHts\n\tb3Ig==","X-Forwarded-Encrypted":"i=1;\n\tAJvYcCUeUm1LgxkjDQZrPvmnPjrvoi23Vtmg5CsS22hpddMUNl20vSTQwW7/KIQbhfof7tYtqzmCL8nekRBDlQMW/n8=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YyBAp5qFRQVwEuLey0vA9uXqDWcrXVrcDHrZWMg1x0ROLLnWDwv\n\t32vsx6Xq98XI9ZBrysAWv+INb+Wv/6E23ln9D/ZfJaD8mo/Kqz3MaOWBJupviPQ=","X-Gm-Gg":"ASbGncs2BUyVjx6zbnONrf4YLIxoKa119l/jYbHaWqyJgm7HI7TXs5DbURnoQjd9lxB\n\t74M4f7ZAk5UPgPGhZCiFJbG6NjFdFYTvl7CSu6bWOYzdRTiNhmnd2f9ied7VrqoXyLYncRcY+6j\n\tDihHGmM1aeBQh/29HpnvTLCaHZAHB9SsxJDS4pTt8K09yvEeOvJbRtcSlCMugqiKHAWkmDqjVgT\n\t2M2mGX0bbZ4oLfCRNNnPODVbPXOMvv0mKnpAu2a7oDNaYOE+tKNqIkjrg==","X-Google-Smtp-Source":"AGHT+IEfxZ5RQcN7RPmSLyHf96IiHHUf7sbUwPQVxJe5K3zwaZgdC05bZO1Q5Z7ucVdKzb/gCsyU+g==","X-Received":"by 2002:a05:622a:8d19:b0:466:aad5:2161 with SMTP id\n\td75a77b69052e-467a58756d8mr268743321cf.54.1734460633274; \n\tTue, 17 Dec 2024 10:37:13 -0800 (PST)","Message-ID":"<d459b6cf1bfce996e7a0b37b9e57a92567bce483.camel@ndufresne.ca>","Subject":"Re: [PATCH v3] gstreamer: Read correct colorimetry from caps into\n\tthe stream configuration","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"Hou Qi <qi.hou@nxp.com>, libcamera-devel@lists.libcamera.org","Cc":"jared.hu@nxp.com, julien.vuillaumier@nxp.com","Date":"Tue, 17 Dec 2024 13:37:12 -0500","In-Reply-To":"<20241217022422.4054343-1-qi.hou@nxp.com>","References":"<20241217022422.4054343-1-qi.hou@nxp.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable","User-Agent":"Evolution 3.54.2 (3.54.2-1.fc41) ","MIME-Version":"1.0","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":32852,"web_url":"https://patchwork.libcamera.org/comment/32852/","msgid":"<20241217194048.GD23470@pendragon.ideasonboard.com>","date":"2024-12-17T19:40:48","subject":"Re: [PATCH v3] gstreamer: Read correct colorimetry from caps into\n\tthe stream configuration","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hou,\n\nThank you for the patch.\n\nOn Tue, Dec 17, 2024 at 11:24:22AM +0900, Hou Qi wrote:\n> When libcamerasrc is negotiating with downstream element, it first\n> extracts colorimetry field from downstream supported caps, then set\n> this colorimetry to its stream configuration and propagates the\n> colorimetry downstream.\n> \n> Currently libamerasrc only considers the case there is one colorimetry\n> in colorimetry field of downstream caps. But the issue is that\n> downstream caps may report a list of supported colorimetry, which\n> causes libcamerasrc to set unknown colorimetry to stream configuration\n> and negotiate fail with downstream element.\n> \n> In order to fix the issue, need to fixate colorimetry field before\n> getting colorimetry string.\n> \n> Signed-off-by: Hou Qi <qi.hou@nxp.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n>  src/gstreamer/gstlibcamera-utils.cpp | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp\n> index a466b305..7b34c759 100644\n> --- a/src/gstreamer/gstlibcamera-utils.cpp\n> +++ b/src/gstreamer/gstlibcamera-utils.cpp\n> @@ -493,9 +493,12 @@ void gst_libcamera_configure_stream_from_caps(StreamConfiguration &stream_cfg,\n>  \n>  \t/* Configure colorimetry */\n>  \tif (gst_structure_has_field(s, \"colorimetry\")) {\n> -\t\tconst gchar *colorimetry_str = gst_structure_get_string(s, \"colorimetry\");\n> +\t\tconst gchar *colorimetry_str;\n>  \t\tGstVideoColorimetry colorimetry;\n>  \n> +\t\tgst_structure_fixate_field(s, \"colorimetry\");\n> +\t\tcolorimetry_str = gst_structure_get_string(s, \"colorimetry\");\n> +\n>  \t\tif (!gst_video_colorimetry_from_string(&colorimetry, colorimetry_str))\n>  \t\t\tg_critical(\"Invalid colorimetry %s\", colorimetry_str);\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 714ECBD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 17 Dec 2024 19:40:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD6D468059;\n\tTue, 17 Dec 2024 20:40:51 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D07367FD3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 17 Dec 2024 20:40:50 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 908CE3E;\n\tTue, 17 Dec 2024 20:40:12 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Ky8LIAYd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734464412;\n\tbh=H6fUhQF2hkP1AwxQu0LyxO4u+EEItCB+TWVQ7qejzoM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Ky8LIAYdTILsI6qrc9Ad8sgGM0I6ph0kHv1rjQkEmzFSXaiI89A/0XNtZI8MMg3y4\n\tUBW5Ccyxyuf8lG/Xh91PxrzIyrOs7KleD9SMVKsJ9LWl6yYBnQMlyGwR0z7miu42kn\n\t822k/vdkBAqI3RuYV6GHLD/QETgmznrANtSHimOA=","Date":"Tue, 17 Dec 2024 21:40:48 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hou Qi <qi.hou@nxp.com>","Cc":"libcamera-devel@lists.libcamera.org, jared.hu@nxp.com,\n\tjulien.vuillaumier@nxp.com","Subject":"Re: [PATCH v3] gstreamer: Read correct colorimetry from caps into\n\tthe stream configuration","Message-ID":"<20241217194048.GD23470@pendragon.ideasonboard.com>","References":"<20241217022422.4054343-1-qi.hou@nxp.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241217022422.4054343-1-qi.hou@nxp.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]