Commit b99a49b6 by 鲁志-悦动

视频流的深拷贝

parent 269220f4
b77ab2f7b49389b9182c7f81f043501dbd1f28bc fba8dc5b9b837464b22019519439fe1b9f969740
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
library library
C# C#
.cs .cs
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\obj\x64\Debug\ D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\obj\x64\Debug\
VIZ.FGOUT.Common VIZ.FGOUT.Common
none none
false false
...@@ -13,7 +13,7 @@ false ...@@ -13,7 +13,7 @@ false
21870986562 21870986562
31364711570 31364711570
171166775462 171121717210
Themes\Generic.xaml;Widgets\FootballFieldPanel\FootballFieldPanel.xaml; Themes\Generic.xaml;Widgets\FootballFieldPanel\FootballFieldPanel.xaml;
False False
......
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\obj\x64\Debug\GeneratedInternalTypeHelper.g.cs D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\obj\x64\Debug\GeneratedInternalTypeHelper.g.cs
FD:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\Themes\Generic.xaml;; FD:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\Themes\Generic.xaml;;
FD:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\Widgets\FootballFieldPanel\FootballFieldPanel.xaml;; FD:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Common\Widgets\FootballFieldPanel\FootballFieldPanel.xaml;;
fdabdd16b89e6e5e7c9f808ae8e6503a5aab99e9 47cca392853111971d94a0d2c7f46eca4658dc87
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
/// </summary> /// </summary>
public class ReplayModel public class ReplayModel
{ {
public bool IsReplay { get; set; }
} }
} }
1565ec4cef60aa46d7212ff978cf49d7d3fe3743 a374a7f17b3bff0c3c028efbfc085fc4a1015b5b
...@@ -498,3 +498,5 @@ D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\VIZ.FGOUT.Mo ...@@ -498,3 +498,5 @@ D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\VIZ.FGOUT.Mo
D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\VIZ.FGOUT.Module.Resource.pdb D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\VIZ.FGOUT.Module.Resource.pdb
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\Style\ToogleButton\ToogleButton_Setting.baml D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\Style\ToogleButton\ToogleButton_Setting.baml
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\Style\TextBlock\TextBlock_Setting.baml D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\Style\TextBlock\TextBlock_Setting.baml
D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\Style\TextBlock\TextBlock_Setting.baml
D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\Style\ToogleButton\ToogleButton_Setting.baml
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
library library
C# C#
.cs .cs
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\ D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\
VIZ.FGOUT.Module.Resource VIZ.FGOUT.Module.Resource
none none
false false
...@@ -13,7 +13,7 @@ DEBUG;TRACE ...@@ -13,7 +13,7 @@ DEBUG;TRACE
18560433975 18560433975
1470602451 1470602451
11-350624472 11-350624472
241319896476 24771590698
Style\Button\Button_NdiView.xaml;Style\Button\Button_Setting.xaml;Style\Button\Button_WindowTop.xaml;Style\CheckBox\CheckBox_NdiView.xaml;Style\CheckBox\CheckBox_Setting.xaml;Style\CheckBox\CheckBox_WindowTop.xaml;Style\ComboBox\ComboBox_Setting.xaml;Style\HotkeyBox\HotkeyBox_Setting.xaml;Style\MessageBox\MessageBoxEx.xaml;Style\RadioButton\RadioButton_FootballSide.xaml;Style\RadioButton\RadioButton_NdiView.xaml;Style\RadioButton\RadioButton_Setting.xaml;Style\Slider\Slider_Setting.xaml;Style\TextBlock\TextBlock_Setting.xaml;Style\TextBox\TextBox_Setting.xaml;Style\ToogleButton\ToogleButton_Setting.xaml;Themes\Generic.xaml;Toolkit\NumericUpDown\NumericUpDown.xaml; Style\Button\Button_NdiView.xaml;Style\Button\Button_Setting.xaml;Style\Button\Button_WindowTop.xaml;Style\CheckBox\CheckBox_NdiView.xaml;Style\CheckBox\CheckBox_Setting.xaml;Style\CheckBox\CheckBox_WindowTop.xaml;Style\ComboBox\ComboBox_Setting.xaml;Style\HotkeyBox\HotkeyBox_Setting.xaml;Style\MessageBox\MessageBoxEx.xaml;Style\RadioButton\RadioButton_FootballSide.xaml;Style\RadioButton\RadioButton_NdiView.xaml;Style\RadioButton\RadioButton_Setting.xaml;Style\Slider\Slider_Setting.xaml;Style\TextBlock\TextBlock_Setting.xaml;Style\TextBox\TextBox_Setting.xaml;Style\ToogleButton\ToogleButton_Setting.xaml;Themes\Generic.xaml;Toolkit\NumericUpDown\NumericUpDown.xaml;
False False
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
library library
C# C#
.cs .cs
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\ D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\obj\x64\Debug\
VIZ.FGOUT.Module.Resource VIZ.FGOUT.Module.Resource
none none
false false
...@@ -13,8 +13,8 @@ DEBUG;TRACE ...@@ -13,8 +13,8 @@ DEBUG;TRACE
18560433975 18560433975
1470602451 1470602451
121374819015 121374819015
23-676971786 23-1225277564
Style\Button\Button_NdiView.xaml;Style\Button\Button_Setting.xaml;Style\Button\Button_WindowTop.xaml;Style\CheckBox\CheckBox_NdiView.xaml;Style\CheckBox\CheckBox_Setting.xaml;Style\CheckBox\CheckBox_WindowTop.xaml;Style\ComboBox\ComboBox_Setting.xaml;Style\HotkeyBox\HotkeyBox_Setting.xaml;Style\MessageBox\MessageBoxEx.xaml;Style\RadioButton\RadioButton_FootballSide.xaml;Style\RadioButton\RadioButton_NdiView.xaml;Style\RadioButton\RadioButton_Setting.xaml;Style\Slider\Slider_Setting.xaml;Style\TextBlock\TextBlock_Setting.xaml;Style\TextBox\TextBox_Setting.xaml;Style\ToogleButton\ToogleButton_Setting.xaml;Themes\Generic.xaml;Toolkit\NumericUpDown\NumericUpDown.xaml; Style\Button\Button_NdiView.xaml;Style\Button\Button_Setting.xaml;Style\Button\Button_WindowTop.xaml;Style\CheckBox\CheckBox_NdiView.xaml;Style\CheckBox\CheckBox_Setting.xaml;Style\CheckBox\CheckBox_WindowTop.xaml;Style\ComboBox\ComboBox_Setting.xaml;Style\HotkeyBox\HotkeyBox_Setting.xaml;Style\MessageBox\MessageBoxEx.xaml;Style\RadioButton\RadioButton_FootballSide.xaml;Style\RadioButton\RadioButton_NdiView.xaml;Style\RadioButton\RadioButton_Setting.xaml;Style\Slider\Slider_Setting.xaml;Style\TextBlock\TextBlock_Setting.xaml;Style\TextBox\TextBox_Setting.xaml;Style\ToogleButton\ToogleButton_Setting.xaml;Themes\Generic.xaml;Toolkit\NumericUpDown\NumericUpDown.xaml;
False True
 
FD:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\Themes\Generic.xaml;; FD:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module.Resource\Themes\Generic.xaml;;
...@@ -124,15 +124,13 @@ ...@@ -124,15 +124,13 @@
<WrapPanel <WrapPanel
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="1"
Margin="135,0,0,0"> Margin="135,0,0,0">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<GroupBox Foreground="White" Header="自动检测"> <GroupBox Foreground="White" Header="自动检测">
<CheckBox <CheckBox
Margin="15" Margin="15"
...@@ -178,9 +176,7 @@ ...@@ -178,9 +176,7 @@
Grid.Column="0" Grid.Column="0"
Margin="0,0,40,0" Margin="0,0,40,0"
HorizontalAlignment="Right"> HorizontalAlignment="Right">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
...@@ -204,7 +200,7 @@ ...@@ -204,7 +200,7 @@
<Button <Button
Grid.Column="1" Grid.Column="1"
Width="100" Width="100" IsEnabled="{Binding ReplayEnable, Mode=TwoWay}"
Height="40" Height="40"
Margin="10" Margin="10"
Command="{Binding ReplayCommand}" Command="{Binding ReplayCommand}"
......
...@@ -455,12 +455,17 @@ namespace VIZ.FGOUT.Module ...@@ -455,12 +455,17 @@ namespace VIZ.FGOUT.Module
#region Replay 命令 #region Replay 命令
public VCommand ReplayCommand { get; set; } public VCommand ReplayCommand { get; set; }
private bool _replayButtonIsEnable = true;
/// <summary> /// <summary>
/// replay 播控功能 /// replay 播控功能
/// </summary> /// </summary>
private void Replay() private void Replay()
{ {
ReplayModel replayModel = new ReplayModel(); if (_replayButtonIsEnable)
ReplayEnable = _replayButtonIsEnable = false;
else
ReplayEnable = _replayButtonIsEnable = true;
ReplayModel replayModel = new ReplayModel() { IsReplay = !_replayButtonIsEnable };
ApplicationDomainEx.MessageManager.Send(replayModel); ApplicationDomainEx.MessageManager.Send(replayModel);
} }
...@@ -664,6 +669,19 @@ namespace VIZ.FGOUT.Module ...@@ -664,6 +669,19 @@ namespace VIZ.FGOUT.Module
#region 按钮可用性 #region 按钮可用性
/// <summary>
/// 开始位置可用性
/// </summary>
private bool replayEnable = true;
public bool ReplayEnable
{
get { return replayEnable; }
set { replayEnable = value; this.RaisePropertyChanged(nameof(ReplayEnable)); }
}
/// <summary> /// <summary>
/// 开始位置可用性 /// 开始位置可用性
/// </summary> /// </summary>
......
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Shapes; using System.Windows.Shapes;
using VIZ.FGOUT.Domain;
using VIZ.FGOUT.Storage; using VIZ.FGOUT.Storage;
using VIZ.Framework.Core; using VIZ.Framework.Core;
...@@ -16,7 +14,7 @@ namespace VIZ.FGOUT.Module ...@@ -16,7 +14,7 @@ namespace VIZ.FGOUT.Module
/// </summary> /// </summary>
public partial class NDIView : UserControl public partial class NDIView : UserControl
{ {
NDIViewModel vm = new NDIViewModel(); public NDIViewModel vm = new NDIViewModel();
//Rectangle rectStart = new Rectangle(); //Rectangle rectStart = new Rectangle();
...@@ -100,94 +98,94 @@ namespace VIZ.FGOUT.Module ...@@ -100,94 +98,94 @@ namespace VIZ.FGOUT.Module
private void Border_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) private void Border_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{ {
this.manualConfig = ApplicationDomainEx.LiteDbContext.SetManualConfig.FindAll().FirstOrDefault(); // this.manualConfig = ApplicationDomainEx.LiteDbContext.SetManualConfig.FindAll().FirstOrDefault();
if (!this.manualConfig.IsManual) return; // if (!this.manualConfig.IsManual) return;
isMouseDown = false; // isMouseDown = false;
//if (vm.IsDrawStartPlace) // //if (vm.IsDrawStartPlace)
//{
// rectStart.Stroke = Brushes.Red;
// rectStart.StrokeThickness = 0;
// //if (!this.canvas1.Children.Contains(rectStart))
// //{ // //{
// // this.canvas1.Children.Add(rectStart); // // rectStart.Stroke = Brushes.Red;
// //} // // rectStart.StrokeThickness = 0;
//} // // //if (!this.canvas1.Children.Contains(rectStart))
// // //{
// // // this.canvas1.Children.Add(rectStart);
// // //}
//if (vm.IsDrawEndPlace) // //}
//{
// rectEnd.Stroke = Brushes.Green;
// rectEnd.StrokeThickness = 0;
// //if (!this.canvas1.Children.Contains(rectEnd)) // //if (vm.IsDrawEndPlace)
// //{ // //{
// // this.canvas1.Children.Add(rectEnd);
// // rectEnd.Stroke = Brushes.Green;
// // rectEnd.StrokeThickness = 0;
// // //if (!this.canvas1.Children.Contains(rectEnd))
// // //{
// // // this.canvas1.Children.Add(rectEnd);
// // //}
// //} // //}
//} // double width= this.video.ActualWidth;
double width= this.video.ActualWidth;
double height = this.video.ActualHeight; // double height = this.video.ActualHeight;
double cans1width = this.canvas1.ActualWidth; // double cans1width = this.canvas1.ActualWidth;
double cans1height = this.canvas1.ActualHeight; // double cans1height = this.canvas1.ActualHeight;
if (vm.IsDrawStartPlace) // if (vm.IsDrawStartPlace)
{ // {
///aa = new PathGeometry(); // ///aa = new PathGeometry();
/// // ///
//if (aa == null) // //if (aa == null)
//{ // //{
aa = new PathGeometry(); // aa = new PathGeometry();
//RectangleGeometry temp1 = new RectangleGeometry(rectStart); // //RectangleGeometry temp1 = new RectangleGeometry(rectStart);
// temp1.StrokeContains // // temp1.StrokeContains
//foreach (var rectStart in rectStarts) // //foreach (var rectStart in rectStarts)
//{ // //{
// aa.AddGeometry(new RectangleGeometry(rectStart)); // // aa.AddGeometry(new RectangleGeometry(rectStart));
//} // //}
//aa.AddGeometry(new RectangleGeometry(rectStart)); // //aa.AddGeometry(new RectangleGeometry(rectStart));
aa.AddGeometry(new RectangleGeometry(rectEnd)); // aa.AddGeometry(new RectangleGeometry(rectEnd));
aa.AddGeometry(new RectangleGeometry(rectInvalid)); // aa.AddGeometry(new RectangleGeometry(rectInvalid));
// // }
// } // }
} // else if(vm.IsDrawEndPlace)
else if(vm.IsDrawEndPlace) // {
{ // //if (aa == null)
//if (aa == null)
//{ // //{
// bb = new PathGeometry(); // // bb = new PathGeometry();
// bb.AddGeometry(new RectangleGeometry(rectEnd)); // // bb.AddGeometry(new RectangleGeometry(rectEnd));
// } // // }
aa = new PathGeometry(); // aa = new PathGeometry();
//foreach (var rectStart in rectStarts) // //foreach (var rectStart in rectStarts)
//{ // //{
// aa.AddGeometry(new RectangleGeometry(rectStart)); // // aa.AddGeometry(new RectangleGeometry(rectStart));
//} // //}
//aa.AddGeometry(new RectangleGeometry(rectStart)); // //aa.AddGeometry(new RectangleGeometry(rectStart));
aa.AddGeometry(new RectangleGeometry(rectEnd)); // aa.AddGeometry(new RectangleGeometry(rectEnd));
aa.AddGeometry(new RectangleGeometry(rectInvalid)); // aa.AddGeometry(new RectangleGeometry(rectInvalid));
} // }
else if(vm.IsDrawInvalidPlace) //else if(vm.IsDrawInvalidPlace)
{ // {
aa = new PathGeometry(); // aa = new PathGeometry();
//foreach (var rectStart in rectStarts) // //foreach (var rectStart in rectStarts)
//{ // //{
// aa.AddGeometry(new RectangleGeometry(rectStart)); // // aa.AddGeometry(new RectangleGeometry(rectStart));
//} // //}
//aa.AddGeometry(new RectangleGeometry(rectStart)); // //aa.AddGeometry(new RectangleGeometry(rectStart));
aa.AddGeometry(new RectangleGeometry(rectEnd)); // aa.AddGeometry(new RectangleGeometry(rectEnd));
aa.AddGeometry(new RectangleGeometry(rectInvalid)); // aa.AddGeometry(new RectangleGeometry(rectInvalid));
} // }
myPath.Data = aa; // myPath.Data = aa;
} }
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
......
using SharpDX.Mathematics.Interop; using SharpDX;
using SharpDX.Mathematics.Interop;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using VIZ.FGOUT.Connection; using VIZ.FGOUT.Connection;
using VIZ.FGOUT.Domain; using VIZ.FGOUT.Domain;
...@@ -16,7 +18,11 @@ namespace VIZ.FGOUT.Module ...@@ -16,7 +18,11 @@ namespace VIZ.FGOUT.Module
/// </summary> /// </summary>
public partial class NDIViewModel public partial class NDIViewModel
{ {
private FrameBuffer _frameBuffer = new FrameBuffer(TimeSpan.FromSeconds(10)); //private FrameBuffer _frameBuffer = new FrameBuffer(TimeSpan.FromSeconds(10));
private FrameBuffer _frameBuffer = new FrameBuffer(TimeSpan.FromSeconds(1));
//private CircularVideoBuffer _frameBuffer = new CircularVideoBuffer(50);
MemoryStream videoBuffer = new MemoryStream();
/// <summary> /// <summary>
/// 重置3D鼠标 /// 重置3D鼠标
/// </summary> /// </summary>
...@@ -106,6 +112,25 @@ namespace VIZ.FGOUT.Module ...@@ -106,6 +112,25 @@ namespace VIZ.FGOUT.Module
/// </summary> /// </summary>
public long timecode = 0; public long timecode = 0;
private int index = 0;
/// <summary>
/// 视频流数据的深度复制
/// </summary>
/// <param name="originalStream"></param>
/// <returns></returns>
private static DataStream DeepCloneDataStream(DataStream originalStream)
{
// 创建新的 DataStream 对象
DataStream clonedStream = new DataStream((int)originalStream.Length, true, true);
// 读取原始数据并写入到新的 DataStream 对象
byte[] buffer = new byte[originalStream.Length];
clonedStream.Write(buffer, 0, buffer.Length);
// 重新设置新的 DataStream 对象的 Position 属性
clonedStream.Position = 0;
return clonedStream;
}
/// <summary> /// <summary>
/// 处理NDI流帧 /// 处理NDI流帧
/// </summary> /// </summary>
...@@ -115,14 +140,57 @@ namespace VIZ.FGOUT.Module ...@@ -115,14 +140,57 @@ namespace VIZ.FGOUT.Module
if (view == null) if (view == null)
return; return;
//缓存策略 ////缓存策略
//_frameBuffer.AddFrame(e.Frame); //_frameBuffer.AddFrame(e.Frame);
//_frameBufferPlay.AddFrame(e.Frame);
DataStreamExtend dsExtend = new DataStreamExtend();
if (view.vm.IsReplay)
{
//Queue<IVideoFrame> buffer = _frameBuffer.GetFrames();
//IVideoFrame buffer = _frameBuffer.GetFrame(index);
//if (buffer.DataStream!=null)
// view.video.UpdateVideoFrame(buffer);
//else
// view.vm.IsReplay = false;
//videoBuffer.Seek(0, SeekOrigin.Begin);
//index++;
Queue<DataStreamExtend> buffer = _frameBuffer.GetFrames();
if (buffer.Count > 0)
// 更新画面
view.video.UpdateVideoFrame(buffer.Dequeue());
else
view.vm.IsReplay = false;
}
else
{
//缓存策略
//index = 0;
//Stream videoStream = e.Frame.DataStream;
//videoStream.CopyTo(videoBuffer);
//时间戳获取 //时间戳获取
timecode = e.Frame.TimeStamp; timecode = e.Frame.TimeStamp;
// 更新画面 // 更新画面
view.video.UpdateVideoFrame(e.Frame); view.video.UpdateVideoFrame(e.Frame);
//VideoFrameEventArgs args = new VideoFrameEventArgs
//{
// Frame = e.Frame
//};
//args.Frame.DataStream = DeepCloneDataStream(e.Frame.DataStream);
//dsExtend.DataStream = DeepCloneDataStream(e.Frame.DataStream);
//dsExtend.Length = e.Frame.Length;
//dsExtend.Width = e.Frame.Width;
//dsExtend.Height = e.Frame.Height;
////dsExtend.TimeStamp = e.Frame.TimeStamp;
//_frameBuffer.AddFrame(dsExtend);
// 更新手动裁切框 // 更新手动裁切框
// 仅手动模式下处理 & 居中模式下处理 & 需要进行裁切 时才处理 // 仅手动模式下处理 & 居中模式下处理 & 需要进行裁切 时才处理
if ((this.StrategyMode == AlgorithmStrategyMode.center_mode || this.StrategyMode == AlgorithmStrategyMode.manual_mode) && this.IsUseClip) if ((this.StrategyMode == AlgorithmStrategyMode.center_mode || this.StrategyMode == AlgorithmStrategyMode.manual_mode) && this.IsUseClip)
...@@ -163,7 +231,7 @@ namespace VIZ.FGOUT.Module ...@@ -163,7 +231,7 @@ namespace VIZ.FGOUT.Module
// } // }
//} //}
} }
}
// 统计裁切FPS // 统计裁切FPS
this.ClipFPS.CalcFps(); this.ClipFPS.CalcFps();
} }
...@@ -171,7 +239,7 @@ namespace VIZ.FGOUT.Module ...@@ -171,7 +239,7 @@ namespace VIZ.FGOUT.Module
public class FrameBuffer public class FrameBuffer
{ {
private Queue<IVideoFrame> buffer; private Queue<DataStreamExtend> buffer;
private int bufferSize; private int bufferSize;
private TimeSpan bufferDuration; private TimeSpan bufferDuration;
...@@ -180,22 +248,80 @@ namespace VIZ.FGOUT.Module ...@@ -180,22 +248,80 @@ namespace VIZ.FGOUT.Module
bufferDuration = duration; bufferDuration = duration;
//bufferSize = (int)(duration.TotalMilliseconds / TimeSpan.FromSeconds(0.1).TotalMilliseconds); //bufferSize = (int)(duration.TotalMilliseconds / TimeSpan.FromSeconds(0.1).TotalMilliseconds);
bufferSize = duration.Seconds * 50; bufferSize = duration.Seconds * 50;
buffer = new Queue<IVideoFrame>(bufferSize); buffer = new Queue<DataStreamExtend>(bufferSize);
} }
public void AddFrame(IVideoFrame frame) public void AddFrame(DataStreamExtend frame)
{ {
buffer.Enqueue(frame); buffer.Enqueue(frame);
// 如果缓冲区超过容量,则移除最旧的帧 // 如果缓冲区超过容量,则移除最旧的帧
if (buffer.Count > bufferSize) //if (buffer.Count > bufferSize)
{ if (buffer.Count > 150)
buffer.Dequeue(); buffer.Dequeue();
}
//// 使用 Dispatcher 将操作推送到 UI 线程
//Application.Current.Dispatcher.Invoke((Action)(() =>
//{
// // 在此处将 DataStream 放入队列
// buffer.Enqueue(frame);
// // 如果缓冲区超过容量,则移除最旧的帧
// if (buffer.Count > bufferSize)
// buffer.Dequeue();
//}));
} }
public IEnumerable<IVideoFrame> GetFrames() public Queue<DataStreamExtend> GetFrames()
{ {
return buffer; return buffer;
} }
} }
/// <summary>
/// 循环缓冲区
/// </summary>
public class CircularVideoBuffer
{
private readonly object lockObject = new object();
private readonly List<IVideoFrame> buffer;
private int currentIndex;
public int BufferSize { get; }
public CircularVideoBuffer(int bufferSize)
{
BufferSize = bufferSize;
buffer = new List<IVideoFrame>(bufferSize);
currentIndex = 0;
}
public void AddFrame(IVideoFrame frame)
{
lock (lockObject)
{
if (buffer.Count < BufferSize)
{
buffer.Add(frame);
}
else
{
buffer[currentIndex] = frame;
currentIndex = (currentIndex + 1) % BufferSize;
}
}
}
public IVideoFrame GetFrame(int index)
{
lock (lockObject)
{
if (index < buffer.Count)
{
return buffer[index];
}
return null;
}
}
}
} }
...@@ -69,7 +69,6 @@ namespace VIZ.FGOUT.Module ...@@ -69,7 +69,6 @@ namespace VIZ.FGOUT.Module
//初始化算法 //初始化算法
// this.InitAlgorithm(); // this.InitAlgorithm();
} }
/// <summary> /// <summary>
...@@ -160,20 +159,20 @@ namespace VIZ.FGOUT.Module ...@@ -160,20 +159,20 @@ namespace VIZ.FGOUT.Module
ueControlPanelView.Show(); ueControlPanelView.Show();
} }
public bool IsReplay =false;
/// <summary> /// <summary>
/// replay 命令 /// replay 命令
/// </summary> /// </summary>
private void Replay(ReplayModel replayModel) private void Replay(ReplayModel replayModel)
{ {
if (this.ViewKey != "CAM_1") if (this.ViewKey != "CAM_1")
{
return; return;
} IsReplay = replayModel.IsReplay;
//ReplayPanelView replayPanelView = new ReplayPanelView();
ReplayPanelView replayPanelView = new ReplayPanelView(); //RePlayPanelViewModel rePlayPanelViewModel = replayPanelView.DataContext as RePlayPanelViewModel;
RePlayPanelViewModel rePlayPanelViewModel = replayPanelView.DataContext as RePlayPanelViewModel; //rePlayPanelViewModel.timecode = timecode;
rePlayPanelViewModel.timecode = timecode; //replayPanelView.Show();
replayPanelView.Show();
} }
/// <summary> /// <summary>
...@@ -235,7 +234,6 @@ namespace VIZ.FGOUT.Module ...@@ -235,7 +234,6 @@ namespace VIZ.FGOUT.Module
IsDrawStartPlace = false; IsDrawStartPlace = false;
IsDrawEndPlace = false; IsDrawEndPlace = false;
IsCleanPlace = false; IsCleanPlace = false;
} }
...@@ -255,8 +253,8 @@ namespace VIZ.FGOUT.Module ...@@ -255,8 +253,8 @@ namespace VIZ.FGOUT.Module
IsDrawInvalidPlace = false; IsDrawInvalidPlace = false;
//nDIView.rectStart = new System.Windows.Rect(0, 0, 0, 0); //nDIView.rectStart = new System.Windows.Rect(0, 0, 0, 0);
nDIView.rectEnd = new System.Windows.Rect(0, 0, 0, 0); //nDIView.rectEnd = new System.Windows.Rect(0, 0, 0, 0);
nDIView.rectInvalid = new System.Windows.Rect(0, 0, 0, 0); //nDIView.rectInvalid = new System.Windows.Rect(0, 0, 0, 0);
nDIView.polygonsStart.Clear(); nDIView.polygonsStart.Clear();
nDIView.polygonsEnd.Clear(); nDIView.polygonsEnd.Clear();
...@@ -394,9 +392,7 @@ namespace VIZ.FGOUT.Module ...@@ -394,9 +392,7 @@ namespace VIZ.FGOUT.Module
this.manualConfig = ApplicationDomainEx.LiteDbContext.SetManualConfig.FindAll().FirstOrDefault(); this.manualConfig = ApplicationDomainEx.LiteDbContext.SetManualConfig.FindAll().FirstOrDefault();
if (this.manualConfig==null) if (this.manualConfig==null)
{
this.manualConfig = new SetManualConfig(); this.manualConfig = new SetManualConfig();
}
this.manualConfig.IsManual = savePlaceModel.IsManual; this.manualConfig.IsManual = savePlaceModel.IsManual;
this.manualConfig.IsStartMat = savePlaceModel.IsStartMat; this.manualConfig.IsStartMat = savePlaceModel.IsStartMat;
......
#pragma checksum "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "01435BBE89EC4DCDB63849DA92F11980D271587C3E8D98E3488B2A1580DCC915" #pragma checksum "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "0B309E3F95FE48A88A7C889AA393045A6B4CE3C6BEE153A0005C54FD0A0F5904"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。
...@@ -58,7 +58,7 @@ namespace VIZ.FGOUT.Module { ...@@ -58,7 +58,7 @@ namespace VIZ.FGOUT.Module {
#line hidden #line hidden
#line 306 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" #line 302 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal VIZ.FGOUT.Module.NDIView cam1; internal VIZ.FGOUT.Module.NDIView cam1;
...@@ -66,7 +66,7 @@ namespace VIZ.FGOUT.Module { ...@@ -66,7 +66,7 @@ namespace VIZ.FGOUT.Module {
#line hidden #line hidden
#line 324 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" #line 320 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal VIZ.FGOUT.Module.NDIView cam2; internal VIZ.FGOUT.Module.NDIView cam2;
......
#pragma checksum "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "01435BBE89EC4DCDB63849DA92F11980D271587C3E8D98E3488B2A1580DCC915" #pragma checksum "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "0B309E3F95FE48A88A7C889AA393045A6B4CE3C6BEE153A0005C54FD0A0F5904"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// 此代码由工具生成。 // 此代码由工具生成。
...@@ -58,7 +58,7 @@ namespace VIZ.FGOUT.Module { ...@@ -58,7 +58,7 @@ namespace VIZ.FGOUT.Module {
#line hidden #line hidden
#line 306 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" #line 302 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal VIZ.FGOUT.Module.NDIView cam1; internal VIZ.FGOUT.Module.NDIView cam1;
...@@ -66,7 +66,7 @@ namespace VIZ.FGOUT.Module { ...@@ -66,7 +66,7 @@ namespace VIZ.FGOUT.Module {
#line hidden #line hidden
#line 324 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml" #line 320 "..\..\..\..\..\NDIMainView\View\NDIMainView.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal VIZ.FGOUT.Module.NDIView cam2; internal VIZ.FGOUT.Module.NDIView cam2;
......
bb45dc7862f5677ab2cd5a3afa72c7ae1c5fd285 804b778db4c457a134cf20855d93b6ed1d83d406
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
library library
C# C#
.cs .cs
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\obj\x64\Debug\ D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\obj\x64\Debug\
VIZ.FGOUT.Module VIZ.FGOUT.Module
none none
false false
...@@ -13,7 +13,7 @@ DEBUG;TRACE ...@@ -13,7 +13,7 @@ DEBUG;TRACE
22-808211288 22-808211288
90-747441034 90-747441034
151130447140 151697787199
NDIMainView\View\NDIMainView.xaml;NDIPreviewView\View\NDIPreviewView.xaml;NDISettingView\View\AlgorithmSettingPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmCablewayPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmNearPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSinglePanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSixteenPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmTacticsPanelView.xaml;NDISettingView\View\NDISettingPanelView.xaml;NDISettingView\View\NDISettingView.xaml;NDIView\View\NDIView.xaml;SystemSetting\View\AboutPanelView.xaml;SystemSetting\View\CheckDataPanelView.xaml;SystemSetting\View\HotkeySettingPanelView.xaml;SystemSetting\View\MattingImagePanelView.xaml;SystemSetting\View\PackageSettingPanelView.xaml;SystemSetting\View\PreviewSettingPanelView.xaml;SystemSetting\View\ReplayPanelView.xaml;SystemSetting\View\StyleSettingPanelView.xaml;SystemSetting\View\SystemSettingView.xaml;SystemSetting\View\UEControlPanelView.xaml;SystemSetting\View\UESettingPanelView.xaml; NDIMainView\View\NDIMainView.xaml;NDIPreviewView\View\NDIPreviewView.xaml;NDISettingView\View\AlgorithmSettingPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmCablewayPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmNearPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSinglePanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSixteenPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmTacticsPanelView.xaml;NDISettingView\View\NDISettingPanelView.xaml;NDISettingView\View\NDISettingView.xaml;NDIView\View\NDIView.xaml;SystemSetting\View\AboutPanelView.xaml;SystemSetting\View\CheckDataPanelView.xaml;SystemSetting\View\HotkeySettingPanelView.xaml;SystemSetting\View\MattingImagePanelView.xaml;SystemSetting\View\PackageSettingPanelView.xaml;SystemSetting\View\PreviewSettingPanelView.xaml;SystemSetting\View\ReplayPanelView.xaml;SystemSetting\View\StyleSettingPanelView.xaml;SystemSetting\View\SystemSettingView.xaml;SystemSetting\View\UEControlPanelView.xaml;SystemSetting\View\UESettingPanelView.xaml;
False False
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
library library
C# C#
.cs .cs
D:\wyh\FGOUT\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\obj\x64\Debug\ D:\Projects\FGOUT\VIZ.FGOUT\VIZ.FGOUT.Module\obj\x64\Debug\
VIZ.FGOUT.Module VIZ.FGOUT.Module
none none
false false
...@@ -13,7 +13,7 @@ DEBUG;TRACE ...@@ -13,7 +13,7 @@ DEBUG;TRACE
22-808211288 22-808211288
91978002453 91978002453
151130447140 151697787199
NDIMainView\View\NDIMainView.xaml;NDIPreviewView\View\NDIPreviewView.xaml;NDISettingView\View\AlgorithmSettingPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmCablewayPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmNearPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSinglePanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSixteenPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmTacticsPanelView.xaml;NDISettingView\View\NDISettingPanelView.xaml;NDISettingView\View\NDISettingView.xaml;NDIView\View\NDIView.xaml;SystemSetting\View\AboutPanelView.xaml;SystemSetting\View\CheckDataPanelView.xaml;SystemSetting\View\HotkeySettingPanelView.xaml;SystemSetting\View\MattingImagePanelView.xaml;SystemSetting\View\PackageSettingPanelView.xaml;SystemSetting\View\PreviewSettingPanelView.xaml;SystemSetting\View\ReplayPanelView.xaml;SystemSetting\View\StyleSettingPanelView.xaml;SystemSetting\View\SystemSettingView.xaml;SystemSetting\View\UEControlPanelView.xaml;SystemSetting\View\UESettingPanelView.xaml; NDIMainView\View\NDIMainView.xaml;NDIPreviewView\View\NDIPreviewView.xaml;NDISettingView\View\AlgorithmSettingPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmCablewayPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmNearPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSinglePanelView.xaml;NDISettingView\View\Algorithm\AlgorithmSixteenPanelView.xaml;NDISettingView\View\Algorithm\AlgorithmTacticsPanelView.xaml;NDISettingView\View\NDISettingPanelView.xaml;NDISettingView\View\NDISettingView.xaml;NDIView\View\NDIView.xaml;SystemSetting\View\AboutPanelView.xaml;SystemSetting\View\CheckDataPanelView.xaml;SystemSetting\View\HotkeySettingPanelView.xaml;SystemSetting\View\MattingImagePanelView.xaml;SystemSetting\View\PackageSettingPanelView.xaml;SystemSetting\View\PreviewSettingPanelView.xaml;SystemSetting\View\ReplayPanelView.xaml;SystemSetting\View\StyleSettingPanelView.xaml;SystemSetting\View\SystemSettingView.xaml;SystemSetting\View\UEControlPanelView.xaml;SystemSetting\View\UESettingPanelView.xaml;
True True
......
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