mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-11 02:35:00 +00:00
feat: add GenericSink
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.Routing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Generic
|
||||
{
|
||||
public class GenericSink : EssentialsDevice, IRoutingSink
|
||||
{
|
||||
public GenericSink(string key, string name) : base(key, name)
|
||||
{
|
||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||
|
||||
var inputPort = new RoutingInputPort($"{Key}-{RoutingPortNames.AnyVideoIn}", eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, null, this);
|
||||
|
||||
InputPorts.Add(inputPort);
|
||||
|
||||
}
|
||||
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
|
||||
public string CurrentSourceInfoKey { get; set; }
|
||||
|
||||
private SourceListItem _currentSource;
|
||||
public SourceListItem CurrentSourceInfo {
|
||||
get => _currentSource;
|
||||
set {
|
||||
if(value == _currentSource)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CurrentSourceChange?.Invoke(_currentSource, ChangeType.WillChange);
|
||||
|
||||
_currentSource = value;
|
||||
|
||||
CurrentSourceChange?.Invoke(_currentSource, ChangeType.DidChange);
|
||||
}
|
||||
}
|
||||
|
||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||
}
|
||||
|
||||
public class GenericSinkFactory : EssentialsDeviceFactory<GenericSink>
|
||||
{
|
||||
public GenericSinkFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "genericsink", "genericdestination" };
|
||||
}
|
||||
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.Console(1, "Factory Attempting to create new Generic Source Device");
|
||||
return new GenericSource(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,5 +54,4 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
return new GenericSource(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user