author | Yuxi Sun <yuxi.sun@amlogic.com> | 2015-01-07 08:54:42 (GMT) |
---|---|---|
committer | Yuxi Sun <yuxi.sun@amlogic.com> | 2015-01-08 05:36:30 (GMT) |
commit | adfc8ee6e191f61a4d744513490fb6de30fb933c (patch) | |
tree | a27bcd90f6fcc5d50335aa7d124a7f3398767c6c | |
parent | 0efc0db663ea63f39e19d1ed37bc11921f3d0de2 (diff) | |
download | camera-adfc8ee6e191f61a4d744513490fb6de30fb933c.zip camera-adfc8ee6e191f61a4d744513490fb6de30fb933c.tar.gz camera-adfc8ee6e191f61a4d744513490fb6de30fb933c.tar.bz2 |
Set default USB camera orientation
Set default USB camera orientation to 0 to facilitate mbox.
Add mSensorType to record senor type in EmulatedFakeCamera3
Change-Id: I531f12e6e2512e41e7f3e2872c1b3960a3689d45
Signed-off-by: Yuxi Sun <yuxi.sun@amlogic.com>
-rwxr-xr-x | v3/EmulatedFakeCamera3.cpp | 54 | ||||
-rwxr-xr-x | v3/EmulatedFakeCamera3.h | 2 |
2 files changed, 29 insertions, 27 deletions
diff --git a/v3/EmulatedFakeCamera3.cpp b/v3/EmulatedFakeCamera3.cpp index 564e1e3..4937c2c 100755 --- a/v3/EmulatedFakeCamera3.cpp +++ b/v3/EmulatedFakeCamera3.cpp @@ -354,24 +354,24 @@ status_t EmulatedFakeCamera3::closeCamera() { status_t EmulatedFakeCamera3::getCameraInfo(struct camera_info *info) { char property[PROPERTY_VALUE_MAX]; info->facing = mFacingBack ? CAMERA_FACING_BACK : CAMERA_FACING_FRONT; - if (mSupportCap & IOCTL_MASK_ROTATE) { + if (mSensorType == SENSOR_USB) { if (mFacingBack) { - property_get("rw.camera.orientation.back", property, "270"); + property_get("hw.camera.orientation.back", property, "0"); } else { - property_get("rw.camera.orientation.front", property, "90"); - } - info->orientation = atoi(property); - } else { - if (mFacingBack) { - property_get("rw.camera.orientation.back", property, "270"); - } else { - property_get("rw.camera.orientation.front", property, "90"); + property_get("hw.camera.orientation.front", property, "0"); } int32_t orientation = atoi(property); - property_get("rw.camera.usb.orientation_offset", property, "0"); + property_get("hw.camera.usb.orientation_offset", property, "0"); orientation += atoi(property); orientation %= 360; info->orientation = orientation ; + } else { + if (mFacingBack) { + property_get("hw.camera.orientation.back", property, "270"); + } else { + property_get("hw.camera.orientation.front", property, "90"); + } + info->orientation = atoi(property); } return EmulatedCamera3::getCameraInfo(info); } @@ -1572,8 +1572,9 @@ status_t EmulatedFakeCamera3::constructStaticInfo() { memset(mAvailableJpegSize,0,(sizeof(uint32_t))*availablejpegsize); sp<Sensor> s = new Sensor(); s->startUp(mCameraID); + mSensorType = s->getSensorType(); - if (s->getSensorType() == SENSOR_USB) { + if ( mSensorType == SENSOR_USB) { char property[PROPERTY_VALUE_MAX]; property_get("rw.camera.usb.faceback", property, "false"); if (strstr(property, "true")) @@ -1701,28 +1702,27 @@ status_t EmulatedFakeCamera3::constructStaticInfo() { static const uint8_t timestampSource = ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN; info.update(ANDROID_SENSOR_INFO_TIMESTAMP_SOURCE, ×tampSource, 1); - if (supportrotate) { + if (mSensorType == SENSOR_USB) { if (mFacingBack) { - property_get("rw.camera.orientation.back", property, "0"); - const int32_t orientation = atoi(property); - info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1); + property_get("hw.camera.orientation.back", property, "0"); } else { - property_get("rw.camera.orientation.front", property, "90"); - const int32_t orientation = atoi(property); - info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1); - } - - } else if (s->getSensorType() == SENSOR_USB) { - if (mFacingBack) { - property_get("rw.camera.orientation.back", property, "0"); - } else { - property_get("rw.camera.orientation.front", property, "90"); + property_get("hw.camera.orientation.front", property, "0"); } int32_t orientation = atoi(property); - property_get("rw.camera.usb.orientation_offset", property, "0"); + property_get("hw.camera.usb.orientation_offset", property, "0"); orientation += atoi(property); orientation %= 360; info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1); + } else { + if (mFacingBack) { + property_get("hw.camera.orientation.back", property, "270"); + const int32_t orientation = atoi(property); + info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1); + } else { + property_get("hw.camera.orientation.front", property, "90"); + const int32_t orientation = atoi(property); + info.update(ANDROID_SENSOR_ORIENTATION, &orientation, 1); + } } static const int64_t rollingShutterSkew = 0; diff --git a/v3/EmulatedFakeCamera3.h b/v3/EmulatedFakeCamera3.h index a78d53c..7052200 100755 --- a/v3/EmulatedFakeCamera3.h +++ b/v3/EmulatedFakeCamera3.h @@ -211,6 +211,8 @@ private: /* Full mode (true) or limited mode (false) switch */ bool mFullMode; + enum sensor_type_e mSensorType; + /** * Cache for default templates. Once one is requested, the pointer must be * valid at least until close() is called on the device |