summaryrefslogtreecommitdiff
path: root/src/cam/main.cpp
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-02-26 02:09:31 +0100
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2019-02-28 18:41:21 +0100
commitdc01a5bc43787ac8bf8f16683383f60265326f27 (patch)
tree87439a4f92467b763f184229df8644f85f9220ca /src/cam/main.cpp
parentacb56ebef833e0189f4d867c144363ef522ba740 (diff)
cam: fix order camera is operated on
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 <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/cam/main.cpp')
-rw-r--r--src/cam/main.cpp18
1 files 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<Stream *> streams = camera->streams();
+ std::vector<Request *> 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();