summaryrefslogtreecommitdiff
authorguosong.zhou <guosong.zhou@amlogic.com>2014-12-15 04:40:49 (GMT)
committer guosong.zhou <guosong.zhou@amlogic.com>2014-12-15 04:40:49 (GMT)
commit420460e5c011443ba2ae64e512ebb02736748772 (patch)
treefaedfb17cb4853987aecbf77e21c55da8a0c9e7a
parent2d63d58e9bb6f9546372fd5c20625f3d18e60dfb (diff)
downloadcamera-420460e5c011443ba2ae64e512ebb02736748772.zip
camera-420460e5c011443ba2ae64e512ebb02736748772.tar.gz
camera-420460e5c011443ba2ae64e512ebb02736748772.tar.bz2
fix usb camera orientation
Change-Id: Ifc882ac877f86c2d87c506d67cb2c4d73570b822
Diffstat
-rwxr-xr-xv3/EmulatedFakeCamera3.cpp25
-rwxr-xr-xv3/fake-pipeline2/Sensor.cpp6
2 files changed, 22 insertions, 9 deletions
diff --git a/v3/EmulatedFakeCamera3.cpp b/v3/EmulatedFakeCamera3.cpp
index 815b178..23b561b 100755
--- a/v3/EmulatedFakeCamera3.cpp
+++ b/v3/EmulatedFakeCamera3.cpp
@@ -1519,11 +1519,19 @@ status_t EmulatedFakeCamera3::constructStaticInfo() {
int64_t* duration = NULL;
int count, duration_count, availablejpegsize;
uint8_t maxCount = 10;
- char property[PROPERTY_VALUE_MAX];
+ char property[PROPERTY_VALUE_MAX];
+ unsigned int supportrotate;
availablejpegsize = ARRAY_SIZE(mAvailableJpegSize);
memset(mAvailableJpegSize,0,(sizeof(uint32_t))*availablejpegsize);
sp<Sensor> s = new Sensor();
s->startUp(mCameraID);
+
+ mSupportCap = s->IoctlStateProbe();
+ if (mSupportCap & IOCTL_MASK_ROTATE) {
+ supportrotate = true;
+ } else {
+ supportrotate = false;
+ }
// android.lens
// 5 cm min focus distance for back camera, infinity (fixed focus) for front
@@ -1618,13 +1626,18 @@ status_t EmulatedFakeCamera3::constructStaticInfo() {
static const uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN;
info.update(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, &timestampSource, 1);
- if (mFacingBack) {
- property_get("ro.camera.orientation.back", property, "270");
+ if (supportrotate) {
+ if (mFacingBack) {
+ property_get("ro.camera.orientation.back", property, "0");
+ } else {
+ property_get("ro.camera.orientation.front", property, "90");
+ }
+ static const int32_t orientation = atoi(property);
+ info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1);
} else {
- property_get("ro.camera.orientation.front", property, "90");
+ static const int32_t orientation = 0;
+ info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1);
}
- static const int32_t orientation = atoi(property);
- info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1);
static const int64_t rollingShutterSkew = 0;
info.update(ANDROID_SENSOR_ROLLING_SHUTTER_SKEW, &rollingShutterSkew, 1);
diff --git a/v3/fake-pipeline2/Sensor.cpp b/v3/fake-pipeline2/Sensor.cpp
index 5285550..d971cac 100755
--- a/v3/fake-pipeline2/Sensor.cpp
+++ b/v3/fake-pipeline2/Sensor.cpp
@@ -1673,7 +1673,7 @@ void Sensor::captureRGB(uint8_t *img, uint32_t gain, uint32_t stride) {
height, width, height, libyuv::FOURCC_MJPG) != 0) {
DBG_LOGA("Decode MJPEG frame failed\n");
} else {
- DBG_LOGA("Decode MJPEG frame failed\n");
+ DBG_LOGA("Decode MJPEG frame succeed\n");
}
nv21_to_rgb24(tmp_buffer,img,width,height);
if (tmp_buffer != NULL)
@@ -1936,7 +1936,7 @@ void Sensor::captureNV21(StreamBuffer b, uint32_t gain) {
continue;
} else {
framecount++;
- DBG_LOGA("Decode MJPEG frame success\n");
+ DBG_LOGA("Decode MJPEG frame succeed\n");
}
} else {
ALOGE("Unable known sensor format: %d", vinfo->preview.format.fmt.pix.pixelformat);
@@ -2114,7 +2114,7 @@ void Sensor::captureYV12(StreamBuffer b, uint32_t gain) {
continue;
} else {
framecount++;
- DBG_LOGA("Decode MJPEG frame success\n");
+ DBG_LOGA("Decode MJPEG frame succeed\n");
}
} else {
ALOGE("Unable known sensor format: %d", vinfo->preview.format.fmt.pix.pixelformat);