Patch Detail
Show a patch.
GET /api/1.1/patches/376/?format=api
{ "id": 376, "url": "https://patchwork.libcamera.org/api/1.1/patches/376/?format=api", "web_url": "https://patchwork.libcamera.org/patch/376/", "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": "<20190125143951.27992-4-niklas.soderlund@ragnatech.se>", "date": "2019-01-25T14:39:51", "name": "[libcamera-devel,v2,3/3] libcamera: pipeline: uvcvideo: create a V4L2Device for the default video entity", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "fa72e47a976ff25539ce8009cc78f443d5248c00", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/1.1/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/376/mbox/", "series": [ { "id": 130, "url": "https://patchwork.libcamera.org/api/1.1/series/130/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=130", "date": "2019-01-25T14:39:49", "name": "libcamera: pipeline: uvcvideo: attach to a V4L2Device", "version": 2, "mbox": "https://patchwork.libcamera.org/series/130/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/376/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/376/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 A6C7B60B21\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 25 Jan 2019 15:40:18 +0100 (CET)", "from bismarck.berto.se (unknown [89.233.230.99])\n\tby bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA\n\tid 1f0cad2f-20af-11e9-9adf-005056917a89;\n\tFri, 25 Jan 2019 15:40:12 +0100 (CET)" ], "X-Halon-ID": "1f0cad2f-20af-11e9-9adf-005056917a89", "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": "Fri, 25 Jan 2019 15:39:51 +0100", "Message-Id": "<20190125143951.27992-4-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20190125143951.27992-1-niklas.soderlund@ragnatech.se>", "References": "<20190125143951.27992-1-niklas.soderlund@ragnatech.se>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 3/3] libcamera: pipeline: uvcvideo:\n\tcreate a V4L2Device for the default video entity", "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": "Fri, 25 Jan 2019 14:40:19 -0000" }, "content": "Add a V4L2Device for the default video entity in the media graph. The\nUVC pipeline needs to search for the entity marked with the\nMEDIA_ENT_FL_DEFAULT flag as the entity names in the media graph varies\ndepending on which device is used.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/libcamera/pipeline/uvcvideo.cpp | 20 +++++++++++++++++++-\n 1 file changed, 19 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/libcamera/pipeline/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo.cpp\nindex 1a445edfa8df777c..e3a475704c080e90 100644\n--- a/src/libcamera/pipeline/uvcvideo.cpp\n+++ b/src/libcamera/pipeline/uvcvideo.cpp\n@@ -11,6 +11,7 @@\n #include \"log.h\"\n #include \"media_device.h\"\n #include \"pipeline_handler.h\"\n+#include \"v4l2_device.h\"\n \n namespace libcamera {\n \n@@ -26,15 +27,20 @@ public:\n \n private:\n \tstd::shared_ptr<MediaDevice> media_;\n+\n+\tV4L2Device *video_;\n };\n \n PipelineHandlerUVC::PipelineHandlerUVC(CameraManager *manager)\n-\t: PipelineHandler(manager), media_(nullptr)\n+\t: PipelineHandler(manager), media_(nullptr), video_(nullptr)\n {\n }\n \n PipelineHandlerUVC::~PipelineHandlerUVC()\n {\n+\tif (video_)\n+\t\tdelete video_;\n+\n \tif (media_)\n \t\tmedia_->release();\n }\n@@ -50,6 +56,18 @@ bool PipelineHandlerUVC::match(DeviceEnumerator *enumerator)\n \n \tmedia_->acquire();\n \n+\tfor (MediaEntity *entity : media_->entities()) {\n+\t\tif (entity->flags() & MEDIA_ENT_FL_DEFAULT) {\n+\t\t\tvideo_ = new V4L2Device(*entity);\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\n+\tif (!video_ || video_->open()) {\n+\t\tmedia_->release();\n+\t\treturn false;\n+\t}\n+\n \tstd::shared_ptr<Camera> camera = Camera::create(this, media_->model());\n \tregisterCamera(std::move(camera));\n \thotplugMediaDevice(media_.get());\n", "prefixes": [ "libcamera-devel", "v2", "3/3" ] }