diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-05-19 14:48:39 +0200 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2021-05-19 14:48:39 +0200 |
commit | 5ad4acef6721a67b8156cd6f7b45ad59849ca09b (patch) | |
tree | adeedaa825f2ef2aa4f9b30265d007b6e7abe8ef /contrib/edioutput/AFPacket.cpp | |
parent | c92c05d1199a2380d8c8c79a89c7e1f3159a2603 (diff) | |
download | ODR-AudioEnc-5ad4acef6721a67b8156cd6f7b45ad59849ca09b.tar.gz ODR-AudioEnc-5ad4acef6721a67b8156cd6f7b45ad59849ca09b.tar.bz2 ODR-AudioEnc-5ad4acef6721a67b8156cd6f7b45ad59849ca09b.zip |
Common 44ae39c: Make SEQ and PSEQ available on EDI receive and improve error handling
Diffstat (limited to 'contrib/edioutput/AFPacket.cpp')
-rw-r--r-- | contrib/edioutput/AFPacket.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/contrib/edioutput/AFPacket.cpp b/contrib/edioutput/AFPacket.cpp index b38c38b..323a3b1 100644 --- a/contrib/edioutput/AFPacket.cpp +++ b/contrib/edioutput/AFPacket.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2014 + Copyright (C) 2021 Matthias P. Braendli, matthias.braendli@mpb.li http://www.opendigitalradio.org @@ -25,7 +25,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "config.h" #include "crc.h" #include "AFPacket.h" #include "TagItems.h" @@ -50,7 +49,7 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet) std::vector<uint8_t> payload = tag_packet.Assemble(); if (m_verbose) - std::cerr << "Assemble AFPacket " << seq << std::endl; + std::cerr << "Assemble AFPacket " << m_seq << std::endl; std::string pack_data("AF"); // SYNC std::vector<uint8_t> packet(pack_data.begin(), pack_data.end()); @@ -67,10 +66,10 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet) packet.push_back(taglength & 0xFF); // 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(m_seq >> 8); + packet.push_back(m_seq & 0xFF); + m_seq++; + packet.push_back((m_have_crc ? 0x80 : 0) | AFHEADER_VERSION); // ar_cf: CRC=1 packet.push_back(AFHEADER_PT_TAG); // insert payload, must have a length multiple of 8 bytes @@ -93,4 +92,9 @@ AFPacket AFPacketiser::Assemble(TagPacket tag_packet) return packet; } +void AFPacketiser::OverrideSeq(uint16_t seq) +{ + m_seq = seq; +} + } |