From 9d3d404a46dd79ed2b7a6c39719c76839787127e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 16 Jan 2019 15:44:45 +0100 Subject: Add charset decoder for FIG1 labels --- src/ensembledatabase.hpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/ensembledatabase.hpp') diff --git a/src/ensembledatabase.hpp b/src/ensembledatabase.hpp index cc080ec..dee434d 100644 --- a/src/ensembledatabase.hpp +++ b/src/ensembledatabase.hpp @@ -41,20 +41,27 @@ namespace ensemble_database { -enum class extended_label_charset { - UTF8, // encoding flag = 0 - UCS2, // encoding flag = 1 +enum class charset_e { + COMPLETE_EBU_LATIN = 0, + UTF8 = 15, // encoding flag = 0 + UCS2 = 6, // encoding flag = 1 + UNDEFINED, }; struct label_t { - // FIG 1 Label and shortlabel - std::string label; + // FIG 1 Label and shortlabel, in raw form + std::vector label_bytes; uint16_t shortlabel_flag; + charset_e charset = charset_e::COMPLETE_EBU_LATIN; + + // Returns a utf-8 encoded shortlabel + std::string shortlabel() const; + std::string label() const; // Extended Label from FIG 2 std::map > segments; size_t segment_count = 0; // number if actual segments (not segment count as in spec) - extended_label_charset charset; + charset_e extended_label_charset = charset_e::UNDEFINED; uint8_t toggle_flag = 0; // Assemble all segments into a UTF-8 string. Returns an @@ -92,8 +99,6 @@ struct component_t { bool primary; - label_t label; - /* TODO uint8_t type; -- cgit v1.2.3