Share via


OutputConfiguration Class

Definition

A class for describing camera output, which contains a Surface and its specific configuration for creating capture session.

[Android.Runtime.Register("android/hardware/camera2/params/OutputConfiguration", ApiSince=24, DoNotGenerateAcw=true)]
public sealed class OutputConfiguration : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/hardware/camera2/params/OutputConfiguration", ApiSince=24, DoNotGenerateAcw=true)>]
type OutputConfiguration = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
OutputConfiguration
Attributes
Implements

Remarks

A class for describing camera output, which contains a Surface and its specific configuration for creating capture session.

There are several ways to instantiate, modify and use OutputConfigurations. The most common and recommended usage patterns are summarized in the following list:

<ul> <li>Passing a Surface to the constructor and using the OutputConfiguration instance as argument to CameraDevice#createCaptureSessionByOutputConfigurations. This is the most frequent usage and clients should consider it first before other more complicated alternatives. </li>

<li>Passing only a surface source class as an argument to the constructor. This is usually followed by a call to create a capture session (see CameraDevice#createCaptureSessionByOutputConfigurations and a Surface add call #addSurface with a valid Surface. The sequence completes with CameraCaptureSession#finalizeOutputConfigurations. This is the deferred usage case which aims to enhance performance by allowing the resource-intensive capture session create call to execute in parallel with any Surface initialization, such as waiting for a android.view.SurfaceView to be ready as part of the UI initialization.</li>

<li>The third and most complex usage pattern involves surface sharing. Once instantiated an OutputConfiguration can be enabled for surface sharing via #enableSurfaceSharing. This must be done before creating a new capture session and enables calls to CameraCaptureSession#updateOutputConfiguration. An OutputConfiguration with enabled surface sharing can be modified via #addSurface or #removeSurface. The updates to this OutputConfiguration will only come into effect after CameraCaptureSession#updateOutputConfiguration returns without throwing exceptions. Such updates can be done as long as the session is active. Clients should always consider the additional requirements and limitations placed on the output surfaces (for more details see #enableSurfaceSharing, #addSurface, #removeSurface, CameraCaptureSession#updateOutputConfiguration). A trade-off exists between additional complexity and flexibility. If exercised correctly surface sharing can switch between different output surfaces without interrupting any ongoing repeating capture requests. This saves time and can significantly improve the user experience.</li>

<li>Surface sharing can be used in combination with deferred surfaces. The rules from both cases are combined and clients must call #enableSurfaceSharing before creating a capture session. Attach and/or remove output surfaces via #addSurface/#removeSurface and finalize the configuration using CameraCaptureSession#finalizeOutputConfigurations. CameraCaptureSession#updateOutputConfiguration can be called after the configuration finalize method returns without exceptions.</li>

<li>If the camera device supports multi-resolution output streams, CameraCharacteristics#SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP will contain the formats and their corresponding stream info. The application can use an OutputConfiguration created with the multi-resolution stream info queried from MultiResolutionStreamConfigurationMap#getOutputInfo and android.hardware.camera2.MultiResolutionImageReader to capture variable size images.

</ul>

As of android.os.Build.VERSION_CODES#P Android P, all formats except ImageFormat#JPEG and ImageFormat#RAW_PRIVATE can be used for sharing, subject to device support. On prior API levels, only ImageFormat#PRIVATE format may be used.

Java documentation for android.hardware.camera2.params.OutputConfiguration.

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

OutputConfiguration(Int32, Surface)

Create a new OutputConfiguration instance with a Surface, with a surface group ID.

OutputConfiguration(Size, Class)

Create a new OutputConfiguration instance, with desired Surface size and Surface source class.

OutputConfiguration(Surface)

Create a new OutputConfiguration instance with a Surface.

Fields

MirrorModeAuto
Obsolete.

Automatic mirroring based on camera facing

MirrorModeH
Obsolete.

Camera output is mirrored horizontally

MirrorModeNone
Obsolete.

No mirror transform is applied

MirrorModeV
Obsolete.

Camera output is mirrored vertically

SurfaceGroupIdNone

Invalid surface group ID.

TimestampBaseChoreographerSynced
Obsolete.

Timestamp is synchronized to choreographer.

TimestampBaseDefault
Obsolete.

Default timestamp base.

TimestampBaseMonotonic
Obsolete.

Timestamp base roughly the same as android.os.SystemClock#uptimeMillis.

TimestampBaseRealtime
Obsolete.

Timestamp base roughly the same as android.os.SystemClock#elapsedRealtime.

TimestampBaseSensor
Obsolete.

Timestamp base of CameraCharacteristics#SENSOR_INFO_TIMESTAMP_SOURCE.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
DynamicRangeProfile

Return current dynamic range profile. -or- Set a specific device supported dynamic range profile.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MaxSharedSurfaceCount

Get the maximum supported shared Surface count.

MirrorMode

Get the current mirroring mode -or- Set the mirroring mode for this output target

PeerReference (Inherited from Object)
ReadoutTimestampEnabled

Whether readout timestamp is used for this OutputConfiguration. -or- Use the camera sensor's readout time for the image timestamp.

StreamUseCase

Get the current stream use case -or- Set stream use case for this OutputConfiguration

Surface

Get the Surface associated with this OutputConfiguration.

SurfaceGroupId

Get the surface group ID associated with this OutputConfiguration.

Surfaces

Get the immutable list of surfaces associated with this OutputConfiguration.

ThresholdClass

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

(Inherited from Object)
ThresholdType

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

(Inherited from Object)
TimestampBase

Get the current timestamp base -or- Set timestamp base for this output target

Methods

AddSensorPixelModeUsed(Int32)

Add a sensor pixel mode that this OutputConfiguration will be used in.

AddSurface(Surface)

Add a surface to this OutputConfiguration.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CreateInstancesForMultiResolutionOutput(MultiResolutionImageReader)

Create a list of OutputConfiguration instances for the outputs used by a android.hardware.camera2.MultiResolutionImageReader.

DescribeContents()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnableSurfaceSharing()

Enable multiple surfaces sharing the same OutputConfiguration

Equals(Object)

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

(Inherited from Object)
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)
RemoveSensorPixelModeUsed(Int32)

Remove a sensor pixel mode, previously added through addSensorPixelModeUsed, from this OutputConfiguration.

RemoveSurface(Surface)

Remove a surface from this OutputConfiguration.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPhysicalCameraId(String)

Set the id of the physical camera for this OutputConfiguration

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

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
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, 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)
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)
WriteToParcel(Parcel, ParcelableWriteFlags)

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