libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
encodeddesc.h
Go to the documentation of this file.
1
8#pragma once
9
12#include <promeki/core/fourcc.h>
13#include <promeki/core/string.h>
16
18
30 public:
33
36
39
41 EncodedDesc() = default;
42
47 EncodedDesc(const FourCC &codec) : _codec(codec) { }
48
55 _codec(codec), _sourceImageDesc(sourceImageDesc) { }
56
61 bool isValid() const {
62 return _codec.value() != 0;
63 }
64
69 FourCC codec() const {
70 return _codec;
71 }
72
77 void setCodec(const FourCC &codec) {
78 _codec = codec;
79 return;
80 }
81
86 const ImageDesc &sourceImageDesc() const {
87 return _sourceImageDesc;
88 }
89
94 void setSourceImageDesc(const ImageDesc &desc) {
95 _sourceImageDesc = desc;
96 return;
97 }
98
106 int quality() const {
107 return _quality;
108 }
109
114 void setQuality(int q) {
115 _quality = q;
116 return;
117 }
118
120 const Metadata &metadata() const {
121 return _metadata;
122 }
123
126 return _metadata;
127 }
128
134 bool formatEquals(const EncodedDesc &other) const {
135 return _codec == other._codec &&
136 _quality == other._quality;
137 }
138
144 bool operator==(const EncodedDesc &other) const {
145 return formatEquals(other) &&
146 _metadata == other._metadata;
147 }
148
154 bool operator!=(const EncodedDesc &other) const {
155 return !(*this == other);
156 }
157
163
165 operator String() const {
166 return toString();
167 }
168
169 private:
170 FourCC _codec = FourCC('\0', '\0', '\0', '\0');
171 ImageDesc _sourceImageDesc;
172 int _quality = -1;
173 Metadata _metadata;
174};
175
Describes a compressed or encoded media format.
Definition encodeddesc.h:28
EncodedDesc()=default
Constructs an invalid (default) encoded description.
EncodedDesc(const FourCC &codec, const ImageDesc &sourceImageDesc)
Constructs an encoded description with codec and source image format.
Definition encodeddesc.h:54
void setSourceImageDesc(const ImageDesc &desc)
Sets the source image description.
Definition encodeddesc.h:94
EncodedDesc(const FourCC &codec)
Constructs an encoded description with the given codec.
Definition encodeddesc.h:47
const ImageDesc & sourceImageDesc() const
Returns the source image description this was encoded from.
Definition encodeddesc.h:86
bool isValid() const
Returns true if this encoded description has a valid (non-zero) codec.
Definition encodeddesc.h:61
bool operator==(const EncodedDesc &other) const
Returns true if both encoded descriptions are fully equal, including metadata.
Definition encodeddesc.h:144
String toString() const
Returns a human-readable string representation.
void setQuality(int q)
Sets the codec-specific quality parameter.
Definition encodeddesc.h:114
promeki::List< Ptr > PtrList
List of shared pointers to EncodedDesc.
Definition encodeddesc.h:38
bool operator!=(const EncodedDesc &other) const
Returns true if the encoded descriptions are not equal.
Definition encodeddesc.h:154
int quality() const
Returns the codec-specific quality parameter.
Definition encodeddesc.h:106
bool formatEquals(const EncodedDesc &other) const
Returns true if the format fields match (codec, quality).
Definition encodeddesc.h:134
const Metadata & metadata() const
Returns a const reference to the metadata.
Definition encodeddesc.h:120
Metadata & metadata()
Returns a mutable reference to the metadata.
Definition encodeddesc.h:125
void setCodec(const FourCC &codec)
Sets the codec identifier.
Definition encodeddesc.h:77
promeki::List< EncodedDesc > List
Plain value list of EncodedDesc objects.
Definition encodeddesc.h:35
FourCC codec() const
Returns the codec identifier.
Definition encodeddesc.h:69
SharedPtr< EncodedDesc > Ptr
Shared pointer type for EncodedDesc.
Definition encodeddesc.h:32
A four-character code (FourCC) identifier.
Definition fourcc.h:25
constexpr uint32_t value() const
Returns the packed 32-bit integer value.
Definition fourcc.h:54
Describes the format and layout of a single image.
Definition imagedesc.h:33
Dynamic array container wrapping std::vector.
Definition list.h:40
List()=default
Default constructor. Creates an empty list.
Key-value metadata container using typed Variant values.
Definition metadata.h:68
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19
#define PROMEKI_SHARED_FINAL(TYPE)
Macro for non-polymorphic native shared objects.
Definition sharedptr.h:88