Show a patch.

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

{
    "id": 10846,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10846/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10846/",
    "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": "<20210111163359.43637-2-email@uajain.com>",
    "date": "2021-01-11T16:33:58",
    "name": "[libcamera-devel,1/2] libcamera: v4l2_videodevice: Track streaming state",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f48055548c975c1fbb39da49ffc2ed0d7c9bbd1e",
    "submitter": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/people/1/?format=api",
        "name": "Umang Jain",
        "email": "email@uajain.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/10846/mbox/",
    "series": [
        {
            "id": 1574,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1574/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1574",
            "date": "2021-01-11T16:33:57",
            "name": "ipu3: Simplify error paths",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1574/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10846/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10846/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 63951BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 11 Jan 2021 16:34:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 307B9680BF;\n\tMon, 11 Jan 2021 17:34:11 +0100 (CET)",
            "from mail.uajain.com (static.126.159.217.95.clients.your-server.de\n\t[95.217.159.126])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6D261680BE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 11 Jan 2021 17:34:09 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"Su56msAC\"; dkim-atps=neutral",
        "From": "Umang Jain <email@uajain.com>",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=uajain.com; s=mail;\n\tt=1610382848; bh=yEAuvXQFdaBYNhs8tGW61ncgf9ds2rojtN/vn1cnXr0=;\n\th=From:To:Cc:Subject:In-Reply-To:References;\n\tb=Su56msACe6MTvho7qZo2tanPGp8cMUhVRMAtS4OqoNWeYWub7lyeObxi/emzbffpK\n\thP2Dfdw6b4vd/ut2k8eOqIb+GiOmk1cOjaZtDtp7mBUllg31FB9pcuVmRCGeUcIuQV\n\tdAQMnob4mDe0PFqLMOrI1UvDHsg6zuKR0kdzZOj/abGDfup8j2Tb7pbTja3TeA/zRg\n\tz5kndA9f2NB7+fDdmHJ/7EwBNsnB5Xr3VFkl6Q+FG8Cs/rr6L/r7dnZH4TM2tLnuva\n\tFuc4d5rhAw1aeMFiUIlM+qwFBzIUDYIirESVI5quLOTS3tiFKtb6R9jHeLHkPR8+Hw\n\tV70xMjtxvh2qg==",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Mon, 11 Jan 2021 22:03:58 +0530",
        "Message-Id": "<20210111163359.43637-2-email@uajain.com>",
        "In-Reply-To": "<20210111163359.43637-1-email@uajain.com>",
        "References": "<20210111163359.43637-1-email@uajain.com>",
        "Mime-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 1/2] libcamera: v4l2_videodevice: Track\n\tstreaming state",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "From: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nTrack the state of streamon/streamoff calls to simplify error paths.\n\nEnsuring that streamOff() can be called on non-streaming streams\nfacilitates simpler error code paths, where a set of devices can all\ncall streamOff regardless of their initialisation state.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n include/libcamera/internal/v4l2_videodevice.h | 2 ++\n src/libcamera/v4l2_videodevice.cpp            | 9 ++++++++-\n 2 files changed, 10 insertions(+), 1 deletion(-)",
    "diff": "diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h\nindex 529ca0e3..626dfbcd 100644\n--- a/include/libcamera/internal/v4l2_videodevice.h\n+++ b/include/libcamera/internal/v4l2_videodevice.h\n@@ -249,6 +249,8 @@ private:\n \tstd::map<unsigned int, FrameBuffer *> queuedBuffers_;\n \n \tEventNotifier *fdBufferNotifier_;\n+\n+\tbool streaming_;\n };\n \n class V4L2M2MDevice\ndiff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\nindex baf683d6..164954f2 100644\n--- a/src/libcamera/v4l2_videodevice.cpp\n+++ b/src/libcamera/v4l2_videodevice.cpp\n@@ -481,7 +481,8 @@ const std::string V4L2DeviceFormat::toString() const\n  * \\param[in] deviceNode The file-system path to the video device node\n  */\n V4L2VideoDevice::V4L2VideoDevice(const std::string &deviceNode)\n-\t: V4L2Device(deviceNode), cache_(nullptr), fdBufferNotifier_(nullptr)\n+\t: V4L2Device(deviceNode), cache_(nullptr), fdBufferNotifier_(nullptr),\n+\t  streaming_(false)\n {\n \t/*\n \t * We default to an MMAP based CAPTURE video device, however this will\n@@ -1554,6 +1555,8 @@ int V4L2VideoDevice::streamOn()\n \t\treturn ret;\n \t}\n \n+\tstreaming_ = true;\n+\n \treturn 0;\n }\n \n@@ -1571,6 +1574,9 @@ int V4L2VideoDevice::streamOff()\n {\n \tint ret;\n \n+\tif (!streaming_ && queuedBuffers_.empty())\n+\t\treturn 0;\n+\n \tret = ioctl(VIDIOC_STREAMOFF, &bufferType_);\n \tif (ret < 0) {\n \t\tLOG(V4L2, Error)\n@@ -1588,6 +1594,7 @@ int V4L2VideoDevice::streamOff()\n \n \tqueuedBuffers_.clear();\n \tfdBufferNotifier_->setEnabled(false);\n+\tstreaming_ = false;\n \n \treturn 0;\n }\n",
    "prefixes": [
        "libcamera-devel",
        "1/2"
    ]
}