summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
Diffstat (limited to 'camera')
-rw-r--r--camera/Camera.cpp7
-rw-r--r--camera/ICameraService.cpp22
2 files changed, 29 insertions, 0 deletions
diff --git a/camera/Camera.cpp b/camera/Camera.cpp
index 2fbddd5..0037399 100644
--- a/camera/Camera.cpp
+++ b/camera/Camera.cpp
@@ -107,6 +107,13 @@ int32_t Camera::getNumberOfCameras()
return cs->getNumberOfCameras();
}
+status_t Camera::getCameraInfo(int cameraId,
+ struct CameraInfo* cameraInfo) {
+ const sp<ICameraService>& cs = getCameraService();
+ if (cs == 0) return UNKNOWN_ERROR;
+ return cs->getCameraInfo(cameraId, cameraInfo);
+}
+
sp<Camera> Camera::connect(int cameraId)
{
LOGV("connect");
diff --git a/camera/ICameraService.cpp b/camera/ICameraService.cpp
index db1dca6..85f1a29 100644
--- a/camera/ICameraService.cpp
+++ b/camera/ICameraService.cpp
@@ -43,6 +43,18 @@ public:
return reply.readInt32();
}
+ // get information about a camera
+ virtual status_t getCameraInfo(int cameraId,
+ struct CameraInfo* cameraInfo) {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICameraService::getInterfaceDescriptor());
+ data.writeInt32(cameraId);
+ remote()->transact(BnCameraService::GET_CAMERA_INFO, data, &reply);
+ cameraInfo->facing = reply.readInt32();
+ cameraInfo->orientation = reply.readInt32();
+ return reply.readInt32();
+ }
+
// connect to camera service
virtual sp<ICamera> connect(const sp<ICameraClient>& cameraClient, int cameraId)
{
@@ -68,6 +80,16 @@ status_t BnCameraService::onTransact(
reply->writeInt32(getNumberOfCameras());
return NO_ERROR;
} break;
+ case GET_CAMERA_INFO: {
+ CHECK_INTERFACE(ICameraService, data, reply);
+ CameraInfo cameraInfo;
+ memset(&cameraInfo, 0, sizeof(cameraInfo));
+ status_t result = getCameraInfo(data.readInt32(), &cameraInfo);
+ reply->writeInt32(cameraInfo.facing);
+ reply->writeInt32(cameraInfo.orientation);
+ reply->writeInt32(result);
+ return NO_ERROR;
+ } break;
case CONNECT: {
CHECK_INTERFACE(ICameraService, data, reply);
sp<ICameraClient> cameraClient = interface_cast<ICameraClient>(data.readStrongBinder());