From 2e9ba51e619a9d3a4a05746e2d45e6fb60853c78 Mon Sep 17 00:00:00 2001 From: Mario Di Vece Date: Sat, 28 Dec 2019 09:38:05 -0600 Subject: [PATCH] compatibility fixes for net framework build --- .../MainWindow.MediaEvents.cs | 4 ++-- Unosquare.FFME/Common/DataFrame.cs | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs b/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs index 6457a713f..929bf4381 100644 --- a/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs +++ b/Unosquare.FFME.Windows.Sample/MainWindow.MediaEvents.cs @@ -498,8 +498,8 @@ private VideoSeekIndex LoadOrCreateVideoSeekIndex(string mediaFilePath, int stre if (File.Exists(seekFilePath)) { - using (var stream = File.OpenRead(seekFilePath)) - return VideoSeekIndex.Load(stream); + using var stream = File.OpenRead(seekFilePath); + return VideoSeekIndex.Load(stream); } else { diff --git a/Unosquare.FFME/Common/DataFrame.cs b/Unosquare.FFME/Common/DataFrame.cs index 9c5525f4d..c216d6f56 100644 --- a/Unosquare.FFME/Common/DataFrame.cs +++ b/Unosquare.FFME/Common/DataFrame.cs @@ -10,6 +10,8 @@ /// public sealed unsafe class DataFrame { + private readonly byte[] PacketData; + /// /// Initializes a new instance of the class. /// @@ -31,7 +33,7 @@ internal DataFrame(MediaPacket packet, StreamInfo stream, MediaEngine mediaCore) Buffer.MemoryCopy(packet.Pointer->data, targetPointer, bufferLength, bufferLength); } - PacketData = new Memory(targetData); + PacketData = targetData; } PacketPosition = packet.Position; @@ -70,11 +72,6 @@ internal DataFrame(MediaPacket packet, StreamInfo stream, MediaEngine mediaCore) /// public TimeSpan DecodingTime { get; } - /// - /// Gets the raw byte data of the data packet. - /// - public Memory PacketData { get; } - /// /// Gets a value indicating whether the presentation time of this data /// frame was guessed. @@ -95,6 +92,12 @@ internal DataFrame(MediaPacket packet, StreamInfo stream, MediaEngine mediaCore) /// public long PacketPosition { get; } + /// + /// Gets the raw byte data of the data packet. + /// + /// The raw bytes of the packet data. May return null when no packet data is available. + public byte[] GetPacketData() => PacketData; + /// /// Guesses the start time of the packet. /// Side effect modify the property and the