Derive program video availability from live samples

This commit is contained in:
Meta Vens 2026-06-03 05:14:10 +01:00
commit e1520d1284
4 changed files with 37 additions and 3 deletions

View file

@ -1220,7 +1220,10 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
var frame = placement is { } value
? $"{value.CenterX:0.00},{value.CenterY:0.00} {value.Width:0.00}x{value.Height:0.00}"
: "unplaced";
return $"{(selected ? "* " : " ")}{feed.Layer + 1}. {feed.DisplayName} {frame}";
var status = feed.Available
? presentationControls.IncludesVideo(feed.SourceId) ? "live" : "hidden"
: "waiting";
return $"{(selected ? "* " : " ")}{feed.Layer + 1}. {feed.DisplayName} {status} {frame}";
}
private void SetSelectedVideoVisible(bool visible)
@ -1373,7 +1376,9 @@ public sealed class MimirRuntime : IAquariumRuntime, IAquariumRuntimeServicesRec
var active = feeds
.Where(feed => presentationControls.IncludesVideo(feed.SourceId))
.Select(feed => $"{feed.Layer + 1}:{feed.SourceId}@{feed.Opacity:0.00}");
return string.Join(" | ", active.DefaultIfEmpty("black"));
var waiting = feeds.Count(feed => !feed.Available);
var summary = string.Join(" | ", active.DefaultIfEmpty("black"));
return waiting == 0 ? summary : $"{summary} / waiting {waiting}";
}
private string DescribeProgramAudio()

View file

@ -87,6 +87,10 @@ public sealed class MimirVideoPresentationControl
public bool Enabled { get; set; } = true;
public bool Available { get; private set; }
public long SampleCount { get; private set; }
public bool Solo { get; set; }
public float Opacity { get; set; } = 1.0f;
@ -100,6 +104,12 @@ public sealed class MimirVideoPresentationControl
DisplayName = displayName;
}
}
public void RefreshAvailability(bool available, long sampleCount)
{
Available = available;
SampleCount = Math.Max(0, sampleCount);
}
}
public sealed class MimirAudioPresentationControl
@ -116,6 +126,10 @@ public sealed class MimirAudioPresentationControl
public bool Muted { get; set; }
public bool Available { get; private set; }
public long SampleCount { get; private set; }
public bool Solo { get; set; }
public float Gain { get; set; } = 1.0f;
@ -127,6 +141,12 @@ public sealed class MimirAudioPresentationControl
DisplayName = displayName;
}
}
public void RefreshAvailability(bool available, long sampleCount)
{
Available = available;
SampleCount = Math.Max(0, sampleCount);
}
}
public sealed record MimirPostprocessControlSnapshot(
@ -186,6 +206,7 @@ public sealed class MimirPresentationControlState
}
control.RefreshLabel(buffer.Descriptor.Label);
control.RefreshAvailability(buffer.Latest.HasValue, buffer.Count);
continue;
}
@ -198,6 +219,7 @@ public sealed class MimirPresentationControlState
}
control.RefreshLabel(buffer.Descriptor.Label);
control.RefreshAvailability(buffer.Latest.HasValue, buffer.Count);
}
}
@ -213,7 +235,7 @@ public sealed class MimirPresentationControlState
}
var hasSolo = video.Values.Any(feed => feed.Solo);
return hasSolo ? control.Solo : control.Enabled;
return control.Available && (hasSolo ? control.Solo : control.Enabled);
}
public float VideoOpacity(string sourceId) =>

View file

@ -1004,6 +1004,9 @@ internal static class MimirWellCapturePage
feed.SourceId,
feed.DisplayName,
feed.Enabled,
feed.Available,
feed.SampleCount,
Included = presentation.IncludesVideo(feed.SourceId),
feed.Solo,
feed.Opacity,
feed.Layer,
@ -1618,6 +1621,9 @@ internal static class MimirWellSnapshot
feed.SourceId,
feed.DisplayName,
feed.Enabled,
feed.Available,
feed.SampleCount,
Included = presentation.IncludesVideo(feed.SourceId),
feed.Solo,
feed.Opacity,
feed.Layer,