CameraCaptureSession Class

Definition

A configured capture session for a CameraDevice, used for capturing images from the camera or reprocessing images captured from the camera in the same session previously.

[Android.Runtime.Register("android/hardware/camera2/CameraCaptureSession", DoNotGenerateAcw=true)]
public abstract class CameraCaptureSession : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IAutoCloseable
[<Android.Runtime.Register("android/hardware/camera2/CameraCaptureSession", DoNotGenerateAcw=true)>]
type CameraCaptureSession = class
    inherit Object
    interface IAutoCloseable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
CameraCaptureSession
Derived
Attributes
Implements

Remarks

A configured capture session for a CameraDevice, used for capturing images from the camera or reprocessing images captured from the camera in the same session previously.

A CameraCaptureSession is created by providing a set of target output surfaces to CameraDevice#createCaptureSession createCaptureSession, or by providing an android.hardware.camera2.params.InputConfiguration and a set of target output surfaces to CameraDevice#createReprocessableCaptureSession createReprocessableCaptureSession for a reprocessable capture session. Once created, the session is active until a new session is created by the camera device, or the camera device is closed.

All capture sessions can be used for capturing images from the camera but only reprocessable capture sessions can reprocess images captured from the camera in the same session previously.

Creating a session is an expensive operation and can take several hundred milliseconds, since it requires configuring the camera device's internal pipelines and allocating memory buffers for sending images to the desired targets. Therefore the setup is done asynchronously, and CameraDevice#createCaptureSession createCaptureSession and CameraDevice#createReprocessableCaptureSession createReprocessableCaptureSession will send the ready-to-use CameraCaptureSession to the provided listener's CameraCaptureSession.StateCallback#onConfigured onConfigured callback. If configuration cannot be completed, then the CameraCaptureSession.StateCallback#onConfigureFailed onConfigureFailed is called, and the session will not become active.

<!--

Any capture requests (repeating or non-repeating) submitted before the session is ready will be queued up and will begin capture once the session becomes ready. In case the session cannot be configured and StateCallback#onConfigureFailed onConfigureFailed is called, all queued capture requests are discarded.

-->

If a new session is created by the camera device, then the previous session is closed, and its associated StateCallback#onClosed onClosed callback will be invoked. All of the session methods will throw an IllegalStateException if called once the session is closed.

A closed session clears any repeating requests (as if #stopRepeating had been called), but will still complete all of its in-progress capture requests as normal, before a newly created session takes over and reconfigures the camera device.

Java documentation for android.hardware.camera2.CameraCaptureSession.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

CameraCaptureSession()
CameraCaptureSession(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Device

Get the camera device that this session is created for.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
InputSurface
IsReprocessable
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AbortCaptures()

Discard all captures currently pending and in-progress as fast as possible.

Capture(CaptureRequest, CameraCaptureSession+CaptureCallback, Handler)

Submit a request for an image to be captured by the camera device.

CaptureBurst(IList<CaptureRequest>, CameraCaptureSession+CaptureCallback, Handler)

Submit a list of requests to be captured in sequence as a burst.

CaptureBurstRequests(IList<CaptureRequest>, IExecutor, CameraCaptureSession+CaptureCallback)

Submit a list of requests to be captured in sequence as a burst.

CaptureSingleRequest(CaptureRequest, IExecutor, CameraCaptureSession+CaptureCallback)

Submit a request for an image to be captured by the camera device.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Close()

Close this capture session asynchronously.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FinalizeOutputConfigurations(IList<OutputConfiguration>)

Finalize the output configurations that now have their deferred and/or extra Surfaces included.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Prepare(Surface)

Pre-allocate all buffers for an output Surface.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetRepeatingBurst(IList<CaptureRequest>, CameraCaptureSession+CaptureCallback, Handler)

Request endlessly repeating capture of a sequence of images by this capture session.

SetRepeatingBurstRequests(IList<CaptureRequest>, IExecutor, CameraCaptureSession+CaptureCallback)

Request endlessly repeating capture of a sequence of images by this capture session.

SetRepeatingRequest(CaptureRequest, CameraCaptureSession+CaptureCallback, Handler)

Request endlessly repeating capture of images by this capture session.

SetSingleRepeatingRequest(CaptureRequest, IExecutor, CameraCaptureSession+CaptureCallback)

Request endlessly repeating capture of images by this capture session.

StopRepeating()

Cancel any ongoing repeating capture set by either #setRepeatingRequest setRepeatingRequest or #setRepeatingBurst.

SupportsOfflineProcessing(Surface)

Query whether a given Surface is able to support offline mode.

SwitchToOffline(ICollection<Surface>, IExecutor, CameraOfflineSession+CameraOfflineSessionCallback)

Switch the current capture session and a given set of registered camera surfaces to offline processing mode.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
UpdateOutputConfiguration(OutputConfiguration)

Update OutputConfiguration after configuration finalization see #finalizeOutputConfigurations.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to