From 53e25831c29615132ba3ee5d1d24dc14c45c20aa Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 18 Dec 2015 11:54:10 +0100 Subject: EDI: Simplify subchannel handling --- src/DabMultiplexer.cpp | 17 ++++++++--------- src/dabOutput/edi/TagItems.cpp | 2 +- src/dabOutput/edi/TagItems.h | 5 +---- 3 files changed, 10 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index 2578cfd..70f3f5e 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -442,8 +442,7 @@ void DabMultiplexer::mux_frame(std::vector >& outpu // For EDI, save ETI(LI) Management data into a TAG Item DETI TagDETI edi_tagDETI; TagStarPTR edi_tagStarPtr; - list edi_subchannels; - map edi_subchannelToTag; + map edi_subchannelToTag; // The above Tag Items will be assembled into a TAG Packet TagPacket edi_tagpacket(edi_conf.tagpacket_alignment); @@ -550,7 +549,8 @@ void DabMultiplexer::mux_frame(std::vector >& outpu sstc->STL_high = getSizeDWord(*subchannel) / 256; sstc->STL_low = getSizeDWord(*subchannel) % 256; - TagESTn tag_ESTn(edi_stream_id++); + TagESTn tag_ESTn; + tag_ESTn.id = edi_stream_id++; tag_ESTn.scid = (*subchannel)->id; tag_ESTn.sad = (*subchannel)->startAddress; tag_ESTn.tpl = sstc->TPL; @@ -558,8 +558,7 @@ void DabMultiplexer::mux_frame(std::vector >& outpu tag_ESTn.mst_length = getSizeByte(*subchannel) / 8; assert(getSizeByte(*subchannel) % 8 == 0); - edi_subchannels.push_back(tag_ESTn); - edi_subchannelToTag[*subchannel] = &edi_subchannels.back(); + edi_subchannelToTag[*subchannel] = tag_ESTn; index += 4; } @@ -1696,7 +1695,7 @@ void DabMultiplexer::mux_frame(std::vector >& outpu subchannel != ensemble->subchannels.end(); ++subchannel) { - TagESTn* tag = edi_subchannelToTag[*subchannel]; + TagESTn& tag = edi_subchannelToTag[*subchannel]; int sizeSubchannel = getSizeByte(*subchannel); int result = (*subchannel)->input->readFrame( @@ -1709,7 +1708,7 @@ void DabMultiplexer::mux_frame(std::vector >& outpu } // save pointer to Audio or Data Stream into correct TagESTn for EDI - tag->mst_data = &etiFrame[index]; + tag.mst_data = &etiFrame[index]; index += sizeSubchannel; } @@ -1807,8 +1806,8 @@ void DabMultiplexer::mux_frame(std::vector >& outpu edi_tagpacket.tag_items.push_back(&edi_tagStarPtr); edi_tagpacket.tag_items.push_back(&edi_tagDETI); - for (auto& tag : edi_subchannels) { - edi_tagpacket.tag_items.push_back(&tag); + for (auto& tag : edi_subchannelToTag) { + edi_tagpacket.tag_items.push_back(&tag.second); } // Assemble into one AF Packet diff --git a/src/dabOutput/edi/TagItems.cpp b/src/dabOutput/edi/TagItems.cpp index f29eaeb..afc45a8 100644 --- a/src/dabOutput/edi/TagItems.cpp +++ b/src/dabOutput/edi/TagItems.cpp @@ -137,7 +137,7 @@ std::vector TagESTn::Assemble() std::vector packet(pack_data.begin(), pack_data.end()); packet.reserve(mst_length*8 + 16); - packet.push_back(id_); + packet.push_back(id); // Placeholder for length packet.push_back(0); diff --git a/src/dabOutput/edi/TagItems.h b/src/dabOutput/edi/TagItems.h index e75d241..af5e7df 100644 --- a/src/dabOutput/edi/TagItems.h +++ b/src/dabOutput/edi/TagItems.h @@ -94,8 +94,6 @@ class TagDETI : public TagItem class TagESTn : public TagItem { public: - TagESTn(uint8_t id) : id_(id) {} ; - std::vector Assemble(); // SSTCn @@ -108,8 +106,7 @@ class TagESTn : public TagItem uint8_t* mst_data; size_t mst_length; // STLn * 8 bytes - private: - uint8_t id_; + uint8_t id; }; // ETSI TS 102 821, 5.2.2.2 Dummy padding -- cgit v1.2.3