From 3f8b97bff750fb0882354593ae51c8978145174d Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 10 Jul 2026 21:48:01 -0600 Subject: [PATCH] feat: add IHasDynamicMultiviewLayout interface and MultiviewParticipantSource class for dynamic layout support --- .../IHasDynamicMultiviewLayout.cs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasDynamicMultiviewLayout.cs diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasDynamicMultiviewLayout.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasDynamicMultiviewLayout.cs new file mode 100644 index 00000000..786e2548 --- /dev/null +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasDynamicMultiviewLayout.cs @@ -0,0 +1,60 @@ +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace PepperDash.Essentials.Core.DeviceTypeInterfaces; + +/// +/// Defines a device (e.g. a multiview-capable video decoder) that can build a multiview tile +/// layout at runtime from a set of sources with priority values, rather than only supporting +/// pre-configured/named layouts. Implementing this interface (instead of requiring consumers to +/// reference the hardware-specific plugin type directly) lets other plugins (e.g. a room plugin) +/// drive dynamic, priority-based layouts on the device without taking a compile-time dependency on +/// the specific hardware plugin that implements it. +/// +public interface IHasDynamicMultiviewLayout +{ + /// + /// Computes and applies a multiview layout from the given participant sources (ordered by + /// priority) and an optional active presentation source. + /// + /// Sources to place in participant tiles, each with a priority (lower value = higher priority). + /// Device key for the active presentation source, or null/empty if no presentation is active. + /// True if the layout was successfully applied. + bool ApplyDynamicLayout(IReadOnlyList participantSources, string presentationSourceKey); +} + +/// +/// Represents a single source eligible for placement in a dynamic multiview layout, along with +/// its priority. Lower priority values are placed first / given more prominent tiles (i.e. lower +/// number = higher priority). +/// +public class MultiviewParticipantSource +{ + /// + /// The device key of the source to place in a tile. + /// + [JsonProperty("sourceKey")] + public string SourceKey { get; set; } + + /// + /// The priority of this source. Lower values are placed first / given more prominent tiles. + /// + [JsonProperty("priority")] + public int Priority { get; set; } + + /// + /// Parameterless constructor for deserialization. + /// + public MultiviewParticipantSource() + { + } + + /// + /// Initializes a new instance of the MultiviewParticipantSource class. + /// + public MultiviewParticipantSource(string sourceKey, int priority) + { + SourceKey = sourceKey; + Priority = priority; + } +}