libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
contentlightlevel.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
13#include <cstdint>
14#include <promeki/namespace.h>
15#include <promeki/string.h>
16#include <promeki/error.h>
17#include <promeki/result.h>
18#include <promeki/datatype.h>
19
20PROMEKI_NAMESPACE_BEGIN
21
22class DataStream;
23
54class ContentLightLevel {
55 public:
56 PROMEKI_DATATYPE(ContentLightLevel, DataTypeContentLightLevel, 1)
57
58
59 Error writeToStream(DataStream &s) const;
61 template <uint32_t V> static Result<ContentLightLevel> readFromStream(DataStream &s);
62
63 ContentLightLevel() = default;
64
65 ContentLightLevel(uint32_t maxCLL, uint32_t maxFALL) : _maxCLL(maxCLL), _maxFALL(maxFALL) {}
66
67 bool isValid() const { return _maxCLL > 0; }
68
69 uint32_t maxCLL() const { return _maxCLL; }
70 uint32_t maxFALL() const { return _maxFALL; }
71
72 void setMaxCLL(uint32_t v) { _maxCLL = v; }
73 void setMaxFALL(uint32_t v) { _maxFALL = v; }
74
75 bool operator==(const ContentLightLevel &o) const {
76 return _maxCLL == o._maxCLL && _maxFALL == o._maxFALL;
77 }
78 bool operator!=(const ContentLightLevel &o) const { return !(*this == o); }
79
80 String toString() const;
81
82 private:
83 uint32_t _maxCLL = 0;
84 uint32_t _maxFALL = 0;
85};
86
87PROMEKI_NAMESPACE_END
88
89#endif // PROMEKI_ENABLE_CORE