-
-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
593 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Mediapipe { | ||
public class Timestamp : MpResourceHandle { | ||
public Timestamp(IntPtr ptr) : base(ptr) {} | ||
|
||
public Timestamp(Int64 value) : base() { | ||
UnsafeNativeMethods.mp_Timestamp__l(value, out var ptr); | ||
this.ptr = ptr; | ||
} | ||
|
||
protected override void DisposeUnmanaged() { | ||
if (OwnsResource()) { | ||
UnsafeNativeMethods.mp_Timestamp__delete(ptr); | ||
} | ||
base.DisposeUnmanaged(); | ||
} | ||
|
||
public Int64 Value() { | ||
return SafeNativeMethods.mp_Timestamp__Value(mpPtr); | ||
} | ||
|
||
public double Seconds() { | ||
return SafeNativeMethods.mp_Timestamp__Seconds(mpPtr); | ||
} | ||
|
||
public Int64 Microseconds() { | ||
return SafeNativeMethods.mp_Timestamp__Microseconds(mpPtr); | ||
} | ||
|
||
public bool IsSpecialValue() { | ||
return SafeNativeMethods.mp_Timestamp__IsSpecialValue(mpPtr); | ||
} | ||
|
||
public bool IsRangeValue() { | ||
return SafeNativeMethods.mp_Timestamp__IsRangeValue(mpPtr); | ||
} | ||
|
||
public bool IsAllowedInStream() { | ||
return SafeNativeMethods.mp_Timestamp__IsAllowedInStream(mpPtr); | ||
} | ||
|
||
public string DebugString() { | ||
UnsafeNativeMethods.mp_Timestamp__DebugString(mpPtr, out var strPtr).Assert(); | ||
var str = Marshal.PtrToStringAnsi(strPtr); | ||
UnsafeNativeMethods.delete_array__PKc(strPtr); | ||
|
||
GC.KeepAlive(this); | ||
return str; | ||
} | ||
|
||
public Timestamp NextAllowedInStream() { | ||
UnsafeNativeMethods.mp_Timestamp__NextAllowedInStream(mpPtr, out var nextPtr).Assert(); | ||
|
||
GC.KeepAlive(this); | ||
return new Timestamp(nextPtr); | ||
} | ||
|
||
public Timestamp PreviousAllowedInStream() { | ||
UnsafeNativeMethods.mp_Timestamp__PreviousAllowedInStream(mpPtr, out var prevPtr).Assert(); | ||
|
||
GC.KeepAlive(this); | ||
return new Timestamp(prevPtr); | ||
} | ||
|
||
public static Timestamp FromSeconds(double seconds) { | ||
UnsafeNativeMethods.mp_Timestamp_FromSeconds__d(seconds, out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp Unset() { | ||
UnsafeNativeMethods.mp_Timestamp_Unset(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp Unstarted() { | ||
UnsafeNativeMethods.mp_Timestamp_Unstarted(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp PreStream() { | ||
UnsafeNativeMethods.mp_Timestamp_PreStream(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp Min() { | ||
UnsafeNativeMethods.mp_Timestamp_Min(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp Max() { | ||
UnsafeNativeMethods.mp_Timestamp_Max(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp PostStream() { | ||
UnsafeNativeMethods.mp_Timestamp_PostStream(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp OneOverPostStream() { | ||
UnsafeNativeMethods.mp_Timestamp_OneOverPostStream(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
|
||
public static Timestamp Done() { | ||
UnsafeNativeMethods.mp_Timestamp_Done(out var ptr).Assert(); | ||
|
||
return new Timestamp(ptr); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
Assets/MediaPipe/SDK/Scripts/PInvoke/NativeMethods/Framework/Timestamp_Safe.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Diagnostics.Contracts; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Mediapipe { | ||
internal static partial class SafeNativeMethods { | ||
[Pure, DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern Int64 mp_Timestamp__Value(IntPtr timestamp); | ||
|
||
[Pure, DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern double mp_Timestamp__Seconds(IntPtr timestamp); | ||
|
||
[Pure, DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern Int64 mp_Timestamp__Microseconds(IntPtr timestamp); | ||
|
||
[Pure, DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
[return: MarshalAs(UnmanagedType.I1)] | ||
public static extern bool mp_Timestamp__IsSpecialValue(IntPtr timestamp); | ||
|
||
[Pure, DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
[return: MarshalAs(UnmanagedType.I1)] | ||
public static extern bool mp_Timestamp__IsRangeValue(IntPtr timestamp); | ||
|
||
[Pure, DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
[return: MarshalAs(UnmanagedType.I1)] | ||
public static extern bool mp_Timestamp__IsAllowedInStream(IntPtr timestamp); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/MediaPipe/SDK/Scripts/PInvoke/NativeMethods/Framework/Timestamp_Safe.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
Assets/MediaPipe/SDK/Scripts/PInvoke/NativeMethods/Framework/Timestamp_Unsafe.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
namespace Mediapipe { | ||
internal static partial class UnsafeNativeMethods { | ||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp__l(Int64 value, out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern void mp_Timestamp__delete(IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp__DebugString(IntPtr timestamp, out IntPtr str); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp__NextAllowedInStream(IntPtr timestamp, out IntPtr nextTimestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp__PreviousAllowedInStream(IntPtr timestamp, out IntPtr prevTimestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_FromSeconds__d(double seconds, out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_Unset(out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_Unstarted(out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_PreStream(out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_Min(out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_Max(out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_PostStream(out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_OneOverPostStream(out IntPtr timestamp); | ||
|
||
[DllImport (MediaPipeLibrary, ExactSpelling = true)] | ||
public static extern MpReturnCode mp_Timestamp_Done(out IntPtr timestamp); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/MediaPipe/SDK/Scripts/PInvoke/NativeMethods/Framework/Timestamp_Unsafe.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.