首页 > 代码库 > android JB2连拍降速原理介绍
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<IShot> 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);
(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<IShot> 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);
android JB2连拍降速原理介绍
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。