diff options
Diffstat (limited to 'src/cam')
-rw-r--r-- | src/cam/camera_session.cpp | 6 | ||||
-rw-r--r-- | src/cam/file_sink.cpp (renamed from src/cam/buffer_writer.cpp) | 16 | ||||
-rw-r--r-- | src/cam/file_sink.h (renamed from src/cam/buffer_writer.h) | 14 | ||||
-rw-r--r-- | src/cam/meson.build | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/cam/camera_session.cpp b/src/cam/camera_session.cpp index f91b5234..f34a6ed5 100644 --- a/src/cam/camera_session.cpp +++ b/src/cam/camera_session.cpp @@ -13,9 +13,9 @@ #include <libcamera/control_ids.h> #include <libcamera/property_ids.h> -#include "buffer_writer.h" #include "camera_session.h" #include "event_loop.h" +#include "file_sink.h" #include "main.h" #include "stream_options.h" @@ -163,9 +163,9 @@ int CameraSession::start() if (options_.isSet(OptFile)) { if (!options_[OptFile].toString().empty()) - sink_ = std::make_unique<BufferWriter>(options_[OptFile]); + sink_ = std::make_unique<FileSink>(options_[OptFile]); else - sink_ = std::make_unique<BufferWriter>(); + sink_ = std::make_unique<FileSink>(); } if (sink_) { diff --git a/src/cam/buffer_writer.cpp b/src/cam/file_sink.cpp index 2f4b2b02..2d30694a 100644 --- a/src/cam/buffer_writer.cpp +++ b/src/cam/file_sink.cpp @@ -2,7 +2,7 @@ /* * Copyright (C) 2019, Google Inc. * - * buffer_writer.cpp - Buffer writer + * file_sink.cpp - File Sink */ #include <fcntl.h> @@ -15,16 +15,16 @@ #include <libcamera/camera.h> -#include "buffer_writer.h" +#include "file_sink.h" using namespace libcamera; -BufferWriter::BufferWriter(const std::string &pattern) +FileSink::FileSink(const std::string &pattern) : pattern_(pattern) { } -BufferWriter::~BufferWriter() +FileSink::~FileSink() { for (auto &iter : mappedBuffers_) { void *memory = iter.second.first; @@ -34,7 +34,7 @@ BufferWriter::~BufferWriter() mappedBuffers_.clear(); } -int BufferWriter::configure(const libcamera::CameraConfiguration &config) +int FileSink::configure(const libcamera::CameraConfiguration &config) { int ret = FrameSink::configure(config); if (ret < 0) @@ -49,7 +49,7 @@ int BufferWriter::configure(const libcamera::CameraConfiguration &config) return 0; } -void BufferWriter::mapBuffer(FrameBuffer *buffer) +void FileSink::mapBuffer(FrameBuffer *buffer) { for (const FrameBuffer::Plane &plane : buffer->planes()) { void *memory = mmap(NULL, plane.length, PROT_READ, MAP_SHARED, @@ -60,7 +60,7 @@ void BufferWriter::mapBuffer(FrameBuffer *buffer) } } -bool BufferWriter::processRequest(Request *request) +bool FileSink::processRequest(Request *request) { for (auto [stream, buffer] : request->buffers()) writeBuffer(stream, buffer); @@ -68,7 +68,7 @@ bool BufferWriter::processRequest(Request *request) return true; } -void BufferWriter::writeBuffer(const Stream *stream, FrameBuffer *buffer) +void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer) { std::string filename; size_t pos; diff --git a/src/cam/buffer_writer.h b/src/cam/file_sink.h index 32bb6ed5..c3eb230a 100644 --- a/src/cam/buffer_writer.h +++ b/src/cam/file_sink.h @@ -2,10 +2,10 @@ /* * Copyright (C) 2019, Google Inc. * - * buffer_writer.h - Buffer writer + * file_sink.h - File Sink */ -#ifndef __CAM_BUFFER_WRITER_H__ -#define __CAM_BUFFER_WRITER_H__ +#ifndef __CAM_FILE_SINK_H__ +#define __CAM_FILE_SINK_H__ #include <map> #include <string> @@ -14,11 +14,11 @@ #include "frame_sink.h" -class BufferWriter : public FrameSink +class FileSink : public FrameSink { public: - BufferWriter(const std::string &pattern = ""); - ~BufferWriter(); + FileSink(const std::string &pattern = ""); + ~FileSink(); int configure(const libcamera::CameraConfiguration &config) override; @@ -35,4 +35,4 @@ private: std::map<int, std::pair<void *, unsigned int>> mappedBuffers_; }; -#endif /* __CAM_BUFFER_WRITER_H__ */ +#endif /* __CAM_FILE_SINK_H__ */ diff --git a/src/cam/meson.build b/src/cam/meson.build index 649cc990..e692ea35 100644 --- a/src/cam/meson.build +++ b/src/cam/meson.build @@ -10,9 +10,9 @@ endif cam_enabled = true cam_sources = files([ - 'buffer_writer.cpp', 'camera_session.cpp', 'event_loop.cpp', + 'file_sink.cpp', 'frame_sink.cpp', 'main.cpp', 'options.cpp', |