1. HAL Layer
(1) Alps\mediatek\platform\mt6589\hardware\camera\core\camshot\multishot\multishot.cpp Sleep to achieve spin down.
Handle Ecamshot_cmd_set_cshot_speed in SendCommand. Ecamshot_cmd_set_cshot_speed defined in Alps\mediatek\platform\mt6589\hardware\camera\inc\camshot\_params.h.
Mbool
Multishot::
SendCommand (MINT32 cmd, MINT32 arg1, MINT32 arg2, MINT32 arg3)
{
Function_log_start;
Mbool ret = mtrue;
//
Switch (CMD)
{
Case Ecamshot_cmd_set_cshot_speed:
if (arg1 > 0)
{
Mu4shotspeed = arg1;
ret = mtrue;
}
Else
{
MY_LOGD ("Set Invalid shot speed:%d", arg1);
ret = Mfalse;
}
Break
Default
Break
}
//
Function_log_end;
//
return ret;
}
(2) The function of sending ecamshot_cmd_set_cshot_speed, in alps\mediatek\platform\mt6589\hardware\camera\hal\adapter\scenario\shot\ Continuousshot\continuousshot.cpp,
bool
Continuousshot::
Oncmd_setcshotspeed (uint32_t u4cshotspeed)
{
BOOL ret = true;
Mutex::autolock Lock (MSHOTSTOPMTX);
if (!mbshotstoped && mpmultishot!=null)
{
MY_LOGD ("Set continuous shot Speed:%d", u4cshotspeed);
ret = Mpmultishot->sendcommand (nscamshot::ecamshot_cmd_set_cshot_speed, u4cshotspeed, 0, 0);
}
return ret;
}
At the same time, the SendCommand function of the file handles the adapter Ecmd_setcshotspeed. Ecmd_setcshotspeed defined in Alps\mediatek\platform\mt6589\hardware\camera\hal\adapter\inc\scenario\shot\ishot.h
Case Ecmd_setcshotspeed:
ret = Oncmd_setcshotspeed (arg1);
Break
(3) Adapter sends Ecmd_setcshotspeed in the function Setcshotspeed of the following file.
MtkPhotoCamAdapter.Capture.cpp (Alps\mediatek\platform\mt6589\hardware\camera\hal\adapter\mtkphoto):
MtkZsdNccCamAdapter.Capture.cpp (ALPS\MEDIATEK\PLATFORM\MT6589\HARDWARE\CAMERA\HAL\ADAPTER\MTKZSD\MTKZSDNCC):
status_t
Camadapter::
Setcshotspeed (int32_t i4cshotspeeed)
{
if (i4cshotspeeed <= 0)
{
My_loge ("Can not set continuous shot speed as%d fps)", i4cshotspeeed);
return bad_value;
}
sp<ishot> pshot = mpshot;
if (pshot! = 0)
{
Pshot->sendcommand (ecmd_setcshotspeed, i4cshotspeeed, 0);
}
return OK;
}
The Sendcommad function in the following file handles the camera_cmd_set_cshot_speed sent down by JNI.
MtkCamera.h (Alps\mediatek\frameworks-ext\av\include\camera):
Camera_cmd_set_cshot_speed,
MtkPhotoCamAdapter.cpp (Alps\mediatek\platform\mt6589\hardware\camera\hal\adapter\mtkphoto):
MtkZsdCcCamAdapter.cpp (ALPS\MEDIATEK\PLATFORM\MT6589\HARDWARE\CAMERA\HAL\ADAPTER\MTKZSD\MTKZSDCC):
MtkZsdNccCamAdapter.cpp (ALPS\MEDIATEK\PLATFORM\MT6589\HARDWARE\CAMERA\HAL\ADAPTER\MTKZSD\MTKZSDNCC):
Case Camera_cmd_set_cshot_speed:
Return Setcshotspeed (ARG1);
2. JNI Layer
(1) android_hardware_camera.cpp (ALPS\FRAMEWORKS\BASE\CORE\JNI):
static void Android_hardware_camera_setcontinuousshotspeed (JNIEnv *env, Jobject thiz, Jint value)
(2)
Static Jninativemethod cammethods[] = {
...
{"Setcontinuousshotspeed",
"(I) V",
(void *) Android_hardware_camera_setcontinuousshotspeed},
(3) Camera.java (Alps\frameworks\base\core\java\android\hardware):
public native void Setcontinuousshotspeed (int. speed);
Introduction to the principle of Android JB2 continuous shooting spin