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/control_ids.h>
|
||||||
#include <libcamera/property_ids.h>
|
#include <libcamera/property_ids.h>
|
||||||
|
|
||||||
#include "buffer_writer.h"
|
|
||||||
#include "camera_session.h"
|
#include "camera_session.h"
|
||||||
#include "event_loop.h"
|
#include "event_loop.h"
|
||||||
|
#include "file_sink.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "stream_options.h"
|
#include "stream_options.h"
|
||||||
|
|
||||||
|
@ -163,9 +163,9 @@ int CameraSession::start()
|
||||||
|
|
||||||
if (options_.isSet(OptFile)) {
|
if (options_.isSet(OptFile)) {
|
||||||
if (!options_[OptFile].toString().empty())
|
if (!options_[OptFile].toString().empty())
|
||||||
sink_ = std::make_unique<BufferWriter>(options_[OptFile]);
|
sink_ = std::make_unique<FileSink>(options_[OptFile]);
|
||||||
else
|
else
|
||||||
sink_ = std::make_unique<BufferWriter>();
|
sink_ = std::make_unique<FileSink>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sink_) {
|
if (sink_) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019, Google Inc.
|
* Copyright (C) 2019, Google Inc.
|
||||||
*
|
*
|
||||||
* buffer_writer.cpp - Buffer writer
|
* file_sink.cpp - File Sink
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -15,16 +15,16 @@
|
||||||
|
|
||||||
#include <libcamera/camera.h>
|
#include <libcamera/camera.h>
|
||||||
|
|
||||||
#include "buffer_writer.h"
|
#include "file_sink.h"
|
||||||
|
|
||||||
using namespace libcamera;
|
using namespace libcamera;
|
||||||
|
|
||||||
BufferWriter::BufferWriter(const std::string &pattern)
|
FileSink::FileSink(const std::string &pattern)
|
||||||
: pattern_(pattern)
|
: pattern_(pattern)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferWriter::~BufferWriter()
|
FileSink::~FileSink()
|
||||||
{
|
{
|
||||||
for (auto &iter : mappedBuffers_) {
|
for (auto &iter : mappedBuffers_) {
|
||||||
void *memory = iter.second.first;
|
void *memory = iter.second.first;
|
||||||
|
@ -34,7 +34,7 @@ BufferWriter::~BufferWriter()
|
||||||
mappedBuffers_.clear();
|
mappedBuffers_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int BufferWriter::configure(const libcamera::CameraConfiguration &config)
|
int FileSink::configure(const libcamera::CameraConfiguration &config)
|
||||||
{
|
{
|
||||||
int ret = FrameSink::configure(config);
|
int ret = FrameSink::configure(config);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -49,7 +49,7 @@ int BufferWriter::configure(const libcamera::CameraConfiguration &config)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferWriter::mapBuffer(FrameBuffer *buffer)
|
void FileSink::mapBuffer(FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
for (const FrameBuffer::Plane &plane : buffer->planes()) {
|
for (const FrameBuffer::Plane &plane : buffer->planes()) {
|
||||||
void *memory = mmap(NULL, plane.length, PROT_READ, MAP_SHARED,
|
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())
|
for (auto [stream, buffer] : request->buffers())
|
||||||
writeBuffer(stream, buffer);
|
writeBuffer(stream, buffer);
|
||||||
|
@ -68,7 +68,7 @@ bool BufferWriter::processRequest(Request *request)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferWriter::writeBuffer(const Stream *stream, FrameBuffer *buffer)
|
void FileSink::writeBuffer(const Stream *stream, FrameBuffer *buffer)
|
||||||
{
|
{
|
||||||
std::string filename;
|
std::string filename;
|
||||||
size_t pos;
|
size_t pos;
|
|
@ -2,10 +2,10 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019, Google Inc.
|
* Copyright (C) 2019, Google Inc.
|
||||||
*
|
*
|
||||||
* buffer_writer.h - Buffer writer
|
* file_sink.h - File Sink
|
||||||
*/
|
*/
|
||||||
#ifndef __CAM_BUFFER_WRITER_H__
|
#ifndef __CAM_FILE_SINK_H__
|
||||||
#define __CAM_BUFFER_WRITER_H__
|
#define __CAM_FILE_SINK_H__
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
|
|
||||||
#include "frame_sink.h"
|
#include "frame_sink.h"
|
||||||
|
|
||||||
class BufferWriter : public FrameSink
|
class FileSink : public FrameSink
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BufferWriter(const std::string &pattern = "");
|
FileSink(const std::string &pattern = "");
|
||||||
~BufferWriter();
|
~FileSink();
|
||||||
|
|
||||||
int configure(const libcamera::CameraConfiguration &config) override;
|
int configure(const libcamera::CameraConfiguration &config) override;
|
||||||
|
|
||||||
|
@ -35,4 +35,4 @@ private:
|
||||||
std::map<int, std::pair<void *, unsigned int>> mappedBuffers_;
|
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_enabled = true
|
||||||
|
|
||||||
cam_sources = files([
|
cam_sources = files([
|
||||||
'buffer_writer.cpp',
|
|
||||||
'camera_session.cpp',
|
'camera_session.cpp',
|
||||||
'event_loop.cpp',
|
'event_loop.cpp',
|
||||||
|
'file_sink.cpp',
|
||||||
'frame_sink.cpp',
|
'frame_sink.cpp',
|
||||||
'main.cpp',
|
'main.cpp',
|
||||||
'options.cpp',
|
'options.cpp',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue