XRCameraImagePlane.cs
2.23 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using Unity.Collections;
namespace UnityEngine.XR.ARSubsystems
{
/// <summary>
/// Information about the camera image planes. An image "plane" refers to an image channel used in video encoding.
/// </summary>
public struct XRCameraImagePlane : IEquatable<XRCameraImagePlane>
{
/// <summary>
/// The number of bytes per row for this plane.
/// </summary>
/// <value>
/// The number of bytes per row for this plane.
/// </value>
public int rowStride { get; internal set; }
/// <summary>
/// The number of bytes per pixel for this plane.
/// </summary>
/// <value>
/// The number of bytes per pixel for this plane.
/// </value>
public int pixelStride { get; internal set; }
/// <summary>
/// A "view" into the platform-specific plane data. It is an error to access <c>data</c> after the owning
/// <see cref="XRCameraImage"/> has been disposed.
/// </summary>
/// <value>
/// The platform-specific plane data.
/// </value>
public NativeArray<byte> data { get; internal set; }
public override int GetHashCode()
{
unchecked
{
var hash = data.GetHashCode();
hash = hash * 486187739 + rowStride.GetHashCode();
hash = hash * 486187739 + pixelStride.GetHashCode();
return hash;
}
}
public override bool Equals(object obj) => ((obj is XRCameraImagePlane) && Equals((XRCameraImagePlane)obj));
public bool Equals(XRCameraImagePlane other)
{
return
(data.Equals(other.data)) &&
(rowStride == other.rowStride) &&
(pixelStride == other.pixelStride);
}
public static bool operator ==(XRCameraImagePlane lhs, XRCameraImagePlane rhs) => lhs.Equals(rhs);
public static bool operator !=(XRCameraImagePlane lhs, XRCameraImagePlane rhs) => !lhs.Equals(rhs);
public override string ToString() => $"({data.Length} bytes, Row Stride: {rowStride}, Pixel Stride: {pixelStride})";
}
}