标签:android io os 使用 ar java for 文件 sp
默认的前置camera, 文字”XI”在preview时显示为”IX”(前置camera preview时默认会有mirror效果), 拍摄出来的照片为"XI",如何让拍摄出来的照片也是”IX” , 也就是和preview时保持一致?
对于普通单拍(非ZSD或其他拍照模式), 需要修改的代码为normalShot.cpp文件中的onCmd_capture()方法,
将原来的
bool
NormalShot::
onCmd_capture()
{
AutoCPTLog cptlog(Event_Shot_capture);
MBOOL ret = MTRUE;
NSCamShot::ISingleShot *pSingleShot =
NSCamShot::ISingleShot::createInstance(static_cast<EShotMode>(mu4ShotMode),
"NormalShot");
......
// shot param
NSCamShot::ShotParam rShotParam(eImgFmt_YUY2, //yuv format
mShotParam.mi4PictureWidth, //picutre width
mShotParam.mi4PictureHeight, //picture height
mShotParam.mi4Rotation, //picture rotation
0, //picture flip
ePostViewFmt, // postview format
mShotParam.mi4PostviewWidth, //postview width
mShotParam.mi4PostviewHeight, //postview height
0, //postview rotation
0, //postview flip
mShotParam.mu4ZoomRatio //zoom
);
......
}
修改为:
bool
NormalShot::
onCmd_capture()
{
AutoCPTLog cptlog(Event_Shot_capture);
MBOOL ret = MTRUE;
NSCamShot::ISingleShot *pSingleShot =
NSCamShot::ISingleShot::createInstance(static_cast<EShotMode>(mu4ShotMode),
"NormalShot");
......
// shot param
NSCamShot::ShotParam rShotParam(eImgFmt_YUY2, //yuv format
mShotParam.mi4PictureWidth, //picutre width
mShotParam.mi4PictureHeight, //picture height
mShotParam.mi4Rotation, //picture rotation
(getOpenId()==1? 1:0), //picture flip //此处为修改的代码,将这里的值改为1,底层则会将image做横向的flip, 相当于mirror.
ePostViewFmt, // postview format
mShotParam.mi4PostviewWidth, //postview width
mShotParam.mi4PostviewHeight, //postview height
0, //postview rotation
0, //postview flip
mShotParam.mu4ZoomRatio //zoom
);
......
}
主要将参数rShotParam里面的flip值改为1, 值为1表示底层将把image做横向的flip,若为0则不做.
(上述改动中的getOpenId()==1? 1:0只为测试使用,意为判断当前是否为前置camera, 若为前置camera, 则赋值为1)
请您注意:
在实际应用中, 请在Parameters中新增一个Flip参数, 并在app中通过Parameters传递Flip值到HAL层来通知底层做flip. (为避免影响CTS测试和三方应用, 请勿直接将上述的提到的flip值固定写为1.)
涉及修改的文件主要如下:
NormalShot.cpp (mediatek\platform\mt6589\hardware\camera\hal\adapter\scenario\shot\normalshot)
IShot.h (mediatek\platform\mt6589\hardware\camera\hal\adapter\inc\scenario\shot)
CameraParameters.cpp (frameworks\av\camera)
CameraParameters.h (frameworks\av\include\camera)
ParamsManager.update.cpp (mediatek\hardware\camera\common\paramsmgr\params)
MtkPhotoCamAdapter.Capture.cpp (mediatek\platform\mt6589\hardware\camera\hal\adapter\mtkphoto)
Camera.java(\frameworks\base\core\java\android\hardware\)
标签:android io os 使用 ar java for 文件 sp
原文地址:http://www.cnblogs.com/yido9932/p/4023570.html