Class GLESCaptureSession
- Namespace
- Uralstech.UXR.QuestCamera.GLES
Manages a camera capture session with a repeating request, but supports both repeating and on-demand conversion.
public sealed class GLESCaptureSession : CaptureSessionBase<GLESCaptureSession.Proxy>
- Inheritance
-
objectGLESCaptureSession
- Inherited Members
- Extension Methods
Remarks
Texture conversion is done in native OpenGL-ES.
Constructors
GLESCaptureSession(Resolution, GraphicsFormat)
public GLESCaptureSession(Resolution resolution, GraphicsFormat textureFormat = null)
Parameters
resolutionResolutiontextureFormatGraphicsFormatIf not specified, uses equivalent of RenderTextureFormat.ARGB32.
Fields
Texture
The output texture with converted frames.
public readonly Texture2D Texture
Field Value
- Texture2D
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
Methods
DisposeAsync()
Closes the session (if not already closed) and releases native resources.
public override ValueTask DisposeAsync()
Returns
- ValueTask
ProcessSingleFrameAsync(CancellationToken)
Processes a single frame and returns the result.
public ValueTask<(long, Texture2D)> ProcessSingleFrameAsync(CancellationToken token = default)
Parameters
tokenCancellationToken
Returns
- ValueTask<(long, Texture2D)>
Capture timestamp and updated texture. Timestamp will be -1 if the capture could not be processed.
Exceptions
- InvalidOperationException
Thrown if continuous processing is active.
- ObjectDisposedException
- TimeoutException
SetupJobAsync()
Registers the texture and creates a job in the native C++ manager.
public ValueTask<uint> SetupJobAsync()
Returns
- ValueTask<uint>
The ID of the source texture created for the job, which the capture session will render to, or 0 if the operation failed.
StartContinuousProcessing(int)
Starts continuous frame processing.
public void StartContinuousProcessing(int maxFramerate = 60)
Parameters
maxFramerateintThe maximum rate at which frames will be processed by the GLES pipeline.
Exceptions
- InvalidOperationException
Thrown if continuous processing is already active.
Events
OnFrameProcessed
Callback for when a frame has been processed, with the frame texture and capture timestamp.
public event Action<Texture2D, long>? OnFrameProcessed
Event Type
- Action<Texture2D, long>