libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
hdrstaticmetadata.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
13#include <cstdint>
14#include <promeki/buffer.h>
16#include <promeki/enums.h>
17#include <promeki/error.h>
18#include <promeki/json.h>
20#include <promeki/namespace.h>
21#include <promeki/result.h>
22#include <promeki/string.h>
23
24PROMEKI_NAMESPACE_BEGIN
25
26class DataStream;
27
118class HdrStaticMetadata {
119 public:
120 PROMEKI_DATATYPE(HdrStaticMetadata, DataTypeHdrStaticMetadata, 1)
121
122
123 static constexpr uint8_t InfoFrameType = 0x87;
124
126 static constexpr uint8_t InfoFrameVersion = 1;
127
129 static constexpr uint8_t DescriptorIdType1 = 0;
130
135 enum WireEotf : uint8_t {
136 EotfSdrGamma = 0,
137 EotfHdrGamma = 1,
138 EotfSmpte2084 = 2,
139 EotfHlg = 3,
140 };
141
143 static constexpr size_t Type1BodySize = 26;
144
158 HdrStaticMetadata()
159 : _md(CIEPoint(0.0, 0.0), CIEPoint(0.0, 0.0), CIEPoint(0.0, 0.0), CIEPoint(0.0, 0.0),
160 0.0, 0.0),
161 _cll(0, 0) {}
162
170 HdrStaticMetadata(TransferCharacteristics eotf, MasteringDisplay md, ContentLightLevel cll)
171 : _eotf(eotf), _md(std::move(md)), _cll(std::move(cll)) {}
172
174 TransferCharacteristics eotf() const { return _eotf; }
175
177 void setEotf(TransferCharacteristics v) { _eotf = v; }
178
180 const MasteringDisplay &masteringDisplay() const { return _md; }
181
183 void setMasteringDisplay(const MasteringDisplay &v) { _md = v; }
184
186 const ContentLightLevel &contentLightLevel() const { return _cll; }
187
189 void setContentLightLevel(const ContentLightLevel &v) { _cll = v; }
190
200 static uint8_t wireEotfFor(TransferCharacteristics tc);
201
211 static TransferCharacteristics transferFromWireEotf(uint8_t wire);
212
226 Buffer toBuffer() const;
227
241 static Result<HdrStaticMetadata> fromBuffer(const void *data, size_t size);
242
244 static Result<HdrStaticMetadata> fromBuffer(const Buffer &buf);
245
271 JsonObject toJson() const;
272
274 bool operator==(const HdrStaticMetadata &o) const;
275
277 bool operator!=(const HdrStaticMetadata &o) const { return !(*this == o); }
278
280 String toString() const;
281
290 Error writeToStream(DataStream &s) const;
291
296 template <uint32_t V> static Result<HdrStaticMetadata> readFromStream(DataStream &s);
297
298 private:
299 TransferCharacteristics _eotf = TransferCharacteristics::Unspecified;
300 MasteringDisplay _md;
301 ContentLightLevel _cll;
302};
303
304PROMEKI_NAMESPACE_END
305
306#endif // PROMEKI_ENABLE_PROAV