Skip to content

Commit 3f8b97b

Browse files
committed
feat: add IHasDynamicMultiviewLayout interface and MultiviewParticipantSource class for dynamic layout support
1 parent f0b546f commit 3f8b97b

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using Newtonsoft.Json;
2+
using System.Collections.Generic;
3+
4+
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces;
5+
6+
/// <summary>
7+
/// Defines a device (e.g. a multiview-capable video decoder) that can build a multiview tile
8+
/// layout at runtime from a set of sources with priority values, rather than only supporting
9+
/// pre-configured/named layouts. Implementing this interface (instead of requiring consumers to
10+
/// reference the hardware-specific plugin type directly) lets other plugins (e.g. a room plugin)
11+
/// drive dynamic, priority-based layouts on the device without taking a compile-time dependency on
12+
/// the specific hardware plugin that implements it.
13+
/// </summary>
14+
public interface IHasDynamicMultiviewLayout
15+
{
16+
/// <summary>
17+
/// Computes and applies a multiview layout from the given participant sources (ordered by
18+
/// priority) and an optional active presentation source.
19+
/// </summary>
20+
/// <param name="participantSources">Sources to place in participant tiles, each with a priority (lower value = higher priority).</param>
21+
/// <param name="presentationSourceKey">Device key for the active presentation source, or null/empty if no presentation is active.</param>
22+
/// <returns>True if the layout was successfully applied.</returns>
23+
bool ApplyDynamicLayout(IReadOnlyList<MultiviewParticipantSource> participantSources, string presentationSourceKey);
24+
}
25+
26+
/// <summary>
27+
/// Represents a single source eligible for placement in a dynamic multiview layout, along with
28+
/// its priority. Lower priority values are placed first / given more prominent tiles (i.e. lower
29+
/// number = higher priority).
30+
/// </summary>
31+
public class MultiviewParticipantSource
32+
{
33+
/// <summary>
34+
/// The device key of the source to place in a tile.
35+
/// </summary>
36+
[JsonProperty("sourceKey")]
37+
public string SourceKey { get; set; }
38+
39+
/// <summary>
40+
/// The priority of this source. Lower values are placed first / given more prominent tiles.
41+
/// </summary>
42+
[JsonProperty("priority")]
43+
public int Priority { get; set; }
44+
45+
/// <summary>
46+
/// Parameterless constructor for deserialization.
47+
/// </summary>
48+
public MultiviewParticipantSource()
49+
{
50+
}
51+
52+
/// <summary>
53+
/// Initializes a new instance of the MultiviewParticipantSource class.
54+
/// </summary>
55+
public MultiviewParticipantSource(string sourceKey, int priority)
56+
{
57+
SourceKey = sourceKey;
58+
Priority = priority;
59+
}
60+
}

0 commit comments

Comments
 (0)