Sdílet prostřednictvím


StreamConfigurationMap.IsOutputSupportedFor Method

Definition

Overloads

IsOutputSupportedFor(Surface)

Determine whether or not the surface in its current state is suitable to be included in a CameraDevice#createCaptureSession capture session as an output.

IsOutputSupportedFor(Class)

Determine whether or not output streams can be configured with a particular class as a consumer.

IsOutputSupportedFor(Int32)

Determine whether or not output surfaces with a particular user-defined format can be passed CameraDevice#createCaptureSession createCaptureSession.

IsOutputSupportedFor(Surface)

Determine whether or not the surface in its current state is suitable to be included in a CameraDevice#createCaptureSession capture session as an output.

[Android.Runtime.Register("isOutputSupportedFor", "(Landroid/view/Surface;)Z", "")]
public bool IsOutputSupportedFor (Android.Views.Surface? surface);
[<Android.Runtime.Register("isOutputSupportedFor", "(Landroid/view/Surface;)Z", "")>]
member this.IsOutputSupportedFor : Android.Views.Surface -> bool

Parameters

surface
Surface

a non-nullSurface object reference

Returns

true if this is supported, false otherwise

Attributes

Exceptions

if surface was null

if the Surface endpoint is no longer valid

Remarks

Determine whether or not the surface in its current state is suitable to be included in a CameraDevice#createCaptureSession capture session as an output.

Not all surfaces are usable with the CameraDevice, and not all configurations of that surface are compatible. Some classes that provide the surface are compatible with the CameraDevice in general (see #isOutputSupportedFor(Class), but it is the caller's responsibility to put the surface into a state that will be compatible with the CameraDevice.

Reasons for a surface being specifically incompatible might be: <ul> <li>Using a format that's not listed by #getOutputFormats<li>Using a format/size combination that's not listed by #getOutputSizes<li>The surface itself is not in a state where it can service a new producer.

</li> </ul>

Surfaces from flexible sources will return true even if the exact size of the Surface does not match a camera-supported size, as long as the format (or class) is supported and the camera device supports a size that is equal to or less than 1080p in that format. If such as Surface is used to create a capture session, it will have its size rounded to the nearest supported size, below or equal to 1080p. Flexible sources include SurfaceView, SurfaceTexture, and ImageReader.

This is not an exhaustive list; see the particular class's documentation for further possible reasons of incompatibility.

Java documentation for android.hardware.camera2.params.StreamConfigurationMap.isOutputSupportedFor(android.view.Surface).

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

IsOutputSupportedFor(Class)

Determine whether or not output streams can be configured with a particular class as a consumer.

[Android.Runtime.Register("isOutputSupportedFor", "(Ljava/lang/Class;)Z", "")]
[Java.Interop.JavaTypeParameters(new System.String[] { "T" })]
public static bool IsOutputSupportedFor (Java.Lang.Class? klass);
[<Android.Runtime.Register("isOutputSupportedFor", "(Ljava/lang/Class;)Z", "")>]
[<Java.Interop.JavaTypeParameters(new System.String[] { "T" })>]
static member IsOutputSupportedFor : Java.Lang.Class -> bool

Parameters

klass
Class

a non-nullClass object reference

Returns

true if this class is supported as an output, false otherwise

Attributes

Remarks

Determine whether or not output streams can be configured with a particular class as a consumer.

The following list is generally usable for outputs: <ul> <li>android.media.ImageReader - Recommended for image processing or streaming to external resources (such as a file or network) <li>android.media.MediaRecorder - Recommended for recording video (simple to use) <li>android.media.MediaCodec - Recommended for recording video (more complicated to use, with more flexibility) <li>android.renderscript.Allocation - Recommended for image processing with android.renderscript RenderScript<li>android.view.SurfaceHolder - Recommended for low-power camera preview with android.view.SurfaceView<li>android.graphics.SurfaceTexture - Recommended for OpenGL-accelerated preview processing or compositing with android.view.TextureView</ul>

Generally speaking this means that creating a Surface from that class may provide a producer endpoint that is suitable to be used with CameraDevice#createCaptureSession.

Since not all of the above classes support output of all format and size combinations, the particular combination should be queried with #isOutputSupportedFor(Surface).

Java documentation for android.hardware.camera2.params.StreamConfigurationMap.isOutputSupportedFor(java.lang.Class<T>).

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

IsOutputSupportedFor(Int32)

Determine whether or not output surfaces with a particular user-defined format can be passed CameraDevice#createCaptureSession createCaptureSession.

[Android.Runtime.Register("isOutputSupportedFor", "(I)Z", "")]
public bool IsOutputSupportedFor (int format);
[<Android.Runtime.Register("isOutputSupportedFor", "(I)Z", "")>]
member this.IsOutputSupportedFor : int -> bool

Parameters

format
Int32

an image format from either ImageFormat or PixelFormat

Returns

true iff using a surface with this format will be supported with CameraDevice#createCaptureSession

Attributes

Exceptions

if the image format was not a defined named constant from either ImageFormat or PixelFormat

Remarks

Determine whether or not output surfaces with a particular user-defined format can be passed CameraDevice#createCaptureSession createCaptureSession.

This method determines that the output format is supported by the camera device; each output surface target may or may not itself support that format. Refer to the class which provides the surface for additional documentation.

Formats for which this returns true are guaranteed to exist in the result returned by #getOutputSizes.

Java documentation for android.hardware.camera2.params.StreamConfigurationMap.isOutputSupportedFor(int).

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.

See also

Applies to