cam: Rename BufferWriter to FileSink
Rename the BufferWriter class to FileSink to establish a common naming scheme for all sinks. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
This commit is contained in:
parent
02001fecb0
commit
ab623b4738
4 changed files with 19 additions and 19 deletions
|
@ -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_) {
|
||||
|
|
|
@ -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;
|
|
@ -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__ */
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue