Put Reader, Writer inside "stream" namespace.

This commit is contained in:
Jared Boone 2016-10-04 17:13:21 -07:00
parent 01320d9806
commit a5793b8b9d
5 changed files with 9 additions and 5 deletions

View File

@ -75,7 +75,7 @@ StreamOutput::~StreamOutput() {
Thread* CaptureThread::thread = nullptr; Thread* CaptureThread::thread = nullptr;
CaptureThread::CaptureThread( CaptureThread::CaptureThread(
std::unique_ptr<Writer> writer, std::unique_ptr<stream::Writer> writer,
size_t write_size, size_t write_size,
size_t buffer_count, size_t buffer_count,
std::function<void()> success_callback, std::function<void()> success_callback,

View File

@ -36,7 +36,7 @@
class CaptureThread { class CaptureThread {
public: public:
CaptureThread( CaptureThread(
std::unique_ptr<Writer> writer, std::unique_ptr<stream::Writer> writer,
size_t write_size, size_t write_size,
size_t buffer_count, size_t buffer_count,
std::function<void()> success_callback, std::function<void()> success_callback,
@ -54,7 +54,7 @@ private:
static constexpr auto event_mask_loop_wake = EVENT_MASK(0); static constexpr auto event_mask_loop_wake = EVENT_MASK(0);
CaptureConfig config; CaptureConfig config;
std::unique_ptr<Writer> writer; std::unique_ptr<stream::Writer> writer;
std::function<void()> success_callback; std::function<void()> success_callback;
std::function<void(File::Error)> error_callback; std::function<void(File::Error)> error_callback;
static Thread* thread; static Thread* thread;

View File

@ -23,6 +23,8 @@
#include "file.hpp" #include "file.hpp"
namespace stream {
class Reader { class Reader {
public: public:
virtual File::Result<File::Size> read(void* const buffer, const File::Size bytes) = 0; virtual File::Result<File::Size> read(void* const buffer, const File::Size bytes) = 0;
@ -34,3 +36,5 @@ public:
virtual File::Result<File::Size> write(const void* const buffer, const File::Size bytes) = 0; virtual File::Result<File::Size> write(const void* const buffer, const File::Size bytes) = 0;
virtual ~Writer() = default; virtual ~Writer() = default;
}; };
} /* namespace stream */

View File

@ -28,7 +28,7 @@
#include <cstdint> #include <cstdint>
class FileWriter : public Writer { class FileWriter : public stream::Writer {
public: public:
FileWriter() = default; FileWriter() = default;

View File

@ -117,7 +117,7 @@ void RecordView::start() {
return; return;
} }
std::unique_ptr<Writer> writer; std::unique_ptr<stream::Writer> writer;
switch(file_type) { switch(file_type) {
case FileType::WAV: case FileType::WAV:
{ {