Android Camera原理之camx hal架构_libcamhal

libcamxncs              \
libstriping

LOCAL_WHOLE_STATIC_LIBRARIES :=
libcamxdspstreamer
libcamxhwlbps
libcamxgenerated
libcamxhal
libcamxhalutils
libcamxhwlfd
libcamxhwlife
libcamxhwlipe
libcamxhwliqmodule
libcamxswlfdmanager
libcamxswljpeg
libcamxhwljpeg
libcamxhwllrme
libcamxswlransac
libcamxhwltitan17x
libcamxiqsetting
libcamxosutils
libcamxstats
libcamxsensor
libcamxutils


camera.provider中如何实现到camera hal层的跳跃,camera service调用到camera provider中的接口方法,现在调用到 camera provider中的 **hardware/interfaces/camera/device/3.2/default/CameraDeviceSession.cpp 中的processCaptureRequest(...)方法,最终会调用到:**


status\_t ret = mDevice->ops->process\_capture\_request(mDevice, &halRequest);


**这个mDevice->ops 就是 hardware/libhardware/include/hardware/camera3.h 中的 camera3\_device\_ops 结构体:**


<https://www.jianshu.com/p/099cc3b0ab25>



typedef struct camera3_device_ops {
int (*initialize)(const struct camera3_device *,
const camera3_callback_ops_t *callback_ops);
int (*configure_streams)(const struct camera3_device *,
camera3_stream_configuration_t *stream_list);
int (*register_stream_buffers)(const struct camera3_device *,
const camera3_stream_buffer_set_t buffer_set);
const camera_metadata_t
(*construct_default_request_settings)(
const struct camera3_device *,
int type);
int (*process_capture_request)(const struct camera3_device *,
camera3_capture_request_t request);
void (get_metadata_vendor_tag_ops)(const struct camera3_device,
vendor_tag_query_ops_t
ops);
void (*dump)(const struct camera3_device *, int fd);
int (*flush)(const struct camera3_device *);

/* reserved for future use */
void *reserved[8];

} camera3_device_ops_t;


**这样找到在camera hal层的函数指针的映射关系。**


**映射到:vendor/qcom/proprietary/camx/src/core/hal/camxhal3entry.cpp 中的:**


// Global dispatch  
 static Dispatch g\_dispatchHAL3(&g\_jumpTableHAL3);


**看一下g\_jumpTableHAL3 变量:在 vendor/qcom/proprietary/camx/src/core/hal/camxhal3.cpp 中定义的:**



// Jump table for HAL3

JumpTableHAL3 g_jumpTableHAL3 =
{
open,
get_number_of_cameras,
get_camera_info,
set_callbacks,
get_vendor_tag_ops,
open_legacy,
set_torch_mode,
init,
parallelQuery,
setCallBack,
get_tag_count,
get_all_tags,
get_section_name,
get_tag_name,
get_tag_type,
close,
initialize,
configure_streams,
construct_default_request_settings,
process_capture_request,
dump,
flush,
camera_device_status_change,
torch_mode_status_change,
process_capture_result,
notify
};


***这儿直接构成了指针函数的映射关系。***


**vendor/qcom/proprietary/camx/src/core/chi/camxchitypes.h中定义了CHIAppCallbacks结构体,如下:**



struct CHIAppCallbacks
{
/// @brief Called by the driver to get number of cameras
INT(CHIGetNumCameras)(
UINT32
pNumFwCameras,
UINT32* pNumLogicalCameras);

/// @brief Called by the driver to get the camera info for the camera id
CamxResult (*CHIGetCameraInfo)(
    UINT32      cameraId,
    CameraInfo* pCameraInfo);

/// @brief Defines the prototype for the device status change callback method from to the framework. Please refer to
///        the camera_device_status_change documentation in hardware/camera_common.h.
VOID (*CHIInitializeOverrideSession)(
    UINT32               cameraId,
    const Camera3Device* pCamera3Device,
  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值