Class YUVConverter
- Namespace
- Uralstech.UXR.QuestCamera
Converts raw camera capture session frames to Unity-supported RGBA.
public sealed class YUVConverter
- Inheritance
-
objectYUVConverter
- Extension Methods
Constructors
YUVConverter(Resolution, GraphicsFormat)
Creates a new converter with the shader and kernel described in the scene instance of QuestCameraManager.
public YUVConverter(Resolution resolution, GraphicsFormat textureFormat = null)
Parameters
resolutionResolutiontextureFormatGraphicsFormatIf not specified, uses equivalent of RenderTextureFormat.ARGB32.
YUVConverter(Resolution, ComputeShaderKernel, GraphicsFormat)
public YUVConverter(Resolution resolution, ComputeShaderKernel kernel, GraphicsFormat textureFormat = null)
Parameters
resolutionResolutionkernelComputeShaderKerneltextureFormatGraphicsFormatIf not specified, uses equivalent of RenderTextureFormat.ARGB32.
Fields
Texture
The output texture with converted frames.
public readonly RenderTexture Texture
Field Value
- RenderTexture
Properties
CaptureTimestamp
The capture timestamp of the last processed frame.
public long CaptureTimestamp { get; }
Property Value
- long
HasNewFrame
public bool HasNewFrame { get; }
Property Value
- bool
ShaderKernel
The shader used for conversion.
public ComputeShaderKernel ShaderKernel { get; set; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
OnFrameReady(nint, long, nint, nint, long, int, int, int, long)
Processes a frame received from the native capture session.
public void OnFrameReady(nint yBuffer, long yBufferSize, nint uBuffer, nint vBuffer, long uvBufferSize, int yRowStride, int uvRowStride, int uvPixelStride, long timestamp)
Parameters
yBuffernintThe pointer to this frame's Y (luminance) data.
yBufferSizelongThe size of the Y buffer in bytes.
uBuffernintThe pointer to this frame's U (color) data.
vBuffernintThe pointer to this frame's V (color) data.
uvBufferSizelongThe size of the U and V buffers in bytes.
yRowStrideintThe size of each row of the image in
yBufferin bytes.uvRowStrideintThe size of each row of the image in
uBufferandvBufferin bytes.uvPixelStrideintThe size of a pixel in a row of the image in
uBufferandvBufferin bytes.timestamplongThe timestamp the frame was captured at in nanoseconds.
Events
OnFrameProcessed
Callback for when a frame has been dispatched for conversion, with the frame texture and capture timestamp.
public event Action<RenderTexture, long>? OnFrameProcessed
Event Type
- Action<RenderTexture, long>