From f470de09c4215c39387fbe6d85330c90fecea10d Mon Sep 17 00:00:00 2001 From: Stefan Pöschel Date: Sun, 24 May 2015 23:42:35 +0200 Subject: Labels: use spaces instead of NULs for trailing padding The NULs ATM used for trailing label padding are not defined in the EBU Latin based charset we use. As all 16 label bytes must be used, use spaces instead, like real-world broadcasters do. --- src/MuxElements.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/MuxElements.h') diff --git a/src/MuxElements.h b/src/MuxElements.h index 3653ea4..22112db 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -61,7 +61,7 @@ class DabLabel * -2 if the short_label is too long * -3 if the text is too long */ - int setLabel(const std::string& text, const std::string& short_label); + int setLabel(const std::string& label, const std::string& short_label); /* Same as above, but sets the flag to 0xff00, truncating at 8 * characters. @@ -69,17 +69,20 @@ class DabLabel * returns: 0 on success * -3 if the text is too long */ - int setLabel(const std::string& text); + int setLabel(const std::string& label); const char* text() const { return m_text; } uint16_t flag() const { return m_flag; } + const std::string long_label() const { return m_label; } const std::string short_label() const; private: - // In the DAB standard, the label is 16 chars. - // We keep it here zero-terminated - char m_text[17]; + // In the DAB standard, the label is 16 bytes long. + // We use spaces for padding at the end if needed. + char m_text[16]; uint16_t m_flag; + std::string m_label; + int setShortLabel(const std::string& slabel); }; -- cgit v1.2.3