From patchwork Thu Feb 28 18:51:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 664 Return-Path: Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C4B50610B6 for ; Thu, 28 Feb 2019 19:51:37 +0100 (CET) X-Halon-ID: deeac7f1-3b89-11e9-8144-0050569116f7 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id deeac7f1-3b89-11e9-8144-0050569116f7; Thu, 28 Feb 2019 19:51:35 +0100 (CET) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 28 Feb 2019 19:51:24 +0100 Message-Id: <20190228185126.32475-2-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190228185126.32475-1-niklas.soderlund@ragnatech.se> References: <20190228185126.32475-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 1/3] cam: fix order camera is operated on X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2019 18:51:38 -0000 Upcoming enforcing of order the camera shall be operate on is not compatible with the cam utility. Requests shall be queued after the camera is started, not before. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/cam/main.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cam/main.cpp b/src/cam/main.cpp index 4c2df583fe8e99b7..8df8844c33a2d052 100644 --- a/src/cam/main.cpp +++ b/src/cam/main.cpp @@ -133,6 +133,7 @@ static int capture() int ret; std::vector streams = camera->streams(); + std::vector requests; ret = configureStreams(camera.get(), streams); if (ret < 0) { @@ -169,21 +170,24 @@ static int capture() goto out; } - ret = camera->queueRequest(request); - if (ret < 0) { - std::cerr << "Can't queue request" << std::endl; - goto out; - } + requests.push_back(request); } - std::cout << "Capture until user interrupts by SIGINT" << std::endl; - ret = camera->start(); if (ret) { std::cout << "Failed to start capture" << std::endl; goto out; } + for (Request *request : requests) { + ret = camera->queueRequest(request); + if (ret < 0) { + std::cerr << "Can't queue request" << std::endl; + goto out; + } + } + + std::cout << "Capture until user interrupts by SIGINT" << std::endl; ret = loop->exec(); ret = camera->stop();