From c073ba525404f3416c2824c435d3d926a9892f1b Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Tue, 26 Feb 2013 14:32:34 -0800 Subject: camera_client: refactor Camera/ProCamera commonalities into BasicCamera Change-Id: Ie10a4094522d49683657665fe94ab0b7ccd280e9 --- include/camera/Camera.h | 81 ++++++++++++------------------------------------- 1 file changed, 20 insertions(+), 61 deletions(-) (limited to 'include/camera/Camera.h') diff --git a/include/camera/Camera.h b/include/camera/Camera.h index be2b7f4..71c66ce 100644 --- a/include/camera/Camera.h +++ b/include/camera/Camera.h @@ -23,35 +23,13 @@ #include #include #include +#include +#include +#include namespace android { -struct CameraInfo { - /** - * The direction that the camera faces to. It should be CAMERA_FACING_BACK - * or CAMERA_FACING_FRONT. - */ - int facing; - - /** - * The orientation of the camera image. The value is the angle that the - * camera image needs to be rotated clockwise so it shows correctly on the - * display in its natural orientation. It should be 0, 90, 180, or 270. - * - * For example, suppose a device has a naturally tall screen. The - * back-facing camera sensor is mounted in landscape. You are looking at - * the screen. If the top side of the camera sensor is aligned with the - * right edge of the screen in natural orientation, the value should be - * 90. If the top side of a front-facing camera sensor is aligned with the - * right of the screen, the value should be 270. - */ - int orientation; -}; - -class ICameraService; -class ICamera; class Surface; -class Mutex; class String8; class String16; @@ -65,32 +43,37 @@ public: virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp& dataPtr) = 0; }; -class Camera : public BnCameraClient, public IBinder::DeathRecipient +class Camera; + +template <> +struct CameraTraits +{ + typedef CameraListener TCamListener; + typedef ICamera TCamUser; + typedef ICameraClient TCamCallbacks; +}; + +class Camera : + public CameraBase, + public BnCameraClient { public: enum { - USE_CALLING_UID = -1 + USE_CALLING_UID = ICameraService::USE_CALLING_UID }; // construct a camera client from an existing remote static sp create(const sp& camera); - static int32_t getNumberOfCameras(); - static status_t getCameraInfo(int cameraId, - struct CameraInfo* cameraInfo); static sp connect(int cameraId, const String16& clientPackageName, int clientUid); virtual ~Camera(); - void init(); status_t reconnect(); - void disconnect(); status_t lock(); status_t unlock(); - status_t getStatus() { return mStatus; } - // pass the buffered Surface to the camera service status_t setPreviewDisplay(const sp& surface); @@ -151,8 +134,6 @@ public: camera_frame_metadata_t *metadata); virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp& dataPtr); - sp remote(); - class RecordingProxy : public BnCameraRecordingProxy { public: @@ -168,35 +149,13 @@ public: }; protected: - Camera(); + Camera(int cameraId); Camera(const Camera&); Camera& operator=(const Camera); - virtual void binderDied(const wp& who); - - class DeathNotifier: public IBinder::DeathRecipient - { - public: - DeathNotifier() { - } - - virtual void binderDied(const wp& who); - }; - - static sp mDeathNotifier; - - // helper function to obtain camera service handle - static const sp& getCameraService(); - - sp mCamera; - status_t mStatus; - - sp mListener; - sp mRecordingProxyListener; - friend class DeathNotifier; + sp mRecordingProxyListener; - static Mutex mLock; - static sp mCameraService; + friend class CameraBase; }; }; // namespace android -- cgit v1.1