summaryrefslogtreecommitdiffstats
path: root/src/dabOutput/edi
diff options
context:
space:
mode:
Diffstat (limited to 'src/dabOutput/edi')
-rw-r--r--src/dabOutput/edi/AFPacket.cpp3
-rw-r--r--src/dabOutput/edi/AFPacket.h2
-rw-r--r--src/dabOutput/edi/PFT.cpp2
-rw-r--r--src/dabOutput/edi/PFT.h16
-rw-r--r--src/dabOutput/edi/TagPacket.cpp7
5 files changed, 18 insertions, 12 deletions
diff --git a/src/dabOutput/edi/AFPacket.cpp b/src/dabOutput/edi/AFPacket.cpp
index 3b69f1c..a1d39b9 100644
--- a/src/dabOutput/edi/AFPacket.cpp
+++ b/src/dabOutput/edi/AFPacket.cpp
@@ -39,7 +39,7 @@
#define AFHEADER_PT_TAG 'T'
// AF Packet Major (3 bits) and Minor (4 bits) version
-#define AFHEADER_VERSION 0x8 // MAJ=1, MIN=0
+#define AFHEADER_VERSION 0x10 // MAJ=1, MIN=0
AFPacket AFPacketiser::Assemble(TagPacket tag_packet)
{
@@ -65,6 +65,7 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet)
// fill rest of header
packet.push_back(seq >> 8);
packet.push_back(seq & 0xFF);
+ seq++;
packet.push_back((have_crc ? 0x80 : 0) | AFHEADER_VERSION); // ar_cf: CRC=1
packet.push_back(AFHEADER_PT_TAG);
diff --git a/src/dabOutput/edi/AFPacket.h b/src/dabOutput/edi/AFPacket.h
index 5f62456..9b189b8 100644
--- a/src/dabOutput/edi/AFPacket.h
+++ b/src/dabOutput/edi/AFPacket.h
@@ -39,6 +39,8 @@ typedef std::vector<uint8_t> AFPacket;
class AFPacketiser
{
public:
+ AFPacketiser() :
+ m_verbose(false) {};
AFPacketiser(bool verbose) :
m_verbose(verbose) {};
diff --git a/src/dabOutput/edi/PFT.cpp b/src/dabOutput/edi/PFT.cpp
index e1c8249..7f463cc 100644
--- a/src/dabOutput/edi/PFT.cpp
+++ b/src/dabOutput/edi/PFT.cpp
@@ -52,7 +52,7 @@ RSBlock PFT::Protect(AFPacket af_packet)
// number of chunks is ceil(afpacketsize / m_k)
// TS 102 821 7.2.2: c = ceil(l / k_max)
- m_num_chunks = CEIL_DIV(af_packet.size(), 207);
+ m_num_chunks = CEIL_DIV(af_packet.size(), m_k);
if (m_verbose) {
fprintf(stderr, "Protect %zu chunks of size %zu\n",
diff --git a/src/dabOutput/edi/PFT.h b/src/dabOutput/edi/PFT.h
index 4aae817..e17d282 100644
--- a/src/dabOutput/edi/PFT.h
+++ b/src/dabOutput/edi/PFT.h
@@ -49,11 +49,17 @@ class PFT
public:
static const int ParityBytes = 48;
- PFT(unsigned int RSDataWordLength,
- unsigned int NumRecoverableFragments,
- const edi_configuration_t &conf) :
- m_k(RSDataWordLength),
- m_m(NumRecoverableFragments),
+ PFT() :
+ m_k(207),
+ m_m(3),
+ m_dest_port(12000),
+ m_pseq(0),
+ m_verbose(false)
+ { }
+
+ PFT(const edi_configuration_t &conf) :
+ m_k(conf.chunk_len),
+ m_m(conf.fec),
m_dest_port(conf.dest_port),
m_pseq(0),
m_verbose(conf.verbose)
diff --git a/src/dabOutput/edi/TagPacket.cpp b/src/dabOutput/edi/TagPacket.cpp
index fbb0f8b..aa4f23b 100644
--- a/src/dabOutput/edi/TagPacket.cpp
+++ b/src/dabOutput/edi/TagPacket.cpp
@@ -31,6 +31,7 @@
#include <string>
#include <list>
#include <stdint.h>
+#include <cassert>
std::vector<uint8_t> TagPacket::Assemble()
@@ -41,21 +42,17 @@ std::vector<uint8_t> TagPacket::Assemble()
//std::cerr << "Assemble TAGPacket" << std::endl;
- size_t packet_length = 0;
for (tag = tag_items.begin(); tag != tag_items.end(); ++tag) {
std::vector<uint8_t> tag_data = (*tag)->Assemble();
packet.insert(packet.end(), tag_data.begin(), tag_data.end());
- packet_length += tag_data.size();
-
//std::cerr << " Add TAGItem of length " << tag_data.size() << std::endl;
}
// Add padding
- while (packet_length % 8 > 0)
+ while (packet.size() % 8 > 0)
{
packet.push_back(0); // TS 102 821, 5.1, "padding shall be undefined"
- packet_length++;
}
return packet;