aboutsummaryrefslogtreecommitdiffstats
path: root/lib/edi/TagPacket.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-11 21:30:35 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2020-05-11 21:30:35 +0200
commited1a35bf8bf8be0e3f3b12c2e9332dfcd86a817b (patch)
tree6bbbcfb086b74381146c63fbc73b882b82495279 /lib/edi/TagPacket.cpp
parent9a30ccf89e93f970832465ae1c443c684ba9e0bf (diff)
downloadODR-SourceCompanion-ed1a35bf8bf8be0e3f3b12c2e9332dfcd86a817b.tar.gz
ODR-SourceCompanion-ed1a35bf8bf8be0e3f3b12c2e9332dfcd86a817b.tar.bz2
ODR-SourceCompanion-ed1a35bf8bf8be0e3f3b12c2e9332dfcd86a817b.zip
Update common
Diffstat (limited to 'lib/edi/TagPacket.cpp')
-rw-r--r--lib/edi/TagPacket.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/edi/TagPacket.cpp b/lib/edi/TagPacket.cpp
index b0bf9a1..ec52ad7 100644
--- a/lib/edi/TagPacket.cpp
+++ b/lib/edi/TagPacket.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014
+ Copyright (C) 2020
Matthias P. Braendli, matthias.braendli@mpb.li
http://www.opendigitalradio.org
@@ -41,17 +41,19 @@ TagPacket::TagPacket(unsigned int alignment) : m_alignment(alignment)
std::vector<uint8_t> TagPacket::Assemble()
{
- std::list<TagItem*>::iterator tag;
+ if (raw_tagpacket.size() > 0 and tag_items.size() > 0) {
+ throw std::logic_error("TagPacket: both raw and items used!");
+ }
- std::vector<uint8_t> packet;
+ if (raw_tagpacket.size() > 0) {
+ return raw_tagpacket;
+ }
- //std::cerr << "Assemble TAGPacket" << std::endl;
+ std::vector<uint8_t> packet;
- for (tag = tag_items.begin(); tag != tag_items.end(); ++tag) {
- std::vector<uint8_t> tag_data = (*tag)->Assemble();
+ for (auto tag : tag_items) {
+ std::vector<uint8_t> tag_data = tag->Assemble();
packet.insert(packet.end(), tag_data.begin(), tag_data.end());
-
- //std::cerr << " Add TAGItem of length " << tag_data.size() << std::endl;
}
if (m_alignment == 0) { /* no padding */ }