-
-
Notifications
You must be signed in to change notification settings - Fork 450
/
DetectionVectorPacket.cs
42 lines (34 loc) · 1.11 KB
/
DetectionVectorPacket.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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;
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) { }
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();
}
}
}