libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
encodeddesc.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 <promeki/namespace.h>
14#include <promeki/sharedptr.h>
15#include <promeki/fourcc.h>
16#include <promeki/string.h>
17#include <promeki/metadata.h>
18#include <promeki/imagedesc.h>
19
20PROMEKI_NAMESPACE_BEGIN
21
37class EncodedDesc {
38 PROMEKI_SHARED_FINAL(EncodedDesc)
39 public:
41 using Ptr = SharedPtr<EncodedDesc>;
42
44 using List = ::promeki::List<EncodedDesc>;
45
47 using PtrList = ::promeki::List<Ptr>;
48
50 EncodedDesc() = default;
51
56 EncodedDesc(const FourCC &codec) : _codec(codec) {}
57
63 EncodedDesc(const FourCC &codec, const ImageDesc &sourceImageDesc)
64 : _codec(codec), _sourceImageDesc(sourceImageDesc) {}
65
70 bool isValid() const { return _codec.value() != 0; }
71
76 FourCC codec() const { return _codec; }
77
82 void setCodec(const FourCC &codec) {
83 _codec = codec;
84 return;
85 }
86
91 const ImageDesc &sourceImageDesc() const { return _sourceImageDesc; }
92
97 void setSourceImageDesc(const ImageDesc &desc) {
98 _sourceImageDesc = desc;
99 return;
100 }
101
109 int quality() const { return _quality; }
110
115 void setQuality(int q) {
116 _quality = q;
117 return;
118 }
119
121 const Metadata &metadata() const { return _metadata; }
122
124 Metadata &metadata() { return _metadata; }
125
131 bool formatEquals(const EncodedDesc &other) const {
132 return _codec == other._codec && _quality == other._quality;
133 }
134
140 bool operator==(const EncodedDesc &other) const {
141 return formatEquals(other) && _metadata == other._metadata;
142 }
143
149 bool operator!=(const EncodedDesc &other) const { return !(*this == other); }
150
155 String toString() const;
156
158 operator String() const { return toString(); }
159
160 private:
161 FourCC _codec = FourCC('\0', '\0', '\0', '\0');
162 ImageDesc _sourceImageDesc;
163 int _quality = -1;
164 Metadata _metadata;
165};
166
167PROMEKI_NAMESPACE_END
168
169PROMEKI_FORMAT_VIA_TOSTRING(promeki::EncodedDesc);
170
171#endif // PROMEKI_ENABLE_PROAV