7 #ifndef PACKAGER_MEDIA_DVB_DVB_SUB_PARSER_H_
8 #define PACKAGER_MEDIA_DVB_DVB_SUB_PARSER_H_
13 #include <packager/media/base/bit_reader.h>
14 #include <packager/media/base/text_sample.h>
15 #include <packager/media/formats/dvb/dvb_image.h>
16 #include <packager/media/formats/dvb/subtitle_composer.h>
22 enum class DvbSubSegmentType : uint16_t {
23 kPageComposition = 0x10,
24 kRegionComposition = 0x11,
25 kClutDefinition = 0x12,
27 kDisplayDefinition = 0x14,
28 kDisparitySignalling = 0x15,
29 kAlternativeClut = 0x16,
41 bool Parse(DvbSubSegmentType segment_type,
43 const uint8_t* payload,
45 std::vector<std::shared_ptr<TextSample>>* samples);
46 bool Flush(std::vector<std::shared_ptr<TextSample>>* samples);
49 friend class DvbSubParserTest;
54 bool ParsePageComposition(int64_t pts,
57 std::vector<std::shared_ptr<TextSample>>* samples);
58 bool ParseRegionComposition(
const uint8_t* data,
size_t size);
59 bool ParseClutDefinition(
const uint8_t* data,
size_t size);
60 bool ParseObjectData(int64_t pts,
const uint8_t* data,
size_t size);
61 bool ParseDisplayDefinition(
const uint8_t* data,
size_t size);
63 bool ParsePixelDataSubObject(
size_t sub_object_length,
68 bool Parse2BitPixelData(
bool is_top_fields,
71 bool Parse4BitPixelData(
bool is_top_fields,
74 bool Parse8BitPixelData(
bool is_top_fields,
All the methods that are virtual are virtual for mocking.