Show a patch.

GET /api/1.1/patches/26312/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26312,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/26312/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26312/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api",
        "name": "libcamera",
        "link_name": "libcamera",
        "list_id": "libcamera_core",
        "list_email": "libcamera-devel@lists.libcamera.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": ""
    },
    "msgid": "<20260323092237.3103-2-david.plowman@raspberrypi.com>",
    "date": "2026-03-23T09:02:05",
    "name": "[v1,1/1] gstreamer: Add sensor-config property",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "eb9628ad238153322e210e9b3b8716bee0b3cd76",
    "submitter": {
        "id": 42,
        "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api",
        "name": "David Plowman",
        "email": "david.plowman@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/26312/mbox/",
    "series": [
        {
            "id": 5836,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5836/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5836",
            "date": "2026-03-23T09:02:04",
            "name": "Add sensor config support to gstreamer",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/5836/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26312/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26312/checks/",
    "tags": {},
    "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 99221C32DE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Mar 2026 09:22:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EBC9862743;\n\tMon, 23 Mar 2026 10:22:44 +0100 (CET)",
            "from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5D43162737\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2026 10:22:42 +0100 (CET)",
            "by mail-wm1-x334.google.com with SMTP id\n\t5b1f17b1804b1-48558d6ef83so24267635e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Mar 2026 02:22:42 -0700 (PDT)",
            "from davidp-pi5.pitowers.org\n\t([2a00:1098:3142:1f:88ea:c658:5b20:5e46])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-48703e26408sm278310335e9.11.2026.03.23.02.22.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Mar 2026 02:22:41 -0700 (PDT)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"chrt7WLi\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1774257762; x=1774862562;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=TEj1zmU+YqKtZdBJqgTz/7IaGGOHqNsvZLmX/9GK6A4=;\n\tb=chrt7WLiMZjSWMbkMykMal4Oyezd9TgfsutPIVlGhaty1RzWvhXHybvKuikD9wfx1v\n\tjEV8j6xZEpspJC/yjD07pekhQtfyeWhRhGfPCO3Zr2f0JInBeweelTE2gXbabF8fEETl\n\tGHz66ctb7dVRVmKRl7s9/YeGwKQu4FQ9u6MbhnIPBcKTprSMZphqyfkTXCflZJQoQ6R2\n\tMHHVlVETw6YHVvIc4AuZgu5bhD0EOy0o0iEem0IX+OF9aac5Ula7C4dTGY/DFaEe8vwA\n\td5R26w+RON5/TS770+8HSNUg85z6OxT1f4bpFCKh/xvH2i4158EMmeD/2QUB0EeO3nUk\n\tgs3A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20251104; t=1774257762; x=1774862562;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n\t:to:cc:subject:date:message-id:reply-to;\n\tbh=TEj1zmU+YqKtZdBJqgTz/7IaGGOHqNsvZLmX/9GK6A4=;\n\tb=AZmnZjqaeeCKGBAsD8qP41L5IghvPGHyS6oHp5SIe9dt4z800M0zzCOTxFvUo44fdA\n\tBl3wz9UvH7/QlvzUOMqxPFKgRFZwCUkI6YVzcfNvBzqVzW1mfBmvgJYYRs2uigZdF6VK\n\tKEZTJkjv7F3YC/9Sj2lP1dPbMmpeEm6NHX8AeWjKdyEttsqemlwepD/ZNwWjE1wsSGLS\n\tLPa2YudiqCeUAsdckX6Wc2mYhQjEpN4jeb24YiP6wyQuFLy4qH4Y8bHmOWFOhaOJ8CTL\n\tAGIhs5Pf1w+viTvAvyALUaYy1PZAg4V41gp+48W2Kvo3GFM25OYOLnkRc3mIJYXlVnVi\n\tykZg==",
        "X-Gm-Message-State": "AOJu0YwnHO4rD+J/K+IF1VzHAw49L6QnHnYXMmuKQfGu3vWSbpB9odnu\n\tkOIYgQKN1BURLZInmyDAONj6Qk0eKSZRTRMmNsOwgdEk7XlaVgfHK1eiLwiFGQLTrvA4aGSSK1v\n\tTgrJJ",
        "X-Gm-Gg": "ATEYQzxHHREr5QWtd9DZko0uOx+xt1VAVSPFS9rloKFJ/rOQynC8fd3DJMOAdCsYBi8\n\tvPayQ/yvJ7f+htenY5qAp7MielvOqYQf4pTnek+zSNyb0GAptavCES0iURNVFz+b1/TrlG8+DP6\n\thEut4XD69ni1CIysOJWREs1MyEWFXYGDIqRpLi0m5Xo9k/LD3OwR8lXCLPRREIyXbImIqOSt2iT\n\tnLR3vfN5MPE/eLskyPoLdoCp+wiEkZNnIoDhNEv7WD00lIV2WSe8TyNyGLB8bMb+/PQlPkdLGxL\n\tGL30iDeRclmVKMk5Gn4Bmyz5gY4906N0I5tHYfVe0wewBZXHripPaw+zuDO60ZnL4Y9lLPloFQe\n\tPusoeaNoQV42ZZmI5iXQeWpWNN6k+aJP74QYMDiZCbDtiIwjZcuxQ5m0M7cSkneGUKQB3nOnoFZ\n\tMMLRBKWTmj0rTgy9JpqS/lph3qkUd0stivOPEooS5esv48o4iZRmORUtxi3Vh3ht25poSBfCuK5\n\tFySKkpN+q7asOtOfuxQehskxaN98wvmGF3KPyQEaCnUAcUXo704",
        "X-Received": "by 2002:a05:600c:8b83:b0:486:fa9c:185 with SMTP id\n\t5b1f17b1804b1-486fee2ffd5mr148455995e9.31.1774257761549; \n\tMon, 23 Mar 2026 02:22:41 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "David Plowman <david.plowman@raspberrypi.com>",
        "Subject": "[PATCH v1 1/1] gstreamer: Add sensor-config property",
        "Date": "Mon, 23 Mar 2026 09:02:05 +0000",
        "Message-ID": "<20260323092237.3103-2-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.47.3",
        "In-Reply-To": "<20260323092237.3103-1-david.plowman@raspberrypi.com>",
        "References": "<20260323092237.3103-1-david.plowman@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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>"
    },
    "content": "The sensor-config property may optionally be specified to give the\noutputSize and bitDepth of the SensorConfiguration that is applied to\nthe camera configuration. For example, use\n\nlibcamerasrc sensor-config=2304x1296/10\n\nto request the 10-bit 2304x1296 mode of a sensor.\n\nAll three parameters, width, height and bit depth, must be present, or\nit will issue a warning and revert to automatic mode selection (as if\nthere were no sensor-config at all).\n\nIf a mode is requested that doesn't exist then camera configuration\nwill fail and the pipeline won't start.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 38 +++++++++++++++++++++++++++++++\n 1 file changed, 38 insertions(+)",
    "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex a7241e9b..9eca65d1 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -141,6 +141,7 @@ struct _GstLibcameraSrc {\n \tGstTask *task;\n \n \tgchar *camera_name;\n+\tgchar *sensor_config;\n \n \tstd::atomic<GstEvent *> pending_eos;\n \n@@ -152,6 +153,7 @@ struct _GstLibcameraSrc {\n enum {\n \tPROP_0,\n \tPROP_CAMERA_NAME,\n+\tPROP_SENSOR_CONFIG,\n \tPROP_LAST\n };\n \n@@ -846,6 +848,23 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n \t}\n \tg_assert(state->config_->size() == state->srcpads_.size());\n \n+\t/* Apply optional sensor configuration. */\n+\tif (self->sensor_config) {\n+\t\tunsigned int w = 0, h = 0, depth = 0;\n+\t\tif (std::sscanf(self->sensor_config, \"%ux%u/%u\", &w, &h, &depth) == 3 && w && h && depth) {\n+\t\t\tSensorConfiguration sensorCfg;\n+\t\t\tsensorCfg.outputSize = Size(w, h);\n+\t\t\tsensorCfg.bitDepth = depth;\n+\t\t\tstate->config_->sensorConfig = sensorCfg;\n+\t\t} else {\n+\t\t\tGST_ELEMENT_WARNING(self, RESOURCE, SETTINGS,\n+\t\t\t\t\t    (\"Invalid sensor-config \\\"%s\\\", expected \\\"WIDTHxHEIGHT/DEPTH\\\",\"\n+\t\t\t\t\t     \" ignoring\",\n+\t\t\t\t\t     self->sensor_config),\n+\t\t\t\t\t    (nullptr));\n+\t\t}\n+\t}\n+\n \tif (!gst_libcamera_src_negotiate(self)) {\n \t\tstate->initControls_.clear();\n \t\tGST_ELEMENT_FLOW_ERROR(self, GST_FLOW_NOT_NEGOTIATED);\n@@ -934,6 +953,10 @@ gst_libcamera_src_set_property(GObject *object, guint prop_id,\n \t\tg_free(self->camera_name);\n \t\tself->camera_name = g_value_dup_string(value);\n \t\tbreak;\n+\tcase PROP_SENSOR_CONFIG:\n+\t\tg_free(self->sensor_config);\n+\t\tself->sensor_config = g_value_dup_string(value);\n+\t\tbreak;\n \tdefault:\n \t\tif (!state->controls_.setProperty(prop_id - PROP_LAST, value, pspec))\n \t\t\tG_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);\n@@ -953,6 +976,9 @@ gst_libcamera_src_get_property(GObject *object, guint prop_id, GValue *value,\n \tcase PROP_CAMERA_NAME:\n \t\tg_value_set_string(value, self->camera_name);\n \t\tbreak;\n+\tcase PROP_SENSOR_CONFIG:\n+\t\tg_value_set_string(value, self->sensor_config);\n+\t\tbreak;\n \tdefault:\n \t\tif (!state->controls_.getProperty(prop_id - PROP_LAST, value, pspec))\n \t\t\tG_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);\n@@ -1040,6 +1066,7 @@ gst_libcamera_src_finalize(GObject *object)\n \tg_clear_object(&self->task);\n \tg_mutex_clear(&self->state->lock_);\n \tg_free(self->camera_name);\n+\tg_free(self->sensor_config);\n \tdelete self->state;\n \n \treturn klass->finalize(object);\n@@ -1162,6 +1189,17 @@ gst_libcamera_src_class_init(GstLibcameraSrcClass *klass)\n \t\t\t\t\t\t\t     | G_PARAM_STATIC_STRINGS));\n \tg_object_class_install_property(object_class, PROP_CAMERA_NAME, spec);\n \n+\tspec = g_param_spec_string(\"sensor-config\", \"Sensor Config\",\n+\t\t\t\t   \"Desired sensor configuration as \\\"WIDTHxHEIGHT/BITDEPTH\\\"\"\n+\t\t\t\t   \" (e.g. \\\"2304x1296/10\\\"). Leave unset to let the pipeline\"\n+\t\t\t\t   \" negotiate the sensor mode automatically.\",\n+\t\t\t\t   nullptr,\n+\t\t\t\t   (GParamFlags)(GST_PARAM_MUTABLE_READY\n+\t\t\t\t\t\t | G_PARAM_CONSTRUCT\n+\t\t\t\t\t\t | G_PARAM_READWRITE\n+\t\t\t\t\t\t | G_PARAM_STATIC_STRINGS));\n+\tg_object_class_install_property(object_class, PROP_SENSOR_CONFIG, spec);\n+\n \tGstCameraControls::installProperties(object_class, PROP_LAST);\n }\n \n",
    "prefixes": [
        "v1",
        "1/1"
    ]
}