Exemple #1
0
            /// <summary>
            /// Start the image conversion using this class to interact with the asynchronous conversion and results.
            /// </summary>
            /// <param name="api">The CPU image API performing the image conversion.</param>
            /// <param name="nativeHandle">The native handle for the camera image.</param>
            /// <param name="conversionParams">The parameters for image conversion.</param>
            internal AsyncConversion(XRCpuImage.Api api, int nativeHandle, ConversionParams conversionParams)
            {
                m_Api                 = api;
                m_RequestId           = m_Api.ConvertAsync(nativeHandle, conversionParams);
                this.conversionParams = conversionParams;

#if ENABLE_UNITY_COLLECTIONS_CHECKS
                m_SafetyHandle = AtomicSafetyHandle.Create();
#endif
            }
Exemple #2
0
        /// <summary>
        /// Construct the <c>XRCpuImage</c> with the given native image information.
        /// </summary>
        /// <param name="api">The camera subsystem to use for interacting with the native image.</param>
        /// <param name="cinfo">Construction information. See <see cref="Cinfo"/>.</param>
        internal XRCpuImage(XRCpuImage.Api api, Cinfo cinfo)
        {
            m_Api           = api;
            m_NativeHandle  = cinfo.nativeHandle;
            this.dimensions = cinfo.dimensions;
            this.planeCount = cinfo.planeCount;
            this.timestamp  = cinfo.timestamp;
            this.format     = cinfo.format;

#if ENABLE_UNITY_COLLECTIONS_CHECKS
            m_SafetyHandle = AtomicSafetyHandle.Create();
#endif
        }
Exemple #3
0
            /// <summary>
            /// Dispose native resources associated with this request, including the raw image data. The `NativeArray`
            /// returned by <see cref="GetData{T}"/> is invalidated immediately after calling <see cref="Dispose"/>.
            /// </summary>
            public void Dispose()
            {
                if (m_Api == null || m_RequestId == 0)
                {
                    return;
                }

                m_Api.DisposeAsyncRequest(m_RequestId);
                m_Api       = null;
                m_RequestId = 0;
#if ENABLE_UNITY_COLLECTIONS_CHECKS
                AtomicSafetyHandle.Release(m_SafetyHandle);
#endif
            }