Wes xx mediapipe integration
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class Anchor3dVectorPacket : Packet<List<Anchor3d>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="Anchor3dVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public Anchor3dVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public Anchor3dVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public Anchor3dVectorPacket(Anchor3d[] value) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeAnchor3dVectorPacket__PA_i(value, value.Length, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public Anchor3dVectorPacket(Anchor3d[] value, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeAnchor3dVectorPacket_At__PA_i_Rt(value, value.Length, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public Anchor3dVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<Anchor3dVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<Anchor3d> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetAnchor3dVector(mpPtr, out var anchorVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var anchors = anchorVector.ToList();
|
||||
anchorVector.Dispose();
|
||||
|
||||
return anchors;
|
||||
}
|
||||
|
||||
public override StatusOr<List<Anchor3d>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e1747c248b3628738bcd536767bfc09
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class BoolPacket : Packet<bool>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="BoolPacket" /> instance.
|
||||
/// </summary>
|
||||
public BoolPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public BoolPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public BoolPacket(bool value) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeBoolPacket__b(value, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public BoolPacket(bool value, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeBoolPacket_At__b_Rt(value, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public BoolPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<BoolPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override bool Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetBool(mpPtr, out var value).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return value;
|
||||
}
|
||||
|
||||
public override StatusOr<bool> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsBool(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2df39f2282bdd39baa43635710e5ddc2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class ClassificationListPacket : Packet<ClassificationList>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="ClassificationListPacket" /> instance.
|
||||
/// </summary>
|
||||
public ClassificationListPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public ClassificationListPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public ClassificationListPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<ClassificationListPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override ClassificationList Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetClassificationList(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var classificationList = serializedProto.Deserialize(ClassificationList.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return classificationList;
|
||||
}
|
||||
|
||||
public override StatusOr<ClassificationList> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 135912f48f055c6b594eac0dcb8c66b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class ClassificationListVectorPacket : Packet<List<ClassificationList>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="ClassificationListVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public ClassificationListVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public ClassificationListVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public ClassificationListVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<ClassificationListVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<ClassificationList> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetClassificationListVector(mpPtr, out var serializedProtoVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var classificationLists = serializedProtoVector.Deserialize(ClassificationList.Parser);
|
||||
serializedProtoVector.Dispose();
|
||||
|
||||
return classificationLists;
|
||||
}
|
||||
|
||||
public override StatusOr<List<ClassificationList>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c078b368cd8dfd66fba14dce3e749bcc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class DetectionPacket : Packet<Detection>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="DetectionPacket" /> instance.
|
||||
/// </summary>
|
||||
public DetectionPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public DetectionPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public DetectionPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<DetectionPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override Detection Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetDetection(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var detection = serializedProto.Deserialize(Detection.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return detection;
|
||||
}
|
||||
|
||||
public override StatusOr<Detection> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cfc4da8c1878374569d2813d16c368e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class DetectionVectorPacket : Packet<List<Detection>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="DetectionVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public DetectionVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public DetectionVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public DetectionVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<DetectionVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<Detection> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetDetectionVector(mpPtr, out var serializedProtoVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var detections = serializedProtoVector.Deserialize(Detection.Parser);
|
||||
serializedProtoVector.Dispose();
|
||||
|
||||
return detections;
|
||||
}
|
||||
|
||||
public override StatusOr<List<Detection>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e75eecc27e896404b76f06106435394
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class FaceGeometryPacket : Packet<FaceGeometry.FaceGeometry>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="FaceGeometryPacket" /> instance.
|
||||
/// </summary>
|
||||
public FaceGeometryPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public FaceGeometryPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public FaceGeometryPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<FaceGeometryPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override FaceGeometry.FaceGeometry Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetFaceGeometry(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var geometry = serializedProto.Deserialize(FaceGeometry.FaceGeometry.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return geometry;
|
||||
}
|
||||
|
||||
public override StatusOr<FaceGeometry.FaceGeometry> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe56866aa90e25df2b520b254aa7d971
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class FaceGeometryVectorPacket : Packet<List<FaceGeometry.FaceGeometry>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="FaceGeometryVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public FaceGeometryVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public FaceGeometryVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public FaceGeometryVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<FaceGeometryVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<FaceGeometry.FaceGeometry> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetFaceGeometryVector(mpPtr, out var serializedProtoVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var geometries = serializedProtoVector.Deserialize(FaceGeometry.FaceGeometry.Parser);
|
||||
serializedProtoVector.Dispose();
|
||||
|
||||
return geometries;
|
||||
}
|
||||
|
||||
public override StatusOr<List<FaceGeometry.FaceGeometry>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26bc289e136a1adfcb6608d60a732931
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class FloatArrayPacket : Packet<float[]>
|
||||
{
|
||||
private int _length = -1;
|
||||
|
||||
public int length
|
||||
{
|
||||
get => _length;
|
||||
set
|
||||
{
|
||||
if (_length >= 0)
|
||||
{
|
||||
throw new InvalidOperationException("Length is already set and cannot be changed");
|
||||
}
|
||||
|
||||
_length = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="FloatArrayPacket" /> instance.
|
||||
/// </summary>
|
||||
public FloatArrayPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public FloatArrayPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public FloatArrayPacket(float[] value) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatArrayPacket__Pf_i(value, value.Length, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
length = value.Length;
|
||||
}
|
||||
|
||||
public FloatArrayPacket(float[] value, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatArrayPacket_At__Pf_i_Rt(value, value.Length, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
length = value.Length;
|
||||
}
|
||||
|
||||
public FloatArrayPacket At(Timestamp timestamp)
|
||||
{
|
||||
var packet = At<FloatArrayPacket>(timestamp);
|
||||
packet.length = length;
|
||||
return packet;
|
||||
}
|
||||
|
||||
public override float[] Get()
|
||||
{
|
||||
if (length < 0)
|
||||
{
|
||||
throw new InvalidOperationException("The array's length is unknown, set Length first");
|
||||
}
|
||||
|
||||
var result = new float[length];
|
||||
UnsafeNativeMethods.mp_Packet__GetFloatArray_i(mpPtr, length, out var arrayPtr).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
unsafe
|
||||
{
|
||||
var src = (float*)arrayPtr;
|
||||
|
||||
for (var i = 0; i < result.Length; i++)
|
||||
{
|
||||
result[i] = *src++;
|
||||
}
|
||||
}
|
||||
|
||||
UnsafeNativeMethods.delete_array__Pf(arrayPtr);
|
||||
return result;
|
||||
}
|
||||
|
||||
public override StatusOr<float[]> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsFloatArray(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: febbf4ee3984896dc8b2f12c06963c37
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class FloatPacket : Packet<float>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="FloatPacket" /> instance.
|
||||
/// </summary>
|
||||
public FloatPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public FloatPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public FloatPacket(float value) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatPacket__f(value, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public FloatPacket(float value, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatPacket_At__f_Rt(value, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public FloatPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<FloatPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override float Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetFloat(mpPtr, out var value).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return value;
|
||||
}
|
||||
|
||||
public override StatusOr<float> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsFloat(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e3f137c2b492809ca377d451e20c329
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,108 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal readonly struct FloatVector
|
||||
{
|
||||
private readonly IntPtr _data;
|
||||
private readonly int _size;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnsafeNativeMethods.delete_array__Pf(_data);
|
||||
}
|
||||
|
||||
public List<float> Copy()
|
||||
{
|
||||
var data = new List<float>(_size);
|
||||
|
||||
unsafe
|
||||
{
|
||||
var floatPtr = (float*)_data;
|
||||
|
||||
for (var i = 0; i < _size; i++)
|
||||
{
|
||||
data.Add(*floatPtr++);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public class FloatVectorPacket : Packet<List<float>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="FloatVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
///
|
||||
public FloatVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public FloatVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
|
||||
public FloatVectorPacket(float[] value) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatVectorPacket__Pf_i(value, value.Length, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public FloatVectorPacket(float[] value, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatVectorPacket_At__Pf_i_Rt(value, value.Length, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public FloatVectorPacket(List<float> value) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatVectorPacket__Pf_i(value.ToArray(), value.Count, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public FloatVectorPacket(List<float> value, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeFloatVectorPacket_At__Pf_i_Rt(value.ToArray(), value.Count, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public FloatVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<FloatVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<float> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetFloatVector(mpPtr, out var floatVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var result = floatVector.Copy();
|
||||
floatVector.Dispose();
|
||||
return result;
|
||||
}
|
||||
|
||||
public override StatusOr<List<float>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsFloatVector(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a9b77e746fd38d46a09d847f7370446
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class FrameAnnotationPacket : Packet<FrameAnnotation>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="FrameAnnotationPacket" /> instance.
|
||||
/// </summary>
|
||||
public FrameAnnotationPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public FrameAnnotationPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public FrameAnnotationPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<FrameAnnotationPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override FrameAnnotation Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetFrameAnnotation(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var frameAnnotation = serializedProto.Deserialize(FrameAnnotation.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return frameAnnotation;
|
||||
}
|
||||
|
||||
public override StatusOr<FrameAnnotation> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bd57a3f3c77dbb16babe8243fc373c1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class GpuBufferPacket : Packet<GpuBuffer>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="GpuBufferPacket" /> instance.
|
||||
/// </summary>
|
||||
public GpuBufferPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public GpuBufferPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public GpuBufferPacket(GpuBuffer gpuBuffer) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeGpuBufferPacket__Rgb(gpuBuffer.mpPtr, out var ptr).Assert();
|
||||
gpuBuffer.Dispose(); // respect move semantics
|
||||
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public GpuBufferPacket(GpuBuffer gpuBuffer, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeGpuBufferPacket_At__Rgb_Rts(gpuBuffer.mpPtr, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
gpuBuffer.Dispose(); // respect move semantics
|
||||
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public GpuBufferPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<GpuBufferPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override GpuBuffer Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetGpuBuffer(mpPtr, out var gpuBufferPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new GpuBuffer(gpuBufferPtr, false);
|
||||
}
|
||||
|
||||
public override StatusOr<GpuBuffer> Consume()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ConsumeGpuBuffer(mpPtr, out var statusOrGpuBufferPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new StatusOrGpuBuffer(statusOrGpuBufferPtr);
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsGpuBuffer(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62016354701eafa7a9a1b07d445b0c44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class ImageFramePacket : Packet<ImageFrame>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="ImageFramePacket" /> instance.
|
||||
/// </summary>
|
||||
public ImageFramePacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public ImageFramePacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public ImageFramePacket(ImageFrame imageFrame) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeImageFramePacket__Pif(imageFrame.mpPtr, out var ptr).Assert();
|
||||
imageFrame.Dispose(); // respect move semantics
|
||||
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public ImageFramePacket(ImageFrame imageFrame, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeImageFramePacket_At__Pif_Rt(imageFrame.mpPtr, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
imageFrame.Dispose(); // respect move semantics
|
||||
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public ImageFramePacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<ImageFramePacket>(timestamp);
|
||||
}
|
||||
|
||||
public override ImageFrame Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetImageFrame(mpPtr, out var imageFramePtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new ImageFrame(imageFramePtr, false);
|
||||
}
|
||||
|
||||
public override StatusOr<ImageFrame> Consume()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ConsumeImageFrame(mpPtr, out var statusOrImageFramePtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new StatusOrImageFrame(statusOrImageFramePtr);
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsImageFrame(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be86f766875a6a848b0add7e41a2226b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class IntPacket : Packet<int>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="IntPacket" /> instance.
|
||||
/// </summary>
|
||||
public IntPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
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_Rt(value, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public IntPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<IntPacket>(timestamp);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea1e37ccb5fd27c0c85d183ab96562e1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class LandmarkListPacket : Packet<LandmarkList>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="LandmarkListPacket" /> instance.
|
||||
/// </summary>
|
||||
public LandmarkListPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public LandmarkListPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public LandmarkListPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<LandmarkListPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override LandmarkList Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetLandmarkList(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var landmarkList = serializedProto.Deserialize(LandmarkList.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return landmarkList;
|
||||
}
|
||||
|
||||
public override StatusOr<LandmarkList> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a52c4850b3d6f4fff840b03da689e307
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class LandmarkListVectorPacket : Packet<List<LandmarkList>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="LandmarkListVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public LandmarkListVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public LandmarkListVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public LandmarkListVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<LandmarkListVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<LandmarkList> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetLandmarkListVector(mpPtr, out var serializedProtoVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var landmarkLists = serializedProtoVector.Deserialize(LandmarkList.Parser);
|
||||
serializedProtoVector.Dispose();
|
||||
|
||||
return landmarkLists;
|
||||
}
|
||||
|
||||
public override StatusOr<List<LandmarkList>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5221b835adb8927dc84cb8c5f3af2f8d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,66 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using Google.Protobuf;
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class MatrixPacket : Packet<MatrixData>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="MatrixPacket" /> instance.
|
||||
/// </summary>
|
||||
public MatrixPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public MatrixPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public MatrixPacket(MatrixData matrixData) : base()
|
||||
{
|
||||
var value = matrixData.ToByteArray();
|
||||
UnsafeNativeMethods.mp__MakeMatrixPacket__PKc_i(value, value.Length, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public MatrixPacket(MatrixData matrixData, Timestamp timestamp) : base()
|
||||
{
|
||||
var value = matrixData.ToByteArray();
|
||||
UnsafeNativeMethods.mp__MakeMatrixPacket_At__PKc_i_Rt(value, value.Length, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public MatrixPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<MatrixPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override MatrixData Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetMatrix(mpPtr, out var serializedMatrixData).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var matrixData = serializedMatrixData.Deserialize(MatrixData.Parser);
|
||||
serializedMatrixData.Dispose();
|
||||
|
||||
return matrixData;
|
||||
}
|
||||
|
||||
public override StatusOr<MatrixData> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsMatrix(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef898503888a0ee42af28aef1fbbe794
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class NormalizedLandmarkListPacket : Packet<NormalizedLandmarkList>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="NormalizedLandmarkListPacket" /> instance.
|
||||
/// </summary>
|
||||
public NormalizedLandmarkListPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public NormalizedLandmarkListPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public NormalizedLandmarkListPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<NormalizedLandmarkListPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override NormalizedLandmarkList Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetNormalizedLandmarkList(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var normalizedLandmarkList = serializedProto.Deserialize(NormalizedLandmarkList.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return normalizedLandmarkList;
|
||||
}
|
||||
|
||||
public override StatusOr<NormalizedLandmarkList> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f33ad7ff69288fbda9c5d2d3a173a23
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class NormalizedLandmarkListVectorPacket : Packet<List<NormalizedLandmarkList>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="NormalizedLandmarkListVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public NormalizedLandmarkListVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public NormalizedLandmarkListVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public NormalizedLandmarkListVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<NormalizedLandmarkListVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<NormalizedLandmarkList> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetNormalizedLandmarkListVector(mpPtr, out var serializedProtoVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var normalizedLandmarkLists = serializedProtoVector.Deserialize(NormalizedLandmarkList.Parser);
|
||||
serializedProtoVector.Dispose();
|
||||
|
||||
return normalizedLandmarkLists;
|
||||
}
|
||||
|
||||
public override StatusOr<List<NormalizedLandmarkList>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf1c0c41a515dfae985791690002e1fb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class NormalizedRectPacket : Packet<NormalizedRect>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="NormalizedRectPacket" /> instance.
|
||||
/// </summary>
|
||||
public NormalizedRectPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public NormalizedRectPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public NormalizedRectPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<NormalizedRectPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override NormalizedRect Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetNormalizedRect(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var normalizedRect = serializedProto.Deserialize(NormalizedRect.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return normalizedRect;
|
||||
}
|
||||
|
||||
public override StatusOr<NormalizedRect> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e39d3cdad5a34bdaf93a850f4f3880eb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class NormalizedRectVectorPacket : Packet<List<NormalizedRect>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="NormalizedRectVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public NormalizedRectVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public NormalizedRectVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public NormalizedRectVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<NormalizedRectVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<NormalizedRect> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetNormalizedRectVector(mpPtr, out var serializedProtoVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var normalizedRects = serializedProtoVector.Deserialize(NormalizedRect.Parser);
|
||||
serializedProtoVector.Dispose();
|
||||
|
||||
return normalizedRects;
|
||||
}
|
||||
|
||||
public override StatusOr<List<NormalizedRect>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 227b1bd0b120bd104af18a436ed254ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,120 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public abstract class Packet<TValue> : MpResourceHandle
|
||||
{
|
||||
/// <remarks>
|
||||
/// The native resource won't be initialized.
|
||||
/// </remarks>
|
||||
protected Packet() : base() { }
|
||||
|
||||
/// <remarks>
|
||||
/// If <paramref name="isOwner" /> is set to <c>false</c>, the native resource won't be initialized.
|
||||
/// </remarks>
|
||||
protected Packet(bool isOwner) : base(isOwner)
|
||||
{
|
||||
if (isOwner)
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__(out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
}
|
||||
|
||||
protected Packet(IntPtr ptr, bool isOwner) : base(ptr, isOwner) { }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a read-write <typeparamref name="TPacket" /> instance.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is a slow operation that makes use of <see cref="Activator.CreateInstance" /> internally, so you should avoid calling it in a loop.<br/>
|
||||
/// If you need to call it in a loop and <paramref name="isOwner" /> is set to <c>false</c>, call <see cref="SwitchNativePtr" /> instead.
|
||||
/// </remarks>
|
||||
public static TPacket Create<TPacket>(IntPtr packetPtr, bool isOwner) where TPacket : Packet<TValue>, new()
|
||||
{
|
||||
return (TPacket)Activator.CreateInstance(typeof(TPacket), packetPtr, isOwner);
|
||||
}
|
||||
|
||||
public void SwitchNativePtr(IntPtr packetPtr)
|
||||
{
|
||||
if (isOwner)
|
||||
{
|
||||
throw new InvalidOperationException("This operation is permitted only when the packet instance is for reference");
|
||||
}
|
||||
ptr = packetPtr;
|
||||
}
|
||||
|
||||
/// <exception cref="MediaPipeException">Thrown when the value is not set</exception>
|
||||
public abstract TValue Get();
|
||||
|
||||
public abstract StatusOr<TValue> Consume();
|
||||
|
||||
public bool IsEmpty()
|
||||
{
|
||||
return SafeNativeMethods.mp_Packet__IsEmpty(mpPtr);
|
||||
}
|
||||
|
||||
public Status ValidateAsProtoMessageLite()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsProtoMessageLite(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
|
||||
// TODO: declare as abstract
|
||||
public virtual Status ValidateAsType()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Timestamp Timestamp()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__Timestamp(mpPtr, out var timestampPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Timestamp(timestampPtr);
|
||||
}
|
||||
|
||||
public string DebugString()
|
||||
{
|
||||
return MarshalStringFromNative(UnsafeNativeMethods.mp_Packet__DebugString);
|
||||
}
|
||||
|
||||
public string RegisteredTypeName()
|
||||
{
|
||||
var typeName = MarshalStringFromNative(UnsafeNativeMethods.mp_Packet__RegisteredTypeName);
|
||||
|
||||
return typeName ?? "";
|
||||
}
|
||||
|
||||
public string DebugTypeName()
|
||||
{
|
||||
return MarshalStringFromNative(UnsafeNativeMethods.mp_Packet__DebugTypeName);
|
||||
}
|
||||
|
||||
protected override void DeleteMpPtr()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__delete(ptr);
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// This method will copy the value and create another packet internally.
|
||||
/// To avoid copying the value, it's preferable to instantiate the packet with timestamp in the first place.
|
||||
/// </remarks>
|
||||
/// <returns>New packet with the given timestamp and the copied value</returns>
|
||||
protected TPacket At<TPacket>(Timestamp timestamp) where TPacket : Packet<TValue>, new()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__At__Rt(mpPtr, timestamp.mpPtr, out var packetPtr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
|
||||
return Create<TPacket>(packetPtr, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a857adad76d497e579b18d1b74c2183c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class RectPacket : Packet<Rect>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="RectPacket" /> instance.
|
||||
/// </summary>
|
||||
public RectPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public RectPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public RectPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<RectPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override Rect Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetRect(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var rect = serializedProto.Deserialize(Rect.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return rect;
|
||||
}
|
||||
|
||||
public override StatusOr<Rect> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bab9dce43b38fd7939bfef3e750d3340
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class RectVectorPacket : Packet<List<Rect>>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="RectVectorPacket" /> instance.
|
||||
/// </summary>
|
||||
public RectVectorPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public RectVectorPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public RectVectorPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<RectVectorPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override List<Rect> Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetRectVector(mpPtr, out var serializedProtoVector).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var rects = serializedProtoVector.Deserialize(Rect.Parser);
|
||||
serializedProtoVector.Dispose();
|
||||
|
||||
return rects;
|
||||
}
|
||||
|
||||
public override StatusOr<List<Rect>> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b3010621ded8ad44949c9958d647b3c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class SidePacket : MpResourceHandle
|
||||
{
|
||||
public SidePacket() : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp_SidePacket__(out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
protected override void DeleteMpPtr()
|
||||
{
|
||||
UnsafeNativeMethods.mp_SidePacket__delete(ptr);
|
||||
}
|
||||
|
||||
public int size => SafeNativeMethods.mp_SidePacket__size(mpPtr);
|
||||
|
||||
/// <remarks>
|
||||
/// This method cannot verify that the packet type corresponding to the <paramref name="key" /> is indeed a <typeparamref name="TPacket" />,
|
||||
/// so you must make sure by youreself that it is.
|
||||
/// </remarks>
|
||||
public TPacket At<TPacket, TValue>(string key) where TPacket : Packet<TValue>, new()
|
||||
{
|
||||
UnsafeNativeMethods.mp_SidePacket__at__PKc(mpPtr, key, out var packetPtr).Assert();
|
||||
|
||||
if (packetPtr == IntPtr.Zero)
|
||||
{
|
||||
return default; // null
|
||||
}
|
||||
GC.KeepAlive(this);
|
||||
return Packet<TValue>.Create<TPacket>(packetPtr, true);
|
||||
}
|
||||
|
||||
public void Emplace<T>(string key, Packet<T> packet)
|
||||
{
|
||||
UnsafeNativeMethods.mp_SidePacket__emplace__PKc_Rp(mpPtr, key, packet.mpPtr).Assert();
|
||||
packet.Dispose(); // respect move semantics
|
||||
GC.KeepAlive(this);
|
||||
}
|
||||
|
||||
public int Erase(string key)
|
||||
{
|
||||
UnsafeNativeMethods.mp_SidePacket__erase__PKc(mpPtr, key, out var count).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return count;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
SafeNativeMethods.mp_SidePacket__clear(mpPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8976efac5d9187e5ea5bd0f2c974425e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,86 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class StringPacket : Packet<string>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="StringPacket" /> instance.
|
||||
/// </summary>
|
||||
public StringPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public StringPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public StringPacket(string value) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeStringPacket__PKc(value, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public StringPacket(byte[] bytes) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeStringPacket__PKc_i(bytes, bytes.Length, out var ptr).Assert();
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public StringPacket(string value, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeStringPacket_At__PKc_Rt(value, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public StringPacket(byte[] bytes, Timestamp timestamp) : base()
|
||||
{
|
||||
UnsafeNativeMethods.mp__MakeStringPacket_At__PKc_i_Rt(bytes, bytes.Length, timestamp.mpPtr, out var ptr).Assert();
|
||||
GC.KeepAlive(timestamp);
|
||||
this.ptr = ptr;
|
||||
}
|
||||
|
||||
public StringPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<StringPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override string Get()
|
||||
{
|
||||
return MarshalStringFromNative(UnsafeNativeMethods.mp_Packet__GetString);
|
||||
}
|
||||
|
||||
public byte[] GetByteArray()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetByteString(mpPtr, out var strPtr, out var size).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var bytes = new byte[size];
|
||||
Marshal.Copy(strPtr, bytes, 0, size);
|
||||
UnsafeNativeMethods.delete_array__PKc(strPtr);
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public override StatusOr<string> Consume()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ConsumeString(mpPtr, out var statusOrStringPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new StatusOrString(statusOrStringPtr);
|
||||
}
|
||||
|
||||
public override Status ValidateAsType()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__ValidateAsString(mpPtr, out var statusPtr).Assert();
|
||||
|
||||
GC.KeepAlive(this);
|
||||
return new Status(statusPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70e3fdcd8f227f24d8b41100474fec7c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2021 homuler
|
||||
//
|
||||
// Use of this source code is governed by an MIT-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://opensource.org/licenses/MIT.
|
||||
|
||||
using System;
|
||||
|
||||
namespace Mediapipe
|
||||
{
|
||||
public class TimedModelMatrixProtoListPacket : Packet<TimedModelMatrixProtoList>
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an empty <see cref="TimedModelMatrixProtoListPacket" /> instance.
|
||||
/// </summary>
|
||||
public TimedModelMatrixProtoListPacket() : base(true) { }
|
||||
|
||||
[UnityEngine.Scripting.Preserve]
|
||||
public TimedModelMatrixProtoListPacket(IntPtr ptr, bool isOwner = true) : base(ptr, isOwner) { }
|
||||
|
||||
public TimedModelMatrixProtoListPacket At(Timestamp timestamp)
|
||||
{
|
||||
return At<TimedModelMatrixProtoListPacket>(timestamp);
|
||||
}
|
||||
|
||||
public override TimedModelMatrixProtoList Get()
|
||||
{
|
||||
UnsafeNativeMethods.mp_Packet__GetTimedModelMatrixProtoList(mpPtr, out var serializedProto).Assert();
|
||||
GC.KeepAlive(this);
|
||||
|
||||
var matrixProtoList = serializedProto.Deserialize(TimedModelMatrixProtoList.Parser);
|
||||
serializedProto.Dispose();
|
||||
|
||||
return matrixProtoList;
|
||||
}
|
||||
|
||||
public override StatusOr<TimedModelMatrixProtoList> Consume()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 244922fa9b8ff20ef8962313f8179a24
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user