Show a patch.

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

{
    "id": 20088,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/20088/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/20088/",
    "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": "<20240522203924.1111388-2-nicolas@ndufresne.ca>",
    "date": "2024-05-22T20:39:23",
    "name": "[v1,1/2] gst: Add child proxy support to libcamerasrc",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "43d70a217d6e1573864ec679b8e0701889fc3411",
    "submitter": {
        "id": 30,
        "url": "https://patchwork.libcamera.org/api/1.1/people/30/?format=api",
        "name": "Nicolas Dufresne",
        "email": "nicolas@ndufresne.ca"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/20088/mbox/",
    "series": [
        {
            "id": 4322,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4322/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4322",
            "date": "2024-05-22T20:39:22",
            "name": "Document libcamerasrc multi stream usage",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4322/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/20088/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/20088/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 C63B8BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 22 May 2024 20:40:03 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 99D4863499;\n\tWed, 22 May 2024 22:40:00 +0200 (CEST)",
            "from madrid.collaboradmins.com (madrid.collaboradmins.com\n\t[46.235.227.194])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C8AD26347E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 22 May 2024 22:39:57 +0200 (CEST)",
            "from nicolas-tpx395.lan (cola.collaboradmins.com [195.201.22.229])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\tkey-exchange X25519 server-signature RSA-PSS (4096 bits)\n\tserver-digest SHA256)\n\t(No client certificate requested) (Authenticated sender: nicolas)\n\tby madrid.collaboradmins.com (Postfix) with ESMTPSA id 3F348378218D; \n\tWed, 22 May 2024 20:39:57 +0000 (UTC)"
        ],
        "From": "Nicolas Dufresne <nicolas@ndufresne.ca>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Nicolas Dufresne <nicolas.dufresne@collabora.com>",
        "Subject": "[PATCH v1 1/2] gst: Add child proxy support to libcamerasrc",
        "Date": "Wed, 22 May 2024 16:39:23 -0400",
        "Message-ID": "<20240522203924.1111388-2-nicolas@ndufresne.ca>",
        "X-Mailer": "git-send-email 2.45.0",
        "In-Reply-To": "<20240522203924.1111388-1-nicolas@ndufresne.ca>",
        "References": "<20240522203924.1111388-1-nicolas@ndufresne.ca>",
        "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": "From: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\nThe child proxy interface is needed in order to allow setting\nproperties on pad using parse launch syntax.\n\nSigned-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n---\n src/gstreamer/gstlibcamerasrc.cpp | 45 +++++++++++++++++++++++++++++--\n 1 file changed, 43 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\nindex 6a95b6af..74b372f3 100644\n--- a/src/gstreamer/gstlibcamerasrc.cpp\n+++ b/src/gstreamer/gstlibcamerasrc.cpp\n@@ -157,7 +157,12 @@ enum {\n \tPROP_AUTO_FOCUS_MODE,\n };\n \n+static void gst_libcamera_src_child_proxy_init(gpointer g_iface,\n+\t\t\t\t\t       gpointer iface_data);\n+\n G_DEFINE_TYPE_WITH_CODE(GstLibcameraSrc, gst_libcamera_src, GST_TYPE_ELEMENT,\n+\t\t\tG_IMPLEMENT_INTERFACE(GST_TYPE_CHILD_PROXY,\n+\t\t\t\t\t      gst_libcamera_src_child_proxy_init)\n \t\t\tGST_DEBUG_CATEGORY_INIT(source_debug, \"libcamerasrc\", 0,\n \t\t\t\t\t\t\"libcamera Source\"))\n \n@@ -864,8 +869,10 @@ gst_libcamera_src_init(GstLibcameraSrc *self)\n \n \tg_mutex_init(&state->lock_);\n \n-\tstate->srcpads_.push_back(gst_pad_new_from_template(templ, \"src\"));\n-\tgst_element_add_pad(GST_ELEMENT(self), state->srcpads_.back());\n+\tGstPad *pad = gst_pad_new_from_template(templ, \"src\");\n+\tstate->srcpads_.push_back(pad);\n+\tgst_element_add_pad(GST_ELEMENT(self), pad);\n+\tgst_child_proxy_child_added(GST_CHILD_PROXY(self), G_OBJECT(pad), GST_OBJECT_NAME(pad));\n \n \tGST_OBJECT_FLAG_SET(self, GST_ELEMENT_FLAG_SOURCE);\n \n@@ -896,6 +903,8 @@ gst_libcamera_src_request_new_pad(GstElement *element, GstPadTemplate *templ,\n \t\treturn NULL;\n \t}\n \n+\tgst_child_proxy_child_added(GST_CHILD_PROXY(self), G_OBJECT(pad), GST_OBJECT_NAME(pad));\n+\n \treturn reinterpret_cast<GstPad *>(g_steal_pointer(&pad));\n }\n \n@@ -904,6 +913,8 @@ gst_libcamera_src_release_pad(GstElement *element, GstPad *pad)\n {\n \tGstLibcameraSrc *self = GST_LIBCAMERA_SRC(element);\n \n+\tgst_child_proxy_child_removed(GST_CHILD_PROXY(self), G_OBJECT(pad), GST_OBJECT_NAME(pad));\n+\n \tGST_DEBUG_OBJECT(self, \"Pad %\" GST_PTR_FORMAT \" being released\", pad);\n \n \t{\n@@ -964,3 +975,33 @@ gst_libcamera_src_class_init(GstLibcameraSrcClass *klass)\n \t\t\t\t G_PARAM_WRITABLE);\n \tg_object_class_install_property(object_class, PROP_AUTO_FOCUS_MODE, spec);\n }\n+\n+/* GstChildProxy implementation */\n+static GObject *\n+gst_libcamera_src_child_proxy_get_child_by_index(GstChildProxy * child_proxy,\n+\t\t\t\t\t\t guint index)\n+{\n+\tGLibLocker lock(GST_OBJECT(child_proxy));\n+\tGObject *obj = nullptr;\n+\n+\tobj = reinterpret_cast<GObject*>(g_list_nth_data(GST_ELEMENT(child_proxy)->srcpads, index));\n+\tif (obj)\n+\t\tgst_object_ref(obj);\n+\n+\treturn obj;\n+}\n+\n+static guint\n+gst_libcamera_src_child_proxy_get_children_count(GstChildProxy * child_proxy)\n+{\n+\tGLibLocker lock(GST_OBJECT(child_proxy));\n+\treturn GST_ELEMENT_CAST(child_proxy)->numsrcpads;\n+}\n+\n+static void\n+gst_libcamera_src_child_proxy_init(gpointer g_iface, [[maybe_unused]] gpointer iface_data)\n+{\n+  GstChildProxyInterface *iface = reinterpret_cast<GstChildProxyInterface *>(g_iface);\n+  iface->get_child_by_index = gst_libcamera_src_child_proxy_get_child_by_index;\n+  iface->get_children_count = gst_libcamera_src_child_proxy_get_children_count;\n+}\n",
    "prefixes": [
        "v1",
        "1/2"
    ]
}