Patch Detail
Show a patch.
GET /api/patches/1327/?format=api
{ "id": 1327, "url": "https://patchwork.libcamera.org/api/patches/1327/?format=api", "web_url": "https://patchwork.libcamera.org/patch/1327/", "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": "<20190528181654.10649-1-niklas.soderlund@ragnatech.se>", "date": "2019-05-28T18:16:54", "name": "[libcamera-devel] qcam: Allow user to select pixel format and resolution", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "509063c86b5c76b75995d5ae1fb68575d67c6a88", "submitter": { "id": 5, "url": "https://patchwork.libcamera.org/api/people/5/?format=api", "name": "Niklas Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "delegate": { "id": 16, "url": "https://patchwork.libcamera.org/api/users/16/?format=api", "username": "neg", "first_name": "Niklas", "last_name": "Söderlund", "email": "niklas.soderlund@ragnatech.se" }, "mbox": "https://patchwork.libcamera.org/patch/1327/mbox/", "series": [ { "id": 331, "url": "https://patchwork.libcamera.org/api/series/331/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=331", "date": "2019-05-28T18:16:54", "name": "[libcamera-devel] qcam: Allow user to select pixel format and resolution", "version": 1, "mbox": "https://patchwork.libcamera.org/series/331/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/1327/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/1327/checks/", "tags": {}, "headers": { "Return-Path": "<niklas.soderlund@ragnatech.se>", "Received": [ "from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net\n\t[195.74.38.229])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4253A600EA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 May 2019 20:17:14 +0200 (CEST)", "from wyvern.fractalia.es (unknown [195.77.54.83])\n\tby bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA\n\tid c48af6ee-8174-11e9-8601-0050569116f7;\n\tTue, 28 May 2019 20:17:02 +0200 (CEST)" ], "X-Halon-ID": "c48af6ee-8174-11e9-8601-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": "Tue, 28 May 2019 20:16:54 +0200", "Message-Id": "<20190528181654.10649-1-niklas.soderlund@ragnatech.se>", "X-Mailer": "git-send-email 2.21.0", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] qcam: Allow user to select pixel format\n\tand resolution", "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, 28 May 2019 18:17:14 -0000" }, "content": "Allow users to select pixel format and resolution from two selection\ndialogues. Ideally the dialog should be turned into a toolbar with an\nadditional start/stop stream button, but this allows us to demonstrate\nthe selection interface for now.\n\nSigned-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\n src/qcam/main_window.cpp | 64 ++++++++++++++++++++++++++++++++++++++--\n src/qcam/main_window.h | 1 +\n 2 files changed, 63 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex 16b123132dd96cbe..20a87bbf9a8a2514 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -93,11 +93,71 @@ int MainWindow::openCamera()\n \treturn 0;\n }\n \n-int MainWindow::startCapture()\n+int MainWindow::selectFormat()\n {\n-\tint ret;\n+\tQStringList list;\n+\tQString name;\n+\tbool result;\n \n \tconfig_ = camera_->generateConfiguration({ StreamRole::VideoRecording });\n+\n+\tStreamConfiguration &cfg = config_->at(0);\n+\n+\tconst std::vector<unsigned int> &pixelformats = cfg.formats().pixelformats();\n+\tif (pixelformats.size()) {\n+\t\tfor (unsigned int pixelformat : pixelformats)\n+\t\t\tlist.append(QString::fromStdString(std::to_string(pixelformat)));\n+\n+\t\tname = QInputDialog::getItem(this, \"Select pixel format\",\n+\t\t\t\t\t \"Pixel format:\", list, 0,\n+\t\t\t\t\t false, &result);\n+\t\tif (!result)\n+\t\t\treturn -EINVAL;\n+\n+\t\tcfg.pixelFormat = pixelformats.at(list.indexOf(name));\n+\t}\n+\n+\tconst std::vector<Size> &sizes = cfg.formats().sizes(cfg.pixelFormat);\n+\tif (sizes.size()) {\n+\t\tlist.clear();\n+\t\tfor (const Size &size : sizes)\n+\t\t\tlist.append(QString::fromStdString(size.toString()));\n+\n+\t\tname = QInputDialog::getItem(this, \"Select resolution\",\n+\t\t\t\t\t \"Resolution:\", list, 0,\n+\t\t\t\t\t false, &result);\n+\t\tif (!result)\n+\t\t\treturn -EINVAL;\n+\n+\t\tcfg.size = sizes.at(list.indexOf(name));\n+\t}\n+\n+\tstd::cout << \"Trying to use stream configuration\" << cfg.toString() << std::endl;\n+\treturn 0;\n+\n+\tswitch (config_->validate()) {\n+\tcase CameraConfiguration::Valid:\n+\t\tbreak;\n+\tcase CameraConfiguration::Adjusted:\n+\t\tstd::cout << \"Camera configuration adjusted\" << std::endl;\n+\t\tbreak;\n+\tcase CameraConfiguration::Invalid:\n+\t\tstd::cout << \"Camera configuration invalid\" << std::endl;\n+\t\tconfig_.reset();\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int MainWindow::startCapture()\n+{\n+\tint ret;\n+\n+\tret = selectFormat();\n+\tif (ret)\n+\t\treturn ret;\n+\n \tret = camera_->configure(config_.get());\n \tif (ret < 0) {\n \t\tstd::cout << \"Failed to configure camera\" << std::endl;\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex fe565cbcb4603d9d..43d2d3e3894fb444 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -34,6 +34,7 @@ public:\n \n private:\n \tint openCamera();\n+\tint selectFormat();\n \n \tint startCapture();\n \tvoid stopCapture();\n", "prefixes": [ "libcamera-devel" ] }