11#include <promeki/config.h>
12#if PROMEKI_ENABLE_CORE
26#if PROMEKI_ENABLE_NETWORK
30PROMEKI_NAMESPACE_BEGIN
64class Metadata :
public VariantDatabase<"Metadata"> {
67 using Base = VariantDatabase<
"Metadata">;
76 PROMEKI_DECLARE_ID(Timecode,
78 .setType(DataTypeTimecode)
79 .setDefault(promeki::Timecode())
80 .setDescription(
"SMPTE timecode associated with this media unit."));
82#if PROMEKI_ENABLE_PROAV
93 PROMEKI_DECLARE_ID(Subtitle,
95 .setType(DataTypeSubtitle)
96 .setDefault(promeki::Subtitle())
98 "Subtitle cue active at this media unit (start <= ts < end)."));
114 PROMEKI_DECLARE_ID(Transcript,
116 .setType(DataTypeTranscript)
117 .setDefault(promeki::Transcript())
119 "Raw transcript utterance attached to this media unit."));
123 PROMEKI_DECLARE_ID(Gamma, VariantSpec()
124 .setType(DataTypeDouble)
127 .setDescription(
"Gamma / transfer-function exponent."));
130 PROMEKI_DECLARE_ID(Title, VariantSpec()
131 .setType(DataTypeString)
132 .setDefault(String())
133 .setDescription(
"Title of the media."));
136 PROMEKI_DECLARE_ID(Copyright, VariantSpec()
137 .setType(DataTypeString)
138 .setDefault(String())
139 .setDescription(
"Copyright notice."));
142 PROMEKI_DECLARE_ID(Software, VariantSpec()
143 .setType(DataTypeString)
144 .setDefault(String())
145 .setDescription(
"Software that created or modified the media."));
148 PROMEKI_DECLARE_ID(Artist, VariantSpec()
149 .setType(DataTypeString)
150 .setDefault(String())
151 .setDescription(
"Artist or creator name."));
154 PROMEKI_DECLARE_ID(Comment, VariantSpec()
155 .setType(DataTypeString)
156 .setDefault(String())
157 .setDescription(
"Free-form comment."));
160 PROMEKI_DECLARE_ID(Date, VariantSpec()
161 .setType(DataTypeString)
162 .setDefault(String())
163 .setDescription(
"Creation or origination date."));
166 PROMEKI_DECLARE_ID(Album, VariantSpec()
167 .setType(DataTypeString)
168 .setDefault(String())
169 .setDescription(
"Album name (audio media)."));
172 PROMEKI_DECLARE_ID(License, VariantSpec()
173 .setType(DataTypeString)
174 .setDefault(String())
175 .setDescription(
"License information."));
178 PROMEKI_DECLARE_ID(TrackNumber, VariantSpec()
179 .setTypes({DataTypeInt32, DataTypeString})
180 .setDefault(String())
181 .setDescription(
"Track number (audio media)."));
184 PROMEKI_DECLARE_ID(Genre, VariantSpec()
185 .setType(DataTypeString)
186 .setDefault(String())
187 .setDescription(
"Genre (audio media)."));
190 PROMEKI_DECLARE_ID(EnableBWF, VariantSpec()
191 .setType(DataTypeBool)
193 .setDescription(
"Enable Broadcast Wave Format metadata."));
196 PROMEKI_DECLARE_ID(Description, VariantSpec()
197 .setType(DataTypeString)
198 .setDefault(String())
199 .setDescription(
"Human-readable description of the content."));
202 PROMEKI_DECLARE_ID(Originator, VariantSpec()
203 .setType(DataTypeString)
204 .setDefault(String())
205 .setDescription(
"BWF originator name."));
208 PROMEKI_DECLARE_ID(OriginatorReference, VariantSpec()
209 .setTypes({DataTypeString, DataTypeUUID})
210 .setDefault(String())
211 .setDescription(
"BWF originator reference."));
214 PROMEKI_DECLARE_ID(OriginationDateTime, VariantSpec()
215 .setType(DataTypeString)
216 .setDefault(String())
217 .setDescription(
"BWF origination date and time."));
220 PROMEKI_DECLARE_ID(FrameRate, VariantSpec()
221 .setTypes({DataTypeRational, DataTypeDouble,
223 .setDefault(Rational<int>())
224 .setDescription(
"Frame rate of the associated video."));
233 .setType(DataTypeString)
234 .setDefault(String())
235 .setDescription(
"Source of the FrameRate value (file, config, or default)."));
238 PROMEKI_DECLARE_ID(UMID, VariantSpec()
239 .setTypes({DataTypeString, DataTypeUMID})
240 .setDefault(String())
241 .setDescription(
"SMPTE UMID (Unique Material Identifier)."));
244 PROMEKI_DECLARE_ID(CodingHistory, VariantSpec()
245 .setType(DataTypeString)
246 .setDefault(String())
247 .setDescription(
"BWF coding history string."));
254 PROMEKI_DECLARE_ID(CompressionLevel,
256 .setType(DataTypeInt32)
257 .setDefault(int32_t(0))
258 .setDescription(
"Compression level hint for lossy codecs."));
261 PROMEKI_DECLARE_ID(EnableVBR, VariantSpec()
262 .setType(DataTypeBool)
264 .setDescription(
"Enable variable bit-rate encoding."));
267 PROMEKI_DECLARE_ID(VBRQuality, VariantSpec()
268 .setType(DataTypeInt32)
269 .setDefault(int32_t(0))
270 .setDescription(
"VBR quality setting (codec-specific)."));
274 PROMEKI_DECLARE_ID(CompressedSize,
276 .setType(DataTypeInt32)
277 .setDefault(int32_t(0))
279 .setDescription(
"Internal allocation hint for compressed pixel formats."));
286 PROMEKI_DECLARE_ID(EndOfStream, VariantSpec()
287 .setType(DataTypeBool)
289 .setDescription(
"Signals end-of-stream to downstream nodes."));
299 PROMEKI_DECLARE_ID(Corrupt, VariantSpec()
300 .setType(DataTypeBool)
302 .setDescription(
"Media unit carries corrupt data."));
305 PROMEKI_DECLARE_ID(CorruptReason,
307 .setType(DataTypeString)
308 .setDefault(String())
309 .setDescription(
"Human-readable reason for a Corrupt marking."));
312 PROMEKI_DECLARE_ID(FrameNumber, VariantSpec()
313 .setType(DataTypeFrameNumber)
314 .setDefault(promeki::FrameNumber())
315 .setDescription(
"Frame sequence number within a stream."));
323 PROMEKI_DECLARE_ID(Duration,
325 .setType(DataTypeMediaDuration)
326 .setDefault(promeki::MediaDuration())
327 .setDescription(
"Clip-level duration: starting frame plus length."));
335 PROMEKI_DECLARE_ID(CaptureTime,
337 .setType(DataTypeMediaTimeStamp)
338 .setDefault(promeki::MediaTimeStamp())
339 .setDescription(
"Timestamp when the library or device captured this data."));
350 PROMEKI_DECLARE_ID(FrameBridgeTimeStamp,
352 .setType(DataTypeMediaTimeStamp)
353 .setDefault(promeki::MediaTimeStamp())
354 .setDescription(
"FrameBridge publish timestamp (SystemMonotonic)."));
361 PROMEKI_DECLARE_ID(RtpTimestamp, VariantSpec()
362 .setType(DataTypeUInt32)
363 .setDefault(uint32_t(0))
364 .setDescription(
"RTP timestamp from the packet header."));
367 PROMEKI_DECLARE_ID(RtpPacketCount,
369 .setType(DataTypeInt32)
370 .setDefault(int32_t(0))
372 .setDescription(
"Number of RTP packets that composed this essence."));
374#if PROMEKI_ENABLE_PROAV
391 .setType(DataTypeAudioMarkerList)
392 .setDefault(AudioMarkerList())
393 .setDescription(
"Per-payload audio event markers (silence fills, "
394 "concealed loss, discontinuities, …)."));
397#if PROMEKI_ENABLE_NETWORK
399 PROMEKI_DECLARE_ID(PtpGrandmasterId,
401 .setType(DataTypeEUI64)
403 .setDescription(
"PTP grandmaster clock identity (EUI-64)."));
406 PROMEKI_DECLARE_ID(PtpDomainNumber, VariantSpec()
407 .setType(DataTypeUInt8)
408 .setDefault(uint8_t(0))
409 .setMax(uint8_t(127))
410 .setDescription(
"PTP domain number (0-127)."));
414 PROMEKI_DECLARE_ID(FrameRepeated,
416 .setType(DataTypeInt32)
417 .setDefault(int32_t(0))
419 .setDescription(
"Number of times frame repeated due to underrun."));
422 PROMEKI_DECLARE_ID(FrameDropped, VariantSpec()
423 .setType(DataTypeInt32)
424 .setDefault(int32_t(0))
426 .setDescription(
"Number of frames dropped before this one."));
441 .setType(DataTypeInt32)
442 .setDefault(int32_t(0))
445 "Input frames dropped between this FrameSync emit and the previous one."));
456 .setType(DataTypeInt32)
457 .setDefault(int32_t(0))
459 .setDescription(
"Position within a FrameSync repeat sequence (0 = fresh emit)."));
462 PROMEKI_DECLARE_ID(FrameLate, VariantSpec()
463 .setType(DataTypeBool)
465 .setDescription(
"Frame arrived later than scheduled."));
468 PROMEKI_DECLARE_ID(FrameKeyframe, VariantSpec()
469 .setType(DataTypeBool)
471 .setDescription(
"Frame is a keyframe / intra frame."));
477 PROMEKI_DECLARE_ID(ForceKeyframe,
479 .setType(DataTypeBool)
481 .setDescription(
"Request encoder to emit an IDR for this frame."));
485 PROMEKI_DECLARE_ID(MediaDescChanged,
487 .setType(DataTypeBool)
489 .setDescription(
"Frame's MediaDesc differs from previously reported."));
502 PROMEKI_DECLARE_ID(SessionHostname,
504 .setType(DataTypeString)
505 .setDefault(String())
506 .setDescription(
"Runtime hostname of the machine that produced the file."));
509 PROMEKI_DECLARE_ID(SessionProcessId, VariantSpec()
510 .setType(DataTypeInt64)
511 .setDefault(int64_t(0))
512 .setDescription(
"Writer process ID at capture time."));
518 PROMEKI_DECLARE_ID(LibraryBuildInfo,
520 .setType(DataTypeString)
521 .setDefault(String())
522 .setDescription(
"libpromeki build identity (version, repo, date, host)."));
526 PROMEKI_DECLARE_ID(LibraryPlatform,
528 .setType(DataTypeString)
529 .setDefault(String())
530 .setDescription(
"Platform / compiler / C++ standard of the writer."));
534 PROMEKI_DECLARE_ID(LibraryFeatures,
536 .setType(DataTypeString)
537 .setDefault(String())
538 .setDescription(
"Library feature flags enabled at build time."));
545 PROMEKI_DECLARE_ID(FileOrigName, VariantSpec()
546 .setType(DataTypeString)
547 .setDefault(String())
548 .setDescription(
"Original source filename."));
551 PROMEKI_DECLARE_ID(Project, VariantSpec()
552 .setType(DataTypeString)
553 .setDefault(String())
554 .setDescription(
"Project name."));
557 PROMEKI_DECLARE_ID(Reel, VariantSpec()
558 .setType(DataTypeString)
559 .setDefault(String())
560 .setDescription(
"Reel or input device name."));
567 PROMEKI_DECLARE_ID(FilmMfgID, VariantSpec()
568 .setType(DataTypeString)
569 .setDefault(String())
570 .setDescription(
"Film manufacturer ID code (2 chars)."));
573 PROMEKI_DECLARE_ID(FilmType, VariantSpec()
574 .setType(DataTypeString)
575 .setDefault(String())
576 .setDescription(
"Film type (2 chars)."));
579 PROMEKI_DECLARE_ID(FilmOffset, VariantSpec()
580 .setType(DataTypeString)
581 .setDefault(String())
582 .setDescription(
"Film offset in perfs (2 chars)."));
585 PROMEKI_DECLARE_ID(FilmPrefix, VariantSpec()
586 .setType(DataTypeString)
587 .setDefault(String())
588 .setDescription(
"Film prefix (6 chars)."));
591 PROMEKI_DECLARE_ID(FilmCount, VariantSpec()
592 .setType(DataTypeString)
593 .setDefault(String())
594 .setDescription(
"Film count (4 chars)."));
597 PROMEKI_DECLARE_ID(FilmFormat, VariantSpec()
598 .setType(DataTypeString)
599 .setDefault(String())
600 .setDescription(
"Film format (e.g. Academy)."));
603 PROMEKI_DECLARE_ID(FilmSeqPos,
605 .setType(DataTypeInt32)
606 .setDefault(int32_t(0))
608 .setDescription(
"Sequence position (frame number in sequence)."));
611 PROMEKI_DECLARE_ID(FilmSeqLen, VariantSpec()
612 .setType(DataTypeInt32)
613 .setDefault(int32_t(0))
615 .setDescription(
"Sequence length (total frames in sequence)."));
618 PROMEKI_DECLARE_ID(FilmHoldCount,
620 .setType(DataTypeInt32)
621 .setDefault(int32_t(1))
623 .setDescription(
"Held count (1 = default, >1 = repeated frame)."));
626 PROMEKI_DECLARE_ID(FilmShutter, VariantSpec()
627 .setType(DataTypeDouble)
631 .setDescription(
"Film shutter angle in degrees."));
634 PROMEKI_DECLARE_ID(FilmFrameID, VariantSpec()
635 .setType(DataTypeString)
636 .setDefault(String())
637 .setDescription(
"Film frame identification (e.g. keycode)."));
640 PROMEKI_DECLARE_ID(FilmSlate, VariantSpec()
641 .setType(DataTypeString)
642 .setDefault(String())
643 .setDescription(
"Film slate information."));
650 PROMEKI_DECLARE_ID(FieldID,
652 .setType(DataTypeInt32)
653 .setDefault(int32_t(0))
654 .setRange(int32_t(0), int32_t(1))
655 .setDescription(
"Field number within an interlaced frame (0 or 1)."));
662 PROMEKI_DECLARE_ID(TransferCharacteristic,
664 .setType(DataTypeInt32)
665 .setDefault(int32_t(0))
667 .setDescription(
"SMPTE 268M transfer characteristic code."));
670 PROMEKI_DECLARE_ID(Colorimetric,
672 .setType(DataTypeInt32)
673 .setDefault(int32_t(0))
675 .setDescription(
"SMPTE 268M colorimetric specification code."));
681 .setType(DataTypeInt32)
682 .setDefault(int32_t(0))
684 .setDescription(
"Image orientation code (0 = left-to-right, top-to-bottom)."));
691 PROMEKI_DECLARE_ID(MasteringDisplay,
693 .setType(DataTypeMasteringDisplay)
694 .setDescription(
"Mastering display color volume (SMPTE ST 2086)."));
697 PROMEKI_DECLARE_ID(ContentLightLevel,
699 .setType(DataTypeContentLightLevel)
700 .setDescription(
"Content light level info (MaxCLL / MaxFALL)."));
725 PROMEKI_DECLARE_ID(VideoColorPrimaries,
727 .setType(DataTypeEnum)
728 .setDefault(promeki::ColorPrimaries::Unspecified)
729 .setEnumType(promeki::ColorPrimaries::Type)
730 .setDescription(
"VUI color primaries (ISO/IEC 23091-4)."));
733 PROMEKI_DECLARE_ID(VideoTransferCharacteristics,
735 .setType(DataTypeEnum)
736 .setDefault(promeki::TransferCharacteristics::Unspecified)
737 .setEnumType(promeki::TransferCharacteristics::Type)
738 .setDescription(
"VUI transfer characteristics (ISO/IEC 23091-4)."));
741 PROMEKI_DECLARE_ID(VideoMatrixCoefficients,
743 .setType(DataTypeEnum)
744 .setDefault(promeki::MatrixCoefficients::Unspecified)
745 .setEnumType(promeki::MatrixCoefficients::Type)
746 .setDescription(
"VUI matrix coefficients (ISO/IEC 23091-4)."));
749 PROMEKI_DECLARE_ID(VideoRange, VariantSpec()
750 .setType(DataTypeEnum)
751 .setDefault(promeki::VideoRange::Unknown)
752 .setEnumType(promeki::VideoRange::Type)
753 .setDescription(
"VUI video range (Unknown / Limited / Full)."));
767 PROMEKI_DECLARE_ID(VideoScanMode, VariantSpec()
768 .setType(DataTypeEnum)
769 .setDefault(promeki::VideoScanMode::Unknown)
770 .setEnumType(promeki::VideoScanMode::Type)
771 .setDescription(
"Raster scan mode "
772 "(Progressive / Interlaced*)."));
789 PROMEKI_DECLARE_ID(CodecFrameAvgQP, VariantSpec()
790 .setType(DataTypeInt32)
791 .setDefault(int32_t(0))
793 .setDescription(
"Average QP of the encoded frame."));
798 PROMEKI_DECLARE_ID(CodecFrameSatd,
800 .setType(DataTypeInt32)
801 .setDefault(int32_t(0))
803 .setDescription(
"Frame SATD (Sum of Absolute Transformed Differences)."));
812 PROMEKI_DECLARE_ID(CodecEncodeOrderIdx, VariantSpec()
813 .setType(DataTypeUInt32)
814 .setDefault(uint32_t(0))
815 .setDescription(
"Frame index in encode order."));
818 PROMEKI_DECLARE_ID(CodecDisplayOrderIdx, VariantSpec()
819 .setType(DataTypeUInt32)
820 .setDefault(uint32_t(0))
821 .setDescription(
"Frame index in display order."));
830 PROMEKI_DECLARE_ID(CodecTemporalId,
832 .setType(DataTypeInt32)
833 .setDefault(int32_t(0))
835 .setDescription(
"Temporal scalability layer ID (0 = base layer)."));
844 PROMEKI_DECLARE_ID(CodecGopPosition,
846 .setType(DataTypeInt32)
847 .setDefault(int32_t(0))
849 .setDescription(
"Offset from last keyframe (0 = keyframe)."));
858 PROMEKI_DECLARE_ID(CodecIntraBlockCount,
860 .setType(DataTypeInt32)
861 .setDefault(int32_t(0))
863 .setDescription(
"Count of intra-coded blocks (codec-specific unit)."));
871 PROMEKI_DECLARE_ID(CodecInterBlockCount,
873 .setType(DataTypeInt32)
874 .setDefault(int32_t(0))
876 .setDescription(
"Count of inter-coded blocks (codec-specific unit)."));
884 PROMEKI_DECLARE_ID(CodecAvgMotionVectorX,
886 .setType(DataTypeInt32)
887 .setDefault(int32_t(0))
888 .setDescription(
"Average motion vector X (codec-defined units)."));
892 PROMEKI_DECLARE_ID(CodecAvgMotionVectorY,
894 .setType(DataTypeInt32)
895 .setDefault(int32_t(0))
896 .setDescription(
"Average motion vector Y (codec-defined units)."));
922 PROMEKI_DECLARE_ID(CodecParameterSets,
924 .setType(DataTypeString)
925 .setDefault(String())
926 .setDescription(
"Out-of-band codec parameter sets "
927 "(Annex-B SPS/PPS/VPS or AV1 sequence header)."));
943 static inline const ID FrontendX = declareID(
944 "Frontend.X", VariantSpec()
945 .setType(DataTypeDouble)
947 .setDescription(
"Frontend X coordinate (pixels) for graphical editors."));
950 static inline const ID FrontendY = declareID(
951 "Frontend.Y", VariantSpec()
952 .setType(DataTypeDouble)
954 .setDescription(
"Frontend Y coordinate (pixels) for graphical editors."));
965 static String idToString(ID
id) {
return id.name(); }
972 static ID stringToID(
const String &val) {
return ID(val); }
980 static Metadata fromJson(
const JsonObject &json, Error *err =
nullptr);
997 String toString(
unsigned int indent = 0)
const;
1016 static Metadata fromString(
const String &str, Error *err =
nullptr);
1019 Metadata() =
default;
1025 StringList dump()
const;
1032 bool operator==(
const Metadata &other)
const;
1065 void applyMediaIOWriteDefaults();
1068PROMEKI_NAMESPACE_END