Table of Contents

Class YUVConverter

Converts raw camera capture session frames to Unity-supported RGBA.

public sealed class YUVConverter
Inheritance
object
YUVConverter
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

resolution Resolution
textureFormat GraphicsFormat

If not specified, uses equivalent of RenderTextureFormat.ARGB32.

YUVConverter(Resolution, ComputeShaderKernel, GraphicsFormat)

public YUVConverter(Resolution resolution, ComputeShaderKernel kernel, GraphicsFormat textureFormat = null)

Parameters

resolution Resolution
kernel ComputeShaderKernel
textureFormat GraphicsFormat

If 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

true if a capture was processed this frame; false otherwise.

public bool HasNewFrame { get; }

Property Value

bool

ShaderKernel

The shader used for conversion.

public ComputeShaderKernel ShaderKernel { get; set; }

Property Value

ComputeShaderKernel

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

yBuffer nint

The pointer to this frame's Y (luminance) data.

yBufferSize long

The size of the Y buffer in bytes.

uBuffer nint

The pointer to this frame's U (color) data.

vBuffer nint

The pointer to this frame's V (color) data.

uvBufferSize long

The size of the U and V buffers in bytes.

yRowStride int

The size of each row of the image in yBuffer in bytes.

uvRowStride int

The size of each row of the image in uBuffer and vBuffer in bytes.

uvPixelStride int

The size of a pixel in a row of the image in uBuffer and vBuffer in bytes.

timestamp long

The 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>