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