From dc01a5bc43787ac8bf8f16683383f60265326f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= Date: Tue, 26 Feb 2019 02:09:31 +0100 Subject: [PATCH] cam: fix order camera is operated on MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 4c2df583..8df8844c 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,6 +170,16 @@ static int capture() goto out; } + requests.push_back(request); + } + + 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; @@ -177,13 +188,6 @@ static int capture() } 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; - } - ret = loop->exec(); ret = camera->stop();