다음을 통해 공유


OutputConfiguration.AddSurface(Surface) Method

Definition

Add a surface to this OutputConfiguration.

[Android.Runtime.Register("addSurface", "(Landroid/view/Surface;)V", "", ApiSince=26)]
public void AddSurface (Android.Views.Surface surface);
[<Android.Runtime.Register("addSurface", "(Landroid/view/Surface;)V", "", ApiSince=26)>]
member this.AddSurface : Android.Views.Surface -> unit

Parameters

surface
Surface

The surface to be added.

Attributes

Remarks

Add a surface to this OutputConfiguration.

This function can be called before or after CameraDevice#createCaptureSessionByOutputConfigurations. If it's called after, the application must finalize the capture session with CameraCaptureSession#finalizeOutputConfigurations. It is possible to call this method after the output configurations have been finalized only in cases of enabled surface sharing see #enableSurfaceSharing. The modified output configuration must be updated with CameraCaptureSession#updateOutputConfiguration. If this function is called before session creation, CameraCaptureSession#finalizeOutputConfigurations doesn't need to be called.

If the OutputConfiguration was constructed by OutputConfiguration#OutputConfiguration(Size, Class), the added surface must be obtained: <ul> <li>from android.view.SurfaceView by calling android.view.SurfaceHolder#getSurface</li> <li>from android.graphics.SurfaceTexture by calling android.view.Surface#Surface(android.graphics.SurfaceTexture)</li> <li>from android.media.MediaRecorder by calling android.media.MediaRecorder#getSurface or android.media.MediaCodec#createPersistentInputSurface</li> <li>from android.media.MediaCodce by calling android.media.MediaCodec#createInputSurface or android.media.MediaCodec#createPersistentInputSource</li> </ul>

If the OutputConfiguration was constructed by #OutputConfiguration(int, Size) or its variants, the added surface must be obtained from android.media.ImageReader by calling android.media.ImageReader#getSurface.

If the OutputConfiguration was constructed by other constructors, the added surface must be compatible with the existing surface. See #enableSurfaceSharing for details of compatible surfaces.

If the OutputConfiguration already contains a Surface, #enableSurfaceSharing must be called before calling this function to add a new Surface.

Java documentation for android.hardware.camera2.params.OutputConfiguration.addSurface(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