Updates to work when there are multiple tie lines from codec inputs to sources and using ExternalSourceSwitching

This commit is contained in:
Neil Dorin
2020-11-12 16:23:14 -07:00
parent 5c63a49071
commit f9ba562b0b

View File

@@ -705,37 +705,44 @@ namespace PepperDash.Essentials
} }
/// <summary> /// <summary>
/// Setup the external sources for the Cisco Touch 10 devices that support IHasExternalSourceSwitch /// Setup the external sources for the Cisco Touch 10 devices that support IHasExternalSourceSwitch
/// </summary> /// </summary>
private void SetCodecExternalSources() private void SetCodecExternalSources()
{ {
var videoCodecWithExternalSwitching = VideoCodec as IHasExternalSourceSwitching; var videoCodecWithExternalSwitching = VideoCodec as IHasExternalSourceSwitching;
if (videoCodecWithExternalSwitching == null) if (videoCodecWithExternalSwitching == null || !videoCodecWithExternalSwitching.ExternalSourceListEnabled)
{ {
return; return;
} }
string codecTieLine = ConfigReader.ConfigObject.TieLines.SingleOrDefault(x => x.DestinationKey == VideoCodec.Key).DestinationPort; try
videoCodecWithExternalSwitching.ClearExternalSources(); {
videoCodecWithExternalSwitching.RunRouteAction = RunRouteAction; // Get the tie line that the external switcher is connected to
var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ; string codecInputConnectorName = ConfigReader.ConfigObject.TieLines.SingleOrDefault(
x => x.DestinationKey == VideoCodec.Key && x.DestinationPort == videoCodecWithExternalSwitching.ExternalSourceInputPort).DestinationPort;
foreach (var kvp in srcList) videoCodecWithExternalSwitching.ClearExternalSources();
{ videoCodecWithExternalSwitching.RunRouteAction = RunRouteAction;
var srcConfig = kvp.Value; var srcList = ConfigReader.ConfigObject.SourceLists.SingleOrDefault(x => x.Key == SourceListKey).Value.OrderBy(kv => kv.Value.Order); ;
if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff") foreach (var kvp in srcList)
{ {
var srcConfig = kvp.Value;
videoCodecWithExternalSwitching.AddExternalSource(codecTieLine, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop); if (kvp.Key != DefaultCodecRouteString && kvp.Key != "roomOff")
videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready); {
videoCodecWithExternalSwitching.AddExternalSource(codecInputConnectorName, kvp.Key, srcConfig.PreferredName, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceType.desktop);
videoCodecWithExternalSwitching.SetExternalSourceState(kvp.Key, PepperDash.Essentials.Devices.Common.VideoCodec.Cisco.eExternalSourceMode.Ready);
} }
} }
} }
catch (Exception e)
{
Debug.Console(2, this, "Error setting codec external sources: {0}", e);
}
}
private void SetCodecBranding() private void SetCodecBranding()
{ {