MCPcopy Create free account
hub / github.com/IENT/YUView / parse_ATSC1_data

Function parse_ATSC1_data

YUViewLib/src/parser/Subtitles/AnnexBItuTT35.cpp:43–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41using namespace parser::reader;
42
43void parse_ATSC1_data(SubByteReaderLogging &reader)
44{
45 SubByteReaderLoggingSubLevel s(reader, "ATSC1_data");
46
47 unsigned user_data_type_code = reader.readBits(
48 "user_data_type_code",
49 8,
50 Options().withMeaningVector({"SCTE/ATSC Reserved", "cc_data() / DTV CC", "bar_data()"}));
51
52 if (user_data_type_code == 0x03)
53 {
54 // cc_data() - CEA-708
55 reader.readFlag("process_em_data_flag");
56 reader.readFlag("process_cc_data_flag");
57 reader.readFlag("additional_data_flag");
58 unsigned cc_count = reader.readBits("cc_count", 5);
59 reader.readBits("em_data", 8);
60
61 if (reader.nrBytesLeft() > cc_count * 3 + 1)
62 {
63 // Possibly, the count is wrong.
64 if ((reader.nrBytesLeft() - 1) % 3 == 0)
65 cc_count = unsigned(reader.nrBytesLeft() - 1) / 3;
66 }
67
68 // Now should follow (cc_count * 24 bits of cc_data_pkts)
69 // Just display the raw bytes of the payload
70 for (unsigned int i = 0; i < cc_count; i++)
71 {
72 parser::subtitle::sub_608::parse608DataPayloadCCDataPacket(reader);
73 }
74
75 reader.readBits("marker_bits", 8);
76 // The ATSC marker_bits indicator should be 255
77
78 // ATSC_reserved_user_data
79 int idx = 0;
80 while (reader.canReadBits(8))
81 {
82 reader.readBits(parser::formatArray("ATSC_reserved_user_data", idx), 8);
83 idx++;
84 }
85 }
86}
87
88} // namespace
89

Callers 1

Calls 6

OptionsClass · 0.85
formatArrayFunction · 0.85
readFlagMethod · 0.80
nrBytesLeftMethod · 0.80
canReadBitsMethod · 0.80
readBitsMethod · 0.45

Tested by

no test coverage detected