Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.GimbalAI
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.GimbalAI
Commits
12dd5af3
Commit
12dd5af3
authored
Oct 18, 2022
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
切换DeckLink设备
parent
4c4b4cd2
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
71 additions
and
435 deletions
+71
-435
VIZ.GimbalAI.Client/App.xaml.cs
+2
-2
VIZ.GimbalAI.Client/config/config.ini
+2
-6
VIZ.GimbalAI.Domain/Enum/VideoViewKeys.cs
+2
-2
VIZ.GimbalAI.Domain/VIZ.GimbalAI.Domain.csproj
+1
-1
VIZ.GimbalAI.Module/ControlView/View/ChangeNdiStreamView.xaml
+0
-94
VIZ.GimbalAI.Module/ControlView/View/ChangeNdiStreamView.xaml.cs
+0
-32
VIZ.GimbalAI.Module/ControlView/ViewModel/ChangeNdiStreamViewModel.cs
+0
-203
VIZ.GimbalAI.Module/ControlView/ViewModel/ChangeVideoFrameDelayViewModel.cs
+1
-1
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
+1
-1
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
+0
-26
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_InitDeckLink.cs
+44
-10
VIZ.GimbalAI.Module/VIZ.GimbalAI.Module.csproj
+1
-9
VIZ.GimbalAI.Module/VideoView/Service/IVideoViewService.cs
+1
-7
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
+10
-19
VIZ.GimbalAI.Storage/Ini/Config/ClientConfig.cs
+6
-0
VIZ.GimbalAI.Storage/Ini/Config/NdiConfig.cs
+0
-21
VIZ.GimbalAI.Storage/VIZ.GimbalAI.Storage.csproj
+0
-1
No files found.
VIZ.GimbalAI.Client/App.xaml.cs
View file @
12dd5af3
...
@@ -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_In
itNDI
());
AppSetup
.
AppendSetup
(
new
AppSetup_In
tDeckLink
());
// 初始化 UDP
// 初始化 UDP
AppSetup
.
AppendSetup
(
new
AppSetup_InitUDP
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitUDP
());
...
...
VIZ.GimbalAI.Client/config/config.ini
View file @
12dd5af3
...
@@ -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 ===
...
...
VIZ.GimbalAI.Domain/Enum/
NDI
ViewKeys.cs
→
VIZ.GimbalAI.Domain/Enum/
Video
ViewKeys.cs
View file @
12dd5af3
...
@@ -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
NDI
ViewKeys
public
static
class
Video
ViewKeys
{
{
/// <summary>
/// <summary>
/// 主视图
/// 主视图
...
...
VIZ.GimbalAI.Domain/VIZ.GimbalAI.Domain.csproj
View file @
12dd5af3
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
<Reference Include="System.Xml" />
<Reference Include="System.Xml" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
<Compile Include="Enum\
NDI
ViewKeys.cs" />
<Compile Include="Enum\
Video
ViewKeys.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" />
...
...
VIZ.GimbalAI.Module/ControlView/View/ChangeNdiStreamView.xaml
deleted
100644 → 0
View file @
4c4b4cd2
<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>
VIZ.GimbalAI.Module/ControlView/View/ChangeNdiStreamView.xaml.cs
deleted
100644 → 0
View file @
4c4b4cd2
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
;
}
}
}
VIZ.GimbalAI.Module/ControlView/ViewModel/ChangeNdiStreamViewModel.cs
deleted
100644 → 0
View file @
4c4b4cd2
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
// ==============================================================================================
}
}
VIZ.GimbalAI.Module/ControlView/ViewModel/ChangeVideoFrameDelayViewModel.cs
View file @
12dd5af3
...
@@ -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
.
Change
Ndi
VideoFrameDelay
(
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
);
...
...
VIZ.GimbalAI.Module/MainView/View/MainView.xaml
View file @
12dd5af3
...
@@ -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>
...
...
VIZ.GimbalAI.Module/MainView/ViewModel/MainViewModel.cs
View file @
12dd5af3
...
@@ -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>
...
...
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_Init
NDI
.cs
→
VIZ.GimbalAI.Module/Setup/Provider/Setup/AppSetup_Init
DeckLink
.cs
View file @
12dd5af3
...
@@ -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_In
itNDI
:
AppSetupBase
public
class
AppSetup_In
tDeckLink
:
AppSetupBase
{
{
/// <summary>
/// <summary>
/// 日志
/// 日志
/// </summary>
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_In
itNDI
));
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
AppSetup_In
tDeckLink
));
/// <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
NDI
StreamOption
();
DeckLinkStreamOption
option
=
new
DeckLink
StreamOption
();
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
VIZ.GimbalAI.Module/VIZ.GimbalAI.Module.csproj
View file @
12dd5af3
...
@@ -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_Init
NDI
.cs" />
<Compile Include="Setup\Provider\Setup\AppSetup_Init
DeckLink
.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" />
...
...
VIZ.GimbalAI.Module/VideoView/Service/IVideoViewService.cs
View file @
12dd5af3
...
@@ -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
Change
Ndi
VideoFrameDelay
(
int
delayFrame
);
void
ChangeVideoFrameDelay
(
int
delayFrame
);
}
}
}
}
VIZ.GimbalAI.Module/VideoView/ViewModel/VideoViewModel.cs
View file @
12dd5af3
...
@@ -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
>(
NDI
ViewKeys
.
Main
);
this
.
deckLinkStream
=
VideoStreamManager
.
Get
<
DeckLinkStream
>(
Video
ViewKeys
.
Main
);
this
.
ndiStream
.
ExecuteVideoFrame
-=
NDI
Stream_ExecuteVideoFrame
;
this
.
deckLinkStream
.
ExecuteVideoFrame
-=
DeckLink
Stream_ExecuteVideoFrame
;
this
.
ndiStream
.
ExecuteVideoFrame
+=
NDI
Stream_ExecuteVideoFrame
;
this
.
deckLinkStream
.
ExecuteVideoFrame
+=
DeckLink
Stream_ExecuteVideoFrame
;
this
.
ndi
Stream
.
Start
();
this
.
deckLink
Stream
.
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
ndi
Stream
;
private
DeckLinkStream
deckLink
Stream
;
/// <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
Change
Ndi
VideoFrameDelay
(
int
delayFrame
)
public
void
ChangeVideoFrameDelay
(
int
delayFrame
)
{
{
this
.
ndi
Stream
.
SetVideoFrameDelay
(
delayFrame
);
this
.
deckLink
Stream
.
SetVideoFrameDelay
(
delayFrame
);
}
}
// ======================================================================================
// ======================================================================================
...
@@ -437,7 +428,7 @@ namespace VIZ.GimbalAI.Module
...
@@ -437,7 +428,7 @@ namespace VIZ.GimbalAI.Module
/// <summary>
/// <summary>
/// 处理视频帧信息
/// 处理视频帧信息
/// </summary>
/// </summary>
private
void
NDI
Stream_ExecuteVideoFrame
(
object
sender
,
VideoFrameEventArgs
e
)
private
void
DeckLink
Stream_ExecuteVideoFrame
(
object
sender
,
VideoFrameEventArgs
e
)
{
{
VideoView
view
=
this
.
GetView
<
VideoView
>();
VideoView
view
=
this
.
GetView
<
VideoView
>();
if
(
view
==
null
)
if
(
view
==
null
)
...
...
VIZ.GimbalAI.Storage/Ini/Config/ClientConfig.cs
View file @
12dd5af3
...
@@ -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
;
}
}
}
}
}
VIZ.GimbalAI.Storage/Ini/Config/NdiConfig.cs
deleted
100644 → 0
View file @
4c4b4cd2
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
;
}
}
}
VIZ.GimbalAI.Storage/VIZ.GimbalAI.Storage.csproj
View file @
12dd5af3
...
@@ -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" />
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment