Show a patch.

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

{
    "id": 338,
    "url": "https://patchwork.libcamera.org/api/patches/338/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/338/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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": "<20190122234505.32634-5-niklas.soderlund@ragnatech.se>",
    "date": "2019-01-22T23:45:01",
    "name": "[libcamera-devel,4/8] libcamera: pipelines: add method to retrieve streams",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ddea6b2b118c1a6cf5f158df580678d7998bc356",
    "submitter": {
        "id": 5,
        "url": "https://patchwork.libcamera.org/api/people/5/?format=api",
        "name": "Niklas Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/338/mbox/",
    "series": [
        {
            "id": 118,
            "url": "https://patchwork.libcamera.org/api/series/118/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=118",
            "date": "2019-01-22T23:44:57",
            "name": "libcamera: add basic support for Streams and format configuration",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/118/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/338/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/338/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<niklas.soderlund@ragnatech.se>",
        "Received": [
            "from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net\n\t[195.74.38.227])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 61DFF60C7D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Jan 2019 00:46:42 +0100 (CET)",
            "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid e9e8992c-1e9f-11e9-911a-0050569116f7;\n\tWed, 23 Jan 2019 00:46:19 +0100 (CET)"
        ],
        "X-Halon-ID": "e9e8992c-1e9f-11e9-911a-0050569116f7",
        "Authorized-sender": "niklas@soderlund.pp.se",
        "From": "=?utf-8?q?Niklas_S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 23 Jan 2019 00:45:01 +0100",
        "Message-Id": "<20190122234505.32634-5-niklas.soderlund@ragnatech.se>",
        "X-Mailer": "git-send-email 2.20.1",
        "In-Reply-To": "<20190122234505.32634-1-niklas.soderlund@ragnatech.se>",
        "References": "<20190122234505.32634-1-niklas.soderlund@ragnatech.se>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 4/8] libcamera: pipelines: add method to\n\tretrieve streams",
        "X-BeenThere": "libcamera-devel@lists.libcamera.org",
        "X-Mailman-Version": "2.1.23",
        "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>",
        "X-List-Received-Date": "Tue, 22 Jan 2019 23:46:42 -0000"
    },
    "content": "A Camera object needs to be able to inquire its responsible\nPipelineHandler for which streams it supports. Add and implement such an\ninterface to the PipelineHandler base class and all pipeline handler\nimplementations.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/include/pipeline_handler.h |  3 +++\n src/libcamera/pipeline/ipu3/ipu3.cpp     | 27 ++++++++++++++++++++++++\n src/libcamera/pipeline/uvcvideo.cpp      | 13 ++++++++++++\n src/libcamera/pipeline/vimc.cpp          | 13 ++++++++++++\n src/libcamera/pipeline_handler.cpp       | 12 +++++++++++\n 5 files changed, 68 insertions(+)",
    "diff": "diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex f05f201f7ca824eb..d4473bf173b815af 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -17,12 +17,15 @@ namespace libcamera {\n \n class CameraManager;\n class DeviceEnumerator;\n+class Stream;\n \n class PipelineHandler\n {\n public:\n \tvirtual ~PipelineHandler() { };\n \n+\tvirtual std::vector<Stream> streams(const Camera *camera) const = 0;\n+\n \tvirtual bool match(CameraManager *manager, DeviceEnumerator *enumerator) = 0;\n };\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex c6106c538f071058..f73479125ed5e21d 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -10,6 +10,7 @@\n \n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n+#include <libcamera/stream.h>\n \n #include \"device_enumerator.h\"\n #include \"log.h\"\n@@ -26,6 +27,8 @@ public:\n \tPipelineHandlerIPU3();\n \t~PipelineHandlerIPU3();\n \n+\tstd::vector<Stream> streams(const Camera *camera) const;\n+\n \tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n \n private:\n@@ -35,6 +38,8 @@ private:\n \tstd::vector<std::shared_ptr<Camera>> cameras_;\n \n \tvoid registerCameras(CameraManager *manager);\n+\n+\tbool handleCamera(const Camera *camera) const;\n };\n \n PipelineHandlerIPU3::PipelineHandlerIPU3()\n@@ -59,6 +64,16 @@ PipelineHandlerIPU3::~PipelineHandlerIPU3()\n \timgu_ = nullptr;\n }\n \n+std::vector<Stream> PipelineHandlerIPU3::streams(const Camera *camera) const\n+{\n+\tstd::vector<Stream> streams;\n+\n+\tif (handleCamera(camera))\n+\t\tstreams.push_back(Stream(0));\n+\n+\treturn streams;\n+}\n+\n bool PipelineHandlerIPU3::match(CameraManager *manager, DeviceEnumerator *enumerator)\n {\n \tDeviceMatch cio2_dm(\"ipu3-cio2\");\n@@ -192,6 +207,18 @@ void PipelineHandlerIPU3::registerCameras(CameraManager *manager)\n \t}\n }\n \n+bool PipelineHandlerIPU3::handleCamera(const Camera *camera) const\n+{\n+\tif (!camera)\n+\t\treturn false;\n+\n+\tfor (const std::shared_ptr<Camera> &cam : cameras_)\n+\t\tif (camera == cam.get())\n+\t\t\treturn true;\n+\n+\treturn false;\n+}\n+\n REGISTER_PIPELINE_HANDLER(PipelineHandlerIPU3);\n \n } /* namespace libcamera */\ndiff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 3e4745ba498e7160..87b556ba0ae17696 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -7,6 +7,7 @@\n \n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n+#include <libcamera/stream.h>\n \n #include \"device_enumerator.h\"\n #include \"log.h\"\n@@ -23,6 +24,8 @@ public:\n \tPipelineHandlerUVC();\n \t~PipelineHandlerUVC();\n \n+\tstd::vector<Stream> streams(const Camera *camera) const;\n+\n \tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n \n private:\n@@ -46,6 +49,16 @@ PipelineHandlerUVC::~PipelineHandlerUVC()\n \t\tdev_->release();\n }\n \n+std::vector<Stream> PipelineHandlerUVC::streams(const Camera *camera) const\n+{\n+\tstd::vector<Stream> streams;\n+\n+\tif (camera && camera == camera_.get())\n+\t\tstreams.push_back(Stream(0));\n+\n+\treturn streams;\n+}\n+\n bool PipelineHandlerUVC::match(CameraManager *manager, DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"uvcvideo\");\ndiff --git a/src/libcamera/pipeline/vimc.cpp b/src/libcamera/pipeline/vimc.cpp\nindex e8dbc0932ab0198a..e894367ba6706aaf 100644\n--- a/src/libcamera/pipeline/vimc.cpp\n+++ b/src/libcamera/pipeline/vimc.cpp\n@@ -7,6 +7,7 @@\n \n #include <libcamera/camera.h>\n #include <libcamera/camera_manager.h>\n+#include <libcamera/stream.h>\n \n #include \"device_enumerator.h\"\n #include \"log.h\"\n@@ -23,6 +24,8 @@ public:\n \tPipeHandlerVimc();\n \t~PipeHandlerVimc();\n \n+\tstd::vector<Stream> streams(const Camera *camera) const;\n+\n \tbool match(CameraManager *manager, DeviceEnumerator *enumerator);\n \n private:\n@@ -46,6 +49,16 @@ PipeHandlerVimc::~PipeHandlerVimc()\n \t\tdev_->release();\n }\n \n+std::vector<Stream> PipeHandlerVimc::streams(const Camera *camera) const\n+{\n+\tstd::vector<Stream> streams;\n+\n+\tif (camera && camera == camera_.get())\n+\t\tstreams.push_back(Stream(0));\n+\n+\treturn streams;\n+}\n+\n bool PipeHandlerVimc::match(CameraManager *manager, DeviceEnumerator *enumerator)\n {\n \tDeviceMatch dm(\"vimc\");\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex c24feeafc503e9b1..c2bed924dece0ac0 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -34,6 +34,18 @@ LOG_DEFINE_CATEGORY(Pipeline)\n  * with the pipelines it supports and creates corresponding Camera devices.\n  */\n \n+/**\n+ * \\fn PipelineHandler::streams(const Camera *camera)\n+ * \\brief Retrive a array of all streams the camera provides\n+ * \\param[in] camera The camera to retrieve streams from\n+ *\n+ * This function is the interface to extract information about streams from a\n+ * PipelineHandler.\n+ *\n+ * \\return A array of streams from the camera or a empty list if \\a camera\n+ *         is not part of the PipelineHandler.\n+ */\n+\n /**\n  * \\fn PipelineHandler::match(DeviceEnumerator *enumerator)\n  * \\brief Match media devices and create camera instances\n",
    "prefixes": [
        "libcamera-devel",
        "4/8"
    ]
}