using System; using Unity.Collections; namespace UnityEngine.XR.ARSubsystems { /// /// Information about the camera image planes. An image "plane" refers to an image channel used in video encoding. /// public struct XRCameraImagePlane : IEquatable { /// /// The number of bytes per row for this plane. /// /// /// The number of bytes per row for this plane. /// public int rowStride { get; internal set; } /// /// The number of bytes per pixel for this plane. /// /// /// The number of bytes per pixel for this plane. /// public int pixelStride { get; internal set; } /// /// A "view" into the platform-specific plane data. It is an error to access data after the owning /// has been disposed. /// /// /// The platform-specific plane data. /// public NativeArray 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})"; } }