7 #ifndef PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_H_
8 #define PACKAGER_MEDIA_FORMATS_MP2T_ES_PARSER_TELETEXT_H_
12 #include <unordered_map>
15 #include <packager/media/base/text_stream_info.h>
16 #include <packager/media/formats/mp2t/es_parser.h>
25 const NewStreamInfoCB& new_stream_info_cb,
26 const EmitTextSampleCB& emit_sample_cb,
27 const uint8_t* descriptor,
28 const size_t descriptor_length);
33 bool Parse(
const uint8_t* buf,
int size, int64_t pts, int64_t dts)
override;
34 bool Flush()
override;
35 void Reset()
override;
38 using RowColReplacementMap =
39 std::unordered_map<uint8_t, std::unordered_map<uint8_t, std::string>>;
42 TextAlignment alignment;
49 std::vector<TextRow> rows;
50 RowColReplacementMap packet_26_replacements;
54 bool ParseInternal(
const uint8_t* data,
const size_t size,
const int64_t pts);
55 bool ParseDataBlock(
const int64_t pts,
56 const uint8_t* data_block,
57 const uint8_t packet_nr,
58 const uint8_t magazine,
59 TextRow& display_text);
61 void SendPending(
const uint16_t index,
const int64_t pts);
62 TextRow BuildRow(
const uint8_t* data_block,
const uint8_t row)
const;
63 void ParsePacket26(
const uint8_t* data_block);
64 void UpdateNationalSubset(
const uint8_t national_subset[13][3]);
66 static void SetPacket26ReplacementString(
67 RowColReplacementMap& replacement_map,
70 std::string&& replacement_string);
72 NewStreamInfoCB new_stream_info_cb_;
73 EmitTextSampleCB emit_sample_cb_;
75 std::unordered_map<uint16_t, std::string> languages_;
76 bool sent_info_ =
false;
79 std::unordered_map<uint16_t, TextBlock> page_state_;
80 uint8_t charset_code_;
81 char current_charset_[96][3];
All the methods that are virtual are virtual for mocking.