Commit 12dd5af3 by liulongfei

切换DeckLink设备

parent 4c4b4cd2
...@@ -24,8 +24,8 @@ namespace VIZ.GimbalAI.Client ...@@ -24,8 +24,8 @@ namespace VIZ.GimbalAI.Client
AppSetup.AppendSetup(new AppSetup_InitLiteDB()); AppSetup.AppendSetup(new AppSetup_InitLiteDB());
// 初始化 配置 // 初始化 配置
AppSetup.AppendSetup(new AppSetup_InitConfig()); AppSetup.AppendSetup(new AppSetup_InitConfig());
// 初始化 NDI // 初始化 采集卡
AppSetup.AppendSetup(new AppSetup_InitNDI()); AppSetup.AppendSetup(new AppSetup_IntDeckLink());
// 初始化 UDP // 初始化 UDP
AppSetup.AppendSetup(new AppSetup_InitUDP()); AppSetup.AppendSetup(new AppSetup_InitUDP());
......
...@@ -12,6 +12,8 @@ APPLICATION_IS_DEBUG=true ...@@ -12,6 +12,8 @@ APPLICATION_IS_DEBUG=true
CLIENT_VIDEO_DELAY=0 CLIENT_VIDEO_DELAY=0
;日志输出最大行数,超过该数目会清理日志 ;日志输出最大行数,超过该数目会清理日志
CLIENT_CONSOLE_LOG_MAX_LINE=500 CLIENT_CONSOLE_LOG_MAX_LINE=500
;采集口名称
CLIENT_DECKLINK_DISPLAY_NAME=DeckLink Quad (1)
; ============================================================ ; ============================================================
; === UDP === ; === UDP ===
; ============================================================ ; ============================================================
...@@ -31,12 +33,6 @@ ALGORITHM_BINDING_PORT=8001 ...@@ -31,12 +33,6 @@ ALGORITHM_BINDING_PORT=8001
GIMBAL_BINDING_IP=127.0.0.1 GIMBAL_BINDING_IP=127.0.0.1
;云台UDP绑定端口 ;云台UDP绑定端口
GIMBAL_BINDING_PORT=8002 GIMBAL_BINDING_PORT=8002
; ============================================================
; === NDI ===
; ============================================================
[NDI]
;NDI流名称
NDI_STREAM_NAME=LAPTOP-6ESNHBU6 (Test Pattern)
;NDI_STREAM_NAME=STATION-P620-03 (OBS) ;NDI_STREAM_NAME=STATION-P620-03 (OBS)
; ============================================================ ; ============================================================
; === Algorithm === ; === Algorithm ===
......
...@@ -7,9 +7,9 @@ using System.Threading.Tasks; ...@@ -7,9 +7,9 @@ using System.Threading.Tasks;
namespace VIZ.GimbalAI.Domain namespace VIZ.GimbalAI.Domain
{ {
/// <summary> /// <summary>
/// NDI视图键 /// 视频视图键
/// </summary> /// </summary>
public static class NDIViewKeys public static class VideoViewKeys
{ {
/// <summary> /// <summary>
/// 主视图 /// 主视图
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Enum\NDIViewKeys.cs" /> <Compile Include="Enum\VideoViewKeys.cs" />
<Compile Include="Enum\ServiceKeys.cs" /> <Compile Include="Enum\ServiceKeys.cs" />
<Compile Include="Message\Gimbal\GimbalInitCompleteMessage.cs" /> <Compile Include="Message\Gimbal\GimbalInitCompleteMessage.cs" />
<Compile Include="Model\Gimbal\GimbalControlModel.cs" /> <Compile Include="Model\Gimbal\GimbalControlModel.cs" />
......
<UserControl x:Class="VIZ.GimbalAI.Module.ChangeNdiStreamView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:VIZ.GimbalAI.Module"
xmlns:common="clr-namespace:VIZ.Framework.Common;assembly=VIZ.Framework.Common"
xmlns:converter="clr-namespace:VIZ.Framework.Core;assembly=VIZ.Framework.Core"
d:DataContext="{d:DesignInstance Type=local:ChangeNdiStreamViewModel}"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/VIZ.GimbalAI.Common.Resource;component/Style/ListBox/ListBox_None.xaml"></ResourceDictionary>
<ResourceDictionary Source="/VIZ.GimbalAI.Common.Resource;component/Style/Button/Button_MessageBox.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
<converter:Bool2VisibilityConverter x:Key="Bool2VisibilityConverter"></converter:Bool2VisibilityConverter>
</ResourceDictionary>
</UserControl.Resources>
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="Loaded">
<behaviors:InvokeCommandAction Command="{Binding LoadedCommand}" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
<Border Background="White" CornerRadius="20">
<Border.Effect>
<DropShadowEffect Opacity="0.36"/>
</Border.Effect>
<Grid Margin="30,20,30,20">
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<common:DragWindowBar Grid.RowSpan="4" Grid.ColumnSpan="2" Background="Transparent"></common:DragWindowBar>
<TextBlock Text="切换NDI流" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="16"></TextBlock>
<TextBlock Text="主机" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="24"></TextBlock>
<Border Grid.Row="2" BorderBrush="#44000000" BorderThickness="1" Margin="0,0,20,0">
<ListBox x:Name="lbHost" Style="{StaticResource ListBox_None}" ItemContainerStyle="{StaticResource ListBoxItem_None_IsSelected}"
ItemsSource="{Binding Path=NdiStreamGroups}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Rectangle Width="10" Height="10" Fill="Green" VerticalAlignment="Center" HorizontalAlignment="Center"
Visibility="{Binding Path=IsCurrentStream,Converter={StaticResource Bool2VisibilityConverter}}"></Rectangle>
<TextBlock Text="{Binding Path=DisplayName}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="1"
FontSize="18"></TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<TextBlock Text="流" Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="24"></TextBlock>
<Border Grid.Row="2" Grid.Column="1" BorderBrush="#44000000" BorderThickness="1" Margin="20,0,0,0">
<ListBox Style="{StaticResource ListBox_None}" ItemContainerStyle="{StaticResource ListBoxItem_None_IsSelected}"
ItemsSource="{Binding ElementName=lbHost,Path=SelectedValue.Items}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Rectangle Width="10" Height="10" Fill="Green" VerticalAlignment="Center" HorizontalAlignment="Center"
Visibility="{Binding Path=IsCurrentStream,Converter={StaticResource Bool2VisibilityConverter}}"></Rectangle>
<TextBlock Text="{Binding Path=DisplayName}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="1"
FontSize="18"></TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Grid.Row="3" Grid.ColumnSpan="2">
<Button Grid.Row="2" Content="关闭" Style="{StaticResource VMessageBox_Button_Cancel}" Margin="10,0,10,0" Command="{Binding Path=CloseCommand}"></Button>
<Button Grid.Row="2" Content="刷新" Style="{StaticResource VMessageBox_Button_Yes}" Margin="10,0,10,0" Command="{Binding Path=LoadedCommand}"></Button>
<Button Grid.Row="2" Content="应用" Style="{StaticResource VMessageBox_Button_Yes}" Margin="10,0,10,0" Command="{Binding Path=ApplyCommand}"></Button>
</StackPanel>
</Grid>
</Border>
</UserControl>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace VIZ.GimbalAI.Module
{
/// <summary>
/// ChangeNdiStreamView.xaml 的交互逻辑
/// </summary>
public partial class ChangeNdiStreamView : UserControl
{
public ChangeNdiStreamView()
{
InitializeComponent();
ChangeNdiStreamViewModel vm = new ChangeNdiStreamViewModel();
vm.SetView(this);
this.DataContext = vm;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.GimbalAI.Common;
using VIZ.GimbalAI.Domain;
using VIZ.GimbalAI.Storage;
using System.Windows;
using System.Windows.Controls;
using VIZ.Framework.Common;
namespace VIZ.GimbalAI.Module
{
/// <summary>
/// 切换NDI流视图模型
/// </summary>
public class ChangeNdiStreamViewModel : ViewModelBase
{
public ChangeNdiStreamViewModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.LoadedCommand = new VCommand(this.Loaded);
this.ApplyCommand = new VCommand(this.Apply);
this.CloseCommand = new VCommand(this.Close);
}
// ==============================================================================================
// === Property ===
// ==============================================================================================
#region NdiStreamGroups -- NDI流分组集合
private List<NdiStreamGroupModel> ndiStreamGroups;
/// <summary>
/// NDI流分组集合
/// </summary>
public List<NdiStreamGroupModel> NdiStreamGroups
{
get { return ndiStreamGroups; }
set { ndiStreamGroups = value; this.RaisePropertyChanged(nameof(NdiStreamGroups)); }
}
#endregion
// ==============================================================================================
// === Property ===
// ==============================================================================================
#region LoadedCommand -- 加载完成命令
/// <summary>
/// 加载完成命令
/// </summary>
public VCommand LoadedCommand { get; set; }
/// <summary>
/// 加载完成
/// </summary>
private void Loaded()
{
NDIStream ndiStream = VideoStreamManager.Get<NDIStream>(NDIViewKeys.Main);
if (ndiStream == null || ndiStream.StreamInfos == null || ndiStream.StreamInfos.Count == 0)
return;
string currentNdiStreamName = ApplicationDomainEx.IniStorage.GetValue<NdiConfig, string>(p => p.NDI_STREAM_NAME);
string groupName = currentNdiStreamName.Split(new char[] { ' ' }, 2)[0];
string streamName = currentNdiStreamName.Substring(currentNdiStreamName.IndexOf(' ') + 1);
List<NdiStreamGroupModel> groupModels = new List<NdiStreamGroupModel>();
lock (ndiStream.StreamInfos)
{
var groups = ndiStream.StreamInfos.GroupBy(p => p.Machine);
foreach (var group in groups)
{
NdiStreamGroupModel groupModel = new NdiStreamGroupModel();
groupModel.Name = group.Key;
groupModel.DisplayName = group.Key;
foreach (NDIStreamInfo info in group)
{
NdiStreamModel model = new NdiStreamModel();
model.Name = info.Name;
model.DisplayName = info.Name;
model.OwnerGroup = groupModel;
groupModel.Items.Add(model);
if (groupModel.Name != groupName || model.Name != streamName)
continue;
model.IsCurrentStream = true;
groupModel.IsCurrentStream = true;
}
groupModels.Add(groupModel);
}
}
this.NdiStreamGroups = groupModels;
}
#endregion
#region ApplyCommand -- 应用流
/// <summary>
/// 应用流
/// </summary>
public VCommand ApplyCommand { get; set; }
/// <summary>
/// 应用流
/// </summary>
public void Apply()
{
string currentNdiStreamName = ApplicationDomainEx.IniStorage.GetValue<NdiConfig, string>(p => p.NDI_STREAM_NAME);
string groupName = currentNdiStreamName.Split(new char[] { ' ' }, 2)[0];
string streamName = currentNdiStreamName.Substring(currentNdiStreamName.IndexOf(' ') + 1);
NdiStreamGroupModel group = this.NdiStreamGroups.FirstOrDefault(p => p.IsSelected);
if (group == null)
return;
NdiStreamModel item = group.Items.FirstOrDefault(p => p.IsSelected);
if (item == null)
return;
if (groupName == group.Name && streamName == item.Name)
return;
IVideoViewService service = ApplicationDomainEx.ServiceManager.GetService<IVideoViewService>(ServiceKeys.VideoView);
if (service == null)
return;
// ------------------------------------------------------------------------------------------------
// 切换NDI流
service.ChangeNdiStream($"{group.Name} {item.Name}");
// ------------------------------------------------------------------------------------------------
// 更新到配置文件
ApplicationDomainEx.IniStorage.SetValue<NdiConfig>(p => p.NDI_STREAM_NAME, $"{group.Name} {item.Name}");
// ------------------------------------------------------------------------------------------------
// 刷新UI
NdiStreamGroupModel beforeGroup = this.NdiStreamGroups.FirstOrDefault(p => p.IsCurrentStream);
if (beforeGroup != null)
{
beforeGroup.IsCurrentStream = false;
}
NdiStreamModel beofreItem = beforeGroup?.Items.FirstOrDefault(p => p.IsCurrentStream);
if (beofreItem != null)
{
beofreItem.IsCurrentStream = false;
}
group.IsCurrentStream = true;
item.IsCurrentStream = true;
// ------------------------------------------------------------------------------------------------
}
#endregion
#region CloseCommand -- 关闭按钮
/// <summary>
/// 关闭按钮
/// </summary>
public VCommand CloseCommand { get; set; }
/// <summary>
/// 关闭
/// </summary>
private void Close()
{
ChangeNdiStreamView view = this.GetView<ChangeNdiStreamView>();
if (view == null)
return;
Window window = WPFHelper.GetAncestorByType<Window>(view);
if (window == null)
return;
window.Close();
}
#endregion
// ==============================================================================================
}
}
...@@ -111,7 +111,7 @@ namespace VIZ.GimbalAI.Module ...@@ -111,7 +111,7 @@ namespace VIZ.GimbalAI.Module
if (service == null) if (service == null)
return; return;
service.ChangeNdiVideoFrameDelay(this.SelectedValue.Value); service.ChangeVideoFrameDelay(this.SelectedValue.Value);
ApplicationDomainEx.IniStorage.SetValue<ClientConfig>(p => p.CLIENT_VIDEO_DELAY, this.SelectedValue.Value); ApplicationDomainEx.IniStorage.SetValue<ClientConfig>(p => p.CLIENT_VIDEO_DELAY, this.SelectedValue.Value);
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top"> <StackPanel Orientation="Horizontal" Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Top">
<Button Command="{Binding Path=ChangeNdiVideoDelayCommand}" Style="{StaticResource Button_Delay}" ></Button> <Button Command="{Binding Path=ChangeNdiVideoDelayCommand}" Style="{StaticResource Button_Delay}" ></Button>
<Button Command="{Binding Path=ChangeNdiCommand}" Style="{StaticResource Button_Setting}" ></Button> <!--<Button Command="{Binding Path=ChangeNdiCommand}" Style="{StaticResource Button_Setting}" ></Button>-->
<Button Command="{Binding Path=MinCommand}" Style="{StaticResource Button_Min}"></Button> <Button Command="{Binding Path=MinCommand}" Style="{StaticResource Button_Min}"></Button>
<Button Command="{Binding Path=CloseCommand}" Style="{StaticResource Button_Close}"></Button> <Button Command="{Binding Path=CloseCommand}" Style="{StaticResource Button_Close}"></Button>
</StackPanel> </StackPanel>
......
...@@ -62,7 +62,6 @@ namespace VIZ.GimbalAI.Module ...@@ -62,7 +62,6 @@ namespace VIZ.GimbalAI.Module
this.LoadedCommand = new VCommand(this.Loaded); this.LoadedCommand = new VCommand(this.Loaded);
this.CloseCommand = new VCommand(this.Close); this.CloseCommand = new VCommand(this.Close);
this.MinCommand = new VCommand(this.Min); this.MinCommand = new VCommand(this.Min);
this.ChangeNdiCommand = new VCommand(this.ChangeNdi);
this.ChangeNdiVideoDelayCommand = new VCommand(this.ChangeNdiVideoDelay); this.ChangeNdiVideoDelayCommand = new VCommand(this.ChangeNdiVideoDelay);
this.RestartAlgorithmCommand = new VCommand(this.RestartAlgorithm); this.RestartAlgorithmCommand = new VCommand(this.RestartAlgorithm);
} }
...@@ -262,31 +261,6 @@ namespace VIZ.GimbalAI.Module ...@@ -262,31 +261,6 @@ namespace VIZ.GimbalAI.Module
#endregion #endregion
#region ChangeNdiCommand -- 切换NDI命令
/// <summary>
/// 测试命令
/// </summary>
public VCommand ChangeNdiCommand { get; set; }
/// <summary>
/// 测试
/// </summary>
private void ChangeNdi()
{
MainView mainView = this.GetView<MainView>();
if (mainView == null)
return;
ChangeNdiStreamView view = new ChangeNdiStreamView();
NoneWindow window = new NoneWindow(600, 500, view);
window.Owner = WPFHelper.GetAncestorByType<Window>(mainView);
window.ShowDialog();
}
#endregion
#region ChangeNdiVideoDelayCommand -- 切换NDI视频延时命令 #region ChangeNdiVideoDelayCommand -- 切换NDI视频延时命令
/// <summary> /// <summary>
......
...@@ -10,23 +10,30 @@ using VIZ.GimbalAI.Storage; ...@@ -10,23 +10,30 @@ using VIZ.GimbalAI.Storage;
using VIZ.GimbalAI.Common; using VIZ.GimbalAI.Common;
using VIZ.Framework.Common; using VIZ.Framework.Common;
using VIZ.Framework.Module; using VIZ.Framework.Module;
using System.Threading;
using System.Windows;
namespace VIZ.GimbalAI.Module namespace VIZ.GimbalAI.Module
{ {
/// <summary> /// <summary>
/// 应用程序启动 -- 初始化NDI /// 应用程序启动 -- 初始化DeckLink
/// </summary> /// </summary>
public class AppSetup_InitNDI : AppSetupBase public class AppSetup_IntDeckLink : AppSetupBase
{ {
/// <summary> /// <summary>
/// 日志 /// 日志
/// </summary> /// </summary>
private readonly static ILog log = LogManager.GetLogger(typeof(AppSetup_InitNDI)); private readonly static ILog log = LogManager.GetLogger(typeof(AppSetup_IntDeckLink));
/// <summary> /// <summary>
/// 描述 /// 描述
/// </summary> /// </summary>
public override string Detail { get; } = "应用程序启动 -- 初始化NDI"; public override string Detail { get; } = "应用程序启动 -- 初始化DeckLink";
/// <summary>
/// 超时时间
/// </summary>
private readonly static TimeSpan Timeout = TimeSpan.FromSeconds(10);
/// <summary> /// <summary>
/// 执行启动 /// 执行启动
...@@ -35,14 +42,38 @@ namespace VIZ.GimbalAI.Module ...@@ -35,14 +42,38 @@ namespace VIZ.GimbalAI.Module
/// <returns>是否成功执行</returns> /// <returns>是否成功执行</returns>
public override bool Setup(AppSetupContext context) public override bool Setup(AppSetupContext context)
{ {
string remoteSenderName = ApplicationDomainEx.IniStorage.GetValue<NdiConfig, string>(p => p.NDI_STREAM_NAME); DeckLinkManager.Init();
string localrecvname = System.Net.Dns.GetHostName() + "_TRTC_0";
NDIStreamOption option = new NDIStreamOption(); DeckLinkStreamOption option = new DeckLinkStreamOption();
option.DelayFrame = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, int>(p => p.CLIENT_VIDEO_DELAY); option.DelayFrame = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, int>(p => p.CLIENT_VIDEO_DELAY);
NDIStream ndiStream = new NDIStream(localrecvname, remoteSenderName, option); string displayName = ApplicationDomainEx.IniStorage.GetValue<ClientConfig, string>(p => p.CLIENT_DECKLINK_DISPLAY_NAME);
VideoStreamManager.Append(NDIViewKeys.Main, ndiStream); DateTime beginTime = DateTime.Now;
DeckLinkInputDevice device = null;
while (DateTime.Now < (beginTime + Timeout))
{
device = DeckLinkManager.DeckLinks.FirstOrDefault(p => p.DisplayName == displayName);
if (device != null)
{
break;
}
Thread.Sleep(500);
}
if (device == null)
{
MessageBox.Show("采集卡初始化失败! ");
DeckLinkManager.Dispose();
return false;
}
DeckLinkStream stream = new DeckLinkStream(device, option);
VideoStreamManager.Append(VideoViewKeys.Main, stream);
return true; return true;
} }
...@@ -53,7 +84,9 @@ namespace VIZ.GimbalAI.Module ...@@ -53,7 +84,9 @@ namespace VIZ.GimbalAI.Module
/// <param name="context">应用程序启动上下文</param> /// <param name="context">应用程序启动上下文</param>
public override void Shutdown(AppSetupContext context) public override void Shutdown(AppSetupContext context)
{ {
VideoStreamManager.Get<NDIStream>(NDIViewKeys.Main)?.Dispose(); VideoStreamManager.Get<DeckLinkStream>(VideoViewKeys.Main)?.Dispose();
DeckLinkManager.Dispose();
} }
} }
} }
\ No newline at end of file
...@@ -160,10 +160,6 @@ ...@@ -160,10 +160,6 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="ControlView\View\ChangeNdiStreamView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ControlView\View\ControlView.xaml"> <Page Include="ControlView\View\ControlView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
...@@ -195,10 +191,6 @@ ...@@ -195,10 +191,6 @@
<DependentUpon>ConsoleView.xaml</DependentUpon> <DependentUpon>ConsoleView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="ControlView\Service\IControlViewService.cs" /> <Compile Include="ControlView\Service\IControlViewService.cs" />
<Compile Include="ControlView\ViewModel\ChangeNdiStreamViewModel.cs" />
<Compile Include="ControlView\View\ChangeNdiStreamView.xaml.cs">
<DependentUpon>ChangeNdiStreamView.xaml</DependentUpon>
</Compile>
<Compile Include="ControlView\ViewModel\ControlViewModel.cs" /> <Compile Include="ControlView\ViewModel\ControlViewModel.cs" />
<Compile Include="ControlView\View\ControlView.xaml.cs"> <Compile Include="ControlView\View\ControlView.xaml.cs">
<DependentUpon>ControlView.xaml</DependentUpon> <DependentUpon>ControlView.xaml</DependentUpon>
...@@ -231,7 +223,7 @@ ...@@ -231,7 +223,7 @@
<Compile Include="Setup\Provider\Load\AppSetup_SetupGimbal.cs" /> <Compile Include="Setup\Provider\Load\AppSetup_SetupGimbal.cs" />
<Compile Include="Setup\Provider\Load\AppSetup_SetupAlgorithm.cs" /> <Compile Include="Setup\Provider\Load\AppSetup_SetupAlgorithm.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitConfig.cs" /> <Compile Include="Setup\Provider\Setup\AppSetup_InitConfig.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitNDI.cs" /> <Compile Include="Setup\Provider\Setup\AppSetup_InitDeckLink.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" /> <Compile Include="Setup\Provider\Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitUDP.cs" /> <Compile Include="Setup\Provider\Setup\AppSetup_InitUDP.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" /> <Compile Include="Setup\Provider\Setup\AppSetup_InitLiteDB.cs" />
......
...@@ -55,15 +55,9 @@ namespace VIZ.GimbalAI.Module ...@@ -55,15 +55,9 @@ namespace VIZ.GimbalAI.Module
void ClearRectangleInfo(); void ClearRectangleInfo();
/// <summary> /// <summary>
/// 切换NDI流
/// </summary>
/// <param name="name">流名称</param>
void ChangeNdiStream(string name);
/// <summary>
/// 设置NDI帧延时 /// 设置NDI帧延时
/// </summary> /// </summary>
/// <param name="delayFrame">帧延时</param> /// <param name="delayFrame">帧延时</param>
void ChangeNdiVideoFrameDelay(int delayFrame); void ChangeVideoFrameDelay(int delayFrame);
} }
} }
...@@ -55,10 +55,10 @@ namespace VIZ.GimbalAI.Module ...@@ -55,10 +55,10 @@ namespace VIZ.GimbalAI.Module
private void InitNDI() private void InitNDI()
{ {
// 注册NDI事件 // 注册NDI事件
this.ndiStream = VideoStreamManager.Get<NDIStream>(NDIViewKeys.Main); this.deckLinkStream = VideoStreamManager.Get<DeckLinkStream>(VideoViewKeys.Main);
this.ndiStream.ExecuteVideoFrame -= NDIStream_ExecuteVideoFrame; this.deckLinkStream.ExecuteVideoFrame -= DeckLinkStream_ExecuteVideoFrame;
this.ndiStream.ExecuteVideoFrame += NDIStream_ExecuteVideoFrame; this.deckLinkStream.ExecuteVideoFrame += DeckLinkStream_ExecuteVideoFrame;
this.ndiStream.Start(); this.deckLinkStream.Start();
} }
/// <summary> /// <summary>
...@@ -138,9 +138,9 @@ namespace VIZ.GimbalAI.Module ...@@ -138,9 +138,9 @@ namespace VIZ.GimbalAI.Module
// ====================================================================================== // ======================================================================================
/// <summary> /// <summary>
/// 流信息 /// DeckLink流
/// </summary> /// </summary>
private NDIStream ndiStream; private DeckLinkStream deckLinkStream;
/// <summary> /// <summary>
/// 跟踪框插件 /// 跟踪框插件
...@@ -413,21 +413,12 @@ namespace VIZ.GimbalAI.Module ...@@ -413,21 +413,12 @@ namespace VIZ.GimbalAI.Module
} }
/// <summary> /// <summary>
/// 切换NDI流 /// 设置帧延时
/// </summary>
/// <param name="name">流名称</param>
public void ChangeNdiStream(string name)
{
this.ndiStream?.ChangeRemoteSenderName(name);
}
/// <summary>
/// 设置NDI帧延时
/// </summary> /// </summary>
/// <param name="delayFrame">帧延时</param> /// <param name="delayFrame">帧延时</param>
public void ChangeNdiVideoFrameDelay(int delayFrame) public void ChangeVideoFrameDelay(int delayFrame)
{ {
this.ndiStream.SetVideoFrameDelay(delayFrame); this.deckLinkStream.SetVideoFrameDelay(delayFrame);
} }
// ====================================================================================== // ======================================================================================
...@@ -437,7 +428,7 @@ namespace VIZ.GimbalAI.Module ...@@ -437,7 +428,7 @@ namespace VIZ.GimbalAI.Module
/// <summary> /// <summary>
/// 处理视频帧信息 /// 处理视频帧信息
/// </summary> /// </summary>
private void NDIStream_ExecuteVideoFrame(object sender, VideoFrameEventArgs e) private void DeckLinkStream_ExecuteVideoFrame(object sender, VideoFrameEventArgs e)
{ {
VideoView view = this.GetView<VideoView>(); VideoView view = this.GetView<VideoView>();
if (view == null) if (view == null)
......
...@@ -47,5 +47,11 @@ namespace VIZ.GimbalAI.Storage ...@@ -47,5 +47,11 @@ namespace VIZ.GimbalAI.Storage
/// </summary> /// </summary>
[Ini(Section = "Client", DefaultValue = @"500")] [Ini(Section = "Client", DefaultValue = @"500")]
public string CLIENT_CONSOLE_LOG_MAX_LINE { get; set; } public string CLIENT_CONSOLE_LOG_MAX_LINE { get; set; }
/// <summary>
/// 采集口名称
/// </summary>
[Ini(Section = "Client", DefaultValue = @"DeckLink Quad (1)")]
public string CLIENT_DECKLINK_DISPLAY_NAME { get; set; }
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Storage;
namespace VIZ.GimbalAI.Storage
{
/// <summary>
/// NDI配置
/// </summary>
public class NdiConfig : IniConfigBase
{
/// <summary>
/// NDI流名称
/// </summary>
[Ini(Section = "NDI", DefaultValue = "STATION-P620-03 (OBS)")]
public string NDI_STREAM_NAME { get; set; }
}
}
...@@ -126,7 +126,6 @@ ...@@ -126,7 +126,6 @@
<Compile Include="Ini\Config\ClientConfig.cs" /> <Compile Include="Ini\Config\ClientConfig.cs" />
<Compile Include="Ini\Config\GimbalConfig.cs" /> <Compile Include="Ini\Config\GimbalConfig.cs" />
<Compile Include="Ini\Config\AlgorithmConfig.cs" /> <Compile Include="Ini\Config\AlgorithmConfig.cs" />
<Compile Include="Ini\Config\NdiConfig.cs" />
<Compile Include="Ini\Config\UdpConfig.cs" /> <Compile Include="Ini\Config\UdpConfig.cs" />
<Compile Include="LiteDB\Gimbal\GimbalPreset.cs" /> <Compile Include="LiteDB\Gimbal\GimbalPreset.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment