When we tune the camera, there are often tests to suggest that the camera's model scenario mode is not supported. Let's analyze how to look at the profile of the Android camera. We take the implementation of MTK as an example.
At the bottom mediatek/proprietary/custom/mt8127/hal/sendepfeature/ov2680_raw/config.ftbl.ov2680_mipi_raw.h This file defines which scenarios the camera supports
#if 1 // Scene mode ftable_config_as_type_of_default_values ( Key_as_ (mtkcameraparameters::key_scene_mode), Scene_as_default_scene ( item_as_ Default_ (Mtkcameraparameters::scene_mode_auto), Item_as_values_ ( Mtkcameraparameters::scene_mode_auto,// Mtkcameraparameters::scene_mode_normal, mtkcameraparameters::scene_mode_portrait, MtkcameraparameTers::scene_mode_landscape, mtkcameraparameters::scene_mode_night, Mtkcameraparameters::scene _mode_night_portrait, mtkcameraparameters::scene_mode_theatre, Mtkcameraparameters::scene_mode_beach, mtkcameraparameters: :scene_mode_snow, Mtkcameraparameters::scene_mode_sunset, Mtkcameraparameters::scene_mode_steadyphoto, // Mtkcameraparameters::scene_mode_fireworks, mtkcameraparameters::scene_mode_sports, Mtkcameraparameters::scene_mode_party, Mtkcameraparameters::scene_mode_candlelight,// Mtkcameraparameters::scene_mode_hdr, ) ), ) # endif
This file defines which profiles our cameras support, SCENE_MODE_HDR, HDR mode, Scene_mode_night night view mode ...
With this, the Android framework will do the corresponding processing according to these, and then passed to the upper layer, the upper Java can determine whether we can support the mode,
In the HAL layer, CameraHardwareInterface.h
status_t Initialize (hw_module_t *module) { ... camera_module_t *cameramodule = reinterpret_cast<camera_module_t *> (module); Camera_info info; status_t res = Cameramodule->get_camera_info (atoi (mname.string ()), &info); ......}
This is where the information about the camera is initialized, and the situational patterns we need are saved in the structure Camera_info.
Get camerainfo information in the Getcameracharacteristics () method in CameraService.cpp
status_t cameraservice::getcameracharacteristics (int cameraid, Camerametada ta* camerainfo) {if (!camerainfo) {Aloge ("%s:camerainfo is NULL", __function__); return bad_value; } if (!mmodule) {aloge ("%s:camera hardware module doesn ' t exist", __function__); Return-enodev; } if (Cameraid < 0 | | Cameraid >= mnumberofcameras) {aloge ("%s:invalid Camera ID:%d", __function__, Cam Eraid); return bad_value; } int facing; status_t ret = OK; if (Mmodule->common.module_api_version < CAMERA_MODULE_API_VERSION_2_0 | | Getdeviceversion (Cameraid, &facing) <= camera_device_api_version_2_1) {/** * backwards Compatibili Ty mode for old HALs: *-Convert camerainfo to static Camerametadata properties. *-Retrieve cached cameraparameters for this camera. If none exist, * attempt to open cameraclient and retrieveThe cameraparameters. *-Convert cached cameraparameters into static Camerametadata * properties. */Alogi ("%s:switching to HAL1 shim implementation ...", __function__); if (ret = Generateshimmetadata (Cameraid, camerainfo))! = OK) {return ret; }} else {/** * Normal HAL 2.1+ Codepath. */struct Camera_info info; ret = Filtergetinfoerrorcode (Mmodule->get_camera_info (Cameraid, &info)); *camerainfo = Info.static_camera_characteristics; } return ret;}
Android Camera acquisition system supported profile