다음을 통해 공유


CameraDevice.CameraDeviceSetup.IsSessionConfigurationSupported Method

Definition

Checks whether a particular SessionConfiguration is supported by the camera device.

[Android.Runtime.Register("isSessionConfigurationSupported", "(Landroid/hardware/camera2/params/SessionConfiguration;)Z", "GetIsSessionConfigurationSupported_Landroid_hardware_camera2_params_SessionConfiguration_Handler", ApiSince=35)]
public abstract bool IsSessionConfigurationSupported (Android.Hardware.Camera2.Params.SessionConfiguration config);
[<Android.Runtime.Register("isSessionConfigurationSupported", "(Landroid/hardware/camera2/params/SessionConfiguration;)Z", "GetIsSessionConfigurationSupported_Landroid_hardware_camera2_params_SessionConfiguration_Handler", ApiSince=35)>]
abstract member IsSessionConfigurationSupported : Android.Hardware.Camera2.Params.SessionConfiguration -> bool

Parameters

Returns

true if the given session configuration is supported by the camera device, false otherwise.

Attributes

Remarks

Checks whether a particular SessionConfiguration is supported by the camera device.

This method performs a runtime check of a given SessionConfiguration. The result confirms whether or not the SessionConfiguration, <b>including the parameters specified via SessionConfiguration#setSessionParameters</b>, can be used to create a camera capture session using CameraDevice#createCaptureSession(SessionConfiguration).

This method is supported if the CameraCharacteristics#INFO_SESSION_CONFIGURATION_QUERY_VERSION is at least android.os.Build.VERSION_CODES#VANILLA_ICE_CREAM. If less or equal to android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE, this function throws UnsupportedOperationException.

Although this method is much faster than creating a new capture session, it can still take a few milliseconds per call. Applications should therefore not use this method to explore the entire space of supported session combinations.

Instead, applications should use this method to query whether combinations of certain features are supported. CameraCharacteristics#INFO_SESSION_CONFIGURATION_QUERY_VERSION provides the list of feature combinations the camera device will reliably report.

<b>IMPORTANT:</b>

<ul> <li>If feature support can be queried via CameraCharacteristics#SCALER_MANDATORY_STREAM_COMBINATIONS or CameraCharacteristics#SCALER_STREAM_CONFIGURATION_MAP, applications should directly use that route rather than calling this function as: (1) using CameraCharacteristics is more efficient, and (2) calling this function with certain non-supported features will throw a IllegalArgumentException.</li>

<li>To minimize SessionConfiguration creation latency due to its dependency on output surfaces, the application can call this method before acquiring valid android.view.SurfaceView, android.graphics.SurfaceTexture, android.media.MediaRecorder, android.media.MediaCodec, or android.media.ImageReader surfaces. For android.view.SurfaceView, android.graphics.SurfaceTexture, android.media.MediaRecorder, and android.media.MediaCodec, the application can call OutputConfiguration#OutputConfiguration(Size, Class). For android.media.ImageReader, the application can call OutputConfiguration#OutputConfiguration(int, Size), OutputConfiguration#OutputConfiguration(int, int, Size), OutputConfiguration#OutputConfiguration(int, Size, long), or OutputConfiguration#OutputConfiguration(int, int, Size, long). The SessionConfiguration can then be created using the OutputConfiguration objects and be used to query whether it's supported by the camera device. To create the CameraCaptureSession, the application still needs to make sure all output surfaces are added via OutputConfiguration#addSurface with the exception of deferred surfaces for android.view.SurfaceView and android.graphics.SurfaceTexture.</li> </ul>

Java documentation for android.hardware.camera2.CameraDevice.CameraDeviceSetup.isSessionConfigurationSupported(android.hardware.camera2.params.SessionConfiguration).

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.

Applies to