[{"id":39794,"web_url":"https://patchwork.libcamera.org/comment/39794/","msgid":"<178471657008.171392.8364061142116747284@ping.linuxembedded.co.uk>","date":"2026-07-22T10:36:10","subject":"Re: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting elliot.chen@oss.nxp.com (2026-07-22 04:40:11)\n> From: Elliot Chen <elliot.chen@nxp.com>\n> \n> When using libcamerasrc as a camera source in camerabin with a\n> video-source-filter that specifies a particular output format,\n> the negotiated format was not respecting the downstream preference.\n> This occurred because gst_pad_peer_query_caps() was called with the\n> libcamera stream format filter directly as its filter argument, which\n> caused the returned caps to be ordered by the libcamera source format\n> list rather than by the downstream element's preference.\n> \n> Fix this by splitting the caps query into two steps: first query the\n> full set of caps supported by the downstream peer without any filter,\n> then intersect with the libcamera stream formats using\n> GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order\n> of the first operand (the downstream peer caps), so when the caps are\n> subsequently fixated, the format preferred by the downstream element\n> (e.g. the video-source-filter in camerabin) is selected.\n> \n> Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n\nIs there any difference here between v1 and v2 or is it just the commit\nmessage?\n\nI can't see any review comments on v1 that prompted a v2, and there's no\nchangelog.\n\n--\nKieran\n\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index 9061f9163..579bd466d 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>                 StreamConfiguration &stream_cfg = state->config_->at(i);\n>  \n>                 /* Retrieve the supported caps. */\n> +               g_autoptr(GstCaps) peer_caps = gst_pad_peer_query_caps(srcpad, NULL);\n> +               if (!peer_caps || gst_caps_is_empty(peer_caps))\n> +                       return false;\n> +\n>                 g_autoptr(GstCaps) filter = gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> -               g_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad, filter);\n> +               /* Intersect with downstream's preferred format order first. */\n> +               g_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps, filter, GST_CAPS_INTERSECT_FIRST);\n>                 if (gst_caps_is_empty(caps))\n>                         return false;\n>  \n> -- \n> 2.34.1\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 A27A8BDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jul 2026 10:36:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8463D67E8C;\n\tWed, 22 Jul 2026 12:36:14 +0200 (CEST)","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 F0477660AE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2026 12:36:12 +0200 (CEST)","from monstersaurus.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C9719447;\n\tWed, 22 Jul 2026 12:35:12 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"HVijMq8w\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784716512;\n\tbh=kRHrYsIf/AWczqnwL9qQYKufPM7KDi2aK+yCjMKxgrc=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=HVijMq8wXimrYsLeKrMRSUkCLDExoun+/JnwY0UkvhOorKmaeT/z3MFaDupNcA4Cp\n\tIw7tBoaYBa4VKwwMEuKTf7MtSO1N3OArhuiDT2NobuCdZb9ta44jME2hH1pUlCthbq\n\t6/eBfcfcCqRufL1HAwcC/PYQA+2zdChvGh/xMk6g=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>","Subject":"Re: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"elliot.chen@nxp.com, elliot.chen@oss.nxp.com,\n\tlibcamera-devel@lists.libcamera.org","Date":"Wed, 22 Jul 2026 11:36:10 +0100","Message-ID":"<178471657008.171392.8364061142116747284@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":39795,"web_url":"https://patchwork.libcamera.org/comment/39795/","msgid":"<PA4PR04MB9688ED3857889E9DB71E1CF9EAC12@PA4PR04MB9688.eurprd04.prod.outlook.com>","date":"2026-07-22T10:48:43","subject":"RE: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","submitter":{"id":443,"url":"https://patchwork.libcamera.org/api/people/443/","name":"Elliot Chen (OSS)","email":"elliot.chen@oss.nxp.com"},"content":"Hi Kieran Bingham,\nThank you for your comments. I updated the comments in the v1 that should be end with a period. And I also updated the commit message to add the issue description that needs to be fixed by this patch.\n\n-----Original Message-----\nFrom: Kieran Bingham <kieran.bingham@ideasonboard.com> \nSent: Wednesday, July 22, 2026 6:36 PM\nTo: Elliot Chen <elliot.chen@nxp.com>; Elliot Chen (OSS) <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org\nSubject: Re: [PATCH v2] gstreamer: Honor downstream format preferences in caps negotiation\n\nQuoting elliot.chen@oss.nxp.com (2026-07-22 04:40:11)\n> From: Elliot Chen <elliot.chen@nxp.com>\n> \n> When using libcamerasrc as a camera source in camerabin with a \n> video-source-filter that specifies a particular output format, the \n> negotiated format was not respecting the downstream preference.\n> This occurred because gst_pad_peer_query_caps() was called with the \n> libcamera stream format filter directly as its filter argument, which \n> caused the returned caps to be ordered by the libcamera source format \n> list rather than by the downstream element's preference.\n> \n> Fix this by splitting the caps query into two steps: first query the \n> full set of caps supported by the downstream peer without any filter, \n> then intersect with the libcamera stream formats using \n> GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order \n> of the first operand (the downstream peer caps), so when the caps are \n> subsequently fixated, the format preferred by the downstream element \n> (e.g. the video-source-filter in camerabin) is selected.\n> \n> Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n\nIs there any difference here between v1 and v2 or is it just the commit message?\n\nI can't see any review comments on v1 that prompted a v2, and there's no changelog.\n\n--\nKieran\n\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp \n> b/src/gstreamer/gstlibcamerasrc.cpp\n> index 9061f9163..579bd466d 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>                 StreamConfiguration &stream_cfg = \n> state->config_->at(i);\n>  \n>                 /* Retrieve the supported caps. */\n> +               g_autoptr(GstCaps) peer_caps = gst_pad_peer_query_caps(srcpad, NULL);\n> +               if (!peer_caps || gst_caps_is_empty(peer_caps))\n> +                       return false;\n> +\n>                 g_autoptr(GstCaps) filter = gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> -               g_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad, filter);\n> +               /* Intersect with downstream's preferred format order first. */\n> +               g_autoptr(GstCaps) caps = \n> + gst_caps_intersect_full(peer_caps, filter, \n> + GST_CAPS_INTERSECT_FIRST);\n>                 if (gst_caps_is_empty(caps))\n>                         return false;\n>  \n> --\n> 2.34.1\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 5DC2BBDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jul 2026 10:48:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 766B067E93;\n\tWed, 22 Jul 2026 12:48:50 +0200 (CEST)","from PA4PR04CU001.outbound.protection.outlook.com\n\t(mail-francecentralazlp170130007.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:c20a::7])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D3F43660AE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2026 12:48:48 +0200 (CEST)","from PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5)\n\tby AS1PR04MB9583.eurprd04.prod.outlook.com (2603:10a6:20b:472::10)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.10;\n\tWed, 22 Jul 2026 10:48:44 +0000","from PA4PR04MB9688.eurprd04.prod.outlook.com\n\t([fe80::3012:9dfe:3b7e:2ff4]) by\n\tPA4PR04MB9688.eurprd04.prod.outlook.com\n\t([fe80::3012:9dfe:3b7e:2ff4%2]) with mapi id 15.21.0245.009;\n\tWed, 22 Jul 2026 10:48:44 +0000"],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"gkRbQ/83\"; \n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n\tb=tFg7mMs11pEcgmf1mmKDwJHpYgrf04Zwt7myC0/Mr9Ht8mq7KxEsyAffoaTpb5xMWkwuZrm0uvuP3dmPYBQOvkquqfbdQyu6SldNRuXOs1c7Tus0QhE51xWun0KASdn23TOCoWaTAk7pokaXooujCgBzzziVwfD1+EBYEg6yoMDBNfpdE/uoVl4Nk9eDGSPurccqaQsLV5IgvUu2ijoodo7hxeqk31LMAZgpddZhIucGsAKsuuNJHTphCBF73UBicvx+MEsBplz93eELzKwlAekxCXtBKrGOmseqD4SJPvzoMksiHyB96DueJK1gXRi9glRp+HCWSiUQDc2r94I0SA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector10001;\n\th=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;\n\tbh=9kvrrHVJR11dfZgr4jvYakPfjX9DK+/L3vHtzN7FHyA=;\n\tb=P1GghQEv9S84pus02PJagcXftxDSFYJ8dWoTJVfu7UEPOobtT4HMfxA6weEsdnyuQREdf7sz98t2egIyxYHbKEgLm4vYlf3gVvqS1wEC1d8Nv37lPGsBZpUiFAxcMp5RIxmDEOiunV2vmlpGNMQ5p4KlfwBP0jOstOIE2ENuJiW8iN564VDnO+GjI6x56UJW2BNGrtKSJb5WgYCDrQ4yK8viJZ+MOTWPPiF3RAkFHgJO6RLJ7p7/T5R9LegLYWs2GbuW1KbtfsHbOZUZSD882ApMgDd3PskiuHD029bKppACmBTKYxBcWbKadCfb4DZ6yxHJFFSmWIx7mg/lnspwow==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=oss.nxp.com;\n\tdmarc=pass action=none header.from=oss.nxp.com; \n\tdkim=pass header.d=oss.nxp.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com;\n\ts=selector1-NXP1-onmicrosoft-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=9kvrrHVJR11dfZgr4jvYakPfjX9DK+/L3vHtzN7FHyA=;\n\tb=gkRbQ/83Q8LoES8SC8kaxp0GtfBrVHwhLhTgXvQfTAwOk8Q2N/h8xOAkpE+I3cl1KifG36nfPIlaEPNy35CVq5RJl9KwWGdPxgeDfvNLcs+Szlwq//5PJoSzl8VNDs1zGgQxIZGMeVGtPsRgYy0ZcIStlZf5+Ed64jfLDwps+HEkLBKoUrr0lPWu5iHCgrjQeILUyns98QzGISFX6GtISTMZqTRbACp0hljmu+DhiYNklsjBlTmw9StoBLLZCXe2mKz6h55VDIWmgzpHaQFV8ah6wpvN1b295nUpuV0CW0PNw//QNpLmZg3Cue6caOlAgScIIPnYHN9rhnSPtmitQA==","From":"\"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>, Elliot Chen\n\t<elliot.chen@nxp.com>, \"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>, \n\t\"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>","Subject":"RE: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","Thread-Topic":"[PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","Thread-Index":"AQHdGceqwvyJtZ3uaUW92LuDawSzfA==","Date":"Wed, 22 Jul 2026 10:48:43 +0000","Message-ID":"<PA4PR04MB9688ED3857889E9DB71E1CF9EAC12@PA4PR04MB9688.eurprd04.prod.outlook.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>\n\t<178471657008.171392.8364061142116747284@ping.linuxembedded.co.uk>","In-Reply-To":"<178471657008.171392.8364061142116747284@ping.linuxembedded.co.uk>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","authentication-results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"gkRbQ/83\"; \n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;"],"x-ms-exchange-messagesentrepresentingtype":"1","x-ms-publictraffictype":"Email","x-ms-traffictypediagnostic":"PA4PR04MB9688:EE_|AS1PR04MB9583:EE_","x-ms-office365-filtering-correlation-id":"fa656ec0-8764-44ed-d8f0-08dee7decd09","x-ms-exchange-sharedmailbox-routingagent-processed":"True","x-ms-exchange-senderadcheck":"1","x-ms-exchange-antispam-relay":"0","x-microsoft-antispam":"BCL:0;\n\tARA:13230040|1800799024|19092799006|366016|376014|23010399003|56012099006|11063799006|5023799004|4143699003|10067099003|6133799003|3023799007|18002099003|22082099003|38070700021;","x-microsoft-antispam-message-info":"PQWRhFVY0P2eXWthzSOiV/IAdFXkwO4ZCaDQQOW3IxZR20qkI1SDD4z1/rhdSQMCz5vAJw/GY5V4HqXqs9KLtwU4AA8QlcyUfcyRHJ52N5Tq93GCeBCN692qAOl7O9ZZnSHUyrC6lto1DWAFGrf/ZyiXtp43kl3Ghy/GX670OzzW+dR9VLRUR4baXGMaVuo18tjiKJnTKTix1Y3wmDTwcFKA7G/NVu4/C6+73kKQ6obKeN4ymsR+R6RW0xnKgjLf7M72T+C5RqyJ9LHnlilEuCA9rS76tYu7AOFUO6xk/peDPiXTf0vkYFz0h41Rz9RsMTkPNf0MlvmuAbcNSjLz8h2xYqnrjiXAVO+WGaPe1e80I9rgtQGMVfwX07LBFy6VMr7zPmrTL2g2f7mxEQij7dh8aR7msvorWyRpGBLlDFG65bEn9YdvrN6h/5MB3sMpmjawLuXw5u7SEtgzMy79Z9rafoAAAkRFSgZ7/30hoR+HrgR/PJ0FVcvITfxjuopoIOUrHz1TfVu3nzcL8Lmvn46Le3Ia3mu4yv2NyHMjWS3uGEYhNs8lBTvbTCOpoT77DLwv4cqfY7HBLOEdcNRsURWp5NaQA7MBapyOPn2ih5VDGFEzndYqgoRiqLN18cbWXPfoJxQfyJzrnaR+rBQe4Yuwy4gVyS6t/HJTp2EFgqaTYro+Spt19EckoVlaaGMfT7//xwEL5g3ObynLpjsowdygKvbagl5wrcYa0RbSY6U=","x-forefront-antispam-report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:PA4PR04MB9688.eurprd04.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230040)(1800799024)(19092799006)(366016)(376014)(23010399003)(56012099006)(11063799006)(5023799004)(4143699003)(10067099003)(6133799003)(3023799007)(18002099003)(22082099003)(38070700021);\n\tDIR:OUT; SFP:1101; ","x-ms-exchange-antispam-messagedata-chunkcount":"1","x-ms-exchange-antispam-messagedata-0":"=?utf-8?q?4DgVEDIp+WgCmlpgr3e8J+NAN?=\n\t=?utf-8?q?pX+KXW0ICnWueFk2oZ6m+uZR4MwJny2N6sZAhbAysnYbGwsA2os5zlTv?=\n\t=?utf-8?q?JW8mF4gjrqq2xFygs/gLDUJbE00zh+ltvNv9BIxbY85Ubo0EJ2uTs4S0?=\n\t=?utf-8?q?I15jdZ1wR/TPoHFOLYjVWTogQcbw9mx1rCXrSjawStODIqooh6GQKSxg?=\n\t=?utf-8?q?gANy15mLFwPhOALQq//3ZvTg9PyecM8Y5EoX5xdsmeANkqUPAbGFLOpP?=\n\t=?utf-8?q?a1Ypv4GrhLpqRGtGaInGY4Sqw+EbSiR60WqwF4bIzqi2BfBkA5JHl1eX?=\n\t=?utf-8?q?9C8vCRUxN1fCv2JNKrBb5dgWLuc4AEiZzZRyjzfWz82iMqtwm9iZQZAg?=\n\t=?utf-8?q?M1gNa5YXHclcQ4CuBrq87Gp+fY93kvWlfoVt5vwS+chsWQ8AJjV/lFbj?=\n\t=?utf-8?q?htqgGrJY6m10fWFzGmQURREuIEgI5zvux3d07Q8kxLSrwjhYtkcR2AyB?=\n\t=?utf-8?q?B96DKjcn6sPgujTuTkB8d/Fed2V34WkIVCENqTBpcXISnRSElqMXi5BM?=\n\t=?utf-8?q?RVRQInCTFnVN9V68qkXGsTp+VDOMX9pOCsb2Xf5/dwFgIH9RIlH8DWA0?=\n\t=?utf-8?q?kfY1F0LPHWrJWzZFkUzVf9VQMbqJwRPwAflELtmodrO+Q2/nn9x95RXg?=\n\t=?utf-8?q?IITG3eo8IuFjZGt2B+yTSlRXXJ7Esy9KK2cJ8Xtm3yX3GmeSQhv7+pj2?=\n\t=?utf-8?q?iHAazgoyai0uD9llGh1jUWozFAV3clu52e2oLRk7obWtYbliivv+XHEq?=\n\t=?utf-8?q?j5Dq5dkEGg3iGBtuFKNdkqg08iZuN8ncN92m/rkVHwaIyT79lqZO9Z1J?=\n\t=?utf-8?q?Ax0lG7FQJp0ok7Bu4TX2Y35pFZweOPkDx1qMwEb/Uv3TZer2p1UrQtRq?=\n\t=?utf-8?q?mtTaYlfer+6VdSHG3WP+AT6yHq9oeUWxGo+0keMJ2RFX4/CJoMYIwMKb?=\n\t=?utf-8?q?cyr7mzkCLZM3URlsKFqE1768Hsvc7rKjaRdhyhX/OG6x+bvMpEpdR9r2?=\n\t=?utf-8?q?5m8Rumlpclf9vsiLVMlMib/JhZAVFecOGBnPY9+3G701tOeA5jQs3T8l?=\n\t=?utf-8?q?iPt9yGA3wz/JUY3imA1CS8lPueGe3sXDAr/5/XCyszWGATPZNv4wZ4sO?=\n\t=?utf-8?q?9eWeehPYUxXHKI+F5svG6Vzpd2GcvklHhurh3UVEf7+JFHpsfGvxWRPL?=\n\t=?utf-8?q?kjJNYCofCT3p8STnfbzsXXHV1oEGA8hfBh7X6BQfVzHokkhwm0NUBgqa?=\n\t=?utf-8?q?/9W0Sn/PKrSOX/VKLbpjAdCB0guKQB0Gys8F1djy3JzzfyV+R8bBRiVO?=\n\t=?utf-8?q?EGcusp54zornES2aUeCf4LAKrsBNS0IdpzrF5JjGGt9y+Z1NSsf40umI?=\n\t=?utf-8?q?DQ0UgMOgct4JTTJJPkaIbYwvyNpO5XC0JrguYwZkh/JEbRRTEhBBxbc8?=\n\t=?utf-8?q?Bg7tsbY20S+QVxPWl4ueswXxeMp2kcOqw1VFoI47K6KTX4Hk41aT/pfD?=\n\t=?utf-8?q?3c79RbaYkOeHBldxsTHjY7tKvsOWbd9sODSIpTsUH2t6K61541vXk3W9?=\n\t=?utf-8?q?COm9TTj7luU0ab2Jf1Xfo76XUpB36HR31qb2Jxah7vKAQfGTetrZqq+z?=\n\t=?utf-8?q?TF8+vtLc154EbtMP6a6CLJxrFtlzu044XSK1M2nfZLzi2nmkK1xpZuFn?=\n\t=?utf-8?q?RF0bCNN5caDqSxJWdbNbtzoLd1XTNxbVyXVMhKlGKLoosuEk38cPTqCy?=\n\t=?utf-8?q?EUOJh5LDYdjKyq5AnNAp+bIDcS1dMYy9+n6ZZllFCz/Vk77E+UI3BU8U?=\n\t=?utf-8?q?UvcirYqG37Bhfyoz+whoBC6ijb7sxVYlW3eFLZ6xU6B+w=3D=3D?=","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","MIME-Version":"1.0","X-OriginatorOrg":"oss.nxp.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-AuthSource":"PA4PR04MB9688.eurprd04.prod.outlook.com","X-MS-Exchange-CrossTenant-Network-Message-Id":"fa656ec0-8764-44ed-d8f0-08dee7decd09","X-MS-Exchange-CrossTenant-originalarrivaltime":"22 Jul 2026 10:48:44.0765\n\t(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":"HpYZj8QPZnRq3TMAQuU25jgELiTuxKoyee6HIm+oqWQXEX4CM7ynyAjtGnoTpI8hUyapy1S0XU/lE8Osd19lAw==","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"AS1PR04MB9583","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":39799,"web_url":"https://patchwork.libcamera.org/comment/39799/","msgid":"<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>","date":"2026-07-22T18:46:16","subject":"Re: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Hi Elliot,\n\nLe mercredi 22 juillet 2026 à 12:40 +0900, elliot.chen@oss.nxp.com a écrit :\n> From: Elliot Chen <elliot.chen@nxp.com>\n> \n> When using libcamerasrc as a camera source in camerabin with a\n> video-source-filter that specifies a particular output format,\n> the negotiated format was not respecting the downstream preference.\n> This occurred because gst_pad_peer_query_caps() was called with the\n> libcamera stream format filter directly as its filter argument, which\n> caused the returned caps to be ordered by the libcamera source format\n> list rather than by the downstream element's preference.\n\nCan you extend on how you have set your filter, and what you described as a\npreference ?\n\nNicolas\n\n> \n> Fix this by splitting the caps query into two steps: first query the\n> full set of caps supported by the downstream peer without any filter,\n> then intersect with the libcamera stream formats using\n> GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order\n> of the first operand (the downstream peer caps), so when the caps are\n> subsequently fixated, the format preferred by the downstream element\n> (e.g. the video-source-filter in camerabin) is selected.\n> \n> Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> b/src/gstreamer/gstlibcamerasrc.cpp\n> index 9061f9163..579bd466d 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>  \t\tStreamConfiguration &stream_cfg = state->config_->at(i);\n>  \n>  \t\t/* Retrieve the supported caps. */\n> +\t\tg_autoptr(GstCaps) peer_caps =\n> gst_pad_peer_query_caps(srcpad, NULL);\n> +\t\tif (!peer_caps || gst_caps_is_empty(peer_caps))\n> +\t\t\treturn false;\n> +\n>  \t\tg_autoptr(GstCaps) filter =\n> gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> -\t\tg_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad,\n> filter);\n> +\t\t/* Intersect with downstream's preferred format order first.\n> */\n> +\t\tg_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps,\n> filter, GST_CAPS_INTERSECT_FIRST);\n>  \t\tif (gst_caps_is_empty(caps))\n>  \t\t\treturn false;\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 2B187C3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 Jul 2026 18:46:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0D4E167EA6;\n\tWed, 22 Jul 2026 20:46:22 +0200 (CEST)","from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com\n\t[IPv6:2607:f8b0:4864:20::e2b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 81AF967E8A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2026 20:46:20 +0200 (CEST)","by mail-vs1-xe2b.google.com with SMTP id\n\tada2fe7eead31-74ab99038afso1673760137.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 Jul 2026 11:46:20 -0700 (PDT)","from ?IPv6:2606:6d00:15:e06b::5ac? ([2606:6d00:15:e06b::5ac])\n\tby smtp.gmail.com with ESMTPSA id\n\tada2fe7eead31-74ad31c215bsm3359817137.2.2026.07.22.11.46.17\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 22 Jul 2026 11:46:18 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=ndufresne-ca.20251104.gappssmtp.com\n\theader.i=@ndufresne-ca.20251104.gappssmtp.com\n\theader.b=\"r8p6Id0Q\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20251104.gappssmtp.com; s=20251104; t=1784745979;\n\tx=1785350779; darn=lists.libcamera.org; \n\th=mime-version:user-agent:content-type:autocrypt:references\n\t:in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date\n\t:message-id:reply-to:content-type;\n\tbh=qOJVIiUQ5pi1Qub1rO5ln2k0mwZullR59yM2PaxKhJw=;\n\tb=r8p6Id0Qh8RUpzZfjVPqzo5Ajhe6rnXTjt3fEeqE05ESDnAigPb7kHN9kNuOcR+dkF\n\taPJkvmcbORda7iRdoRS2elF0dVlZn5c3OniIZ/r0XV+Uo4qQ46FZRFH84ZtqQSWO7eqO\n\tceVl5zerS1No4JijGSWSlb0X2J2ahs3IavFqA7RU4DDe+Aua0Ix6HeW16smHxLSqEWV0\n\tw1d+qulmAlDbeLZm5oN0b/0DCc+9kKpfOsCe9OU4UBA2koUckM6xUwUk7gyOj3C6woqE\n\tgZEPj5eDfJ9jmhx17ZvHMuSI5t/ZFeSD2gUrN3fSXC5otqZD8zRVNBEHT5xhm0HVhq8f\n\tJwQw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1784745979; x=1785350779;\n\th=mime-version:user-agent:content-type:autocrypt:references\n\t:in-reply-to:date:to:from:subject:message-id:x-gm-gg\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to\n\t:content-type;\n\tbh=qOJVIiUQ5pi1Qub1rO5ln2k0mwZullR59yM2PaxKhJw=;\n\tb=DeJc+P8AGRIN3tjFvN8uwldIzchW3k7hSTXNwniApeDtkvDoDkTakP87OXaDPEjLQU\n\tc81JrPN6TVi+6Q5aDga4XEzkoZ1/3Z3kNCNeOwOtauk+qkzyHGzUye+uTDCUWuvXafaC\n\tLtelzMGPyyFy9E7vEUMsFTNXsBRps6HC9PIX/c1rkBqP1H6WLSi4o2Pn9hDfwzH0C/FM\n\tY7XIPSu/8cDQfdzJRQ0I1QPRpXGe8BfDC2mZ4kJbvrPzIAOMdgJsUtPN73us/1oKZoeD\n\t75BwmajT5TyCIophW2TirUMr/ZaIReyadpoaT0lIJ4Xv0tqfTICNYVBhbpDFIvOoJxe7\n\tmmDg==","X-Forwarded-Encrypted":"i=1;\n\tAHgh+RqXsadKuOCMTcOUI3HDUzZaAWrhpKMzqGtgLRjMoCkSfm/iXqybk44N/JvSweyqZnTpYJtXFZVzSicT7m/cZ9U=@lists.libcamera.org","X-Gm-Message-State":"AOJu0YzeHGM7EWg6S9TsHd23S/ctPQdWwYPanISaCgrBsDgXDvhFJGgm\n\tFB4AsDEQ7L6w5RrZm9BoUl3OxoNETe0fSYo9pzVtqc1p3hNMHpO87XBmglO1J7C69wA=","X-Gm-Gg":"AR+sD13oW0AVU3zM44pEoAA2vIjjJS636swookbmvUYSqlSEt5Qjz1d4QniT5kJXnfc\n\twYVZXMA+eTRiBDFg5nG1f6R4+n7HljVciN9s+5BqH3AEoC+fEp0adY4Vh8XbKB03AsBKpueeoET\n\tsdagVn/jMPin+V2600ziBGzmRzjcfYoTkrecNtW00v9w8AYP4hcXnZ9U9Jbb5mY1HN0zSPehPnd\n\tcLWJqv+kv2BisC88dSL8/9A9iXBt5RBniow7K0wJ7G20Vx9VTmoWszTSWMuUo6S469SpUO5Y1X7\n\t/4G5AaO6W/5H7Kj0SI3qG+DVz4S1rkykp+CoZOcPME0Lkc+u1eiPL2zBwOpZvaaA38ZHRYnZGuf\n\tlEMDg8yovcq980BWdvosnL+/i8vzfhMrSkY/HOjKwVuaHbLeeO/HgIPwEr5Y6YGkkq9wi+6Ugkf\n\tra2PVratI=","X-Received":"by 2002:a05:6102:161e:b0:726:8813:2085 with SMTP id\n\tada2fe7eead31-74753625ab4mr9736654137.13.1784745978860; \n\tWed, 22 Jul 2026 11:46:18 -0700 (PDT)","Message-ID":"<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>","Subject":"Re: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"elliot.chen@oss.nxp.com, libcamera-devel@lists.libcamera.org, \n\telliot.chen@nxp.com","Date":"Wed, 22 Jul 2026 14:46:16 -0400","In-Reply-To":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>","Autocrypt":"addr=nicolas@ndufresne.ca; prefer-encrypt=mutual;\n\tkeydata=mDMEaCN2ixYJKwYBBAHaRw8BAQdAM0EHepTful3JOIzcPv6ekHOenE1u0vDG1gdHFrChD\n\t/e0J05pY29sYXMgRHVmcmVzbmUgPG5pY29sYXNAbmR1ZnJlc25lLmNhPoicBBMWCgBEAhsDBQsJCA\n\tcCAiICBhUKCQgLAgQWAgMBAh4HAheABQkJZfd1FiEE7w1SgRXEw8IaBG8S2UGUUSlgcvQFAmibrjo\n\tCGQEACgkQ2UGUUSlgcvQlQwD/RjpU1SZYcKG6pnfnQ8ivgtTkGDRUJ8gP3fK7+XUjRNIA/iXfhXMN\n\tabIWxO2oCXKf3TdD7aQ4070KO6zSxIcxgNQFtDFOaWNvbGFzIER1ZnJlc25lIDxuaWNvbGFzLmR1Z\n\tnJlc25lQGNvbGxhYm9yYS5jb20+iJkEExYKAEECGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4\n\tAWIQTvDVKBFcTDwhoEbxLZQZRRKWBy9AUCaCyyxgUJCWX3dQAKCRDZQZRRKWBy9ARJAP96pFmLffZ\n\tsmBUpkyVBfFAf+zq6BJt769R0al3kHvUKdgD9G7KAHuioxD2v6SX7idpIazjzx8b8rfzwTWyOQWHC\n\tAAS0LU5pY29sYXMgRHVmcmVzbmUgPG5pY29sYXMuZHVmcmVzbmVAZ21haWwuY29tPoiZBBMWCgBBF\n\tiEE7w1SgRXEw8IaBG8S2UGUUSlgcvQFAmibrGYCGwMFCQll93UFCwkIBwICIgIGFQoJCAsCBBYCAw\n\tECHgcCF4AACgkQ2UGUUSlgcvRObgD/YnQjfi4+L8f4fI7p1pPMTwRTcaRdy6aqkKEmKsCArzQBAK8\n\tbRLv9QjuqsE6oQZra/RB4widZPvphs78H0P6NmpIJ","Content-Type":"multipart/signed; micalg=\"pgp-sha512\";\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"=-+zTKx4E518JBWt7ejEAP\"","User-Agent":"Evolution 3.60.2 (3.60.2-1.fc44) ","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":39805,"web_url":"https://patchwork.libcamera.org/comment/39805/","msgid":"<PA4PR04MB9688C111E54C6C1A0EEC124AEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","date":"2026-07-23T06:50:37","subject":"RE: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","submitter":{"id":452,"url":"https://patchwork.libcamera.org/api/people/452/","name":"Elliot Chen","email":"elliot.chen@nxp.com"},"content":"Hi Nicolas Dufresne,\n1. Thank you for your comments. The issue occurs when using ap1302 camera on NXP i.MX95 board when using libcamerasrc as a camera source in camerabin. \n2. First, I create a capsfilter to configure the expected output format and resolution, then configure video-source-filter property of wrappercamerabinsrc. \n3. I wrote a demo to showcase my configuration flow as below. The final pipeline diagram can refer to the attachment.\n     libcamerasrc will select NV12 instead of YUY2 format in this flow. But in fact, camera can support YUY2 format. \n\n//step1: configure the expected video format and resolution\ngchar *output_video_format_str = \"YUY2\";\ngint image_width = 1280;\ngint image_height = 800;\ncamera_output_caps  = gst_caps_new_full (gst_structure_new (\"video/x-raw\",\n                \"width\", G_TYPE_INT, image_width,\n                \"height\", G_TYPE_INT, image_height,\n                \"format\", G_TYPE_STRING, output_video_format_str,\n                NULL), NULL);\ngchar *video_filter_str = g_strdup_printf (\"%s\\\"%s\\\"\", \"capsfilter caps=\", gst_caps_to_string (camera_output_caps));\nvideosrc_filter = gst_parse_bin_from_description (video_filter_str, TRUE, NULL);\n\n//step2: set video source filter\nGstElement *wrapper = gst_element_factory_make (\"wrappercamerabinsrc\", NULL);\ng_object_set (wrapper, \"video-source-filter\", videosrc_filter, NULL);\n\n\n-----Original Message-----\nFrom: Nicolas Dufresne <nicolas@ndufresne.ca> \nSent: Thursday, July 23, 2026 2:46 AM\nTo: Elliot Chen (OSS) <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org; Elliot Chen <elliot.chen@nxp.com>\nSubject: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format preferences in caps negotiation\n\nHi Elliot,\n\nLe mercredi 22 juillet 2026 à 12:40 +0900, elliot.chen@oss.nxp.com a écrit :\n> From: Elliot Chen <elliot.chen@nxp.com>\n> \n> When using libcamerasrc as a camera source in camerabin with a \n> video-source-filter that specifies a particular output format, the \n> negotiated format was not respecting the downstream preference.\n> This occurred because gst_pad_peer_query_caps() was called with the \n> libcamera stream format filter directly as its filter argument, which \n> caused the returned caps to be ordered by the libcamera source format \n> list rather than by the downstream element's preference.\n\nCan you extend on how you have set your filter, and what you described as a preference ?\n\nNicolas\n\n> \n> Fix this by splitting the caps query into two steps: first query the \n> full set of caps supported by the downstream peer without any filter, \n> then intersect with the libcamera stream formats using \n> GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order \n> of the first operand (the downstream peer caps), so when the caps are \n> subsequently fixated, the format preferred by the downstream element \n> (e.g. the video-source-filter in camerabin) is selected.\n> \n> Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> b/src/gstreamer/gstlibcamerasrc.cpp\n> index 9061f9163..579bd466d 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>  \t\tStreamConfiguration &stream_cfg = state->config_->at(i);\n>  \n>  \t\t/* Retrieve the supported caps. */\n> +\t\tg_autoptr(GstCaps) peer_caps =\n> gst_pad_peer_query_caps(srcpad, NULL);\n> +\t\tif (!peer_caps || gst_caps_is_empty(peer_caps))\n> +\t\t\treturn false;\n> +\n>  \t\tg_autoptr(GstCaps) filter =\n> gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> -\t\tg_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad,\n> filter);\n> +\t\t/* Intersect with downstream's preferred format order first.\n> */\n> +\t\tg_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps,\n> filter, GST_CAPS_INTERSECT_FIRST);\n>  \t\tif (gst_caps_is_empty(caps))\n>  \t\t\treturn false;\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 54E1ABDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jul 2026 13:53:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E4CD267EC3;\n\tThu, 23 Jul 2026 15:53:03 +0200 (CEST)","from GVXPR05CU001.outbound.protection.outlook.com\n\t(mail-swedencentralazlp170130007.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:c202::7])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 815406601C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 08:50:42 +0200 (CEST)","from PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5)\n\tby GV2PR04MB12019.eurprd04.prod.outlook.com (2603:10a6:150:30c::14)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.10;\n\tThu, 23 Jul 2026 06:50:37 +0000","from PA4PR04MB9688.eurprd04.prod.outlook.com\n\t([fe80::3012:9dfe:3b7e:2ff4]) by\n\tPA4PR04MB9688.eurprd04.prod.outlook.com\n\t([fe80::3012:9dfe:3b7e:2ff4%2]) with mapi id 15.21.0245.009;\n\tThu, 23 Jul 2026 06:50:37 +0000"],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=nxp.com header.i=@nxp.com header.b=\"Ed7qqnVZ\";\n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=nxp.com;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n\tb=LZ8XqT55cds5C2Hpb91MxIzb1XS0RGRl5CONw4qnryFQX2PcrKWHwlQVGartoH9IAHc9ViI5XbZ0ybDxgYsknKQ3luhlW3PKDM8EVKii6JERj/MythZfx8NzDgwarvb+UnkSx5YsqrDNvG7ShTIO0vCDdODQTOGkk8bMHj0zCrHPqn1qvkzry9DlxIvYV4lIYxUikZSHXZnAfIM5YpN/iMAqiarZrn2Fe2JKOt07XNiQQEJJgrObz46c5dtxayG/3KKcBHkjhkbUv8aZyM8rydGXhTkBMlT34boy+YRvO7ZuQTgtRB8PnAwmdiu/ID6/lfr9cNahRNCLbYnVLL6F7A==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector10001;\n\th=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;\n\tbh=YzKHNoVIgcrFd4xVqhbzEid8ebw4snFvoT3p8ExS3CU=;\n\tb=zRrOBox3FmDrfBMLkpym5jilMfTy1HsQQDYDBcK6fw6fjSVgKLjVKIvJ2PhIg9hXFzYg358ZPgFGjy+jQihHhJCRyUQKiUzA1U99Lhpt7QUQGvPMqp/ExRJ1+nAUiTuZnb+eMae+Awql89uoB1/mc1XUNTrdXM1bJOrHBddtgahO094WsNgAgm8zV0xKpxA9yUSZHrtb9PbcDyGRAVfkhUxcQqylKbUJG+eqtk3JD7O356Eeig2gDDe11AGEd1pkpb8tr+D0v4Hi/hpsbmbgMjJqiu6zKVR323fa+lFH+cG/yV3s7aumKO5jliulAQUgYm3HLQD4joTHouF7YOhzVQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com;\n\tdkim=pass header.d=nxp.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=YzKHNoVIgcrFd4xVqhbzEid8ebw4snFvoT3p8ExS3CU=;\n\tb=Ed7qqnVZYnBwS0VWWAQ68VCKr86brE6DGn7NSKkv0KOO0DNoKWs9Q337oKXbAnN0rO4zNtfxGCyvhpwJYB3gmvYuzBdD77Zi7EH05yGVKKTKVCFxb3aqB05+Dgi0fP0Evjcn0+ZLoWtBA/ka8lwXsz9c0Owe0lSo2G0uCIg+SyM7a+TLzHKGKJuxYRVK2vsWL2rXDQ3yMe38zfj8OY+139iXBAs1NVFUsF2kxTKLrsbMMNURu2YwpklZ+DHQTfCh5GLIR7gWpOEyKMhJMO0JExS5oEv3UnvGUPCjC2s5lO0SgEae194FKHBszEBkORd1x/LLWgMCEaMkC0IUke+KBQ==","From":"Elliot Chen <elliot.chen@nxp.com>","To":"Nicolas Dufresne <nicolas@ndufresne.ca>, \"Elliot Chen (OSS)\"\n\t<elliot.chen@oss.nxp.com>, \"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>","Subject":"RE: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","Thread-Topic":"[EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","Thread-Index":"AQHdGYvSD0arGvEpHUe+bcfzYRN/E7Z54akAgAC9jfA=","Date":"Thu, 23 Jul 2026 06:50:37 +0000","Message-ID":"<PA4PR04MB9688C111E54C6C1A0EEC124AEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>\n\t<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>","In-Reply-To":"<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"yes","X-MS-TNEF-Correlator":"","authentication-results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=nxp.com header.i=@nxp.com header.b=\"Ed7qqnVZ\";\n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=nxp.com;"],"x-ms-publictraffictype":"Email","x-ms-traffictypediagnostic":"PA4PR04MB9688:EE_|GV2PR04MB12019:EE_","x-ms-office365-filtering-correlation-id":"5842c602-5a7e-49f3-6bbe-08dee886b3dc","x-ms-exchange-senderadcheck":"1","x-ms-exchange-antispam-relay":"0","x-microsoft-antispam":"BCL:0;\n\tARA:13230040|6049299003|376014|23010399003|19092799006|366016|1800799024|4053099003|38070700021|6133799003|11063799006|4143699003|5023799004|56012099006|10067099003|18002099003|22082099003|3023799007;","x-microsoft-antispam-message-info":"R4am6A8wsC33uHViHOMO5P8NLLc5Dte03Unt8kHln3uTOzbDIq7BbUavWzd5Xf2txkGp29Zo0GEULD6LRzs9x5VKsNhWIhd8LcH9WHjs75l2KXt0RgVdqSdZyxM/ZPNq9iq9qgTCdbnkbYRJ0/GGB89+3kwn3r2LAwrXJoALfnWoloklfMXWAv6/aLBZSbXgqWbiZ3mVUrdYMKvc7M2xRlOywx9WLDVUd5gOY5XqNq9WsMhW7qic1MMiZe1A+Ol22uR1480pnkUgku+EPJyJhrW5UuaQrRSE69iYadNM2wm86eMZAazjSPUP/HoU/HtCcT7OipJnDdIGAgRoBUSlCcGnIYOHO9XMEngSNaYyknnqyL+l3yg5xp/DPRITGbwAmjruRKfySajOY0MQoSgt4oI3VV/H60b+zL4buV7xPqU2sJN05POhOz7En13u+JOOva+XkDcPyGtu50x9418u280ao+EkqKN2NF1Qyvpf7of1mjJzS65wO0/kpplC16jM1E65Jq8AE5vYWjo7F6UrCp8N7k3X+8Eo3bO8lmBc6elQWjsE4G4qLbk3rXNuuEf1ku2v3RZm2812l56T2pyK3VcNBJNRe9qDRHnwJ+3pZ1wOQhzNgUeO569SDN1ZtJ6zojyzAaGeRBJDjEnwnmI73MA85wFbZfAdWN7I5t4C/N7MrP4EwjUJ8AEO2mfc/W0cODR/O1AXrGXqvymyXZbpKx1R8ZzwjFsvs5qGvk72CLo=","x-forefront-antispam-report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:PA4PR04MB9688.eurprd04.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230040)(6049299003)(376014)(23010399003)(19092799006)(366016)(1800799024)(4053099003)(38070700021)(6133799003)(11063799006)(4143699003)(5023799004)(56012099006)(10067099003)(18002099003)(22082099003)(3023799007);\n\tDIR:OUT; SFP:1101; ","x-ms-exchange-antispam-messagedata-chunkcount":"1","x-ms-exchange-antispam-messagedata-0":"=?utf-8?q?nqLTLzhznc0yd/noPLrsvOAxa?=\n\t=?utf-8?q?bsPkjjJef7OpaKvy6+bIoQaj6OrFBxRjnzIM7wEcCfZbZauabM1L86F3?=\n\t=?utf-8?q?qDtkebR496cMob0pRau6mLNQbdpnkra9BLi+n3K053XOdcNiiWfjdjE6?=\n\t=?utf-8?q?ivi5iJ80nOVuHpawhPBdT4g7m1zu89y/44hFE+7/295IQeE8nc+GEhQK?=\n\t=?utf-8?q?5wq4SgXP1xQGbAjIkQpxxLxUhp5y95y9rndp27eyQM0hnXaxeTMeTZDq?=\n\t=?utf-8?q?zYHPyufTVmcQJZzs+SIrRUKrZ5G+zJUPB5K/gvoNOf7lrkgQppj1MtE1?=\n\t=?utf-8?q?qHWhI2gDLqS/Q4/GDRklZnBOd8c0PQ1vGucN804OMTRVR8ZMfON1KKfl?=\n\t=?utf-8?q?hjoUmWl9At6dHRYnsqcKPH7mCayjDZp02YkzG91hp6VQL1CNtGYbuEqP?=\n\t=?utf-8?q?jGZFirsBwIpha9uxrmbNZFFiZdMadzovBj5J4FqefqecvX8FuD4j/+pi?=\n\t=?utf-8?q?4FGvGsS/MPIz1EbGCfgUmGdgpbmAzxj7ELG/t5iL+/EZhW6mHd7cB/qH?=\n\t=?utf-8?q?ewJgycccDOEprsUwqqgaCgqzD/R/orIm6AaNJQTXpGq+ntbkMJKWl60A?=\n\t=?utf-8?q?Aty0wm6BtPvBQ8pd8kBGgi3afc+qjiciiQHW1o2HwBGzM4cAZWab9ptC?=\n\t=?utf-8?q?NA4Wz9W90AHq4wyv3gkRXCBr/O1Rh+n/iDpAgSZBVsq5+x0NIpEnCpbK?=\n\t=?utf-8?q?GCQ+I0x0RqxEZedTKw9/5Fvv+l5MyQm+inxiXhv2gqhuqm6xQHUwqYZV?=\n\t=?utf-8?q?xjbjoBkJcWT3tZOhXUUkm3JqrEe1xFZk9KpMdo4RZ7yfmrPyef8Kl0SU?=\n\t=?utf-8?q?6avie3Bk3JXOhkjKgPyLrfD86R4nN3wstLI9zbeKu7ItA1hLV302yndq?=\n\t=?utf-8?q?5yCgCH4+Ix8ijwIpaVKLS6P+wNOudUqEn8L1kYNjuBdLPH9tjK5eXEqC?=\n\t=?utf-8?q?YEGd/FSGLiQhPW7+aZokJuHSJNnjeUkd6TBDZGLINsTddaXxmgfR6gj8?=\n\t=?utf-8?q?0vpli/oUE2/3HOyFfsh7ZoKMtB+piTZYBFnfUl6LEW/odA5m+/TsBiCU?=\n\t=?utf-8?q?auUNl6aQmH75u8D0IJEzKeXJP+D2s8Dl70j3Oy1KzkVLk3gJsAAXcIqq?=\n\t=?utf-8?q?GI00wIPullgRSJa2MHjzx/3Rx1W22JYRTSdtW3qrFraviXPkfVbWBPfi?=\n\t=?utf-8?q?z5X1DbbAIKHiTRcAVsgkjRcPbTAN3K7fTB71qrKvTEc0tp1uP6cqvPEp?=\n\t=?utf-8?q?PjHMREFUEDMHn0itrovQ1B+p+q8OvDN1onI3VVNePcOIJU3rE2v15RLp?=\n\t=?utf-8?q?66rTFMNx/wrGXiGowCIkE31Y9iGhkAyMosR2HDTCRkVhaLyGT64LYI2r?=\n\t=?utf-8?q?CV80w8MLAp7+/rax/0gO2aNwddyGRjkl3K0W9HaVttrRUOyNcjya70v7?=\n\t=?utf-8?q?buqHjHq82MsrEgSeEJ04GdnYmFX6tYH6gmN0JLmENr7NRjvSjfrGmc87?=\n\t=?utf-8?q?HKiJDCFH1pQ1jacStOk0RLt4nb79ZSIif0lXJsAb703+3mmYNkd7hDWs?=\n\t=?utf-8?q?2+md9d109/rmP1T+ntWIJnQqyN9k/3llyHrTrLKexIhcwAZnJQ92zv9M?=\n\t=?utf-8?q?XMrJCynBPdweYWYzj9BBHjEGzfkN5avq5NSpe8vdOUUpvFfrJpYAC78o?=\n\t=?utf-8?q?DFUUXYoEl43Xlusfq5Ef7bmOKRY5VjGBZPzhotloYkcSjwMz33llc8qF?=\n\t=?utf-8?q?Z6fJ4VbYh8DOAcuu+uzED76eBzOMhc3y9akyyYiinGfk+tdVZ+k/4tXv?=\n\t=?utf-8?q?CHtYyHucMb3spQbT5MXjpyQ?=","Content-Type":"multipart/mixed;\n\tboundary=\"_002_PA4PR04MB9688C111E54C6C1A0EEC124AEAC02PA4PR04MB9688eurp_\"","MIME-Version":"1.0","X-OriginatorOrg":"nxp.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-AuthSource":"PA4PR04MB9688.eurprd04.prod.outlook.com","X-MS-Exchange-CrossTenant-Network-Message-Id":"5842c602-5a7e-49f3-6bbe-08dee886b3dc","X-MS-Exchange-CrossTenant-originalarrivaltime":"23 Jul 2026 06:50:37.3561\n\t(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":"80WdFTiPlwhN0+QCAZ3dY8dSOh+n1/nVcxH/TcsvcClXlot/W262WdlLmWjyaMMhxxoiA9epsjcOEGBtOJ0yVg==","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"GV2PR04MB12019","X-Mailman-Approved-At":"Thu, 23 Jul 2026 15:52:57 +0200","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":39806,"web_url":"https://patchwork.libcamera.org/comment/39806/","msgid":"<PA4PR04MB9688798DD1DAFC0D5C00819DEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","date":"2026-07-23T06:57:36","subject":"RE: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","submitter":{"id":443,"url":"https://patchwork.libcamera.org/api/people/443/","name":"Elliot Chen (OSS)","email":"elliot.chen@oss.nxp.com"},"content":"Hi Nicolas Dufresne,\n1. Thank you for your comments. The issue occurs when using ap1302 camera on NXP i.MX95 board when using libcamerasrc as a camera source in camerabin. \n2. First, I create a capsfilter to configure the expected output format and resolution, then configure video-source-filter property of wrappercamerabinsrc. \n3. I wrote a demo to showcase my configuration flow as below. The final pipeline diagram can refer to the attachment.\n     libcamerasrc will select NV12 instead of YUY2 format in this flow. But in fact, camera can support YUY2 format. \n\n//step1: configure the expected video format and resolution gchar *output_video_format_str = \"YUY2\"; gint image_width = 1280; gint image_height = 800; camera_output_caps  = gst_caps_new_full (gst_structure_new (\"video/x-raw\",\n                \"width\", G_TYPE_INT, image_width,\n                \"height\", G_TYPE_INT, image_height,\n                \"format\", G_TYPE_STRING, output_video_format_str,\n                NULL), NULL);\ngchar *video_filter_str = g_strdup_printf (\"%s\\\"%s\\\"\", \"capsfilter caps=\", gst_caps_to_string (camera_output_caps)); videosrc_filter = gst_parse_bin_from_description (video_filter_str, TRUE, NULL);\n\n//step2: set video source filter\nGstElement *wrapper = gst_element_factory_make (\"wrappercamerabinsrc\", NULL); g_object_set (wrapper, \"video-source-filter\", videosrc_filter, NULL);\n\n-----Original Message-----\nFrom: Nicolas Dufresne <nicolas@ndufresne.ca> \nSent: Thursday, July 23, 2026 2:46 AM\nTo: Elliot Chen (OSS) <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org; Elliot Chen <elliot.chen@nxp.com>\nSubject: Re: [PATCH v2] gstreamer: Honor downstream format preferences in caps negotiation\n\nHi Elliot,\n\nLe mercredi 22 juillet 2026 à 12:40 +0900, elliot.chen@oss.nxp.com a écrit :\n> From: Elliot Chen <elliot.chen@nxp.com>\n> \n> When using libcamerasrc as a camera source in camerabin with a \n> video-source-filter that specifies a particular output format, the \n> negotiated format was not respecting the downstream preference.\n> This occurred because gst_pad_peer_query_caps() was called with the \n> libcamera stream format filter directly as its filter argument, which \n> caused the returned caps to be ordered by the libcamera source format \n> list rather than by the downstream element's preference.\n\nCan you extend on how you have set your filter, and what you described as a preference ?\n\nNicolas\n\n> \n> Fix this by splitting the caps query into two steps: first query the \n> full set of caps supported by the downstream peer without any filter, \n> then intersect with the libcamera stream formats using \n> GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order \n> of the first operand (the downstream peer caps), so when the caps are \n> subsequently fixated, the format preferred by the downstream element \n> (e.g. the video-source-filter in camerabin) is selected.\n> \n> Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> b/src/gstreamer/gstlibcamerasrc.cpp\n> index 9061f9163..579bd466d 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>  \t\tStreamConfiguration &stream_cfg = state->config_->at(i);\n>  \n>  \t\t/* Retrieve the supported caps. */\n> +\t\tg_autoptr(GstCaps) peer_caps =\n> gst_pad_peer_query_caps(srcpad, NULL);\n> +\t\tif (!peer_caps || gst_caps_is_empty(peer_caps))\n> +\t\t\treturn false;\n> +\n>  \t\tg_autoptr(GstCaps) filter =\n> gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> -\t\tg_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad,\n> filter);\n> +\t\t/* Intersect with downstream's preferred format order first.\n> */\n> +\t\tg_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps,\n> filter, GST_CAPS_INTERSECT_FIRST);\n>  \t\tif (gst_caps_is_empty(caps))\n>  \t\t\treturn false;\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 9691CBDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 23 Jul 2026 13:53:09 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9B52367EBC;\n\tThu, 23 Jul 2026 15:53:08 +0200 (CEST)","from DU2PR03CU002.outbound.protection.outlook.com\n\t(mail-northeuropeazlp170110003.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:c200::3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 89B8267E9C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 23 Jul 2026 08:57:44 +0200 (CEST)","from PA4PR04MB9688.eurprd04.prod.outlook.com (2603:10a6:102:271::5)\n\tby AM8PR04MB8036.eurprd04.prod.outlook.com (2603:10a6:20b:242::13)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.10;\n\tThu, 23 Jul 2026 06:57:36 +0000","from PA4PR04MB9688.eurprd04.prod.outlook.com\n\t([fe80::3012:9dfe:3b7e:2ff4]) by\n\tPA4PR04MB9688.eurprd04.prod.outlook.com\n\t([fe80::3012:9dfe:3b7e:2ff4%2]) with mapi id 15.21.0245.009;\n\tThu, 23 Jul 2026 06:57:36 +0000"],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"RQYVpBrb\"; \n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n\tb=zDBaZAkBnWnmuTw4nP54JwU6CJEp0QdQCxGgszd+d0gYlIxMATyKVBXjvMcBjNGXn9JMBsH2aTnnK1n6J32badtyh+UzCiI8BgOa9TnV1CKvCmvh2pifcR/NJ4iIYJEzJ1PHqVOP0mCCcQNToXxo6z5QyJDfj5Q5Z8oGEFjgVaoM4prrxY0EVTwFMQwH+Rdlzsk74WzXBQdg3InCILpoJMZpeWebJGzxtBFHfVEl9YPrcuQwN6lmrFilkCCINouev8z1jymkj9BnMADUHLS683laPJYHMRCaf4l/Ip9nPOeFUV1d2qTbiMCtY2mbqerr5dwGyIZs3letXIheg4DQVg==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector10001;\n\th=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;\n\tbh=y4YOSEJL7FkLWPEnnn8NfnQUWxPtxIid3P/ClV0cctk=;\n\tb=LRNtxxcyPCdVcKTTKDpbZwbe3dF45sAgZ5x6tfBW8CLUxU6antTzt2JQL2/5HKsLV9OCbZ+2IW7Y2sl+OpP8cC0QktyRrBFc8kL7AH4SGjHihsDDOCOSU5zBFb4JUgZg1KNJabSElvSv0d1KJ7s3li+xSIR9NJ8s5a0p9bNCyW3aYLNRJ7fZbPBSqrZCeE+EmSylw9B31/TjLuC0ng4sUUPKqdl9DBv0wbnpCwM0jkILL7kNMhoKshFXFOLomBMLW6SG/mJR1N5m9zLyTaUpUTPoF/Q8ihIzdhHvdLEj5X+GrBWEsDtie/pGSiK7RZYzpjh0TArd0tXpA6KSXM/5fw==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=oss.nxp.com;\n\tdmarc=pass action=none header.from=oss.nxp.com; \n\tdkim=pass header.d=oss.nxp.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com;\n\ts=selector1-NXP1-onmicrosoft-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=y4YOSEJL7FkLWPEnnn8NfnQUWxPtxIid3P/ClV0cctk=;\n\tb=RQYVpBrbrREm3TJuO/M7Ij8Vh7kUhhbYQL9TRR+5IPOzWexzLmVhxE2m3kpCpJFGgj4HamDAKTTskYwha9CtPbr0t74ScWqxaalP7F06JTVlaU0H9+UkwR4uS9wefvWtQxl3NmqaVazl+RPk9scmfcAwxuTnernQzeFk56Ty8XAOV9Zum8joE6CbNILeIsOAYcCk47vmqcNupqFX3aVJ1y5+UTC4yP+ONuH9XhK1tO8fPYY3I+9J+GBb7s2kK/I8Av2cc2mw/zRVenyW3DtRSkwBRSZdf4OblIkwhREtMvk0xB4nRMEYhOcfZvd5j58/u47uzZpB1KtG7D3y56FAWQ==","From":"\"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>","To":"Nicolas Dufresne <nicolas@ndufresne.ca>,\n\t\"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>","Subject":"RE: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","Thread-Topic":"[PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","Thread-Index":"AQHdGnCKdRccq8z7DUmEUz+zB5FNEQ==","Date":"Thu, 23 Jul 2026 06:57:36 +0000","Message-ID":"<PA4PR04MB9688798DD1DAFC0D5C00819DEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>\n\t<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>","In-Reply-To":"<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"yes","X-MS-TNEF-Correlator":"","authentication-results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"RQYVpBrb\"; \n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;"],"x-ms-exchange-messagesentrepresentingtype":"1","x-ms-publictraffictype":"Email","x-ms-traffictypediagnostic":"PA4PR04MB9688:EE_|AM8PR04MB8036:EE_","x-ms-office365-filtering-correlation-id":"b5a2d887-ab6f-4fe9-5d76-08dee887ad7f","x-ms-exchange-sharedmailbox-routingagent-processed":"True","x-ms-exchange-senderadcheck":"1","x-ms-exchange-antispam-relay":"0","x-microsoft-antispam":"BCL:0;\n\tARA:13230040|23010399003|6049299003|1800799024|19092799006|376014|366016|56012099006|38070700021|11063799006|5023799004|4053099003|10067099003|22082099003|18002099003|6133799003|4143699003|3023799007;","x-microsoft-antispam-message-info":"yO0cJx5MwjcOaeWQI2TiBten8hVtbtEhvDIBjDK+iwAkPXKNhGsmOG6FmLwoRQUYcAEnjD+uLHA8UwKFyVsACLW8xCTKQsnCj1sjw9fNbZNGrMRHUkj4b1WgOnCyWSk091ulknVVBJH6Q4z/GIYDW0+AjhCvjjVMmzRQ4k57AKuuqMBcyB0hz+M4n4yMbf2wDmwd1Szhb1OeEs9ukEYT44CO/V2ZRsFheT30DeCuYqKaenwflm3AkyullZB+qacO3JcVhNGutcp+TiAip5fslVyZtDr8wM4q4iGKCWbTILIsfy4KTKT+aUshyY2WXP9N6UNOfKVYi8aE/WIybF4YKb8TBRJGR3WxgsPlQFyWTCNfNWDYfF11RHpNp5SQBDE1LuoSnizURvuSqKe6HJBkx4ScXF31kw6fO2/eVTJojZg+gEhHyP0c694aOSWwz7/ox7hRWuTUrBUCv/QuwZvto/dWjcZzrj9xmAjvG5cLIN6O3Q+VMbTWTi8KlObKBCRzbuJNOG0v6Ot0kxvWgYPjDUwbxWl46+aOHqOnlvUyv6gxu7Q/zI4fxaMnF7wMHnAm4+PJVU69AEcmj2F0HOeo/MGdJpirfdCVQ8EzkZKB0uXo4qXpPbTSCdlD8RRjBh5mOyfRTvgOXD62AgmHs943bfmym/MLqR3KtlvFUHUwyGsuYYbSLougZw/k1eKi6UhoyxJEzj726P/j9ejGT56rehPSFMxZaIow9tXI7V9PfOA=","x-forefront-antispam-report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:PA4PR04MB9688.eurprd04.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230040)(23010399003)(6049299003)(1800799024)(19092799006)(376014)(366016)(56012099006)(38070700021)(11063799006)(5023799004)(4053099003)(10067099003)(22082099003)(18002099003)(6133799003)(4143699003)(3023799007);\n\tDIR:OUT; SFP:1101; ","x-ms-exchange-antispam-messagedata-chunkcount":"1","x-ms-exchange-antispam-messagedata-0":"=?utf-8?q?LnN8ETV0I/vjMglpbpkMjKCw0?=\n\t=?utf-8?q?D4kBejQGDqNfuomvcxRiQTkSwcOL4gb8KlKbtwee8UTnlcJbmavSbAiZ?=\n\t=?utf-8?q?r0b7EuuxGn4+P0Ax/vVs2rcDAHm8pNwkVyIl0aodahlLHxM+Z12FtUit?=\n\t=?utf-8?q?FZvc6Oo/lA6vVeonGoMODztOlhQN/XWTLaMygOX+rvpHBQB47zD7yKd4?=\n\t=?utf-8?q?w6AtDJNBECNU+qlpzyThjaLvF06BVLykOrJjhhzf/SGT2f6p7VvRz4ag?=\n\t=?utf-8?q?aSnmiFNxvHXIOwMaMePwQirhOl8aNrW+TBtI3xmJIa3cv6s/eyPP3xJV?=\n\t=?utf-8?q?hNYu0diynwcfFHRX5ImypK5cv9BiJJYWN3oH4/v9s7fEzdK9m0ePMXa1?=\n\t=?utf-8?q?zJn1r9aPFru+THSnrlALn7dOzJPItMGGFiVn30oZo6uC3n3lbr3fpkxh?=\n\t=?utf-8?q?F7N4r9qCBOqkXhfoQo087AaYqJXCCcnCeCBcohhpyf5lKQYjlqgvdF8T?=\n\t=?utf-8?q?pyqu/nF4RWNmCNw89O9f4ZdYnZsDqzKaM8ahMakzgL8iarv2q+Skaarm?=\n\t=?utf-8?q?RJriRM7JmxX1pyu4SbeBpWOldMu3m4NoP/zMjCX4UUfS+0ZpkspMDRE/?=\n\t=?utf-8?q?13MJSc+AOf0d3cq7saqUZXY86UM7GEfH8G4p4iM+hJSsZyg8Ugstts91?=\n\t=?utf-8?q?lzWcIWkoCbZcdVgmx3eP6FXF2jhZIMhBFrmJsDy8agt0MqIxhgrcQ9N1?=\n\t=?utf-8?q?U6kZpRKVJs/KKFw6WUqTD41pczTiYMHaBLxvcJrE2CA00OkH4its0l/E?=\n\t=?utf-8?q?Jsvk1TCE+lS/vNF2i308yQnjm27nq2FX0d3h2vujfkfzKkWW71nCiQKr?=\n\t=?utf-8?q?V5frpmb95Vfzkm2jJzq6pgbQO49a3Ur/sIT9XrolsEfZs1TSekuPkCHK?=\n\t=?utf-8?q?LEBkJrEoJtaRBjsxvRhS8cveuCppZM4SXCnhtun/h9xXzjvEk/OXwuka?=\n\t=?utf-8?q?I4gziFARlXf33o+yuk+Kylpy0nMvebmI842sLEiRTdH+ofh3OkD6trrk?=\n\t=?utf-8?q?BCkpL42PnwD/Defs6+mN1Z1IBamdPOJMuGNSY3V0/wLIvLLcivvo6Anw?=\n\t=?utf-8?q?SsvV4PMoDc21cilv33kbgR9hjBPpDXWpYWkRZ/DXg/DMS+66eeIW60mh?=\n\t=?utf-8?q?/j2rdXwqm2JcqxaamqcAySFsC6hOwjoyuomTx+dHaQ0eU5o5FfF4Q22p?=\n\t=?utf-8?q?vNVoOmZpUBumdzYLDH06Dd0CmqCUxsASYL8isILrm/5Gb3RJWn2kEQOW?=\n\t=?utf-8?q?8VgpBS9hglOlZF+BN73+2iIdAZPzeD27Zm4tLNBFLu91b3QJ2RBB8eqK?=\n\t=?utf-8?q?L8Q7zhFR1xiUgKCebRG9jsmTFNG/v8YseW7lzhoLvvagKkMmJw3MAVSg?=\n\t=?utf-8?q?XUaOlcFZR/rr8ekK/kgQ2cNFjKizfOOQ/eDbeyo6xzdIgjhjgk9kCutk?=\n\t=?utf-8?q?5KiUeZF0INxH5fZy5anBoSJ4dy9jVlHcSWEEapikgHFLNAzq94d6rKR+?=\n\t=?utf-8?q?7ZdKdimSAHXdsf3uWgAJAAHS41XRxDfUCkXC15yqDB0x1DCJer5Ix5dh?=\n\t=?utf-8?q?sq/ah0psQfiAuhPyZsgmrQgx3ro6HPCPrey6tJqZZA2QPG4wkf4Xv8JM?=\n\t=?utf-8?q?Vi0fM75TTEJgwtbrYcX8dnK8jM0gbLXXvCcj5BNVS78+FlZxFZJkgpyS?=\n\t=?utf-8?q?WoDPUw5zLharRLYe3gAOCTKpoPjmUkYFrJg8nAwW7xCMLCRv2e8BCwmy?=\n\t=?utf-8?q?OPMXOgPVo5awTRzlCWitKzd9pxK8D3ubIqWrnc3VUEHNfSireogKAecY?=\n\t=?utf-8?q?Nzmx6qsSpTmw8PHnM1mTmzN?=","Content-Type":"multipart/mixed;\n\tboundary=\"_002_PA4PR04MB9688798DD1DAFC0D5C00819DEAC02PA4PR04MB9688eurp_\"","MIME-Version":"1.0","X-OriginatorOrg":"oss.nxp.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-AuthSource":"PA4PR04MB9688.eurprd04.prod.outlook.com","X-MS-Exchange-CrossTenant-Network-Message-Id":"b5a2d887-ab6f-4fe9-5d76-08dee887ad7f","X-MS-Exchange-CrossTenant-originalarrivaltime":"23 Jul 2026 06:57:36.1754\n\t(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":"HhwlSHdJwSIh0t0stMeMCEC0myBxA1TK40e1FZ+w74+RqU2vFaWhT+Fw/HKDxyAJkujyToJxbgdM5vCokceSkA==","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"AM8PR04MB8036","X-Mailman-Approved-At":"Thu, 23 Jul 2026 15:52:57 +0200","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":39812,"web_url":"https://patchwork.libcamera.org/comment/39812/","msgid":"<AS4PR04MB9690D552E05B7F1A229F8A1DEACF2@AS4PR04MB9690.eurprd04.prod.outlook.com>","date":"2026-07-24T02:15:37","subject":"RE: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","submitter":{"id":443,"url":"https://patchwork.libcamera.org/api/people/443/","name":"Elliot Chen (OSS)","email":"elliot.chen@oss.nxp.com"},"content":"Hi Nicolas Dufresne,\nAnother point is that v4l2src plugin also follows this rule.\n\n-----Original Message-----\nFrom: Elliot Chen <elliot.chen@nxp.com> \nSent: Thursday, July 23, 2026 2:51 PM\nTo: Nicolas Dufresne <nicolas@ndufresne.ca>; Elliot Chen (OSS) <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org\nSubject: RE: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format preferences in caps negotiation\n\nHi Nicolas Dufresne,\n1. Thank you for your comments. The issue occurs when using ap1302 camera on NXP i.MX95 board when using libcamerasrc as a camera source in camerabin. \n2. First, I create a capsfilter to configure the expected output format and resolution, then configure video-source-filter property of wrappercamerabinsrc. \n3. I wrote a demo to showcase my configuration flow as below. The final pipeline diagram can refer to the attachment.\n     libcamerasrc will select NV12 instead of YUY2 format in this flow. But in fact, camera can support YUY2 format. \n\n//step1: configure the expected video format and resolution gchar *output_video_format_str = \"YUY2\"; gint image_width = 1280; gint image_height = 800; camera_output_caps  = gst_caps_new_full (gst_structure_new (\"video/x-raw\",\n                \"width\", G_TYPE_INT, image_width,\n                \"height\", G_TYPE_INT, image_height,\n                \"format\", G_TYPE_STRING, output_video_format_str,\n                NULL), NULL);\ngchar *video_filter_str = g_strdup_printf (\"%s\\\"%s\\\"\", \"capsfilter caps=\", gst_caps_to_string (camera_output_caps)); videosrc_filter = gst_parse_bin_from_description (video_filter_str, TRUE, NULL);\n\n//step2: set video source filter\nGstElement *wrapper = gst_element_factory_make (\"wrappercamerabinsrc\", NULL); g_object_set (wrapper, \"video-source-filter\", videosrc_filter, NULL);\n\n\n-----Original Message-----\nFrom: Nicolas Dufresne <nicolas@ndufresne.ca>\nSent: Thursday, July 23, 2026 2:46 AM\nTo: Elliot Chen (OSS) <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org; Elliot Chen <elliot.chen@nxp.com>\nSubject: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format preferences in caps negotiation\n\nHi Elliot,\n\nLe mercredi 22 juillet 2026 à 12:40 +0900, elliot.chen@oss.nxp.com a écrit :\n> From: Elliot Chen <elliot.chen@nxp.com>\n> \n> When using libcamerasrc as a camera source in camerabin with a \n> video-source-filter that specifies a particular output format, the \n> negotiated format was not respecting the downstream preference.\n> This occurred because gst_pad_peer_query_caps() was called with the \n> libcamera stream format filter directly as its filter argument, which \n> caused the returned caps to be ordered by the libcamera source format \n> list rather than by the downstream element's preference.\n\nCan you extend on how you have set your filter, and what you described as a preference ?\n\nNicolas\n\n> \n> Fix this by splitting the caps query into two steps: first query the \n> full set of caps supported by the downstream peer without any filter, \n> then intersect with the libcamera stream formats using \n> GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order \n> of the first operand (the downstream peer caps), so when the caps are \n> subsequently fixated, the format preferred by the downstream element \n> (e.g. the video-source-filter in camerabin) is selected.\n> \n> Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n> ---\n>  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n>  1 file changed, 6 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> b/src/gstreamer/gstlibcamerasrc.cpp\n> index 9061f9163..579bd466d 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n>  \t\tStreamConfiguration &stream_cfg = state->config_->at(i);\n>  \n>  \t\t/* Retrieve the supported caps. */\n> +\t\tg_autoptr(GstCaps) peer_caps =\n> gst_pad_peer_query_caps(srcpad, NULL);\n> +\t\tif (!peer_caps || gst_caps_is_empty(peer_caps))\n> +\t\t\treturn false;\n> +\n>  \t\tg_autoptr(GstCaps) filter =\n> gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> -\t\tg_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad,\n> filter);\n> +\t\t/* Intersect with downstream's preferred format order first.\n> */\n> +\t\tg_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps,\n> filter, GST_CAPS_INTERSECT_FIRST);\n>  \t\tif (gst_caps_is_empty(caps))\n>  \t\t\treturn false;\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 B0B24C3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Jul 2026 02:15:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BAC8E67EE5;\n\tFri, 24 Jul 2026 04:15:47 +0200 (CEST)","from OSPPR02CU001.outbound.protection.outlook.com\n\t(mail-norwayeastazlp170130007.outbound.protection.outlook.com\n\t[IPv6:2a01:111:f403:c20f::7])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 621D167EC4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jul 2026 04:15:46 +0200 (CEST)","from AS4PR04MB9690.eurprd04.prod.outlook.com (2603:10a6:20b:4fd::6)\n\tby DU0PR04MB9695.eurprd04.prod.outlook.com (2603:10a6:10:321::15)\n\twith Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.245.11;\n\tFri, 24 Jul 2026 02:15:38 +0000","from AS4PR04MB9690.eurprd04.prod.outlook.com\n\t([fe80::b1a9:c4ca:13b7:407a]) by\n\tAS4PR04MB9690.eurprd04.prod.outlook.com\n\t([fe80::b1a9:c4ca:13b7:407a%6]) with mapi id 15.21.0245.010;\n\tFri, 24 Jul 2026 02:15:38 +0000"],"Authentication-Results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"gWHE0k/L\"; \n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;"],"ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n\tb=vfDpstGETuShOb1+v2GQKPG0X/Q6UXvG1+m3Up5yieF0unQXqRQarEVlqxVeLc6bsW2xoKnz7L/f8i2L3WviP7mCF1HEJrYQuETwyDDCp3nzcYo4uOuGbciW2fWFIQfePiNE807KUnL+qS8ptnuKSJ3Rq85IzUFkzK0Y5XwlN64Q7d9id50OrMItmW+FtIPutnieDGzOtBONpMAls8RxRynhnRVFdvTAZFc1Bj0+xVb2wJ/E711DT7pnY8C4wnJ/dFnwQB6jDEi4kXEWMlh+VgIzQ4S0Fiar789N88tUglIuv+bzPnJY0PAKG5qb4mAvuAVt9SQrZt2B5JoQPmyYvA==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n\ts=arcselector10001;\n\th=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;\n\tbh=u5EnOVarLvMx1Llra/3682J5QNsc52JvWusSk3H1Qvc=;\n\tb=JzyT4XJgVc9CCBdNVyCsuN2pyS9p7blFIo2NuGNf6qgtai3Rz89XH92XA1aDNymmdUG1Jbm4V/FpUZWYQPuZ3omKNOnlpunZw+3uqdSvQTEFX3D2iYGIRZUQTAnmP7DeQLWJD8Jc96lvSlgZOULveYt2SHvBBzb9sGeSle45JA9R51K+5rqshWy6Rt1aI+04xtl8pbBV7QfwkRYqBvA8jMwit50dU/W3MU6v1qu/c4fDr1tyrX3oCfnxs8VIfCfeRbFblVWBD11FawVkk1pax4DbiWlzx9mmQTpT7x15WDj50upkXSWS9vsk0rlMEF/CeGYY+0safhLsYucfUW+jRQ==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=pass\n\tsmtp.mailfrom=oss.nxp.com;\n\tdmarc=pass action=none header.from=oss.nxp.com; \n\tdkim=pass header.d=oss.nxp.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com;\n\ts=selector1-NXP1-onmicrosoft-com;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=u5EnOVarLvMx1Llra/3682J5QNsc52JvWusSk3H1Qvc=;\n\tb=gWHE0k/LTm18elaeBb4ArLFsHpxt7Yii5/iLh8ZHwIbWUAGB80/oSv4hnQViWrJHgMAKR1HDgV1JIvmJMCIfWqybuJgGbsGmaxbabIKgG1oyiPN2eLmWw6rKN9pBxHPb08oxFa9VlIywSTQy1JHJ4B/LFBhKhBh7eMYAQ5Fo0z1Ih/xCXwIoAAn4DoPAcsvsh4xaav0LxpJq/+RnDeE730x1RI/+AZyCFqkz9D1zdzTZEbi5OvsYdWR/hSJ8LlpXEiWg8HNlsvxoZ5VpiE8zYTJ5rcFZtpLup/PNsvVKx+4OdazBcLy/i9PgU9yRi3OCck444ZA+46FlvQE5DSml2g==","From":"\"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>","To":"Elliot Chen <elliot.chen@nxp.com>, Nicolas Dufresne\n\t<nicolas@ndufresne.ca>, \"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>,\n\t\"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>","Subject":"RE: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","Thread-Topic":"[EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","Thread-Index":"AQHdGYvSD0arGvEpHUe+bcfzYRN/E7Z54akAgAC9jfCAAVJRAA==","Date":"Fri, 24 Jul 2026 02:15:37 +0000","Message-ID":"<AS4PR04MB9690D552E05B7F1A229F8A1DEACF2@AS4PR04MB9690.eurprd04.prod.outlook.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>\n\t<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>\n\t<PA4PR04MB9688C111E54C6C1A0EEC124AEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","In-Reply-To":"<PA4PR04MB9688C111E54C6C1A0EEC124AEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","Accept-Language":"en-US","Content-Language":"en-US","X-MS-Has-Attach":"","X-MS-TNEF-Correlator":"","authentication-results":["lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=NXP1.onmicrosoft.com\n\theader.i=@NXP1.onmicrosoft.com header.b=\"gWHE0k/L\"; \n\tdkim-atps=neutral","dkim=none (message not signed)\n\theader.d=none;dmarc=none action=none header.from=oss.nxp.com;"],"x-ms-exchange-messagesentrepresentingtype":"1","x-ms-publictraffictype":"Email","x-ms-traffictypediagnostic":"AS4PR04MB9690:EE_|DU0PR04MB9695:EE_","x-ms-office365-filtering-correlation-id":"2c3f2fc1-8b1a-46bd-9069-08dee92973ff","x-ms-exchange-sharedmailbox-routingagent-processed":"True","x-ms-exchange-senderadcheck":"1","x-ms-exchange-antispam-relay":"0","x-microsoft-antispam":"BCL:0;\n\tARA:13230040|23010399003|366016|19092799006|376014|1800799024|3023799007|38070700021|10067099003|56012099006|4143699003|5023799004|11063799006|6133799003|22082099003|18002099003;","x-microsoft-antispam-message-info":"Uzpt2+te+gJcFltWEiGSCOukVisZ7nIaCKzg9nAbDtcrBCy+XORzfduIG66TbGZ4w3aUqWd8wvMvQCQKvnqQhtNDbk3sSRZozYym3XiY09R1y7TZ0aQm1eWfL1A0JdPPc+9SxvH8KvLeerGL7XxZPPsNCUP8H+A0+KyaOLyr+mb+QVO3G/P7kEDAzYWuPLJNustDz/qZGn14dn+dmyEa3oDd8WhFP5WYrDIYrB8ckRU/c5g11Fv55o8t+6h/RMdnwpa3nrUsZ9rqZrcf3B+Bf8fLawTISsrfZpMnacuXu311XYjMyo0KY+G+le7P7LUKckbUOOUS7bCK+DJ1oWC6uSo+IQbpv5XfEiIESBMOs8ifdMmFg5csZka+bqKuJi9eBvqdQ5ymWEOjHIJZAjOY1OT746Ic7dVn0BDkLoSmNiYoAJJIJW+pjRkiN+kzcBC7+Teo3EWBnk6xAJr5WEbjAMtuVWZqDnsuf+HMzDnJWhzYsss2LfJdh83VRD1zBbpn70wCJElu5fD8LRqyqsdFJYlrJQACU4K6eOPrQgqsbphVv9/HidCrdEZKrWbE46o2A9WrcclfhIK41tm95AWvYYOsaf1wpTPUIxOuygR5mPGDEIeYRKXiDMNo1zJYABAjAZ+t9OjzYiZHgYTuTXdDw3yPrCK5TnFErpA20SnoMF8SuNk1aiiOeDcT0yWAXiacdHB78Pc9PKyFCHQqprVqTRZjM7Pqj8mFkLV5HcuKKeM=","x-forefront-antispam-report":"CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;\n\tIPV:NLI; SFV:NSPM; H:AS4PR04MB9690.eurprd04.prod.outlook.com; PTR:;\n\tCAT:NONE; \n\tSFS:(13230040)(23010399003)(366016)(19092799006)(376014)(1800799024)(3023799007)(38070700021)(10067099003)(56012099006)(4143699003)(5023799004)(11063799006)(6133799003)(22082099003)(18002099003);\n\tDIR:OUT; SFP:1101; ","x-ms-exchange-antispam-messagedata-chunkcount":"1","x-ms-exchange-antispam-messagedata-0":"=?utf-8?q?vYU/HAvzPqX8zDpikH5nd+Y5o?=\n\t=?utf-8?q?22FoqOAxdJWmLYRRDWJwMmm++9dnBrg1WT9TzA4yHDdgrhB/hmagMT3f?=\n\t=?utf-8?q?NHQmOXvYhvtR8UjnOfS30Bl6Mldo268MNdS1ZqRR1gAPOMggqB+f0ZmK?=\n\t=?utf-8?q?gpymhyIxWDmqAEp57imaunGft/av4c1TGawHEljHSNX7GjdNX36MWC0x?=\n\t=?utf-8?q?4B/mHUNa2/KzR6lbt/RRWVMunkJpQqoPBmnCSyluXNA8+Q2J6em3qMwi?=\n\t=?utf-8?q?ZC8SJ3GeoJEDvFjzR/Fkta+jHLfkOyJiHDOCts/WaNaqQjwU45k3PKes?=\n\t=?utf-8?q?xFEuUd3BrZLHza9jL6iaAtwUS71op4QKXfP06vxjk0WbD7wt/cNxaWA8?=\n\t=?utf-8?q?LcGTZEUNTya7g1f7NYrFyGT6cg7wunJRdwYS9xZ0ncsi+7IuNJnGdJg3?=\n\t=?utf-8?q?ktU0ZzWruRfhkuGDv4qkDzzGWmYjftSCPBABkz0sVQP+6zJuAKQN9S3+?=\n\t=?utf-8?q?Z0XKWXINTdSbPOwqPCpK0wv+5RqJsjL6Hp05LN29NLTURyoOZiKV9c5S?=\n\t=?utf-8?q?+E8548DZD4zFG5lCOF27asw3sfGlGiwlPWsc6WCP0qrgM2z03azt+2qE?=\n\t=?utf-8?q?N75n3dMgamfFC19z5xEoM1AIEy6rN+hQvqXYyT/ECWWDq4iiedhy23RW?=\n\t=?utf-8?q?95cx75ItJSHQYndrxHwxEhYnT8Kt3DQBW3Mab7MNFb3ZK6U5KRpV5lPC?=\n\t=?utf-8?q?Ed+B556cbGhjX6KRStJ8iJ9I+oSWcnOPioSa/pVZWMxZz3pn90THJDV4?=\n\t=?utf-8?q?g+7/BVgBU58vdKMQFZkyg8r/uVfe3T1zK2A9iGhAukuGkSWk3YYPfqEc?=\n\t=?utf-8?q?asvRFWffWRDMEPuuFKnfmR7ZR2Ml0b/a1NDal7sTzNeJcA8A9u6isJ27?=\n\t=?utf-8?q?TY3r5r5a2fKvinlYL0ew6fANU5p7qCuIFm2FR/Wz/WNaNgvEuvFwl/Zv?=\n\t=?utf-8?q?nBaBzxcJF52VYFt2rMnckKoHWW5XLBM3c+cOhcpB7DRXU/Ruz5i2fHju?=\n\t=?utf-8?q?cDD0pZWZQmPz893vL4GIwRM+vfD+pTlq9WkhmSrlBfYIeMzZ2Qe/hQ+y?=\n\t=?utf-8?q?Z28c2nazhFfTj9TiXerC6i4HsO6Wb7QDSb75y8KnJkTUQJNhk6IW9LOO?=\n\t=?utf-8?q?MWxn4iVcnbg3XnoCZi8IhsUjXFnMPXQXtMUA9AtAGUbYvZs2lQ9pU3PT?=\n\t=?utf-8?q?4m3flD8qZXxcjrJbZHK3EPW/WuG/FkwFnm8g69gQy5xjjZG9skDVavyq?=\n\t=?utf-8?q?I4lBnt3PB5Ujrcrg6JZLEYEYCmexV7KgU0sq8N0YLQK6Tn+MlIlPAzkf?=\n\t=?utf-8?q?2hbtF4ekh1/SqHYtCgbSQUOfba85UPZnVlHwny6lJ4+ZzEUGAnXBrS1L?=\n\t=?utf-8?q?O/Cj2h6CApjSrvBjDIDydShx1pUIAMXrkLry9bLKUk4weKV87d+GmET6?=\n\t=?utf-8?q?HxfY4uKq/pdqtrXrjNNcs1SQwAE2YMCPKDq8CgZns1AGhvOrked/DH78?=\n\t=?utf-8?q?wp3/7SW0u3vB6qHP43nV+r6uFJeHQcPQonKb2ATI0W9vAWxqAEAUDFIT?=\n\t=?utf-8?q?UDyGvPcF8To9Kew8JIP/+WgsOm/Lc4r0/FKdWCtjGoePSgBsIGbKiaYP?=\n\t=?utf-8?q?esS9bFgB7JwcKDAucF4ZTKcTfl31ZXPDkoW3IW0X9ojSYH4Qm9w9dJ5p?=\n\t=?utf-8?q?TdnNwq5Q4gEsCT5o2u6NUzSM3OG6NDPbkVRutrA7U3hYD7bw7wiMaubj?=\n\t=?utf-8?q?BnLenII4Lnlz/RsQdq3caOvLhfEObCGdv++G7TuKgep3ivvQF8hrhB/d?=\n\t=?utf-8?q?ir6jsKrkLPJJ/tR8pywOu3zR3/cZNOiwMBqHMytWqGXPw=3D=3D?=","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","MIME-Version":"1.0","X-OriginatorOrg":"oss.nxp.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-AuthSource":"AS4PR04MB9690.eurprd04.prod.outlook.com","X-MS-Exchange-CrossTenant-Network-Message-Id":"2c3f2fc1-8b1a-46bd-9069-08dee92973ff","X-MS-Exchange-CrossTenant-originalarrivaltime":"24 Jul 2026 02:15:38.1938\n\t(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":"HiSRz2pkpZDe56620QhqGZhZ/QIfu5sG+yuWUBAE5zB0acNAesz1ox8+b4BlCJ5O0CIllE2t7LrlNGpNr+NXng==","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"DU0PR04MB9695","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":39841,"web_url":"https://patchwork.libcamera.org/comment/39841/","msgid":"<6eec9f53d9f10e808360c929ae4401733d88e016.camel@ndufresne.ca>","date":"2026-07-24T14:59:19","subject":"Re: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","submitter":{"id":30,"url":"https://patchwork.libcamera.org/api/people/30/","name":"Nicolas Dufresne","email":"nicolas@ndufresne.ca"},"content":"Hi,\n\nLe vendredi 24 juillet 2026 à 02:15 +0000, Elliot Chen (OSS) a écrit :\n> Hi Nicolas Dufresne,\n> Another point is that v4l2src plugin also follows this rule.\n\nCan you share couple of simplified negotiation cases ? Things have shifted quite\na bit lately in v4l2src, enforcing v4l2src choices over downstream a bit. I'd\nlike to compare and understand better. camerabin case is something we could\nsolve by introducing a GstBaseCameraSrc that wraps the libcamerasrc properly,\nallowing multi-streams etc.\n\nNicolas\n\n> \n> -----Original Message-----\n> From: Elliot Chen <elliot.chen@nxp.com> \n> Sent: Thursday, July 23, 2026 2:51 PM\n> To: Nicolas Dufresne <nicolas@ndufresne.ca>; Elliot Chen (OSS)\n> <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org\n> Subject: RE: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n> preferences in caps negotiation\n> \n> Hi Nicolas Dufresne,\n> 1. Thank you for your comments. The issue occurs when using ap1302 camera on\n> NXP i.MX95 board when using libcamerasrc as a camera source in camerabin. \n> 2. First, I create a capsfilter to configure the expected output format and\n> resolution, then configure video-source-filter property of\n> wrappercamerabinsrc. \n> 3. I wrote a demo to showcase my configuration flow as below. The final\n> pipeline diagram can refer to the attachment.\n>      libcamerasrc will select NV12 instead of YUY2 format in this flow. But in\n> fact, camera can support YUY2 format. \n> \n> //step1: configure the expected video format and resolution gchar\n> *output_video_format_str = \"YUY2\"; gint image_width = 1280; gint image_height\n> = 800; camera_output_caps  = gst_caps_new_full (gst_structure_new (\"video/x-\n> raw\",\n>                 \"width\", G_TYPE_INT, image_width,\n>                 \"height\", G_TYPE_INT, image_height,\n>                 \"format\", G_TYPE_STRING, output_video_format_str,\n>                 NULL), NULL);\n> gchar *video_filter_str = g_strdup_printf (\"%s\\\"%s\\\"\", \"capsfilter caps=\",\n> gst_caps_to_string (camera_output_caps)); videosrc_filter =\n> gst_parse_bin_from_description (video_filter_str, TRUE, NULL);\n> \n> //step2: set video source filter\n> GstElement *wrapper = gst_element_factory_make (\"wrappercamerabinsrc\", NULL);\n> g_object_set (wrapper, \"video-source-filter\", videosrc_filter, NULL);\n> \n> \n> -----Original Message-----\n> From: Nicolas Dufresne <nicolas@ndufresne.ca>\n> Sent: Thursday, July 23, 2026 2:46 AM\n> To: Elliot Chen (OSS) <elliot.chen@oss.nxp.com>;\n> libcamera-devel@lists.libcamera.org; Elliot Chen <elliot.chen@nxp.com>\n> Subject: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format preferences\n> in caps negotiation\n> \n> Hi Elliot,\n> \n> Le mercredi 22 juillet 2026 à 12:40 +0900, elliot.chen@oss.nxp.com a écrit :\n> > From: Elliot Chen <elliot.chen@nxp.com>\n> > \n> > When using libcamerasrc as a camera source in camerabin with a \n> > video-source-filter that specifies a particular output format, the \n> > negotiated format was not respecting the downstream preference.\n> > This occurred because gst_pad_peer_query_caps() was called with the \n> > libcamera stream format filter directly as its filter argument, which \n> > caused the returned caps to be ordered by the libcamera source format \n> > list rather than by the downstream element's preference.\n> \n> Can you extend on how you have set your filter, and what you described as a\n> preference ?\n> \n> Nicolas\n> \n> > \n> > Fix this by splitting the caps query into two steps: first query the \n> > full set of caps supported by the downstream peer without any filter, \n> > then intersect with the libcamera stream formats using \n> > GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order \n> > of the first operand (the downstream peer caps), so when the caps are \n> > subsequently fixated, the format preferred by the downstream element \n> > (e.g. the video-source-filter in camerabin) is selected.\n> > \n> > Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n> > ---\n> >  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n> >  1 file changed, 6 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> > b/src/gstreamer/gstlibcamerasrc.cpp\n> > index 9061f9163..579bd466d 100644\n> > --- a/src/gstreamer/gstlibcamerasrc.cpp\n> > +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> > @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n> >  \t\tStreamConfiguration &stream_cfg = state->config_->at(i);\n> >  \n> >  \t\t/* Retrieve the supported caps. */\n> > +\t\tg_autoptr(GstCaps) peer_caps =\n> > gst_pad_peer_query_caps(srcpad, NULL);\n> > +\t\tif (!peer_caps || gst_caps_is_empty(peer_caps))\n> > +\t\t\treturn false;\n> > +\n> >  \t\tg_autoptr(GstCaps) filter =\n> > gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> > -\t\tg_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad,\n> > filter);\n> > +\t\t/* Intersect with downstream's preferred format order\n> > first.\n> > */\n> > +\t\tg_autoptr(GstCaps) caps =\n> > gst_caps_intersect_full(peer_caps,\n> > filter, GST_CAPS_INTERSECT_FIRST);\n> >  \t\tif (gst_caps_is_empty(caps))\n> >  \t\t\treturn false;\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 EA8E2BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Jul 2026 14:59:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EF83A67F2C;\n\tFri, 24 Jul 2026 16:59:25 +0200 (CEST)","from mail-ua1-x92e.google.com (mail-ua1-x92e.google.com\n\t[IPv6:2607:f8b0:4864:20::92e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 458E367E89\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jul 2026 16:59:24 +0200 (CEST)","by mail-ua1-x92e.google.com with SMTP id\n\ta1e0cc1a2514c-963f63fe025so135994241.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jul 2026 07:59:24 -0700 (PDT)","from [192.168.42.160] (mtl.collabora.ca. [66.171.169.34])\n\tby smtp.gmail.com with ESMTPSA id\n\tada2fe7eead31-74ad31c215bsm7540251137.2.2026.07.24.07.59.21\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 24 Jul 2026 07:59:21 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=ndufresne-ca.20251104.gappssmtp.com\n\theader.i=@ndufresne-ca.20251104.gappssmtp.com\n\theader.b=\"TPQ4h1M+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=ndufresne-ca.20251104.gappssmtp.com; s=20251104; t=1784905163;\n\tx=1785509963; darn=lists.libcamera.org; \n\th=mime-version:user-agent:content-type:autocrypt:references\n\t:in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date\n\t:message-id:reply-to:content-type;\n\tbh=YxzcCtqvHXbU/QgfKRM70g09jRldrASkJ2BgYszOEpY=;\n\tb=TPQ4h1M+krEhuJQfYGWgYFEBr7wYihMfq/8NkZFTQ/3nB1VI6DNSErPzRLT9FmnF5x\n\tfjlKiX8bqZ89tW48J/lM5/jnP2auSUJVE9KTYb3136PO6aqpbWCMcVB/nrDC7Am35Dll\n\tqWnV3BjhpgyDn1Rk0BPWQEnqNZztFOznpIeacORkzMG3pUUjthAHiwMaqYWP6j25GDyU\n\tMBVl594psQ1vCMgJ4ePuK6ZgVynjS6JHKjqfX13QWqsFjZlUBH1iMnvE0r57LqqQh1vm\n\tgoESW6hQFkmWspPEsm/oYUhPooEPRV6s7izxIOCAiCUHdvC39DebV7GQxxfWT+enC/E2\n\tnQYw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1784905163; x=1785509963;\n\th=mime-version:user-agent:content-type:autocrypt:references\n\t:in-reply-to:date:to:from:subject:message-id:x-gm-gg\n\t:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to\n\t:content-type;\n\tbh=YxzcCtqvHXbU/QgfKRM70g09jRldrASkJ2BgYszOEpY=;\n\tb=cvql8NkLb7Hp+82KeHP+65enpse9EXBS7dQi4fvy51sVQdgVh9cl0GyMa67R+YHgFS\n\tZMSRwn8bZVQA9YQXhLI3pc1/Kc21zQgmUkcfqU5BxKj0xMsBoNGb0H9QPu0G3vAiArwD\n\tPx3/8s/XZh1O5dWSrQo6dx7lcVYan9B2GRXjWofbn4wcSZb+NeHRacp4PwNIxFtY8/zj\n\twC9zwgA7Upr2dx8lAob+0IqpnLQhkciX4qpkF1dPcWYgcEVHSc1LF1cckc6O6aJjdOZk\n\tbekgdIocCqDUX2HqR8HGlP13wOt65PSDB/jutGg6lFwLZglKR0B8gOPVf8Kh6rywZwUk\n\t4Zeg==","X-Forwarded-Encrypted":"i=1;\n\tAHgh+Rq7ZZmh3Sm8soxFNs2WgMD4dSg5hSuusa5Jb3ZlJ6X9QzrUON9BlPTu8sgHmVjgkHWrn2v5uVFuPki5Ph8MHJw=@lists.libcamera.org","X-Gm-Message-State":"AOJu0Yzph1fJleD3jOfdUMY1tsmzITEErcuqW4a/jYeVw1fYnMRorRVF\n\tEhk6iKZyEPEyCzNcGAQ4H8fNxPmBc8n0N05diZAxteod3BVEumEMM5EfsJXUIdGuxis=","X-Gm-Gg":"AR+sD11cHbGzcCkVkbkAFQocTX8ViJWLJb4iujYtXzTo26GPQgXYGzVRUElf6rc6LE4\n\t2ynPIOKw9ofEPfWKcUyMmi8nj8zdFriW2DxZuuGiEohPwYeSGjTqww7WwT86qig5hj2bRWD4ZIX\n\trp3dNrrS0KmGpkLBbDzUAfGapZXTxe8WrDEkNkdnmULFOcEpldPmmEHXHOz8yfPcCqP1W53B0ht\n\t5ENP5Nlzy/vdzmYJsWHv6rb4w2la+oo6gEFBGPiq1DgorWHfFk6VATByuNxY3/+Ng1sVZpvLbsC\n\tBT8E0O32i/iv+IZET8rRJol6W/KrQDqujrNReoc3EvIo8KstKOVe95eEB32ZCZ4sBVCvRwY6eCX\n\tC0+S9+lny0UtqZTjv11V7Vw7r9t64R5BXwc3JD/meOs3MovJgROPkBDNuHegIBf0lA9ObgRMSLx\n\t40HKcZVDLN45ZVTsUVlWAUGvGiBEVVDJQb","X-Received":"by 2002:a05:6102:4bcc:b0:744:cb59:d6e0 with SMTP id\n\tada2fe7eead31-74d5ad4147amr3414523137.0.1784905162800; \n\tFri, 24 Jul 2026 07:59:22 -0700 (PDT)","Message-ID":"<6eec9f53d9f10e808360c929ae4401733d88e016.camel@ndufresne.ca>","Subject":"Re: [EXT] Re: [PATCH v2] gstreamer: Honor downstream format\n\tpreferences in caps negotiation","From":"Nicolas Dufresne <nicolas@ndufresne.ca>","To":"\"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>, Elliot Chen\n\t<elliot.chen@nxp.com>, \"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>","Date":"Fri, 24 Jul 2026 10:59:19 -0400","In-Reply-To":"<AS4PR04MB9690D552E05B7F1A229F8A1DEACF2@AS4PR04MB9690.eurprd04.prod.outlook.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>\n\t<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>\n\t<PA4PR04MB9688C111E54C6C1A0EEC124AEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>\n\t<AS4PR04MB9690D552E05B7F1A229F8A1DEACF2@AS4PR04MB9690.eurprd04.prod.outlook.com>","Autocrypt":"addr=nicolas@ndufresne.ca; prefer-encrypt=mutual;\n\tkeydata=mDMEaCN2ixYJKwYBBAHaRw8BAQdAM0EHepTful3JOIzcPv6ekHOenE1u0vDG1gdHFrChD\n\t/e0J05pY29sYXMgRHVmcmVzbmUgPG5pY29sYXNAbmR1ZnJlc25lLmNhPoicBBMWCgBEAhsDBQsJCA\n\tcCAiICBhUKCQgLAgQWAgMBAh4HAheABQkJZfd1FiEE7w1SgRXEw8IaBG8S2UGUUSlgcvQFAmibrjo\n\tCGQEACgkQ2UGUUSlgcvQlQwD/RjpU1SZYcKG6pnfnQ8ivgtTkGDRUJ8gP3fK7+XUjRNIA/iXfhXMN\n\tabIWxO2oCXKf3TdD7aQ4070KO6zSxIcxgNQFtDFOaWNvbGFzIER1ZnJlc25lIDxuaWNvbGFzLmR1Z\n\tnJlc25lQGNvbGxhYm9yYS5jb20+iJkEExYKAEECGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4\n\tAWIQTvDVKBFcTDwhoEbxLZQZRRKWBy9AUCaCyyxgUJCWX3dQAKCRDZQZRRKWBy9ARJAP96pFmLffZ\n\tsmBUpkyVBfFAf+zq6BJt769R0al3kHvUKdgD9G7KAHuioxD2v6SX7idpIazjzx8b8rfzwTWyOQWHC\n\tAAS0LU5pY29sYXMgRHVmcmVzbmUgPG5pY29sYXMuZHVmcmVzbmVAZ21haWwuY29tPoiZBBMWCgBBF\n\tiEE7w1SgRXEw8IaBG8S2UGUUSlgcvQFAmibrGYCGwMFCQll93UFCwkIBwICIgIGFQoJCAsCBBYCAw\n\tECHgcCF4AACgkQ2UGUUSlgcvRObgD/YnQjfi4+L8f4fI7p1pPMTwRTcaRdy6aqkKEmKsCArzQBAK8\n\tbRLv9QjuqsE6oQZra/RB4widZPvphs78H0P6NmpIJ","Content-Type":"multipart/signed; micalg=\"pgp-sha512\";\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"=-scRX6YD5s9Y6WvXIVsZD\"","User-Agent":"Evolution 3.60.2 (3.60.2-1.fc44) ","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":39862,"web_url":"https://patchwork.libcamera.org/comment/39862/","msgid":"<178514178748.1159743.2517680198683072174@ping.linuxembedded.co.uk>","date":"2026-07-27T08:43:07","subject":"RE: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Hi Elliot,\n\nI noticed that you are trying to send e-mails with large e-mail attachments\nto this thread.\n\nAs the latest one is a 5MB attatchment, I'm afraid I'm considering\nrejecting that from the mailing-list moderation request. I think sending\n5MB of log files to every recipient of the libcamera maililng list is\nprobably excessive.\n\nPerhaps if the discussions require large media attachments we could move\nthe discussion to\nhttps://gitlab.freedesktop.org/camera/libcamera/-/work_items ?\n\n--\nRegards\n\nKieran\n\n\nQuoting Elliot Chen (OSS) (2026-07-23 07:57:36)\n> Hi Nicolas Dufresne,\n> 1. Thank you for your comments. The issue occurs when using ap1302 camera on NXP i.MX95 board when using libcamerasrc as a camera source in camerabin. \n> 2. First, I create a capsfilter to configure the expected output format and resolution, then configure video-source-filter property of wrappercamerabinsrc. \n> 3. I wrote a demo to showcase my configuration flow as below. The final pipeline diagram can refer to the attachment.\n>      libcamerasrc will select NV12 instead of YUY2 format in this flow. But in fact, camera can support YUY2 format. \n> \n> //step1: configure the expected video format and resolution gchar *output_video_format_str = \"YUY2\"; gint image_width = 1280; gint image_height = 800; camera_output_caps  = gst_caps_new_full (gst_structure_new (\"video/x-raw\",\n>                 \"width\", G_TYPE_INT, image_width,\n>                 \"height\", G_TYPE_INT, image_height,\n>                 \"format\", G_TYPE_STRING, output_video_format_str,\n>                 NULL), NULL);\n> gchar *video_filter_str = g_strdup_printf (\"%s\\\"%s\\\"\", \"capsfilter caps=\", gst_caps_to_string (camera_output_caps)); videosrc_filter = gst_parse_bin_from_description (video_filter_str, TRUE, NULL);\n> \n> //step2: set video source filter\n> GstElement *wrapper = gst_element_factory_make (\"wrappercamerabinsrc\", NULL); g_object_set (wrapper, \"video-source-filter\", videosrc_filter, NULL);\n> \n> -----Original Message-----\n> From: Nicolas Dufresne <nicolas@ndufresne.ca> \n> Sent: Thursday, July 23, 2026 2:46 AM\n> To: Elliot Chen (OSS) <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org; Elliot Chen <elliot.chen@nxp.com>\n> Subject: Re: [PATCH v2] gstreamer: Honor downstream format preferences in caps negotiation\n> \n> Hi Elliot,\n> \n> Le mercredi 22 juillet 2026 à 12:40 +0900, elliot.chen@oss.nxp.com a écrit :\n> > From: Elliot Chen <elliot.chen@nxp.com>\n> > \n> > When using libcamerasrc as a camera source in camerabin with a \n> > video-source-filter that specifies a particular output format, the \n> > negotiated format was not respecting the downstream preference.\n> > This occurred because gst_pad_peer_query_caps() was called with the \n> > libcamera stream format filter directly as its filter argument, which \n> > caused the returned caps to be ordered by the libcamera source format \n> > list rather than by the downstream element's preference.\n> \n> Can you extend on how you have set your filter, and what you described as a preference ?\n> \n> Nicolas\n> \n> > \n> > Fix this by splitting the caps query into two steps: first query the \n> > full set of caps supported by the downstream peer without any filter, \n> > then intersect with the libcamera stream formats using \n> > GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order \n> > of the first operand (the downstream peer caps), so when the caps are \n> > subsequently fixated, the format preferred by the downstream element \n> > (e.g. the video-source-filter in camerabin) is selected.\n> > \n> > Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n> > ---\n> >  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n> >  1 file changed, 6 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> > b/src/gstreamer/gstlibcamerasrc.cpp\n> > index 9061f9163..579bd466d 100644\n> > --- a/src/gstreamer/gstlibcamerasrc.cpp\n> > +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> > @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n> >               StreamConfiguration &stream_cfg = state->config_->at(i);\n> >  \n> >               /* Retrieve the supported caps. */\n> > +             g_autoptr(GstCaps) peer_caps =\n> > gst_pad_peer_query_caps(srcpad, NULL);\n> > +             if (!peer_caps || gst_caps_is_empty(peer_caps))\n> > +                     return false;\n> > +\n> >               g_autoptr(GstCaps) filter =\n> > gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> > -             g_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad,\n> > filter);\n> > +             /* Intersect with downstream's preferred format order first.\n> > */\n> > +             g_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps,\n> > filter, GST_CAPS_INTERSECT_FIRST);\n> >               if (gst_caps_is_empty(caps))\n> >                       return false;\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 6F25CBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jul 2026 08:43:13 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6F06467F5F;\n\tMon, 27 Jul 2026 10:43:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9B25967F4C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jul 2026 10:43:10 +0200 (CEST)","from monstersaurus.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DD545492;\n\tMon, 27 Jul 2026 10:42:06 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"PCMmc5jD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1785141726;\n\tbh=a5KrD1/iVVvouYbZxNE18qQBPw5lq4bRvwb7m9unmDs=;\n\th=In-Reply-To:References:Subject:From:To:Date:From;\n\tb=PCMmc5jDABUpNroH40Y9TX4V/NhDrSxGiwB7N9fnejG32D+4JQdJo5KodGK2E3fgf\n\tVFrC2vnr33cAzsEuQHblN8Bt8Rb5kCk0rXOWHC/szYpyViAPX3Y0u/9DkQ4JAh1na6\n\t9pzIA+qCyv/vvwUGt0e8OnD0J6mWRKHG6AFfh440=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<PA4PR04MB9688798DD1DAFC0D5C00819DEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>\n\t<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>\n\t<PA4PR04MB9688798DD1DAFC0D5C00819DEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>","Subject":"RE: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"\"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>,\n\t\"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>,\n\tNicolas Dufresne <nicolas@ndufresne.ca>","Date":"Mon, 27 Jul 2026 09:43:07 +0100","Message-ID":"<178514178748.1159743.2517680198683072174@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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":39864,"web_url":"https://patchwork.libcamera.org/comment/39864/","msgid":"<20260727091610.GF1059400@killaraus.ideasonboard.com>","date":"2026-07-27T09:16:10","subject":"Re: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Jul 27, 2026 at 09:43:07AM +0100, Kieran Bingham wrote:\n> Hi Elliot,\n> \n> I noticed that you are trying to send e-mails with large e-mail attachments\n> to this thread.\n> \n> As the latest one is a 5MB attatchment, I'm afraid I'm considering\n> rejecting that from the mailing-list moderation request. I think sending\n> 5MB of log files to every recipient of the libcamera maililng list is\n> probably excessive.\n> \n> Perhaps if the discussions require large media attachments we could move\n> the discussion to\n> https://gitlab.freedesktop.org/camera/libcamera/-/work_items ?\n\nPlease don't.\n\nLog files compress well.\n\n> Quoting Elliot Chen (OSS) (2026-07-23 07:57:36)\n> > Hi Nicolas Dufresne,\n> > 1. Thank you for your comments. The issue occurs when using ap1302 camera on NXP i.MX95 board when using libcamerasrc as a camera source in camerabin. \n> > 2. First, I create a capsfilter to configure the expected output format and resolution, then configure video-source-filter property of wrappercamerabinsrc. \n> > 3. I wrote a demo to showcase my configuration flow as below. The final pipeline diagram can refer to the attachment.\n> >      libcamerasrc will select NV12 instead of YUY2 format in this flow. But in fact, camera can support YUY2 format. \n> > \n> > //step1: configure the expected video format and resolution gchar *output_video_format_str = \"YUY2\"; gint image_width = 1280; gint image_height = 800; camera_output_caps  = gst_caps_new_full (gst_structure_new (\"video/x-raw\",\n> >                 \"width\", G_TYPE_INT, image_width,\n> >                 \"height\", G_TYPE_INT, image_height,\n> >                 \"format\", G_TYPE_STRING, output_video_format_str,\n> >                 NULL), NULL);\n> > gchar *video_filter_str = g_strdup_printf (\"%s\\\"%s\\\"\", \"capsfilter caps=\", gst_caps_to_string (camera_output_caps)); videosrc_filter = gst_parse_bin_from_description (video_filter_str, TRUE, NULL);\n> > \n> > //step2: set video source filter\n> > GstElement *wrapper = gst_element_factory_make (\"wrappercamerabinsrc\", NULL); g_object_set (wrapper, \"video-source-filter\", videosrc_filter, NULL);\n> > \n> > -----Original Message-----\n> > From: Nicolas Dufresne <nicolas@ndufresne.ca> \n> > Sent: Thursday, July 23, 2026 2:46 AM\n> > To: Elliot Chen (OSS) <elliot.chen@oss.nxp.com>; libcamera-devel@lists.libcamera.org; Elliot Chen <elliot.chen@nxp.com>\n> > Subject: Re: [PATCH v2] gstreamer: Honor downstream format preferences in caps negotiation\n> > \n> > Hi Elliot,\n> > \n> > Le mercredi 22 juillet 2026 à 12:40 +0900, elliot.chen@oss.nxp.com a écrit :\n> > > From: Elliot Chen <elliot.chen@nxp.com>\n> > > \n> > > When using libcamerasrc as a camera source in camerabin with a \n> > > video-source-filter that specifies a particular output format, the \n> > > negotiated format was not respecting the downstream preference.\n> > > This occurred because gst_pad_peer_query_caps() was called with the \n> > > libcamera stream format filter directly as its filter argument, which \n> > > caused the returned caps to be ordered by the libcamera source format \n> > > list rather than by the downstream element's preference.\n> > \n> > Can you extend on how you have set your filter, and what you described as a preference ?\n> > \n> > Nicolas\n> > \n> > > \n> > > Fix this by splitting the caps query into two steps: first query the \n> > > full set of caps supported by the downstream peer without any filter, \n> > > then intersect with the libcamera stream formats using \n> > > GST_CAPS_INTERSECT_FIRST. This intersection mode preserves the order \n> > > of the first operand (the downstream peer caps), so when the caps are \n> > > subsequently fixated, the format preferred by the downstream element \n> > > (e.g. the video-source-filter in camerabin) is selected.\n> > > \n> > > Signed-off-by: Elliot Chen <elliot.chen@nxp.com>\n> > > ---\n> > >  src/gstreamer/gstlibcamerasrc.cpp | 7 ++++++-\n> > >  1 file changed, 6 insertions(+), 1 deletion(-)\n> > > \n> > > diff --git a/src/gstreamer/gstlibcamerasrc.cpp\n> > > b/src/gstreamer/gstlibcamerasrc.cpp\n> > > index 9061f9163..579bd466d 100644\n> > > --- a/src/gstreamer/gstlibcamerasrc.cpp\n> > > +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> > > @@ -598,8 +598,13 @@ gst_libcamera_src_negotiate(GstLibcameraSrc *self)\n> > >               StreamConfiguration &stream_cfg = state->config_->at(i);\n> > >  \n> > >               /* Retrieve the supported caps. */\n> > > +             g_autoptr(GstCaps) peer_caps =\n> > > gst_pad_peer_query_caps(srcpad, NULL);\n> > > +             if (!peer_caps || gst_caps_is_empty(peer_caps))\n> > > +                     return false;\n> > > +\n> > >               g_autoptr(GstCaps) filter =\n> > > gst_libcamera_stream_formats_to_caps(stream_cfg.formats());\n> > > -             g_autoptr(GstCaps) caps = gst_pad_peer_query_caps(srcpad,\n> > > filter);\n> > > +             /* Intersect with downstream's preferred format order first.\n> > > */\n> > > +             g_autoptr(GstCaps) caps = gst_caps_intersect_full(peer_caps,\n> > > filter, GST_CAPS_INTERSECT_FIRST);\n> > >               if (gst_caps_is_empty(caps))\n> > >                       return false;\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 9D060BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jul 2026 09:16:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7990067F64;\n\tMon, 27 Jul 2026 11:16:14 +0200 (CEST)","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 8041367F4C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jul 2026 11:16:12 +0200 (CEST)","from killaraus.ideasonboard.com\n\t(2001-14ba-70f3-e800--a06.rev.dnainternet.fi\n\t[IPv6:2001:14ba:70f3:e800::a06])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 70BF33A4;\n\tMon, 27 Jul 2026 11:15:08 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"DD3+vL6o\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1785143708;\n\tbh=YQZm0blcgHzEifUHSQghL6VCps4qUWAbEXPRTGCqdog=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DD3+vL6oM3Jr1Ajrwb46f2x+eClUtTFZqCf5UJPcBunJ5pFcaSnpJrcRHjM8HkiDI\n\two4LNu+lNylqZtI8jOW2JEXdYU2Ec4U7MztCeWh/c7PSMyLRwWGU/QsxsPkda483rx\n\thEoDlnsfz7sD56pzgFj5sZA+mcyUwnSoyLG4bgp4=","Date":"Mon, 27 Jul 2026 12:16:10 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"\"Elliot Chen (OSS)\" <elliot.chen@oss.nxp.com>,\n\t\"libcamera-devel@lists.libcamera.org\"\n\t<libcamera-devel@lists.libcamera.org>, \n\tNicolas Dufresne <nicolas@ndufresne.ca>","Subject":"Re: [PATCH v2] gstreamer: Honor downstream format preferences in\n\tcaps negotiation","Message-ID":"<20260727091610.GF1059400@killaraus.ideasonboard.com>","References":"<20260722034011.1016641-1-elliot.chen@oss.nxp.com>\n\t<3684329b7b787482c4d3743a20ee1c1f50a26bd7.camel@ndufresne.ca>\n\t<PA4PR04MB9688798DD1DAFC0D5C00819DEAC02@PA4PR04MB9688.eurprd04.prod.outlook.com>\n\t<178514178748.1159743.2517680198683072174@ping.linuxembedded.co.uk>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<178514178748.1159743.2517680198683072174@ping.linuxembedded.co.uk>","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>"}}]