Show a patch.

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

{
    "id": 17060,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/17060/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/17060/",
    "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": "<20220809205042.344923-9-utkarsh02t@gmail.com>",
    "date": "2022-08-09T20:50:42",
    "name": "[libcamera-devel,v7,8/8] qcam: Add --script to load capture script",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "1bb388a608ffb28b313c99b9c2c9be86867ab187",
    "submitter": {
        "id": 114,
        "url": "https://patchwork.libcamera.org/api/1.1/people/114/?format=api",
        "name": "Utkarsh Tiwari",
        "email": "utkarsh02t@gmail.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/17060/mbox/",
    "series": [
        {
            "id": 3400,
            "url": "https://patchwork.libcamera.org/api/1.1/series/3400/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3400",
            "date": "2022-08-09T20:50:34",
            "name": "Introduce capture scripts to qcam",
            "version": 7,
            "mbox": "https://patchwork.libcamera.org/series/3400/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/17060/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/17060/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 E61EFBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  9 Aug 2022 20:53:24 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A58196332F;\n\tTue,  9 Aug 2022 22:53:24 +0200 (CEST)",
            "from mail-pg1-x535.google.com (mail-pg1-x535.google.com\n\t[IPv6:2607:f8b0:4864:20::535])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 022B863326\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  9 Aug 2022 22:53:22 +0200 (CEST)",
            "by mail-pg1-x535.google.com with SMTP id f65so12428788pgc.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 09 Aug 2022 13:53:21 -0700 (PDT)",
            "from localhost.localdomain ([2404:bd00:3:d2bc:2358:3bcd:fb4f:cbb7])\n\tby smtp.gmail.com with ESMTPSA id\n\td3-20020a623603000000b0052d981e7842sm301936pfa.208.2022.08.09.13.53.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 09 Aug 2022 13:53:20 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1660078404;\n\tbh=Mh458UP2fIbdUlAJuSxCqrj9cpiKx0IlnO1iGdmcrJs=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=vA55UoBaU5B3f14icWFKoXMoO6W+oIHmP5vQq7udY3fU7ZdMRsAlWREq4jouFtkKk\n\ts/T7yHXlHuPIDPMSWLA+RK1477/u/X2961Y7kyd6pZfq2s//HoLzT7OR9HL/UmzsLH\n\t0jjW9ge3cHLN0cNZB5gWBE4sMu4RbyeyFKDXR7h2lmMDx/1yo8J0GcVhxp7cI2RvTi\n\tvC/FsradFQmr6dCJJHsF58nBQMLD057ht4zHDs4wPSKdf0/mSpEREBQXMsiqdue94Z\n\tXpZFy8qsXgESOQUbmZQEcKzN8pLcYctjIb2Gw/7HXUmTIw3sgLf4b6JjNJH1JAVuL9\n\t8rbpTheSsro/A==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc;\n\tbh=4kJc2X3IFnYFC/i3pZnsTvmeQjYWGAtyZAF3am6hQFI=;\n\tb=HghvDntfyzWVtJ1HEDVC+pMzAAwYYvbo3+X3lkH61qWa+uViHkPgvmA/0t0mZqtcJm\n\tKXrHQz/jN818HilaTFTAW2Jw1ZiQtFqGyq19Z+dnrE8vE29dSpL8BvlQl55n8Tsh3gY8\n\tog77Cr+00Dq3jnuX2okK7xdmD48BGRI1OHnsLO2WTSfDEaKt8ubhEPgV1x5NMCuvfA7E\n\tJ0WNEYa+mUG1D+2/0QLHVakebmdi6pr5MMakJQgIrkKwghFKu+VPchbW6rvnqMMbTeIf\n\tiSyRlY9cryg62po/+0rFDfJWlsvbsv3S3zwnAZv2xuoarYcMleoDXtoRawNhkbRYFtQ2\n\t505w=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"HghvDntf\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc;\n\tbh=4kJc2X3IFnYFC/i3pZnsTvmeQjYWGAtyZAF3am6hQFI=;\n\tb=pEk3XtAggDXlrJnO3JgBREJJdxogx5MA4f8kjG5mDK65WgcZ7IAcHaHHvz84pLIk5x\n\tOAg9lWhFrHxIy7caOS9S/jqelWWMwqf3iNLpptfqzDSkB384JcQ2WttCwFcyZwPTdSmV\n\t/Sd5LvWWaaMhPSk1b1z32A6hP4tuGcwmZWlyjHpFzDZR6/cfH3T6wupk8er+LRZ6TmoX\n\tpN0dyI95ADq/32K+HNP06AwhWjh0MPwvCKSG/1Sj8KdSvZHT5zzxKx2DLWUiG7oM8RMF\n\tIkbRrbUfIvpRIFsRMRurwRGelaT2+9PbM6BuffvBksmOdzoM6V/PD9oeqehCKPXYZ2GR\n\tEUzw==",
        "X-Gm-Message-State": "ACgBeo1FhT5Vn8xXu9+PmT2LRI7Y0KsdFXdqCyRaN+JtcEXfDYBG55t4\n\tFyWruRz7XygkMrR4n8VUcNNooIihL0k=",
        "X-Google-Smtp-Source": "AA6agR6yTOQL9duoirMgjBc/pFzH+oKgMVDyuk9UCzOMYYBdoHdH8iDIurdbyS2u7YogHna4ycDjQg==",
        "X-Received": "by 2002:a05:6a00:240f:b0:52e:f99d:1157 with SMTP id\n\tz15-20020a056a00240f00b0052ef99d1157mr15371950pfh.70.1660078400416; \n\tTue, 09 Aug 2022 13:53:20 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 10 Aug 2022 02:20:42 +0530",
        "Message-Id": "<20220809205042.344923-9-utkarsh02t@gmail.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220809205042.344923-1-utkarsh02t@gmail.com>",
        "References": "<20220809205042.344923-1-utkarsh02t@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v7 8/8] qcam: Add --script to load capture\n\tscript",
        "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>",
        "From": "Utkarsh Tiwari via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Utkarsh Tiwari <utkarsh02t@gmail.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Add --script as an individual option to load capture scripts.\nLoad the capture script before starting the capture.\n\nIf an invalid capture script has been given, display an critical error\nQMessageBox and close the application.\n\nSigned-off-by: Utkarsh Tiwari <utkarsh02t@gmail.com>\n---\nDifference:\n\t1. firstCameraSelect_  newly introduced to keep track if its the\n\t\tfirst time dialog is been opened.\n src/qcam/main.cpp        |  3 +++\n src/qcam/main_window.cpp | 16 ++++++++++++++--\n src/qcam/main_window.h   |  2 ++\n 3 files changed, 19 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/src/qcam/main.cpp b/src/qcam/main.cpp\nindex d3f01a85..91166be5 100644\n--- a/src/qcam/main.cpp\n+++ b/src/qcam/main.cpp\n@@ -43,6 +43,9 @@ OptionsParser::Options parseOptions(int argc, char *argv[])\n \t\t\t \"Set configuration of a camera stream\", \"stream\", true);\n \tparser.addOption(OptVerbose, OptionNone,\n \t\t\t \"Print verbose log messages\", \"verbose\");\n+\tparser.addOption(OptCaptureScript, OptionString,\n+\t\t\t \"Load a capture session configuration script from a file\",\n+\t\t\t \"script\", ArgumentRequired, \"script\");\n \n \tOptionsParser::Options options = parser.parse(argc, argv);\n \tif (options.isSet(OptHelp))\ndiff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp\nindex f2e3c576..d6ad0083 100644\n--- a/src/qcam/main_window.cpp\n+++ b/src/qcam/main_window.cpp\n@@ -100,7 +100,7 @@ private:\n \n MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \t: saveRaw_(nullptr), options_(options), cm_(cm), allocator_(nullptr),\n-\t  isCapturing_(false), captureRaw_(false)\n+\t  isCapturing_(false), captureRaw_(false), firstCameraSelect_(true)\n {\n \tint ret;\n \n@@ -146,6 +146,9 @@ MainWindow::MainWindow(CameraManager *cm, const OptionsParser::Options &options)\n \tcm_->cameraAdded.connect(this, &MainWindow::addCamera);\n \tcm_->cameraRemoved.connect(this, &MainWindow::removeCamera);\n \n+\tif (options_.isSet(OptCaptureScript))\n+\t\tscriptPath_ = options_[OptCaptureScript].toString();\n+\n \t/* Open the camera and start capture. */\n \tret = openCamera();\n \tif (ret < 0) {\n@@ -324,6 +327,13 @@ void MainWindow::loadCaptureScript()\n \t\tQMessageBox::critical(this, \"Invalid Script\",\n \t\t\t\t      \"Couldn't load the capture script\");\n \n+\t\t/*\n+\t\t * Close the camera if started by command line and its the first capture\n+\t\t * script.\n+\t\t */\n+\t\tif (firstCameraSelect_ && options_.isSet(OptCaptureScript))\n+\t\t\tquit();\n+\n \t} else\n \t\tcameraSelectorDialog_->informScriptRunning(scriptPath_);\n \n@@ -347,8 +357,10 @@ std::string MainWindow::chooseCamera()\n \t * Use the camera specified on the command line, if any, or display the\n \t * camera selection dialog box otherwise.\n \t */\n-\tif (options_.isSet(OptCamera))\n+\tif (firstCameraSelect_ && options_.isSet(OptCamera)) {\n+\t\tfirstCameraSelect_ = false;\n \t\treturn static_cast<std::string>(options_[OptCamera]);\n+\t}\n \n \tif (cameraSelectorDialog_->exec() == QDialog::Accepted) {\n \t\tstd::string cameraId = cameraSelectorDialog_->getCameraId();\ndiff --git a/src/qcam/main_window.h b/src/qcam/main_window.h\nindex 887f1db1..3a264f96 100644\n--- a/src/qcam/main_window.h\n+++ b/src/qcam/main_window.h\n@@ -46,6 +46,7 @@ enum {\n \tOptRenderer = 'r',\n \tOptStream = 's',\n \tOptVerbose = 'v',\n+\tOptCaptureScript = 256,\n };\n \n class MainWindow : public QMainWindow\n@@ -123,6 +124,7 @@ private:\n \t/* Capture state, buffers queue and statistics */\n \tbool isCapturing_;\n \tbool captureRaw_;\n+\tbool firstCameraSelect_;\n \tlibcamera::Stream *vfStream_;\n \tlibcamera::Stream *rawStream_;\n \tstd::map<const libcamera::Stream *, QQueue<libcamera::FrameBuffer *>> freeBuffers_;\n",
    "prefixes": [
        "libcamera-devel",
        "v7",
        "8/8"
    ]
}