11#if PROMEKI_ENABLE_CORE
13#include <promeki/config.h>
23#if PROMEKI_ENABLE_NETWORK
27PROMEKI_NAMESPACE_BEGIN
61class Metadata :
public VariantDatabase<"Metadata"> {
64 using Base = VariantDatabase<
"Metadata">;
73 PROMEKI_DECLARE_ID(Timecode,
75 .setType(DataTypeTimecode)
76 .setDefault(promeki::Timecode())
77 .setDescription(
"SMPTE timecode associated with this media unit."));
79#if PROMEKI_ENABLE_PROAV
90 PROMEKI_DECLARE_ID(Subtitle,
92 .setType(DataTypeSubtitle)
93 .setDefault(promeki::Subtitle())
95 "Subtitle cue active at this media unit (start <= ts < end)."));
99 PROMEKI_DECLARE_ID(Gamma, VariantSpec()
100 .setType(DataTypeDouble)
103 .setDescription(
"Gamma / transfer-function exponent."));
106 PROMEKI_DECLARE_ID(Title, VariantSpec()
107 .setType(DataTypeString)
108 .setDefault(String())
109 .setDescription(
"Title of the media."));
112 PROMEKI_DECLARE_ID(Copyright, VariantSpec()
113 .setType(DataTypeString)
114 .setDefault(String())
115 .setDescription(
"Copyright notice."));
118 PROMEKI_DECLARE_ID(Software, VariantSpec()
119 .setType(DataTypeString)
120 .setDefault(String())
121 .setDescription(
"Software that created or modified the media."));
124 PROMEKI_DECLARE_ID(Artist, VariantSpec()
125 .setType(DataTypeString)
126 .setDefault(String())
127 .setDescription(
"Artist or creator name."));
130 PROMEKI_DECLARE_ID(Comment, VariantSpec()
131 .setType(DataTypeString)
132 .setDefault(String())
133 .setDescription(
"Free-form comment."));
136 PROMEKI_DECLARE_ID(Date, VariantSpec()
137 .setType(DataTypeString)
138 .setDefault(String())
139 .setDescription(
"Creation or origination date."));
142 PROMEKI_DECLARE_ID(Album, VariantSpec()
143 .setType(DataTypeString)
144 .setDefault(String())
145 .setDescription(
"Album name (audio media)."));
148 PROMEKI_DECLARE_ID(License, VariantSpec()
149 .setType(DataTypeString)
150 .setDefault(String())
151 .setDescription(
"License information."));
154 PROMEKI_DECLARE_ID(TrackNumber, VariantSpec()
155 .setTypes({DataTypeInt32, DataTypeString})
156 .setDefault(String())
157 .setDescription(
"Track number (audio media)."));
160 PROMEKI_DECLARE_ID(Genre, VariantSpec()
161 .setType(DataTypeString)
162 .setDefault(String())
163 .setDescription(
"Genre (audio media)."));
166 PROMEKI_DECLARE_ID(EnableBWF, VariantSpec()
167 .setType(DataTypeBool)
169 .setDescription(
"Enable Broadcast Wave Format metadata."));
172 PROMEKI_DECLARE_ID(Description, VariantSpec()
173 .setType(DataTypeString)
174 .setDefault(String())
175 .setDescription(
"Human-readable description of the content."));
178 PROMEKI_DECLARE_ID(Originator, VariantSpec()
179 .setType(DataTypeString)
180 .setDefault(String())
181 .setDescription(
"BWF originator name."));
184 PROMEKI_DECLARE_ID(OriginatorReference, VariantSpec()
185 .setTypes({DataTypeString, DataTypeUUID})
186 .setDefault(String())
187 .setDescription(
"BWF originator reference."));
190 PROMEKI_DECLARE_ID(OriginationDateTime, VariantSpec()
191 .setType(DataTypeString)
192 .setDefault(String())
193 .setDescription(
"BWF origination date and time."));
196 PROMEKI_DECLARE_ID(FrameRate, VariantSpec()
197 .setTypes({DataTypeRational, DataTypeDouble,
199 .setDefault(Rational<int>())
200 .setDescription(
"Frame rate of the associated video."));
209 .setType(DataTypeString)
210 .setDefault(String())
211 .setDescription(
"Source of the FrameRate value (file, config, or default)."));
214 PROMEKI_DECLARE_ID(UMID, VariantSpec()
215 .setTypes({DataTypeString, DataTypeUMID})
216 .setDefault(String())
217 .setDescription(
"SMPTE UMID (Unique Material Identifier)."));
220 PROMEKI_DECLARE_ID(CodingHistory, VariantSpec()
221 .setType(DataTypeString)
222 .setDefault(String())
223 .setDescription(
"BWF coding history string."));
230 PROMEKI_DECLARE_ID(CompressionLevel,
232 .setType(DataTypeInt32)
233 .setDefault(int32_t(0))
234 .setDescription(
"Compression level hint for lossy codecs."));
237 PROMEKI_DECLARE_ID(EnableVBR, VariantSpec()
238 .setType(DataTypeBool)
240 .setDescription(
"Enable variable bit-rate encoding."));
243 PROMEKI_DECLARE_ID(VBRQuality, VariantSpec()
244 .setType(DataTypeInt32)
245 .setDefault(int32_t(0))
246 .setDescription(
"VBR quality setting (codec-specific)."));
250 PROMEKI_DECLARE_ID(CompressedSize,
252 .setType(DataTypeInt32)
253 .setDefault(int32_t(0))
255 .setDescription(
"Internal allocation hint for compressed pixel formats."));
262 PROMEKI_DECLARE_ID(EndOfStream, VariantSpec()
263 .setType(DataTypeBool)
265 .setDescription(
"Signals end-of-stream to downstream nodes."));
275 PROMEKI_DECLARE_ID(Corrupt, VariantSpec()
276 .setType(DataTypeBool)
278 .setDescription(
"Media unit carries corrupt data."));
281 PROMEKI_DECLARE_ID(CorruptReason,
283 .setType(DataTypeString)
284 .setDefault(String())
285 .setDescription(
"Human-readable reason for a Corrupt marking."));
288 PROMEKI_DECLARE_ID(FrameNumber, VariantSpec()
289 .setType(DataTypeFrameNumber)
290 .setDefault(promeki::FrameNumber())
291 .setDescription(
"Frame sequence number within a stream."));
299 PROMEKI_DECLARE_ID(Duration,
301 .setType(DataTypeMediaDuration)
302 .setDefault(promeki::MediaDuration())
303 .setDescription(
"Clip-level duration: starting frame plus length."));
311 PROMEKI_DECLARE_ID(CaptureTime,
313 .setType(DataTypeMediaTimeStamp)
314 .setDefault(promeki::MediaTimeStamp())
315 .setDescription(
"Timestamp when the library or device captured this data."));
326 PROMEKI_DECLARE_ID(FrameBridgeTimeStamp,
328 .setType(DataTypeMediaTimeStamp)
329 .setDefault(promeki::MediaTimeStamp())
330 .setDescription(
"FrameBridge publish timestamp (SystemMonotonic)."));
337 PROMEKI_DECLARE_ID(RtpTimestamp, VariantSpec()
338 .setType(DataTypeUInt32)
339 .setDefault(uint32_t(0))
340 .setDescription(
"RTP timestamp from the packet header."));
343 PROMEKI_DECLARE_ID(RtpPacketCount,
345 .setType(DataTypeInt32)
346 .setDefault(int32_t(0))
348 .setDescription(
"Number of RTP packets that composed this essence."));
350#if PROMEKI_ENABLE_PROAV
367 .setType(DataTypeAudioMarkerList)
368 .setDefault(AudioMarkerList())
369 .setDescription(
"Per-payload audio event markers (silence fills, "
370 "concealed loss, discontinuities, …)."));
373#if PROMEKI_ENABLE_NETWORK
375 PROMEKI_DECLARE_ID(PtpGrandmasterId,
377 .setType(DataTypeEUI64)
379 .setDescription(
"PTP grandmaster clock identity (EUI-64)."));
382 PROMEKI_DECLARE_ID(PtpDomainNumber, VariantSpec()
383 .setType(DataTypeUInt8)
384 .setDefault(uint8_t(0))
385 .setMax(uint8_t(127))
386 .setDescription(
"PTP domain number (0-127)."));
390 PROMEKI_DECLARE_ID(FrameRepeated,
392 .setType(DataTypeInt32)
393 .setDefault(int32_t(0))
395 .setDescription(
"Number of times frame repeated due to underrun."));
398 PROMEKI_DECLARE_ID(FrameDropped, VariantSpec()
399 .setType(DataTypeInt32)
400 .setDefault(int32_t(0))
402 .setDescription(
"Number of frames dropped before this one."));
417 .setType(DataTypeInt32)
418 .setDefault(int32_t(0))
421 "Input frames dropped between this FrameSync emit and the previous one."));
432 .setType(DataTypeInt32)
433 .setDefault(int32_t(0))
435 .setDescription(
"Position within a FrameSync repeat sequence (0 = fresh emit)."));
438 PROMEKI_DECLARE_ID(FrameLate, VariantSpec()
439 .setType(DataTypeBool)
441 .setDescription(
"Frame arrived later than scheduled."));
444 PROMEKI_DECLARE_ID(FrameKeyframe, VariantSpec()
445 .setType(DataTypeBool)
447 .setDescription(
"Frame is a keyframe / intra frame."));
453 PROMEKI_DECLARE_ID(ForceKeyframe,
455 .setType(DataTypeBool)
457 .setDescription(
"Request encoder to emit an IDR for this frame."));
461 PROMEKI_DECLARE_ID(MediaDescChanged,
463 .setType(DataTypeBool)
465 .setDescription(
"Frame's MediaDesc differs from previously reported."));
478 PROMEKI_DECLARE_ID(SessionHostname,
480 .setType(DataTypeString)
481 .setDefault(String())
482 .setDescription(
"Runtime hostname of the machine that produced the file."));
485 PROMEKI_DECLARE_ID(SessionProcessId, VariantSpec()
486 .setType(DataTypeInt64)
487 .setDefault(int64_t(0))
488 .setDescription(
"Writer process ID at capture time."));
494 PROMEKI_DECLARE_ID(LibraryBuildInfo,
496 .setType(DataTypeString)
497 .setDefault(String())
498 .setDescription(
"libpromeki build identity (version, repo, date, host)."));
502 PROMEKI_DECLARE_ID(LibraryPlatform,
504 .setType(DataTypeString)
505 .setDefault(String())
506 .setDescription(
"Platform / compiler / C++ standard of the writer."));
510 PROMEKI_DECLARE_ID(LibraryFeatures,
512 .setType(DataTypeString)
513 .setDefault(String())
514 .setDescription(
"Library feature flags enabled at build time."));
521 PROMEKI_DECLARE_ID(FileOrigName, VariantSpec()
522 .setType(DataTypeString)
523 .setDefault(String())
524 .setDescription(
"Original source filename."));
527 PROMEKI_DECLARE_ID(Project, VariantSpec()
528 .setType(DataTypeString)
529 .setDefault(String())
530 .setDescription(
"Project name."));
533 PROMEKI_DECLARE_ID(Reel, VariantSpec()
534 .setType(DataTypeString)
535 .setDefault(String())
536 .setDescription(
"Reel or input device name."));
543 PROMEKI_DECLARE_ID(FilmMfgID, VariantSpec()
544 .setType(DataTypeString)
545 .setDefault(String())
546 .setDescription(
"Film manufacturer ID code (2 chars)."));
549 PROMEKI_DECLARE_ID(FilmType, VariantSpec()
550 .setType(DataTypeString)
551 .setDefault(String())
552 .setDescription(
"Film type (2 chars)."));
555 PROMEKI_DECLARE_ID(FilmOffset, VariantSpec()
556 .setType(DataTypeString)
557 .setDefault(String())
558 .setDescription(
"Film offset in perfs (2 chars)."));
561 PROMEKI_DECLARE_ID(FilmPrefix, VariantSpec()
562 .setType(DataTypeString)
563 .setDefault(String())
564 .setDescription(
"Film prefix (6 chars)."));
567 PROMEKI_DECLARE_ID(FilmCount, VariantSpec()
568 .setType(DataTypeString)
569 .setDefault(String())
570 .setDescription(
"Film count (4 chars)."));
573 PROMEKI_DECLARE_ID(FilmFormat, VariantSpec()
574 .setType(DataTypeString)
575 .setDefault(String())
576 .setDescription(
"Film format (e.g. Academy)."));
579 PROMEKI_DECLARE_ID(FilmSeqPos,
581 .setType(DataTypeInt32)
582 .setDefault(int32_t(0))
584 .setDescription(
"Sequence position (frame number in sequence)."));
587 PROMEKI_DECLARE_ID(FilmSeqLen, VariantSpec()
588 .setType(DataTypeInt32)
589 .setDefault(int32_t(0))
591 .setDescription(
"Sequence length (total frames in sequence)."));
594 PROMEKI_DECLARE_ID(FilmHoldCount,
596 .setType(DataTypeInt32)
597 .setDefault(int32_t(1))
599 .setDescription(
"Held count (1 = default, >1 = repeated frame)."));
602 PROMEKI_DECLARE_ID(FilmShutter, VariantSpec()
603 .setType(DataTypeDouble)
607 .setDescription(
"Film shutter angle in degrees."));
610 PROMEKI_DECLARE_ID(FilmFrameID, VariantSpec()
611 .setType(DataTypeString)
612 .setDefault(String())
613 .setDescription(
"Film frame identification (e.g. keycode)."));
616 PROMEKI_DECLARE_ID(FilmSlate, VariantSpec()
617 .setType(DataTypeString)
618 .setDefault(String())
619 .setDescription(
"Film slate information."));
626 PROMEKI_DECLARE_ID(FieldID,
628 .setType(DataTypeInt32)
629 .setDefault(int32_t(0))
630 .setRange(int32_t(0), int32_t(1))
631 .setDescription(
"Field number within an interlaced frame (0 or 1)."));
638 PROMEKI_DECLARE_ID(TransferCharacteristic,
640 .setType(DataTypeInt32)
641 .setDefault(int32_t(0))
643 .setDescription(
"SMPTE 268M transfer characteristic code."));
646 PROMEKI_DECLARE_ID(Colorimetric,
648 .setType(DataTypeInt32)
649 .setDefault(int32_t(0))
651 .setDescription(
"SMPTE 268M colorimetric specification code."));
657 .setType(DataTypeInt32)
658 .setDefault(int32_t(0))
660 .setDescription(
"Image orientation code (0 = left-to-right, top-to-bottom)."));
667 PROMEKI_DECLARE_ID(MasteringDisplay,
669 .setType(DataTypeMasteringDisplay)
670 .setDescription(
"Mastering display color volume (SMPTE ST 2086)."));
673 PROMEKI_DECLARE_ID(ContentLightLevel,
675 .setType(DataTypeContentLightLevel)
676 .setDescription(
"Content light level info (MaxCLL / MaxFALL)."));
701 PROMEKI_DECLARE_ID(VideoColorPrimaries,
703 .setType(DataTypeEnum)
704 .setDefault(promeki::ColorPrimaries::Unspecified)
705 .setEnumType(promeki::ColorPrimaries::Type)
706 .setDescription(
"VUI color primaries (ISO/IEC 23091-4)."));
709 PROMEKI_DECLARE_ID(VideoTransferCharacteristics,
711 .setType(DataTypeEnum)
712 .setDefault(promeki::TransferCharacteristics::Unspecified)
713 .setEnumType(promeki::TransferCharacteristics::Type)
714 .setDescription(
"VUI transfer characteristics (ISO/IEC 23091-4)."));
717 PROMEKI_DECLARE_ID(VideoMatrixCoefficients,
719 .setType(DataTypeEnum)
720 .setDefault(promeki::MatrixCoefficients::Unspecified)
721 .setEnumType(promeki::MatrixCoefficients::Type)
722 .setDescription(
"VUI matrix coefficients (ISO/IEC 23091-4)."));
725 PROMEKI_DECLARE_ID(VideoRange, VariantSpec()
726 .setType(DataTypeEnum)
727 .setDefault(promeki::VideoRange::Unknown)
728 .setEnumType(promeki::VideoRange::Type)
729 .setDescription(
"VUI video range (Unknown / Limited / Full)."));
743 PROMEKI_DECLARE_ID(VideoScanMode, VariantSpec()
744 .setType(DataTypeEnum)
745 .setDefault(promeki::VideoScanMode::Unknown)
746 .setEnumType(promeki::VideoScanMode::Type)
747 .setDescription(
"Raster scan mode "
748 "(Progressive / Interlaced*)."));
765 PROMEKI_DECLARE_ID(CodecFrameAvgQP, VariantSpec()
766 .setType(DataTypeInt32)
767 .setDefault(int32_t(0))
769 .setDescription(
"Average QP of the encoded frame."));
774 PROMEKI_DECLARE_ID(CodecFrameSatd,
776 .setType(DataTypeInt32)
777 .setDefault(int32_t(0))
779 .setDescription(
"Frame SATD (Sum of Absolute Transformed Differences)."));
788 PROMEKI_DECLARE_ID(CodecEncodeOrderIdx, VariantSpec()
789 .setType(DataTypeUInt32)
790 .setDefault(uint32_t(0))
791 .setDescription(
"Frame index in encode order."));
794 PROMEKI_DECLARE_ID(CodecDisplayOrderIdx, VariantSpec()
795 .setType(DataTypeUInt32)
796 .setDefault(uint32_t(0))
797 .setDescription(
"Frame index in display order."));
806 PROMEKI_DECLARE_ID(CodecTemporalId,
808 .setType(DataTypeInt32)
809 .setDefault(int32_t(0))
811 .setDescription(
"Temporal scalability layer ID (0 = base layer)."));
820 PROMEKI_DECLARE_ID(CodecGopPosition,
822 .setType(DataTypeInt32)
823 .setDefault(int32_t(0))
825 .setDescription(
"Offset from last keyframe (0 = keyframe)."));
834 PROMEKI_DECLARE_ID(CodecIntraBlockCount,
836 .setType(DataTypeInt32)
837 .setDefault(int32_t(0))
839 .setDescription(
"Count of intra-coded blocks (codec-specific unit)."));
847 PROMEKI_DECLARE_ID(CodecInterBlockCount,
849 .setType(DataTypeInt32)
850 .setDefault(int32_t(0))
852 .setDescription(
"Count of inter-coded blocks (codec-specific unit)."));
860 PROMEKI_DECLARE_ID(CodecAvgMotionVectorX,
862 .setType(DataTypeInt32)
863 .setDefault(int32_t(0))
864 .setDescription(
"Average motion vector X (codec-defined units)."));
868 PROMEKI_DECLARE_ID(CodecAvgMotionVectorY,
870 .setType(DataTypeInt32)
871 .setDefault(int32_t(0))
872 .setDescription(
"Average motion vector Y (codec-defined units)."));
898 PROMEKI_DECLARE_ID(CodecParameterSets,
900 .setType(DataTypeString)
901 .setDefault(String())
902 .setDescription(
"Out-of-band codec parameter sets "
903 "(Annex-B SPS/PPS/VPS or AV1 sequence header)."));
919 static inline const ID FrontendX = declareID(
920 "Frontend.X", VariantSpec()
921 .setType(DataTypeDouble)
923 .setDescription(
"Frontend X coordinate (pixels) for graphical editors."));
926 static inline const ID FrontendY = declareID(
927 "Frontend.Y", VariantSpec()
928 .setType(DataTypeDouble)
930 .setDescription(
"Frontend Y coordinate (pixels) for graphical editors."));
941 static String idToString(ID
id) {
return id.name(); }
948 static ID stringToID(
const String &val) {
return ID(val); }
956 static Metadata fromJson(
const JsonObject &json, Error *err =
nullptr);
973 String toString(
unsigned int indent = 0)
const;
992 static Metadata fromString(
const String &str, Error *err =
nullptr);
995 Metadata() =
default;
1001 StringList dump()
const;
1008 bool operator==(
const Metadata &other)
const;
1041 void applyMediaIOWriteDefaults();
1044PROMEKI_NAMESPACE_END