summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-12-23 17:56:12 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-12-23 17:56:12 +0100
commit0f158ac9c63c6770cea423c8486a5ff192b36366 (patch)
tree7cd646cd32aa7f5fd099ef4923e04899fa29a99f /src
parente473f5183a1146d76940e9bfe7e3d76bbfe7baca (diff)
downloaddabmux-0f158ac9c63c6770cea423c8486a5ff192b36366.tar.gz
dabmux-0f158ac9c63c6770cea423c8486a5ff192b36366.tar.bz2
dabmux-0f158ac9c63c6770cea423c8486a5ff192b36366.zip
Create namespace for EDI
Diffstat (limited to 'src')
-rw-r--r--src/DabMultiplexer.cpp18
-rw-r--r--src/DabMultiplexer.h4
-rw-r--r--src/dabOutput/edi/AFPacket.cpp7
-rw-r--r--src/dabOutput/edi/AFPacket.h4
-rw-r--r--src/dabOutput/edi/PFT.cpp4
-rw-r--r--src/dabOutput/edi/PFT.h4
-rw-r--r--src/dabOutput/edi/TagItems.cpp13
-rw-r--r--src/dabOutput/edi/TagItems.h4
-rw-r--r--src/dabOutput/edi/TagPacket.cpp4
-rw-r--r--src/dabOutput/edi/TagPacket.h3
10 files changed, 46 insertions, 19 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index 1a2b238..a0c713b 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -120,7 +120,7 @@ void DabMultiplexer::set_edi_config(const edi_configuration_t& new_edi_conf)
}
// The AF Packet will be protected with reed-solomon and split in fragments
- PFT pft(edi_conf);
+ edi::PFT pft(edi_conf);
edi_pft = pft;
#endif
}
@@ -372,12 +372,12 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
unsigned FICL = (ensemble->mode == 3 ? 32 : 24);
// For EDI, save ETI(LI) Management data into a TAG Item DETI
- TagDETI edi_tagDETI;
- TagStarPTR edi_tagStarPtr;
- map<DabSubchannel*, TagESTn> edi_subchannelToTag;
+ edi::TagDETI edi_tagDETI;
+ edi::TagStarPTR edi_tagStarPtr;
+ map<DabSubchannel*, edi::TagESTn> edi_subchannelToTag;
// The above Tag Items will be assembled into a TAG Packet
- TagPacket edi_tagpacket(edi_conf.tagpacket_alignment);
+ edi::TagPacket edi_tagpacket(edi_conf.tagpacket_alignment);
update_dab_time();
@@ -477,7 +477,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
sstc->STL_high = (*subchannel)->getSizeDWord() / 256;
sstc->STL_low = (*subchannel)->getSizeDWord() % 256;
- TagESTn tag_ESTn;
+ edi::TagESTn tag_ESTn;
tag_ESTn.id = edi_stream_id++;
tag_ESTn.scid = (*subchannel)->id;
tag_ESTn.sad = (*subchannel)->startAddress;
@@ -569,7 +569,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
subchannel != ensemble->subchannels.end();
++subchannel) {
- TagESTn& tag = edi_subchannelToTag[*subchannel];
+ edi::TagESTn& tag = edi_subchannelToTag[*subchannel];
int sizeSubchannel = (*subchannel)->getSizeByte();
int result = (*subchannel)->input->readFrame(
@@ -703,11 +703,11 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
}
// Assemble into one AF Packet
- AFPacket edi_afpacket = edi_afPacketiser.Assemble(edi_tagpacket);
+ edi::AFPacket edi_afpacket = edi_afPacketiser.Assemble(edi_tagpacket);
if (edi_conf.enable_pft) {
// Apply PFT layer to AF Packet (Reed Solomon FEC and Fragmentation)
- vector< PFTFragment > edi_fragments =
+ vector< edi::PFTFragment > edi_fragments =
edi_pft.Assemble(edi_afpacket);
// Send over ethernet
diff --git a/src/DabMultiplexer.h b/src/DabMultiplexer.h
index 0d008be..e2a94f5 100644
--- a/src/DabMultiplexer.h
+++ b/src/DabMultiplexer.h
@@ -98,10 +98,10 @@ class DabMultiplexer : public RemoteControllable {
std::ofstream edi_debug_file;
// The TagPacket will then be placed into an AFPacket
- AFPacketiser edi_afPacketiser;
+ edi::AFPacketiser edi_afPacketiser;
// The AF Packet will be protected with reed-solomon and split in fragments
- PFT edi_pft;
+ edi::PFT edi_pft;
#endif // HAVE_OUTPUT_EDI
/* New FIG Carousel */
diff --git a/src/dabOutput/edi/AFPacket.cpp b/src/dabOutput/edi/AFPacket.cpp
index 509c3a6..a58a980 100644
--- a/src/dabOutput/edi/AFPacket.cpp
+++ b/src/dabOutput/edi/AFPacket.cpp
@@ -37,11 +37,13 @@
#include <stdint.h>
#include <arpa/inet.h>
+namespace edi {
+
// Header PT field. AF packet contains TAG payload
-#define AFHEADER_PT_TAG 'T'
+const uint8_t AFHEADER_PT_TAG = 'T';
// AF Packet Major (3 bits) and Minor (4 bits) version
-#define AFHEADER_VERSION 0x10 // MAJ=1, MIN=0
+const uint8_t AFHEADER_VERSION = 0x10; // MAJ=1, MIN=0
AFPacket AFPacketiser::Assemble(TagPacket tag_packet)
{
@@ -91,3 +93,4 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet)
return packet;
}
+}
diff --git a/src/dabOutput/edi/AFPacket.h b/src/dabOutput/edi/AFPacket.h
index a6fd603..0ffd13f 100644
--- a/src/dabOutput/edi/AFPacket.h
+++ b/src/dabOutput/edi/AFPacket.h
@@ -34,6 +34,8 @@
#include "TagItems.h"
#include "TagPacket.h"
+namespace edi {
+
typedef std::vector<uint8_t> AFPacket;
// ETSI TS 102 821, 6.1 AF packet structure
@@ -55,3 +57,5 @@ class AFPacketiser
bool m_verbose;
};
+}
+
diff --git a/src/dabOutput/edi/PFT.cpp b/src/dabOutput/edi/PFT.cpp
index 62b9f98..511a6ae 100644
--- a/src/dabOutput/edi/PFT.cpp
+++ b/src/dabOutput/edi/PFT.cpp
@@ -43,6 +43,8 @@
#include "crc.h"
#include "ReedSolomon.h"
+namespace edi {
+
using namespace std;
// An integer division that rounds up, i.e. ceil(a/b)
@@ -293,3 +295,5 @@ std::vector< PFTFragment > PFT::Assemble(AFPacket af_packet)
return pft_fragments;
}
+}
+
diff --git a/src/dabOutput/edi/PFT.h b/src/dabOutput/edi/PFT.h
index 5e2685e..05afdb1 100644
--- a/src/dabOutput/edi/PFT.h
+++ b/src/dabOutput/edi/PFT.h
@@ -42,6 +42,8 @@
#include "ReedSolomon.h"
#include "dabOutput/dabOutput.h"
+namespace edi {
+
typedef std::vector<uint8_t> RSBlock;
typedef std::vector<uint8_t> PFTFragment;
@@ -105,3 +107,5 @@ class PFT
};
+}
+
diff --git a/src/dabOutput/edi/TagItems.cpp b/src/dabOutput/edi/TagItems.cpp
index 54e996b..75a4ecf 100644
--- a/src/dabOutput/edi/TagItems.cpp
+++ b/src/dabOutput/edi/TagItems.cpp
@@ -1,6 +1,8 @@
/*
- Copyright (C) 2016 Matthias P. Braendli
- http://mpb.li
+ Copyright (C) 2016
+ Matthias P. Braendli, matthias.braendli@mpb.li
+
+ http://www.opendigitalradio.org
EDI output.
This defines a few TAG items as defined ETSI TS 102 821 and
@@ -24,9 +26,6 @@
along with ODR-DabMux. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _AFPACKET_H_
-#define _AFPACKET_H_
-
#include "config.h"
#include "TagItems.h"
#include <vector>
@@ -35,6 +34,8 @@
#include <stdint.h>
#include <stdexcept>
+namespace edi {
+
std::vector<uint8_t> TagStarPTR::Assemble()
{
//std::cerr << "TagItem *ptr" << std::endl;
@@ -209,5 +210,5 @@ std::vector<uint8_t> TagStarDMY::Assemble()
return packet;
}
-#endif
+}
diff --git a/src/dabOutput/edi/TagItems.h b/src/dabOutput/edi/TagItems.h
index 959a9a4..5a4ac6c 100644
--- a/src/dabOutput/edi/TagItems.h
+++ b/src/dabOutput/edi/TagItems.h
@@ -35,6 +35,8 @@
#include <string>
#include <stdint.h>
+namespace edi {
+
class TagItem
{
public:
@@ -153,3 +155,5 @@ class TagStarDMY : public TagItem
uint32_t length_;
};
+}
+
diff --git a/src/dabOutput/edi/TagPacket.cpp b/src/dabOutput/edi/TagPacket.cpp
index 332a130..b16dc33 100644
--- a/src/dabOutput/edi/TagPacket.cpp
+++ b/src/dabOutput/edi/TagPacket.cpp
@@ -35,6 +35,8 @@
#include <stdint.h>
#include <cassert>
+namespace edi {
+
TagPacket::TagPacket(unsigned int alignment) : m_alignment(alignment)
{ }
@@ -73,3 +75,5 @@ std::vector<uint8_t> TagPacket::Assemble()
return packet;
}
+}
+
diff --git a/src/dabOutput/edi/TagPacket.h b/src/dabOutput/edi/TagPacket.h
index 41d922c..a861cbb 100644
--- a/src/dabOutput/edi/TagPacket.h
+++ b/src/dabOutput/edi/TagPacket.h
@@ -33,6 +33,7 @@
#include <list>
#include <stdint.h>
+namespace edi {
// A TagPacket is nothing else than a list of tag items, with an
// Assemble function that puts the bytestream together and adds
@@ -51,3 +52,5 @@ class TagPacket
unsigned int m_alignment;
};
+}
+