summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cam/camera_session.cpp (renamed from src/cam/capture.cpp)21
-rw-r--r--src/cam/camera_session.h (renamed from src/cam/capture.h)16
-rw-r--r--src/cam/main.cpp6
-rw-r--r--src/cam/meson.build2
4 files changed, 22 insertions, 23 deletions
diff --git a/src/cam/capture.cpp b/src/cam/camera_session.cpp
index 3c3e3a53..439dcdb2 100644
--- a/src/cam/capture.cpp
+++ b/src/cam/camera_session.cpp
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2019, Google Inc.
*
- * capture.cpp - Cam capture
+ * camera_session.cpp - Camera capture session
*/
#include <iomanip>
@@ -12,20 +12,20 @@
#include <libcamera/control_ids.h>
-#include "capture.h"
+#include "camera_session.h"
#include "main.h"
using namespace libcamera;
-Capture::Capture(std::shared_ptr<Camera> camera, CameraConfiguration *config,
- EventLoop *loop)
+CameraSession::CameraSession(std::shared_ptr<Camera> camera,
+ CameraConfiguration *config, EventLoop *loop)
: camera_(camera), config_(config), writer_(nullptr), last_(0), loop_(loop),
queueCount_(0), captureCount_(0), captureLimit_(0),
printMetadata_(false)
{
}
-int Capture::run(const OptionsParser::Options &options)
+int CameraSession::run(const OptionsParser::Options &options)
{
int ret;
@@ -51,7 +51,7 @@ int Capture::run(const OptionsParser::Options &options)
streamName_[cfg.stream()] = "stream" + std::to_string(index);
}
- camera_->requestCompleted.connect(this, &Capture::requestComplete);
+ camera_->requestCompleted.connect(this, &CameraSession::requestComplete);
if (options.isSet(OptFile)) {
if (!options[OptFile].toString().empty())
@@ -60,7 +60,6 @@ int Capture::run(const OptionsParser::Options &options)
writer_ = new BufferWriter();
}
-
FrameBufferAllocator *allocator = new FrameBufferAllocator(camera_);
ret = capture(allocator);
@@ -77,7 +76,7 @@ int Capture::run(const OptionsParser::Options &options)
return ret;
}
-int Capture::capture(FrameBufferAllocator *allocator)
+int CameraSession::capture(FrameBufferAllocator *allocator)
{
int ret;
@@ -157,7 +156,7 @@ int Capture::capture(FrameBufferAllocator *allocator)
return ret;
}
-int Capture::queueRequest(Request *request)
+int CameraSession::queueRequest(Request *request)
{
if (captureLimit_ && queueCount_ >= captureLimit_)
return 0;
@@ -167,7 +166,7 @@ int Capture::queueRequest(Request *request)
return camera_->queueRequest(request);
}
-void Capture::requestComplete(Request *request)
+void CameraSession::requestComplete(Request *request)
{
if (request->status() == Request::RequestCancelled)
return;
@@ -179,7 +178,7 @@ void Capture::requestComplete(Request *request)
loop_->callLater([=]() { processRequest(request); });
}
-void Capture::processRequest(Request *request)
+void CameraSession::processRequest(Request *request)
{
const Request::BufferMap &buffers = request->buffers();
diff --git a/src/cam/capture.h b/src/cam/camera_session.h
index de478c98..ef8a11c3 100644
--- a/src/cam/capture.h
+++ b/src/cam/camera_session.h
@@ -2,10 +2,10 @@
/*
* Copyright (C) 2019, Google Inc.
*
- * capture.h - Cam capture
+ * camera_session.h - Camera capture session
*/
-#ifndef __CAM_CAPTURE_H__
-#define __CAM_CAPTURE_H__
+#ifndef __CAM_CAMERA_SESSION_H__
+#define __CAM_CAMERA_SESSION_H__
#include <memory>
#include <stdint.h>
@@ -21,12 +21,12 @@
#include "event_loop.h"
#include "options.h"
-class Capture
+class CameraSession
{
public:
- Capture(std::shared_ptr<libcamera::Camera> camera,
- libcamera::CameraConfiguration *config,
- EventLoop *loop);
+ CameraSession(std::shared_ptr<libcamera::Camera> camera,
+ libcamera::CameraConfiguration *config,
+ EventLoop *loop);
int run(const OptionsParser::Options &options);
private:
@@ -52,4 +52,4 @@ private:
std::vector<std::unique_ptr<libcamera::Request>> requests_;
};
-#endif /* __CAM_CAPTURE_H__ */
+#endif /* __CAM_CAMERA_SESSION_H__ */
diff --git a/src/cam/main.cpp b/src/cam/main.cpp
index 70e9f62c..f71b65a2 100644
--- a/src/cam/main.cpp
+++ b/src/cam/main.cpp
@@ -13,7 +13,7 @@
#include <libcamera/libcamera.h>
#include <libcamera/property_ids.h>
-#include "capture.h"
+#include "camera_session.h"
#include "event_loop.h"
#include "main.h"
#include "options.h"
@@ -363,8 +363,8 @@ int CamApp::run()
}
if (options_.isSet(OptCapture)) {
- Capture capture(camera_, config_.get(), &loop_);
- return capture.run(options_);
+ CameraSession session(camera_, config_.get(), &loop_);
+ return session.run(options_);
}
if (options_.isSet(OptMonitor)) {
diff --git a/src/cam/meson.build b/src/cam/meson.build
index 6234ed0a..1e90ee52 100644
--- a/src/cam/meson.build
+++ b/src/cam/meson.build
@@ -11,7 +11,7 @@ cam_enabled = true
cam_sources = files([
'buffer_writer.cpp',
- 'capture.cpp',
+ 'camera_session.cpp',
'event_loop.cpp',
'main.cpp',
'options.cpp',