1- using System ;
2- using System . Collections . Generic ;
3- using System . Globalization ;
1+ //------------------------------------------------------------------------------
2+ // <copyright file="DataBlock.cs" company="Microsoft">
3+ // Copyright (c) Microsoft Corporation. All rights reserved.
4+ // Licensed under the MIT License.
5+ // </copyright>
6+ //------------------------------------------------------------------------------
7+ using System ;
8+ using System . Buffers ;
49using System . Runtime . InteropServices ;
5- using System . Text ;
610
711namespace Microsoft . Azure . Kinect . Sensor . Record
812{
9- public class DataBlock : IDisposable
13+ /// <summary>
14+ /// Represents a block of data from a custom recording track.
15+ /// </summary>
16+ public class DataBlock : IDisposable , IMemoryOwner < byte >
1017 {
1118 // The native handle for this data block.
1219 private readonly NativeMethods . k4a_playback_data_block_t handle ;
@@ -16,12 +23,19 @@ public class DataBlock : IDisposable
1623
1724 private byte [ ] buffer = null ;
1825
26+ /// <summary>
27+ /// Initializes a new instance of the <see cref="DataBlock"/> class.
28+ /// </summary>
29+ /// <param name="handle">Native handle to the data block.</param>
1930 internal DataBlock ( NativeMethods . k4a_playback_data_block_t handle )
2031 {
2132 this . handle = handle ;
2233 }
2334
24- public byte [ ] Buffer
35+ /// <summary>
36+ /// Gets the memory with the custom data.
37+ /// </summary>
38+ public Memory < byte > Memory
2539 {
2640 get
2741 {
@@ -37,7 +51,7 @@ public byte[] Buffer
3751 ulong bufferSize = NativeMethods . k4a_playback_data_block_get_buffer_size ( this . handle ) ;
3852
3953 this . buffer = new byte [ bufferSize ] ;
40-
54+
4155 IntPtr bufferPtr = NativeMethods . k4a_playback_data_block_get_buffer ( this . handle ) ;
4256
4357 if ( bufferPtr != IntPtr . Zero )
@@ -55,6 +69,9 @@ public byte[] Buffer
5569 }
5670 }
5771
72+ /// <summary>
73+ /// Gets the device timestamp associated with the data.
74+ /// </summary>
5875 public TimeSpan DeviceTimestamp
5976 {
6077 get
@@ -73,7 +90,6 @@ public TimeSpan DeviceTimestamp
7390 }
7491 }
7592
76-
7793 /// <inheritdoc/>
7894 public void Dispose ( )
7995 {
0 commit comments