android JB2連拍降速原理介紹

來源:互聯網
上載者:User

android JB2連拍降速原理介紹
1、HAL層
(1)alps\mediatek\platform\mt6589\hardware\camera\core\camshot\MultiShot\MultiShot.cpp sleep實現降速。
在sendCommand處理ECamShot_CMD_SET_CSHOT_SPEED。ECamShot_CMD_SET_CSHOT_SPEED定義在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)發送ECamShot_CMD_SET_CSHOT_SPEED的函數,在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;
}
同時在該檔案的sendCommand函數處理adapter傳下的eCmd_setCShotSpeed。eCmd_setCShotSpeed定義在alps\mediatek\platform\mt6589\hardware\camera\hal\adapter\inc\scenario\shot\IShot.h
case eCmd_setCShotSpeed:
ret = onCmd_setCShotSpeed(arg1);
break;

(3)Adapter在以下檔案的函數setCShotSpeed發送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;
}

在以下檔案sendCommad函數處理JNI送下來的CAMERA_CMD_SET_CSHOT_SPEED。
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層
(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);

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.