Most visited

Recently visited

Added in API level 23

CameraConstrainedHighSpeedCaptureSession

public abstract class CameraConstrainedHighSpeedCaptureSession
extends CameraCaptureSession

java.lang.Object
   ↳ android.hardware.camera2.CameraCaptureSession
     ↳ android.hardware.camera2.CameraConstrainedHighSpeedCaptureSession


CameraDevice约束高速捕捉会话,用于从 CameraDevice捕捉高速视频录制用例的高速图像。

通过向createConstrainedHighSpeedCaptureSession(List , CameraCaptureSession.StateCallback, Handler) 提供一组目标输出表面来创建 createConstrainedHighSpeedCaptureSession(List , CameraCaptureSession.StateCallback, Handler) 。创建完成后,会话将处于活动状态,直到相机设备创建新会话或相机设备关闭。

如果摄像机设备支持高速视频功能(即, REQUEST_AVAILABLE_CAPABILITIES包含REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO ),则主动式高速捕获会话是专门用于高速视频记录(> = 120fps)使用情况的专用捕获会话。 它仅接受通过createHighSpeedRequestList(CaptureRequest)创建的请求列表,并且请求列表只能通过captureBurstsetRepeatingBurst提交给此会话。 有关createConstrainedHighSpeedCaptureSession(List , CameraCaptureSession.StateCallback, Handler) 的更多详细信息,请参阅createConstrainedHighSpeedCaptureSession(List , CameraCaptureSession.StateCallback, Handler)

创建会话是一项昂贵的操作,可能需要几百毫秒,因为它需要配置摄像机设备的内部管道并分配内存缓冲区以将图像发送到所需的目标。 因此,该设置是异步完成的,并且createConstrainedHighSpeedCaptureSession(List , CameraCaptureSession.StateCallback, Handler) 将发送准备使用的onConfigured(CameraCaptureSession)到所提供的监听器的回调onConfigured(CameraCaptureSession) 如果配置无法完成,则调用onConfigureFailed(CameraCaptureSession) ,并且会话不会变为活动状态。

如果相机设备创建了新的会话,则关闭前一个会话,并调用其关联的onClosed回调。 如果会话关闭,所有的会话方法都会抛出IllegalStateException异常。

关闭的会话会清除所有重复请求(就好像 stopRepeating()已被调用一样),但在新创建的会话接管并重新配置摄像机设备之前,仍然会正常完成其所有正在进行的捕获请求。

Summary

Public constructors

CameraConstrainedHighSpeedCaptureSession()

Public methods

abstract List<CaptureRequest> createHighSpeedRequestList(CaptureRequest request)

创建一个适用于受约束的高速捕获会话流的不可修改的请求列表。

Inherited methods

From class android.hardware.camera2.CameraCaptureSession
From class java.lang.Object
From interface java.lang.AutoCloseable

Public constructors

CameraConstrainedHighSpeedCaptureSession

Added in API level 23
CameraConstrainedHighSpeedCaptureSession ()

Public methods

createHighSpeedRequestList

Added in API level 23
List<CaptureRequest> createHighSpeedRequestList (CaptureRequest request)

创建一个适用于受约束的高速捕获会话流的不可修改的请求列表。

高速视频流在相机设备上造成显着的性能压力,因此为了实现高效的高速流传输,相机设备可能必须将多个帧聚合在一起。 这意味着请求必须以批处理组发送,并且所有请求都共享相同的设置。 此方法使用输出目标Surfaces(受限于受约束的高速会话指定的输出Surface要求)和request列表,并生成一个请求列表,该列表对每个请求都具有相同的控件。 输入request必须包含目标输出曲面和目标高速FPS范围,该范围是曲面尺寸的getHighSpeedVideoFpsRangesFor(Size)之一。

如果同时指定预览和记录表面request ,在target FPS range在输入request必须是固定帧速率FPS范围,其中minimal FPS == maximum FPS 创建的请求列表将包含交错的请求模式,以便预览输出FPS至少为30fps,录制输出FPS为请求的FPS范围的maximum FPS 应用程序可以直接将此请求列表提交到活动高速捕获会话,以实现高速视频记录。 当仅指定了预览或记录Surface时,此方法将返回一个请求列表,其中包含与所有请求相同的控件和输出目标。

Submitting a request list created by this method to a normal capture session will result in an IllegalArgumentException if the high speed FPS range is not supported by CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES.

Parameters
request CaptureRequest: The high speed capture request that will be used to generate the high speed request list.
Returns
List<CaptureRequest> A unmodifiable CaptureRequest list that is suitable for constrained high speed capture.
Throws
IllegalArgumentException if the set of output Surfaces in the request do not meet the high speed video capability requirements, or the camera device doesn't support high speed video capability, or the request doesn't meet the high speed video capability requirements, or the request doesn't contain the required controls for high speed capture.
CameraAccessException if the camera device is no longer connected or has encountered a fatal error
IllegalStateException if the camera device has been closed

也可以看看:

Hooray!