Gondwana Game Engine Development (master) - 2.6.1
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
23
28public sealed record VideoMetadata(VideoMetadataStatus Status, bool HasAudio, TimeSpan Duration)
29{
30 internal static readonly VideoMetadata Unavailable = new(VideoMetadataStatus.Unavailable, false, TimeSpan.Zero);
31}
32
33// A generation prevents completion from a replaced source from publishing stale metadata.
34internal sealed class VideoMetadataState
35{
36 private readonly object _gate = new();
37 private long _generation;
38 private VideoMetadata _current = VideoMetadata.Unavailable;
39 internal VideoMetadata Current { get { lock (_gate) return _current; } }
40 internal long Begin()
41 {
42 lock (_gate)
43 {
44 _current = new(VideoMetadataStatus.Pending, false, TimeSpan.Zero);
45 return ++_generation;
46 }
47 }
48 internal bool Complete(long generation, VideoMetadata metadata)
49 {
50 lock (_gate)
51 {
52 if (generation != _generation) return false;
53 _current = metadata;
54 return true;
55 }
56 }
57 internal void Reset()
58 {
59 lock (_gate) { ++_generation; _current = VideoMetadata.Unavailable; }
60 }
61}
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.