diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-20 01:20:41 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-01-20 01:20:41 +0100 |
commit | 28ddaa742d1a815c8c07d17b2a79fbfb964fdc1d (patch) | |
tree | f22941e989bb775aacda52876c97ada7b899a7dd /src/ModPlugin.cpp | |
parent | 95f556cf0797ab4c23f431e5c8c5accfa7f4c30b (diff) | |
parent | f52b0e13f61a947c26236504ffb4b072352abc04 (diff) | |
download | dabmod-28ddaa742d1a815c8c07d17b2a79fbfb964fdc1d.tar.gz dabmod-28ddaa742d1a815c8c07d17b2a79fbfb964fdc1d.tar.bz2 dabmod-28ddaa742d1a815c8c07d17b2a79fbfb964fdc1d.zip |
Merge branch 'outputRefactoring' into next
Diffstat (limited to 'src/ModPlugin.cpp')
-rw-r--r-- | src/ModPlugin.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/ModPlugin.cpp b/src/ModPlugin.cpp index c39d883..d567a90 100644 --- a/src/ModPlugin.cpp +++ b/src/ModPlugin.cpp @@ -72,17 +72,7 @@ int ModOutput::process( return process(dataIn[0]); } -PipelinedModCodec::PipelinedModCodec() : - ModCodec(), - m_number_of_runs(0), - m_input_queue(), - m_output_queue(), - m_running(false), - m_thread() -{ -} - -PipelinedModCodec::~PipelinedModCodec() +void PipelinedModCodec::stop_pipeline_thread() { m_input_queue.push({}); if (m_thread.joinable()) { @@ -107,7 +97,7 @@ int PipelinedModCodec::process(Buffer* dataIn, Buffer* dataOut) m_input_queue.push(inbuffer); - if (m_number_of_runs > 0) { + if (m_ready_to_output_data) { std::shared_ptr<Buffer> outbuffer; m_output_queue.wait_and_pop(outbuffer); @@ -116,13 +106,26 @@ int PipelinedModCodec::process(Buffer* dataIn, Buffer* dataOut) else { dataOut->setLength(dataIn->getLength()); memset(dataOut->getData(), 0, dataOut->getLength()); - m_number_of_runs++; + m_ready_to_output_data = true; } return dataOut->getLength(); } +meta_vec_t PipelinedModCodec::process_metadata(const meta_vec_t& metadataIn) +{ + m_metadata_fifo.push_back(metadataIn); + if (m_metadata_fifo.size() == 2) { + auto r = std::move(m_metadata_fifo.front()); + m_metadata_fifo.pop_front(); + return r; + } + else { + return {}; + } +} + void PipelinedModCodec::process_thread() { set_thread_name(name()); |