diff options
-rw-r--r-- | camera/libcameraservice/Android.mk | 8 | ||||
-rw-r--r-- | camera/libcameraservice/CameraHardwareStub.cpp | 2 | ||||
-rw-r--r-- | camera/libcameraservice/CameraHardwareStub.h | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | camera/libcameraservice/CameraService.cpp | 24 | ||||
-rw-r--r-- | camera/libcameraservice/CameraService.h | 7 | ||||
-rw-r--r-- | include/camera/Camera.h | 3 | ||||
-rw-r--r-- | include/camera/CameraHardwareInterface.h | 17 | ||||
-rw-r--r-- | include/camera/ICamera.h | 10 | ||||
-rw-r--r-- | libs/camera/Android.mk | 4 | ||||
-rw-r--r-- | libs/camera/Camera.cpp | 18 | ||||
-rw-r--r-- | libs/camera/ICamera.cpp | 8 |
11 files changed, 66 insertions, 38 deletions
diff --git a/camera/libcameraservice/Android.mk b/camera/libcameraservice/Android.mk index 4430541..09494ea 100644 --- a/camera/libcameraservice/Android.mk +++ b/camera/libcameraservice/Android.mk @@ -31,6 +31,10 @@ endif LOCAL_SHARED_LIBRARIES:= libui +ifeq ($(BOARD_CAMERA_USE_GETBUFFERINFO),true) + LOCAL_CFLAGS += -DUSE_GETBUFFERINFO +endif + include $(BUILD_STATIC_LIBRARY) endif # USE_CAMERA_STUB @@ -71,5 +75,9 @@ else LOCAL_SHARED_LIBRARIES += libcamera endif +ifeq ($(BOARD_CAMERA_USE_GETBUFFERINFO),true) + LOCAL_CFLAGS += -DUSE_GETBUFFERINFO +endif + include $(BUILD_SHARED_LIBRARY) diff --git a/camera/libcameraservice/CameraHardwareStub.cpp b/camera/libcameraservice/CameraHardwareStub.cpp index db4f31a..b92870d 100644 --- a/camera/libcameraservice/CameraHardwareStub.cpp +++ b/camera/libcameraservice/CameraHardwareStub.cpp @@ -400,6 +400,7 @@ extern "C" sp<CameraHardwareInterface> openCameraHardware() return CameraHardwareStub::createInstance(); } +#ifdef USE_GETBUFFERINFO status_t CameraHardwareStub::getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) { /* No Support for this API in STUB Camera. Just return NULL */ Frame = NULL; @@ -408,4 +409,5 @@ status_t CameraHardwareStub::getBufferInfo(sp<IMemory>& Frame, size_t *alignedSi return UNKNOWN_ERROR; } +#endif }; // namespace android diff --git a/camera/libcameraservice/CameraHardwareStub.h b/camera/libcameraservice/CameraHardwareStub.h index 5794d5a..35266e6 100644 --- a/camera/libcameraservice/CameraHardwareStub.h +++ b/camera/libcameraservice/CameraHardwareStub.h @@ -60,8 +60,9 @@ public: virtual CameraParameters getParameters() const; virtual status_t sendCommand(int32_t command, int32_t arg1, int32_t arg2); +#ifdef USE_GETBUFFERINFO virtual status_t getBufferInfo( sp<IMemory>& Frame, size_t *alignedSize); - +#endif virtual void release(); static sp<CameraHardwareInterface> createInstance(); diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp index 43e92bc..d390466 100644..100755 --- a/camera/libcameraservice/CameraService.cpp +++ b/camera/libcameraservice/CameraService.cpp @@ -709,6 +709,19 @@ status_t CameraService::Client::startPreviewMode() return ret; } +#ifdef USE_GETBUFFERINFO +status_t CameraService::Client::getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) +{ + LOGD(" getBufferInfo : E"); + if (mHardware == NULL) { + LOGE("mHardware is NULL, returning."); + Frame = NULL; + return INVALID_OPERATION; + } + return mHardware->getBufferInfo(Frame, alignedSize); +} +#endif + status_t CameraService::Client::startPreview() { LOGV("startPreview (pid %d)", getCallingPid()); @@ -1478,15 +1491,4 @@ status_t CameraService::onTransact( return err; } -status_t CameraService::Client::getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) -{ - LOGD(" getBufferInfo : E"); - if (mHardware == NULL) { - LOGE("mHardware is NULL, returning."); - Frame = NULL; - return INVALID_OPERATION; - } - return mHardware->getBufferInfo(Frame, alignedSize); -} - }; // namespace android diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h index 2918b0e..7a04fb1 100644 --- a/camera/libcameraservice/CameraService.h +++ b/camera/libcameraservice/CameraService.h @@ -86,6 +86,10 @@ private: // preview are handled. virtual void setPreviewCallbackFlag(int callback_flag); +#ifdef USE_GETBUFFERINFO + // get the recording buffers information from HAL Layer. + virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize); +#endif // start preview mode, must call setPreviewDisplay first virtual status_t startPreview(); @@ -128,9 +132,6 @@ private: // our client... const sp<ICameraClient>& getCameraClient() const { return mCameraClient; } - // get the recording buffers information from HAL Layer. - virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize); - private: friend class CameraService; Client(const sp<CameraService>& cameraService, diff --git a/include/camera/Camera.h b/include/camera/Camera.h index f4a80b5..d565315 100644 --- a/include/camera/Camera.h +++ b/include/camera/Camera.h @@ -129,9 +129,10 @@ public: status_t setPreviewDisplay(const sp<Surface>& surface); status_t setPreviewDisplay(const sp<ISurface>& surface); +#ifdef USE_GETBUFFERINFO // query the recording buffer information from HAL layer. status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize); - +#endif // start preview mode, must call setPreviewDisplay first status_t startPreview(); diff --git a/include/camera/CameraHardwareInterface.h b/include/camera/CameraHardwareInterface.h index 54aad5b..7e19976 100644 --- a/include/camera/CameraHardwareInterface.h +++ b/include/camera/CameraHardwareInterface.h @@ -127,6 +127,15 @@ public: */ virtual status_t startPreview() = 0; +#ifdef USE_GETBUFFERINFO + /** + * Query the recording buffer information from HAL. + * This is needed because the opencore expects the buffer + * information before starting the recording. + */ + virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) = 0; +#endif + /** * Only used if overlays are used for camera preview. */ @@ -212,14 +221,6 @@ public: * Dump state of the camera hardware */ virtual status_t dump(int fd, const Vector<String16>& args) const = 0; - - /** - * Query the recording buffer information from HAL. - * This is needed because the opencore expects the buffer - * information before starting the recording. - */ - virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) = 0; - }; /** factory function to instantiate a camera hardware object */ diff --git a/include/camera/ICamera.h b/include/camera/ICamera.h index 7b3b8fb..d9c43bf 100644 --- a/include/camera/ICamera.h +++ b/include/camera/ICamera.h @@ -53,6 +53,11 @@ public: // preview are handled. virtual void setPreviewCallbackFlag(int flag) = 0; +#ifdef USE_GETBUFFERINFO + // get the recording buffer information from HAL layer. + virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) = 0; +#endif + // start preview mode, must call setPreviewDisplay first virtual status_t startPreview() = 0; @@ -66,7 +71,7 @@ public: virtual status_t startRecording() = 0; // stop recording mode - virtual void stopRecording() = 0; + virtual void stopRecording() = 0; // get recording state virtual bool recordingEnabled() = 0; @@ -91,9 +96,6 @@ public: // send command to camera driver virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0; - - // get the recording buffer information from HAL layer. - virtual status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) = 0; }; // ---------------------------------------------------------------------------- diff --git a/libs/camera/Android.mk b/libs/camera/Android.mk index 3691bde..1e6c6e0 100644 --- a/libs/camera/Android.mk +++ b/libs/camera/Android.mk @@ -10,6 +10,10 @@ LOCAL_SRC_FILES:= \ LOCAL_MODULE:= libcamera_client +ifeq ($(BOARD_CAMERA_USE_GETBUFFERINFO),true) + LOCAL_CFLAGS += -DUSE_GETBUFFERINFO +endif + ifneq ($(BOARD_USES_ECLAIR_LIBCAMERA),true) LOCAL_SHARED_LIBRARIES := \ diff --git a/libs/camera/Camera.cpp b/libs/camera/Camera.cpp index d289a8d..913acd6 100644 --- a/libs/camera/Camera.cpp +++ b/libs/camera/Camera.cpp @@ -175,6 +175,16 @@ status_t Camera::setPreviewDisplay(const sp<ISurface>& surface) return c->setPreviewDisplay(surface); } +#ifdef USE_GETBUFFERINFO +status_t Camera::getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) +{ + LOGV("getBufferInfo"); + sp <ICamera> c = mCamera; + if (c == 0) return NO_INIT; + return c->getBufferInfo(Frame, alignedSize); +} +#endif + // start preview mode status_t Camera::startPreview() { @@ -356,13 +366,5 @@ void Camera::DeathNotifier::binderDied(const wp<IBinder>& who) { LOGW("Camera server died!"); } -status_t Camera::getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) -{ - LOGV("getBufferInfo"); - sp <ICamera> c = mCamera; - if (c == 0) return NO_INIT; - return c->getBufferInfo(Frame, alignedSize); -} - }; // namespace android diff --git a/libs/camera/ICamera.cpp b/libs/camera/ICamera.cpp index 48ba361..451be45 100644 --- a/libs/camera/ICamera.cpp +++ b/libs/camera/ICamera.cpp @@ -46,7 +46,9 @@ enum { STOP_RECORDING, RECORDING_ENABLED, RELEASE_RECORDING_FRAME, +#ifdef USE_GETBUFFERINFO GET_BUFFER_INFO, +#endif }; class BpCamera: public BpInterface<ICamera> @@ -88,7 +90,7 @@ public: remote()->transact(SET_PREVIEW_CALLBACK_FLAG, data, &reply); } - +#ifdef USE_GETBUFFERINFO // get the recording buffer information. status_t getBufferInfo(sp<IMemory>& Frame, size_t *alignedSize) { @@ -102,7 +104,7 @@ public: *alignedSize = reply.readInt32(); return ret; } - +#endif // start preview mode, must call setPreviewDisplay first status_t startPreview() @@ -287,6 +289,7 @@ status_t BnCamera::onTransact( setPreviewCallbackFlag(callback_flag); return NO_ERROR; } break; +#ifdef USE_GETBUFFERINFO case GET_BUFFER_INFO:{ LOGV("GET_BUFFER_INFO"); CHECK_INTERFACE(ICamera, data, reply); @@ -296,6 +299,7 @@ status_t BnCamera::onTransact( reply->writeInt32(alignedSize); return NO_ERROR; } break; +#endif case START_PREVIEW: { LOGV("START_PREVIEW"); CHECK_INTERFACE(ICamera, data, reply); |