Android Camera2架构-ICameraDeviceCallbacks机制

我们看到ICameraDeviceCallbacks 所处位置是CameraDeviceClient向CameraDevice返回位置。

谷歌原文解释:

ICameraDeviceCallbacks is the  CameraDevice callbacks to the application framework.

 

这个回调是在CameraDevice的继承类CameraDeviceImpl定义,从打开相机经过ICameraService中MakeClient传给CameraDeviceClient中。

参考open流程:

Android Camera2架构-OpenCamera2流程Frameworks层到HAL层(1)

也就是说在CameraDeviceClient中会通过这些回调函数通知CameraDevice一些消息。

具体看ICameraDeviceCallbacks.aidl里面定义的消息方法。

interface ICameraDeviceCallbacks
{
    // Error codes for onDeviceError
    const int ERROR_CAMERA_INVALID_ERROR = -1; // To indicate all invalid error codes
    const int ERROR_CAMERA_DISCONNECTED = 0;
    const int ERROR_CAMERA_DEVICE = 1;
    const int ERROR_CAMERA_SERVICE = 2;
    const int ERROR_CAMERA_REQUEST = 3;
    const int ERROR_CAMERA_RESULT = 4;
    const int ERROR_CAMERA_BUFFER = 5;
    const int ERROR_CAMERA_DISABLED = 6;

    oneway void onDeviceError(int errorCode, in CaptureResultExtras resultExtras);
    oneway void onDeviceIdle();
    oneway void onCaptureStarted(in CaptureResultExtras resultExtras, long timestamp);
    oneway void onResultReceived(in CameraMetadataNative result,
                                 in CaptureResultExtras resultExtras,
                                 in PhysicalCaptureResultInfo[] physicalCaptureResultInfos);
    oneway void onPrepared(int streamId);

    /**
     * Repeating request encountered an error and was stopped.
     *
     * @param lastFrameNumber Frame number of the last frame of the streaming request.
     * @param repeatingRequestId the ID of the repeating request being stopped
     */
    oneway void onRepeatingRequestError(in long lastFrameNumber,
                                        in int repeatingRequestId);
    oneway void onRequestQueueEmpty();
}

比如:

说当CameraDeviceCilent收到onResultReceived消息时候就会触发ICameraDeviceCallbacks.onResultReceived()方法通知到CameraDevice。

返回Result参考

Android Camera2架构-ResultThread处理队列中的预览和拍照请求流程Frameworks层到HAL层(1)

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值