Introduction to the principle of simultaneous downloading and downloading of android JB2
1. HAL Layer
(1) alps \ mediatek \ platform \ mt6589 \ hardware \ camera \ core \ camshot \ MultiShot. cpp sleep to reduce the speed.
Process ecamshot_pai_set_cshot_speed in sendCommand. Ecamshot_pai_set_cshot_speed is 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_pai_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) Send the ecamshot_pai_set_cshot_speed function in alps \ mediatek \ platform \ mt6589 \ hardware \ camera \ hal \ adapter \ scenario \ shot \ continuousshot \ ContinuousShot. cpp,
Bool
ContinuousShot ::
On__setcshotspeed (uint32_t u4CShotSpeed)
{
Bool ret = true;
Mutex: Autolock lock (mshotstopctx );
If (! MbShotStoped & mpMultiShot! = NULL)
{
MY_LOGD ("set continuous shot speed: % d", u4CShotSpeed );
Ret = mpMultiShot-> sendCommand (NSCamShot: ecamshot_assist_set_cshot_speed, u4CShotSpeed, 0, 0 );
}
Return ret;
}
At the same time, the sendCommand function of the file processes the eCmd_setCShotSpeed transmitted by the adapter. ECmd_setCShotSpeed is defined in alps \ mediatek \ platform \ mt6589 \ hardware \ camera \ hal \ adapter \ inc \ scenario \ shot \ IShot. h
Case eCmd_setCShotSpeed:
Ret = onCmd_setCShotSpeed (arg1 );
Break;
(3) The setCShotSpeed function of the Adapter in the following file sends eCmd_setCShotSpeed.
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 PShot = mpShot;
If (pShot! = 0)
{
PShot-> sendCommand (eCmd_setCShotSpeed, i4CShotSpeeed, 0 );
}
Return OK;
}
The sendCommad function in the following file processes the camera_pai_set_cshot_speed sent by JNI.
MtkCamera. h (alps \ mediatek \ frameworks-ext \ av \ include \ camera ):
Camera_pai_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 );