Gondwana Game Engine Development (master) - 2.7.0
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
VideoMetadata.cs
1namespace Gondwana.Video;
2
26
31public sealed record VideoMetadata(VideoMetadataStatus Status, bool HasAudio, TimeSpan Duration)
32{
33 internal static readonly VideoMetadata Unavailable = new(VideoMetadataStatus.Unavailable, false, TimeSpan.Zero);
34}
35
36// A generation prevents completion from a replaced source from publishing stale metadata.
37internal sealed class VideoMetadataState
38{
39 private readonly object _gate = new();
40 private long _generation;
41 private VideoMetadata _current = VideoMetadata.Unavailable;
42
43 internal VideoMetadata Current
44 {
45 get
46 {
47 lock (_gate)
48 return _current;
49 }
50 }
51
52 internal long Begin()
53 {
54 lock (_gate)
55 {
56 _current = new(VideoMetadataStatus.Pending, false, TimeSpan.Zero);
57 return ++_generation;
58 }
59 }
60
61 internal bool Complete(long generation, VideoMetadata metadata)
62 {
63 lock (_gate)
64 {
65 if (generation != _generation)
66 return false;
67
68 _current = metadata;
69 return true;
70 }
71 }
72
73 internal void Reset()
74 {
75 lock (_gate)
76 {
77 ++_generation;
78 _current = VideoMetadata.Unavailable;
79 }
80 }
81}
VideoMetadataStatus
The availability of metadata for the active source.
@ Pending
Metadata discovery is in progress.
@ Unavailable
No metadata is available for the current source.
@ Failed
Metadata discovery failed.
@ Ready
Metadata discovery completed successfully.
record VideoMetadata(VideoMetadataStatus Status, bool HasAudio, TimeSpan Duration)
An immutable metadata snapshot. Values are authoritative only when status is Ready.