aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--decoder/ETIDecoder.cpp6
-rw-r--r--decoder/ETIDecoder.hpp21
-rw-r--r--decoder/ETIWriter.cpp8
-rw-r--r--decoder/ETIWriter.hpp6
-rw-r--r--decoder/common.hpp4
6 files changed, 22 insertions, 24 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b60716..b52b116 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,7 @@ list(APPEND edilib_cpp_sources
ReedSolomon.cpp
Log.cpp
decoder/ETIDecoder.cpp
+ decoder/STIDecoder.cpp
decoder/ETIWriter.cpp
decoder/PFT.cpp
decoder/eti.cpp
diff --git a/decoder/ETIDecoder.cpp b/decoder/ETIDecoder.cpp
index 9c7dbf4..a1b801b 100644
--- a/decoder/ETIDecoder.cpp
+++ b/decoder/ETIDecoder.cpp
@@ -30,7 +30,7 @@ namespace EdiDecoder {
using namespace std;
-ETIDecoder::ETIDecoder(DataCollector& data_collector, bool verbose) :
+ETIDecoder::ETIDecoder(ETIDataCollector& data_collector, bool verbose) :
m_data_collector(data_collector),
m_dispatcher(std::bind(&ETIDecoder::packet_completed, this), verbose)
{
@@ -162,7 +162,7 @@ bool ETIDecoder::decode_deti(const vector<uint8_t> &value, uint16_t)
fic.begin());
i += fic_length;
- m_data_collector.update_fic(fic);
+ m_data_collector.update_fic(move(fic));
}
if (rfudf) {
@@ -202,7 +202,7 @@ bool ETIDecoder::decode_estn(const vector<uint8_t> &value, uint16_t n)
value.end(),
back_inserter(stc.mst));
- m_data_collector.add_subchannel(stc);
+ m_data_collector.add_subchannel(move(stc));
return true;
}
diff --git a/decoder/ETIDecoder.hpp b/decoder/ETIDecoder.hpp
index 907fe9f..f5d0b81 100644
--- a/decoder/ETIDecoder.hpp
+++ b/decoder/ETIDecoder.hpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2017
+ Copyright (C) 2019
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -20,7 +20,6 @@
*/
#pragma once
-#include "PFT.hpp"
#include "eti.hpp"
#include "common.hpp"
#include <cstdint>
@@ -34,7 +33,7 @@ namespace EdiDecoder {
// EDI.
//
// Number of streams is given separately, and frame length
-// is calculated in the DataCollector
+// is calculated in the ETIDataCollector
struct eti_fc_data {
bool atstf;
uint32_t tsta;
@@ -59,10 +58,10 @@ struct eti_stc_data {
};
/* A class that receives multiplex data must implement the interface described
- * in the DataCollector. This can be e.g. a converter to ETI, or something that
+ * in the ETIDataCollector. This can be e.g. a converter to ETI, or something that
* prepares data structures for a modulator.
*/
-class DataCollector {
+class ETIDataCollector {
public:
// Tell the ETIWriter what EDI protocol we receive in *ptr.
// This is not part of the ETI data, but is used as check
@@ -74,21 +73,19 @@ class DataCollector {
// Update the data for the frame characterisation
virtual void update_fc_data(const eti_fc_data& fc_data) = 0;
- virtual void update_fic(const std::vector<uint8_t>& fic) = 0;
+ virtual void update_fic(std::vector<uint8_t>&& fic) = 0;
virtual void update_err(uint8_t err) = 0;
// In addition to TSTA in ETI, EDI also transports more time
// stamp information.
- virtual void update_edi_time(
- uint32_t utco,
- uint32_t seconds) = 0;
+ virtual void update_edi_time(uint32_t utco, uint32_t seconds) = 0;
virtual void update_mnsc(uint16_t mnsc) = 0;
virtual void update_rfu(uint16_t rfu) = 0;
- virtual void add_subchannel(const eti_stc_data& stc) = 0;
+ virtual void add_subchannel(eti_stc_data&& stc) = 0;
// Tell the ETIWriter that the AFPacket is complete
virtual void assemble(void) = 0;
@@ -102,7 +99,7 @@ class DataCollector {
*/
class ETIDecoder {
public:
- ETIDecoder(DataCollector& data_collector, bool verbose);
+ ETIDecoder(ETIDataCollector& data_collector, bool verbose);
/* Push bytes into the decoder. The buf can contain more
* than a single packet. This is useful when reading from streams
@@ -128,7 +125,7 @@ class ETIDecoder {
void packet_completed();
- DataCollector& m_data_collector;
+ ETIDataCollector& m_data_collector;
TagDispatcher m_dispatcher;
};
diff --git a/decoder/ETIWriter.cpp b/decoder/ETIWriter.cpp
index eaff872..e51eccd 100644
--- a/decoder/ETIWriter.cpp
+++ b/decoder/ETIWriter.cpp
@@ -104,13 +104,13 @@ void ETIWriter::update_fc_data(const eti_fc_data& fc_data)
m_fc_valid = true;
}
-void ETIWriter::update_fic(const std::vector<uint8_t>& fic)
+void ETIWriter::update_fic(std::vector<uint8_t>&& fic)
{
if (not m_proto_valid) {
throw std::logic_error("Cannot update FIC before protocol");
}
- m_fic = fic;
+ m_fic = move(fic);
}
void ETIWriter::update_edi_time(
@@ -147,13 +147,13 @@ void ETIWriter::update_rfu(uint16_t rfu)
m_rfu = rfu;
}
-void ETIWriter::add_subchannel(const eti_stc_data& stc)
+void ETIWriter::add_subchannel(eti_stc_data&& stc)
{
if (not m_proto_valid) {
throw std::logic_error("Cannot add subchannel before protocol");
}
- m_subchannels.push_back(stc);
+ m_subchannels.emplace_back(move(stc));
if (m_subchannels.size() > 64) {
throw std::invalid_argument("Too many subchannels");
diff --git a/decoder/ETIWriter.hpp b/decoder/ETIWriter.hpp
index 58a56bc..0b1dc0e 100644
--- a/decoder/ETIWriter.hpp
+++ b/decoder/ETIWriter.hpp
@@ -38,7 +38,7 @@ struct eti_frame_t {
time_t timestamp_in_unix_epoch() const;
};
-class ETIWriter : public DataCollector {
+class ETIWriter : public ETIDataCollector {
public:
// Tell the ETIWriter what EDI protocol we receive in *ptr.
// This is not part of the ETI data, but is used as check
@@ -50,7 +50,7 @@ class ETIWriter : public DataCollector {
// Update the data for the frame characterisation
virtual void update_fc_data(const eti_fc_data& fc_data);
- virtual void update_fic(const std::vector<uint8_t>& fic);
+ virtual void update_fic(std::vector<uint8_t>&& fic);
virtual void update_err(uint8_t err);
@@ -64,7 +64,7 @@ class ETIWriter : public DataCollector {
virtual void update_rfu(uint16_t rfu);
- virtual void add_subchannel(const eti_stc_data& stc);
+ virtual void add_subchannel(eti_stc_data&& stc);
// Tell the ETIWriter that the AFPacket is complete
virtual void assemble(void);
diff --git a/decoder/common.hpp b/decoder/common.hpp
index 66a931a..b5df890 100644
--- a/decoder/common.hpp
+++ b/decoder/common.hpp
@@ -20,11 +20,11 @@
*/
#pragma once
-#include <cstddef>
+#include "PFT.hpp"
#include <vector>
#include <map>
#include <functional>
-#include "PFT.hpp"
+#include <cstddef>
namespace EdiDecoder {