diff options
Diffstat (limited to 'src/ModPlugin.h')
-rw-r--r-- | src/ModPlugin.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/ModPlugin.h b/src/ModPlugin.h index bdc3843..edb7d2d 100644 --- a/src/ModPlugin.h +++ b/src/ModPlugin.h @@ -2,7 +2,7 @@ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2016 + Copyright (C) 2017 Matthias P. Braendli, matthias.braendli@mpb.li http://opendigitalradio.org @@ -32,9 +32,12 @@ #include "Buffer.h" +#include "ThreadsafeQueue.h" #include <sys/types.h> #include <vector> +#include <memory> +#include <thread> class ModPlugin { @@ -65,6 +68,32 @@ public: virtual int process(Buffer* const dataIn, Buffer* dataOut) = 0; }; +class PipelinedModCodec : public ModCodec +{ +public: + PipelinedModCodec(); + PipelinedModCodec(const PipelinedModCodec&) = delete; + PipelinedModCodec& operator=(const PipelinedModCodec&) = delete; + PipelinedModCodec(PipelinedModCodec&&) = delete; + PipelinedModCodec& operator=(PipelinedModCodec&&) = delete; + ~PipelinedModCodec(); + + virtual int process(Buffer* const dataIn, Buffer* dataOut) final; + virtual const char* name() = 0; + +protected: + void process_thread(void); + virtual int internal_process(Buffer* const dataIn, Buffer* dataOut) = 0; + + ThreadsafeQueue<std::shared_ptr<Buffer> > m_input_queue; + ThreadsafeQueue<std::shared_ptr<Buffer> > m_output_queue; + + std::atomic<bool> m_running; + size_t m_number_of_runs; + std::thread m_thread; +}; + + /* Muxes are N-input 1-output flowgraph plugins */ class ModMux : public ModPlugin { |