一、CAMERA_DEVICE_API_VERSION_3_0 and 3_1
- 重置HAL相机设备正在处理的pipeline并设置新的输入和输出流。此调用将所有现有的stream配置替换为stream_list中定义的stream。在initialize()之后,使用process_capture_request()提交请求之前,将至少调用一次此方法。
- stream_list必须至少包含一个具有输出能力的stream,并且可能不会含一个以上具有输入能力的stream。
- stream_list中的stream可能也处于一组当前活跃状态stream中(来自先前configure_stream()调用)。这些stream将已经具有有效的usage、max_buffers和私有指针。
- 如果这样的stream已经有已注册的buffer,register_stream_buffers()将不会为这个stream再被调用,stream中的buffer可以立即被包含在输入请求当中。
- 如果HAL因新配置而需要更改现有stream的配置,在configure调用的时候有可能修改usage、max_Buffers的值。
- Framework将检测到这样的更改,然后将重新分配stream buffers,并在请求中使用该stream中的buffer之前再次调用register_stream_buffers()。
- 如果当前活跃的stream没有包含在stream_list,HAL可以安全地移除对该stream的任何引用。在之后的Framework调用configure()的时候将不会再使用,并且该stream中的所有gralloc buffer在configure_streams()调用返回之后将被释放。
- stream_list结构体归框架所有,并且一旦该调用完成就不能访问。单个camera3_stream_t的结构体地址将对HAL保持有效,直到第一个configure_stream()调用结束时为止,该调用不再在stream_list参数中包括该camera3_stream_t。HAL不能在私有指针之外更改stream结构体中的值,除了usage和max_buffer成员在configure_streams()调用自己的时候。
- (1) CAMERA_DEVICE_API_VERSION_3_0:
如果是新的stream,stream结构体的usage、max_buffers和私有指针字段将被置为0。HAL device必须在configure_streams()调用返回之前设置这些字段。这些字段然后会被Framework和platform gralloc module使用去分配每个stream的gralloc buffer。
(2) CAMERA_DEVICE_API_VERSION_3_1:
如果是新的stream,stream结构体的max_buffers和私有指针字段将被置为0。usage将被置为用户usage flags。HAL device必须在configure_streams()调用返回之前设置这些字段。这些字段然后会被Framework和platform gralloc module使用去分配每个stream的gralloc buffer。 - 在这个新stream有包含在capture请求中的自己的buffer之前,Framework将使用这个stream调用register_stream_buffers()。但是,在提交请求之前,Framework不需要为所有的stream都注册buffer。允许(例如)preview stream的快速启动,最后或并行进行其他stream的分配。
二、>= CAMERA_DEVICE_API_VERSION_3_2
- 重置HAL相机设备正在处理的pipeline并设置新的输入和输出流。此调用将所有现有的stream配置替换为stream_list中定义的stream。在initialize()之后,使用process_capture_request()提交请求之前,将至少调用一次此方法。
- stream_list必须至少包含一个具有输出能力的stream,并且可能不会含一个以上具有输入能力的stream。
- stream_list中的stream可能也处于一组当前活跃状态stream中(来自先前configure_stream()调用)。这些stream将已经具有有效的usage、max_buffers和私有指针。
- 如果HAL因新配置而需要更改现有stream的配置,在configure调用的时候有可能修改usage、max_Buffers的值。
- Framework将检测到这样的更改,然后在使用请求里stream的buffer之前,重新分配stream buffer。
- 如果当前活跃的stream没有包含在stream_list,HAL可以安全地移除对该stream的任何引用。在之后的Framework调用configure()的时候将不会再使用,并且该stream中的所有gralloc buffer在configure_streams()调用返回之后将被释放。
- stream_list结构体归框架所有,并且一旦该调用完成就不能访问。单个camera3_stream_t的结构体地址将对HAL保持有效,直到第一个configure_stream()调用结束时为止,该调用不再在stream_list参数中包括该camera3_stream_t。HAL不能在私有指针之外更改stream结构体中的值,除了usage和max_buffer成员在configure_streams()调用自己的时候。
- 如果是新的stream,stream结构体的max_buffers和私有指针字段将被置为0。usage将被置为用户usage flags。HAL device必须在configure_streams()调用返回之前设置这些字段。这些字段然后会被Framework和platform gralloc module使用去分配每个stream的gralloc buffer。
- Framework可以在任何时间将新分配的buffer包含在capture请求中。一旦gralloc buffer通过process_capture_result返还给framework(并且它各自的release_fence已经被发送信号),Framework可以在任何时候释放或再使用它。
前提条件
Framework将仅在没有capture正被处理的时候调用这个方法。也就是,所有的结果已经被返回给Framework,并且所有途中的输入和输出buffer已经返回,HAL也发送了他们的release sync fences信号。当configure_streams()调用在进行中得时候,Framework将不会提交新的capture请求。
后续条件
HAL device必须配置自己,根据输出stream的size和format提供尽可能最大的输出帧率,就像相机设备的静态metadata中记录的那样。
性能要求
预计是个重量级的调用,可能需要几百毫秒完成,由于它需要重置和重新配置图像传感器和相机处理pipeline。然而,在应用程序操作模式切换时(例如从拍照切换到录像),HAL
device应尝试最小化重新配置延时以减小用户视觉暂停。
HAL应当500ms内且必须1000ms内返回该调用。
/**
* camera3_stream_configuration_t:
*
* A structure of stream definitions, used by configure_streams(). This
* structure defines all the output streams and the reprocessing input
* stream for the current camera use case.
*/
typedef struct camera3_stream_configuration {
/**
* The total number of streams requested by the framework.
*/
uint32_t num_streams;
/**
* An array of camera stream pointers, defining the input/output
* configuration for the camera HAL device.
*/
camera3_stream_t **streams;
/**
* >= CAMERA_DEVICE_API_VERSION_3_3:
* The operation mode of streams in this configuration, one of the value
* defined in camera3_stream_configuration_mode_t.
*/
uint32_t operation_mode;
/**
* >= CAMERA_DEVICE_API_VERSION_3_5:
* The session metadata buffer contains the initial values of
* ANDROID_REQUEST_AVAILABLE_SESSION_KEYS.
*/
const camera_metadata_t *session_parameters;
} camera3_stream_configuration_t;
待续…