{"id":552,"url":"https://patchwork.libcamera.org/api/patches/552/?format=json","web_url":"https://patchwork.libcamera.org/patch/552/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190208230138.8182-1-laurent.pinchart@ideasonboard.com>","date":"2019-02-08T23:01:38","name":"[libcamera-devel] libcamera: pipeline_handler: Reorder member declaration order","commit_ref":"d8f2ed7d0d7f0de7184916da59cd2097529bd1c9","pull_url":null,"state":"accepted","archived":false,"hash":"2355864a71f0e0cd8087ce77361de2e885322c20","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/552/mbox/","series":[{"id":174,"url":"https://patchwork.libcamera.org/api/series/174/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=174","date":"2019-02-08T23:01:38","name":"[libcamera-devel] libcamera: pipeline_handler: Reorder member declaration order","version":1,"mbox":"https://patchwork.libcamera.org/series/174/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/552/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/552/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FADD6101F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  9 Feb 2019 00:01:44 +0100 (CET)","from pendragon.ideasonboard.com (d51A4137F.access.telenet.be\n\t[81.164.19.127])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C8264F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat,  9 Feb 2019 00:01:43 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549666903;\n\tbh=Y6v08suyZvGMddvawN+bNxCQ3TCkQlkzJJIW9E3lEyY=;\n\th=From:To:Subject:Date:From;\n\tb=hZStQgak/+jHSzLCNfSFW0GuKvxoqIcF/CdiGd0+5pt858rq92Ns4RohLscv1AVzD\n\tMdEt0ZPwT98j/k9lhorZZ+aETT7Qe8smh1zhLLeauPiGvZ8ReQwdT/koA4qCwpOWp+\n\toSLSRlLdYB+uAslTMVIUtX5fowJagJF2xb7Wk2tI=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat,  9 Feb 2019 01:01:38 +0200","Message-Id":"<20190208230138.8182-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.19.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH] libcamera: pipeline_handler: Reorder\n\tmember declaration order","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, 08 Feb 2019 23:01:44 -0000"},"content":"Reorder the member declaration order in the PipelineHandler class to\nmatch the control flow order, and to declare variables after methods\naccording to the coding style. Update the documentation accordingly,\npreserving the order within the public, protected and private sections,\nbut grouping related methods together between the sections.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/libcamera/include/pipeline_handler.h |  10 +--\n src/libcamera/pipeline_handler.cpp       | 101 +++++++++++------------\n 2 files changed, 55 insertions(+), 56 deletions(-)","diff":"diff --git a/src/libcamera/include/pipeline_handler.h b/src/libcamera/include/pipeline_handler.h\nindex 7f2ec2975db0..4363dcd8ed8e 100644\n--- a/src/libcamera/include/pipeline_handler.h\n+++ b/src/libcamera/include/pipeline_handler.h\n@@ -42,6 +42,8 @@ public:\n \tPipelineHandler(CameraManager *manager);\n \tvirtual ~PipelineHandler();\n \n+\tvirtual bool match(DeviceEnumerator *enumerator) = 0;\n+\n \tvirtual std::map<Stream *, StreamConfiguration>\n \tstreamConfiguration(Camera *camera, std::vector<Stream *> &streams) = 0;\n \tvirtual int configureStreams(Camera *camera,\n@@ -55,20 +57,18 @@ public:\n \n \tvirtual int queueRequest(const Camera *camera, Request *request) = 0;\n \n-\tvirtual bool match(DeviceEnumerator *enumerator) = 0;\n-\n protected:\n-\tCameraManager *manager_;\n-\n \tvoid registerCamera(std::shared_ptr<Camera> camera);\n \tvoid hotplugMediaDevice(MediaDevice *media);\n \n \tCameraData *cameraData(const Camera *camera);\n \tvoid setCameraData(const Camera *camera, std::unique_ptr<CameraData> data);\n \n+\tCameraManager *manager_;\n+\n private:\n-\tvirtual void disconnect();\n \tvoid mediaDeviceDisconnected(MediaDevice *media);\n+\tvirtual void disconnect();\n \n \tstd::vector<std::weak_ptr<Camera>> cameras_;\n \tstd::map<const Camera *, std::unique_ptr<CameraData>> cameraData_;\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex cc2d4643ec2f..4e111d6d2f55 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -75,6 +75,36 @@ PipelineHandler::~PipelineHandler()\n {\n };\n \n+/**\n+ * \\fn PipelineHandler::match(DeviceEnumerator *enumerator)\n+ * \\brief Match media devices and create camera instances\n+ * \\param enumerator The enumerator providing all media devices found in the\n+ * system\n+ *\n+ * This function is the main entry point of the pipeline handler. It is called\n+ * by the camera manager with the \\a enumerator passed as an argument. It shall\n+ * acquire from the \\a enumerator all the media devices it needs for a single\n+ * pipeline, create one or multiple Camera instances and register them with the\n+ * camera manager.\n+ *\n+ * If all media devices needed by the pipeline handler are found, they must all\n+ * be acquired by a call to MediaDevice::acquire(). This function shall then\n+ * create the corresponding Camera instances, store them internally, and return\n+ * true. Otherwise it shall not acquire any media device (or shall release all\n+ * the media devices is has acquired by calling MediaDevice::release()) and\n+ * return false.\n+ *\n+ * If multiple instances of a pipeline are available in the system, the\n+ * PipelineHandler class will be instanciated once per instance, and its match()\n+ * function called for every instance. Each call shall acquire media devices for\n+ * one pipeline instance, until all compatible media devices are exhausted.\n+ *\n+ * If this function returns true, a new instance of the pipeline handler will\n+ * be created and its match() function called.\n+ *\n+ * \\return true if media devices have been acquired and camera instances\n+ * created, or false otherwise\n+ */\n \n /**\n  * \\fn PipelineHandler::streamConfiguration()\n@@ -176,46 +206,6 @@ PipelineHandler::~PipelineHandler()\n  * \\return 0 on success or a negative error code on error\n  */\n \n-/**\n- * \\fn PipelineHandler::match(DeviceEnumerator *enumerator)\n- * \\brief Match media devices and create camera instances\n- * \\param enumerator The enumerator providing all media devices found in the\n- * system\n- *\n- * This function is the main entry point of the pipeline handler. It is called\n- * by the camera manager with the \\a enumerator passed as an argument. It shall\n- * acquire from the \\a enumerator all the media devices it needs for a single\n- * pipeline, create one or multiple Camera instances and register them with the\n- * camera manager.\n- *\n- * If all media devices needed by the pipeline handler are found, they must all\n- * be acquired by a call to MediaDevice::acquire(). This function shall then\n- * create the corresponding Camera instances, store them internally, and return\n- * true. Otherwise it shall not acquire any media device (or shall release all\n- * the media devices is has acquired by calling MediaDevice::release()) and\n- * return false.\n- *\n- * If multiple instances of a pipeline are available in the system, the\n- * PipelineHandler class will be instanciated once per instance, and its match()\n- * function called for every instance. Each call shall acquire media devices for\n- * one pipeline instance, until all compatible media devices are exhausted.\n- *\n- * If this function returns true, a new instance of the pipeline handler will\n- * be created and its match() function called.\n- *\n- * \\return true if media devices have been acquired and camera instances\n- * created, or false otherwise\n- */\n-\n-/**\n- * \\var PipelineHandler::manager_\n- * \\brief The Camera manager associated with the pipeline handler\n- *\n- * The camera manager pointer is stored in the pipeline handler for the\n- * convenience of pipeline handler implementations. It remains valid and\n- * constant for the whole lifetime of the pipeline handler.\n- */\n-\n /**\n  * \\brief Register a camera to the camera manager and pipeline handler\n  * \\param[in] camera The camera to be added\n@@ -246,6 +236,17 @@ void PipelineHandler::hotplugMediaDevice(MediaDevice *media)\n \tmedia->disconnected.connect(this, &PipelineHandler::mediaDeviceDisconnected);\n }\n \n+/**\n+ * \\brief Slot for the MediaDevice disconnected signal\n+ */\n+void PipelineHandler::mediaDeviceDisconnected(MediaDevice *media)\n+{\n+\tif (cameras_.empty())\n+\t\treturn;\n+\n+\tdisconnect();\n+}\n+\n /**\n  * \\brief Device disconnection handler\n  *\n@@ -272,17 +273,6 @@ void PipelineHandler::disconnect()\n \tcameras_.clear();\n }\n \n-/**\n- * \\brief Slot for the MediaDevice disconnected signal\n- */\n-void PipelineHandler::mediaDeviceDisconnected(MediaDevice *media)\n-{\n-\tif (cameras_.empty())\n-\t\treturn;\n-\n-\tdisconnect();\n-}\n-\n /**\n  * \\brief Retrieve the pipeline-specific data associated with a Camera\n  * \\param camera The camera whose data to retrieve\n@@ -331,6 +321,15 @@ void PipelineHandler::setCameraData(const Camera *camera,\n \tcameraData_[camera] = std::move(data);\n }\n \n+/**\n+ * \\var PipelineHandler::manager_\n+ * \\brief The Camera manager associated with the pipeline handler\n+ *\n+ * The camera manager pointer is stored in the pipeline handler for the\n+ * convenience of pipeline handler implementations. It remains valid and\n+ * constant for the whole lifetime of the pipeline handler.\n+ */\n+\n /**\n  * \\class PipelineHandlerFactory\n  * \\brief Registration of PipelineHandler classes and creation of instances\n","prefixes":["libcamera-devel"]}