Bug 949930 - CameraControl.sensorAngle doesn't return consistent angle among different devices, r=mikeh, a=1.3+

This commit is contained in:
Ben Tian 2014-01-13 10:12:40 +08:00
parent d25a65ec28
commit c685a9a4a7
3 changed files with 7 additions and 5 deletions

View File

@ -992,7 +992,7 @@ nsGonkCameraControl::TakePictureImpl(TakePictureTask* aTakePicture)
// Convert 'rotation' to a positive value from 0..270 degrees, in steps of 90.
uint32_t r = static_cast<uint32_t>(aTakePicture->mRotation);
r += mCameraHw->GetSensorOrientation();
r += mCameraHw->GetSensorOrientation(GonkCameraHardware::OFFSET_SENSOR_ORIENTATION);
r %= 360;
r += 45;
r /= 90;
@ -1533,7 +1533,7 @@ nsGonkCameraControl::SetupRecording(int aFd, int aRotation, int64_t aMaxFileSize
// adjust rotation by camera sensor offset
int r = aRotation;
r += mCameraHw->GetSensorOrientation(GonkCameraHardware::RAW_SENSOR_ORIENTATION);
r += mCameraHw->GetSensorOrientation();
r %= 360;
r += 45;
r /= 90;

View File

@ -168,8 +168,10 @@ GonkCameraHardware::Init()
mRawSensorOrientation = info.orientation;
mSensorOrientation = mRawSensorOrientation;
// Some kernels report the wrong sensor orientation through
// get_camera_info()...
/**
* Non-V4L2-based camera driver adds extra offset onto picture orientation
* set by gecko, so we have to adjust it back.
*/
char propname[PROP_NAME_MAX];
char prop[PROP_VALUE_MAX];
int offset = 0;

View File

@ -78,7 +78,7 @@ public:
RAW_SENSOR_ORIENTATION,
OFFSET_SENSOR_ORIENTATION
};
int GetSensorOrientation(uint32_t aType = OFFSET_SENSOR_ORIENTATION);
int GetSensorOrientation(uint32_t aType = RAW_SENSOR_ORIENTATION);
int AutoFocus();
void CancelAutoFocus();