-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
5 changed files
with
101 additions
and
3 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
Assets/MediaPipe/SDK/Scripts/Framework/Packet/IntPacket.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,38 @@ | ||
using System; | ||
|
||
namespace Mediapipe { | ||
public class IntPacket : Packet<int> { | ||
public IntPacket() : base() {} | ||
|
||
public IntPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) {} | ||
|
||
public IntPacket(int value) : base() { | ||
UnsafeNativeMethods.mp__MakeIntPacket__i(value, out var ptr).Assert(); | ||
this.ptr = ptr; | ||
} | ||
|
||
public IntPacket(int value, Timestamp timestamp) : base() { | ||
UnsafeNativeMethods.mp__MakeIntPacket_At__i_Rtimestamp(value, timestamp.mpPtr, out var ptr).Assert(); | ||
GC.KeepAlive(timestamp); | ||
this.ptr = ptr; | ||
} | ||
|
||
public override int Get() { | ||
UnsafeNativeMethods.mp_Packet__GetInt(mpPtr, out var value).Assert(); | ||
|
||
GC.KeepAlive(this); | ||
return value; | ||
} | ||
|
||
public override StatusOr<int> Consume() { | ||
throw new NotSupportedException(); | ||
} | ||
|
||
public override Status ValidateAsType() { | ||
UnsafeNativeMethods.mp_Packet__ValidateAsInt(mpPtr, out var statusPtr).Assert(); | ||
|
||
GC.KeepAlive(this); | ||
return new Status(statusPtr); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/MediaPipe/SDK/Scripts/Framework/Packet/IntPacket.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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