11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
23PROMEKI_NAMESPACE_BEGIN
113 PROMEKI_DATATYPE(Cea708Cdp, DataTypeCea708Cdp, 1)
116 static constexpr uint16_t Identifier = 0x9669;
119 static constexpr uint8_t FooterId = 0x74;
122 static constexpr uint8_t TimeCodeSectionId = 0x71;
125 static constexpr uint8_t CcDataSectionId = 0x72;
128 static constexpr uint8_t CcSvcInfoSectionId = 0x73;
144 bool operator==(
const CcData &o)
const {
145 return valid == o.valid && type == o.type && b1 == o.b1 && b2 == o.b2;
147 bool operator!=(
const CcData &o)
const {
return !(*
this == o); }
151 using CcDataList = ::promeki::List<CcData>;
156 uint8_t frameRateCode = 0;
159 bool timeCodePresent =
false;
162 bool ccDataPresent =
false;
166 bool svcInfoPresent =
false;
169 bool svcInfoStart =
false;
172 bool svcInfoChange =
false;
175 bool svcInfoComplete =
false;
178 bool captionServiceActive =
false;
182 uint16_t sequenceCounter = 0;
204 bool tcFieldFlag =
false;
221 Cea708Cdp() =
default;
237 Cea708Cdp(uint8_t frameRateCode, CcDataList ccData, uint16_t sequenceCounter = 0)
238 : frameRateCode(frameRateCode)
239 , ccDataPresent(!ccData.isEmpty())
240 , captionServiceActive(!ccData.isEmpty())
241 , sequenceCounter(sequenceCounter)
242 , ccData(std::move(ccData)) {}
256 Buffer toBuffer()
const;
270 static Result<Cea708Cdp> fromBuffer(
const void *data,
size_t size);
273 static Result<Cea708Cdp> fromBuffer(
const Buffer &buf);
286 JsonObject toJson()
const;
299 bool operator==(
const Cea708Cdp &o)
const;
302 bool operator!=(
const Cea708Cdp &o)
const {
return !(*
this == o); }
313 String toString()
const;
323 Error writeToStream(DataStream &s)
const;
329 template <u
int32_t V>
static Result<Cea708Cdp> readFromStream(DataStream &s);