summaryrefslogtreecommitdiffstats
path: root/src/MuxElements.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/MuxElements.h')
-rw-r--r--src/MuxElements.h80
1 files changed, 43 insertions, 37 deletions
diff --git a/src/MuxElements.h b/src/MuxElements.h
index be10bf9..b2be73f 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -167,27 +167,50 @@ class DabLabel
*/
int setLabel(const std::string& label);
+ /* Set the FIG2 label. label must be UTF-8.
+ *
+ * returns: 0 on success
+ */
+ int setFIG2Label(const std::string& label);
+
/* Write the label to the 16-byte buffer given in buf
* In the DAB standard, the label is 16 bytes long, and is
* padded using spaces.
*/
void writeLabel(uint8_t* buf) const;
- uint16_t flag() const { return m_flag; }
+ // For FIG 1
+ bool has_fig1_label() const { return not m_fig1_label.empty(); };
+ uint16_t flag() const { return m_fig1_flag; }
const std::string long_label() const;
const std::string short_label() const;
+ // For FIG 2
+ bool has_fig2_label() const { return not m_fig2_label.empty(); };
+ const std::string fig2_label() const;
+
+ /* FIG 2 labels are either in UCS-2 or in UTF-8. Because there are upcoming
+ * changes in the spec regarding the encoding of FIG2 (currently in draft
+ * ETSI TS 103 176 v2.2.1), the character flag is not implemented yet.
+ *
+ * Both FIG 1 and FIG 2 labels can be sent, and receiver will show the one
+ * they support.
+ */
+
private:
+ /* The m_fig1_label is not padded in any way. Stored in EBU Latin Charset */
+ std::string m_fig1_label;
+
/* The flag field selects which label characters make
* up the short label
*/
- uint16_t m_flag = 0xFFFF;
+ uint16_t m_fig1_flag = 0xFFFF;
- /* The m_label is not padded in any way */
- std::string m_label;
+ /* FIG2 label, stored in UTF-8. TODO: support UCS-2 */
+ std::string m_fig2_label;
/* Checks and calculates the flag. slabel must be EBU Latin Charset */
- int setShortLabel(const std::string& slabel);
+ int setFIG1ShortLabel(const std::string& slabel);
};
@@ -295,15 +318,7 @@ class DabSubchannel
{
public:
DabSubchannel(std::string& uid) :
- uid(uid),
- input(),
- id(0),
- type(subchannel_type_t::DABAudio),
- startAddress(0),
- bitrate(0),
- protection()
- {
- }
+ uid(uid) { }
// Calculate subchannel size in number of CU
unsigned short getSizeCu(void) const;
@@ -321,20 +336,17 @@ public:
std::string inputUri;
std::shared_ptr<Inputs::InputBase> input;
- unsigned char id;
- subchannel_type_t type;
- uint16_t startAddress;
- uint16_t bitrate;
- dabProtection protection;
+ unsigned char id = 0;
+ subchannel_type_t type = subchannel_type_t::DABAudio;
+ uint16_t startAddress = 0;
+ uint16_t bitrate = 0;
+ struct dabProtection protection;
};
struct dabAudioComponent {
- dabAudioComponent() :
- uaType(0xFFFF) {}
-
- uint16_t uaType; // User Application Type
+ uint16_t uaType = 0xFFFF; // User Application Type
};
@@ -347,16 +359,10 @@ struct dabFidcComponent {
struct dabPacketComponent {
- dabPacketComponent() :
- id(0),
- address(0),
- appType(0xFFFF),
- datagroup(false) { }
-
- uint16_t id;
- uint16_t address;
- uint16_t appType;
- bool datagroup;
+ uint16_t id = 0;
+ uint16_t address = 0;
+ uint16_t appType = 0xFFFF;
+ bool datagroup = false;
};
class DabComponent : public RemoteControllable
@@ -372,10 +378,10 @@ class DabComponent : public RemoteControllable
std::string uid;
DabLabel label;
- uint32_t serviceId;
- uint8_t subchId;
- uint8_t type;
- uint8_t SCIdS;
+ uint32_t serviceId = 0;
+ uint8_t subchId = 0;
+ uint8_t type = 0;
+ uint8_t SCIdS = 0;
dabAudioComponent audio;
dabDataComponent data;