diff options
author | Iliyan Malchev <malchev@google.com> | 2011-03-28 16:10:12 -0700 |
---|---|---|
committer | Iliyan Malchev <malchev@google.com> | 2011-03-28 16:28:57 -0700 |
commit | 108dddf924d714c811dd565b8f4c7a0178cca2f2 (patch) | |
tree | 84d71d367dfb079a12738ca5f6c3edc4bd13aab1 | |
parent | b1d3d37c7990d22d0659e4c8c9aac56d4c09b6ea (diff) | |
download | frameworks_av-108dddf924d714c811dd565b8f4c7a0178cca2f2.zip frameworks_av-108dddf924d714c811dd565b8f4c7a0178cca2f2.tar.gz frameworks_av-108dddf924d714c811dd565b8f4c7a0178cca2f2.tar.bz2 |
frameworks/base: some camera-interface cleanup
Methods getNumberOfVideoBuffers() and getVideoBuffer() as well as struct
image_rect_struct are no longer used (instead, the necessary information is
passed through ANativeWindow.)
Change-Id: If4b11446fc9ccbde1f6b45bc70c0d0b8e54376eb
Signed-off-by: Iliyan Malchev <malchev@google.com>
-rw-r--r-- | camera/Camera.cpp | 16 | ||||
-rw-r--r-- | camera/ICamera.cpp | 36 | ||||
-rw-r--r-- | include/camera/Camera.h | 6 | ||||
-rw-r--r-- | include/camera/CameraHardwareInterface.h | 54 | ||||
-rw-r--r-- | include/camera/ICamera.h | 6 | ||||
-rw-r--r-- | include/media/stagefright/CameraSource.h | 28 | ||||
-rw-r--r-- | media/libstagefright/CameraSource.cpp | 22 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 20 | ||||
-rw-r--r-- | services/camera/libcameraservice/CameraService.h | 4 |
9 files changed, 3 insertions, 189 deletions
diff --git a/camera/Camera.cpp b/camera/Camera.cpp index e288312..5eb48da 100644 --- a/camera/Camera.cpp +++ b/camera/Camera.cpp @@ -205,22 +205,6 @@ status_t Camera::startPreview() return c->startPreview(); } -int32_t Camera::getNumberOfVideoBuffers() const -{ - LOGV("getNumberOfVideoBuffers"); - sp <ICamera> c = mCamera; - if (c == 0) return 0; - return c->getNumberOfVideoBuffers(); -} - -sp<IMemory> Camera::getVideoBuffer(int32_t index) const -{ - LOGV("getVideoBuffer: %d", index); - sp <ICamera> c = mCamera; - if (c == 0) return 0; - return c->getVideoBuffer(index); -} - status_t Camera::storeMetaDataInBuffers(bool enabled) { LOGV("storeMetaDataInBuffers: %s", diff --git a/camera/ICamera.cpp b/camera/ICamera.cpp index 931b57d..5f6e5ef 100644 --- a/camera/ICamera.cpp +++ b/camera/ICamera.cpp @@ -46,8 +46,6 @@ enum { STOP_RECORDING, RECORDING_ENABLED, RELEASE_RECORDING_FRAME, - GET_NUM_VIDEO_BUFFERS, - GET_VIDEO_BUFFER, STORE_META_DATA_IN_BUFFERS, }; @@ -149,27 +147,6 @@ public: remote()->transact(RELEASE_RECORDING_FRAME, data, &reply); } - int32_t getNumberOfVideoBuffers() const - { - LOGV("getNumberOfVideoBuffers"); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - remote()->transact(GET_NUM_VIDEO_BUFFERS, data, &reply); - return reply.readInt32(); - } - - sp<IMemory> getVideoBuffer(int32_t index) const - { - LOGV("getVideoBuffer: %d", index); - Parcel data, reply; - data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); - data.writeInt32(index); - remote()->transact(GET_VIDEO_BUFFER, data, &reply); - sp<IMemory> mem = interface_cast<IMemory>( - reply.readStrongBinder()); - return mem; - } - status_t storeMetaDataInBuffers(bool enabled) { LOGV("storeMetaDataInBuffers: %s", enabled? "true": "false"); @@ -355,19 +332,6 @@ status_t BnCamera::onTransact( releaseRecordingFrame(mem); return NO_ERROR; } break; - case GET_NUM_VIDEO_BUFFERS: { - LOGV("GET_NUM_VIDEO_BUFFERS"); - CHECK_INTERFACE(ICamera, data, reply); - reply->writeInt32(getNumberOfVideoBuffers()); - return NO_ERROR; - } break; - case GET_VIDEO_BUFFER: { - LOGV("GET_VIDEO_BUFFER"); - CHECK_INTERFACE(ICamera, data, reply); - int32_t index = data.readInt32(); - reply->writeStrongBinder(getVideoBuffer(index)->asBinder()); - return NO_ERROR; - } break; case STORE_META_DATA_IN_BUFFERS: { LOGV("STORE_META_DATA_IN_BUFFERS"); CHECK_INTERFACE(ICamera, data, reply); diff --git a/include/camera/Camera.h b/include/camera/Camera.h index f3c8f64..3c6dccc 100644 --- a/include/camera/Camera.h +++ b/include/camera/Camera.h @@ -219,12 +219,6 @@ public: // send command to camera driver status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2); - // return the total number of available video buffers. - int32_t getNumberOfVideoBuffers() const; - - // return the individual video buffer corresponding to the given index. - sp<IMemory> getVideoBuffer(int32_t index) const; - // tell camera hal to store meta data or real YUV in video buffers. status_t storeMetaDataInBuffers(bool enabled); diff --git a/include/camera/CameraHardwareInterface.h b/include/camera/CameraHardwareInterface.h index 86bd849..3f34120 100644 --- a/include/camera/CameraHardwareInterface.h +++ b/include/camera/CameraHardwareInterface.h @@ -28,16 +28,6 @@ namespace android { -/** - * The size of image for display. - */ -typedef struct image_rect_struct -{ - uint32_t width; /* Image width */ - uint32_t height; /* Image height */ -} image_rect_type; - - typedef void (*notify_callback)(int32_t msgType, int32_t ext1, int32_t ext2, @@ -90,9 +80,6 @@ public: /** Set the ANativeWindow to which preview frames are sent */ virtual status_t setPreviewWindow(const sp<ANativeWindow>& buf) = 0; - /** Return the IMemoryHeap for the raw image heap */ - virtual sp<IMemoryHeap> getRawHeap() const = 0; - /** Set the notification and data callbacks */ virtual void setCallbacks(notify_callback notify_cb, data_callback data_cb, @@ -145,47 +132,6 @@ public: virtual bool previewEnabled() = 0; /** - * Retrieve the total number of available buffers from camera hal for passing - * video frame data in a recording session. Must be called again if a new - * recording session is started. - * - * This method should be called after startRecording(), since - * the some camera hal may choose to allocate the video buffers only after - * recording is started. - * - * Some camera hal may not implement this method, and 0 can be returned to - * indicate that this feature is not available. - * - * @return the number of video buffers that camera hal makes available. - * Zero (0) is returned to indicate that camera hal does not support - * this feature. - */ - virtual int32_t getNumberOfVideoBuffers() const { return 0; } - - /** - * Retrieve the video buffer corresponding to the given index in a - * recording session. Must be called again if a new recording session - * is started. - * - * It allows a client to retrieve all video buffers that camera hal makes - * available to passing video frame data by calling this method with all - * valid index values. The valid index value ranges from 0 to n, where - * n = getNumberOfVideoBuffers() - 1. With an index outside of the valid - * range, 0 must be returned. This method should be called after - * startRecording(). - * - * The video buffers should NOT be modified/released by camera hal - * until stopRecording() is called and all outstanding video buffers - * previously sent out via CAMERA_MSG_VIDEO_FRAME have been released - * via releaseVideoBuffer(). - * - * @param index an index to retrieve the corresponding video buffer. - * - * @return the video buffer corresponding to the given index. - */ - virtual sp<IMemory> getVideoBuffer(int32_t index) const { return 0; } - - /** * Request the camera hal to store meta data or real YUV data in * the video buffers send out via CAMERA_MSG_VIDEO_FRRAME for a * recording session. If it is not called, the default camera diff --git a/include/camera/ICamera.h b/include/camera/ICamera.h index 2344b3f..400d7f4 100644 --- a/include/camera/ICamera.h +++ b/include/camera/ICamera.h @@ -102,12 +102,6 @@ public: // send command to camera driver virtual status_t sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) = 0; - // return the total number of available video buffers - virtual int32_t getNumberOfVideoBuffers() const = 0; - - // return the individual video buffer corresponding to the given index. - virtual sp<IMemory> getVideoBuffer(int32_t index) const = 0; - // tell the camera hal to store meta data or real YUV data in video buffers. virtual status_t storeMetaDataInBuffers(bool enabled) = 0; }; diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h index 4a39fbf..bb25bae 100644 --- a/include/media/stagefright/CameraSource.h +++ b/include/media/stagefright/CameraSource.h @@ -99,34 +99,6 @@ public: virtual sp<MetaData> getFormat(); /** - * Retrieve the total number of video buffers available from - * this source. - * - * This method is useful if these video buffers are used - * for passing video frame data to other media components, - * such as OMX video encoders, in order to eliminate the - * memcpy of the data. - * - * @return the total numbner of video buffers. Returns 0 to - * indicate that this source does not make the video - * buffer information availalble. - */ - size_t getNumberOfVideoBuffers() const; - - /** - * Retrieve the individual video buffer available from - * this source. - * - * @param index the index corresponding to the video buffer. - * Valid range of the index is [0, n], where n = - * getNumberOfVideoBuffers() - 1. - * - * @return the video buffer corresponding to the given index. - * If index is out of range, 0 should be returned. - */ - sp<IMemory> getVideoBuffer(size_t index) const; - - /** * Tell whether this camera source stores meta data or real YUV * frame data in video buffers. * diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index 8a24bc4..a1f04d3 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -740,28 +740,6 @@ void CameraSource::dataCallbackTimestamp(int64_t timestampUs, mFrameAvailableCondition.signal(); } -size_t CameraSource::getNumberOfVideoBuffers() const { - LOGV("getNumberOfVideoBuffers"); - size_t nBuffers = 0; - int64_t token = IPCThreadState::self()->clearCallingIdentity(); - if (mInitCheck == OK && mCamera != 0) { - nBuffers = mCamera->getNumberOfVideoBuffers(); - } - IPCThreadState::self()->restoreCallingIdentity(token); - return nBuffers; -} - -sp<IMemory> CameraSource::getVideoBuffer(size_t index) const { - LOGV("getVideoBuffer: %d", index); - sp<IMemory> buffer = 0; - int64_t token = IPCThreadState::self()->clearCallingIdentity(); - if (mInitCheck == OK && mCamera != 0) { - buffer = mCamera->getVideoBuffer(index); - } - IPCThreadState::self()->restoreCallingIdentity(token); - return buffer; -} - bool CameraSource::isMetaDataStoredInVideoBuffers() const { LOGV("isMetaDataStoredInVideoBuffers"); return mIsMetaDataStoredInVideoBuffers; diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index a09e16b..f3c9959 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -666,20 +666,6 @@ void CameraService::Client::releaseRecordingFrame(const sp<IMemory>& mem) { mHardware->releaseRecordingFrame(mem); } -int32_t CameraService::Client::getNumberOfVideoBuffers() const { - LOG1("getNumberOfVideoBuffers"); - Mutex::Autolock lock(mLock); - if (checkPidAndHardware() != NO_ERROR) return 0; - return mHardware->getNumberOfVideoBuffers(); -} - -sp<IMemory> CameraService::Client::getVideoBuffer(int32_t index) const { - LOG1("getVideoBuffer: %d", index); - Mutex::Autolock lock(mLock); - if (checkPidAndHardware() != NO_ERROR) return 0; - return mHardware->getVideoBuffer(index); -} - status_t CameraService::Client::storeMetaDataInBuffers(bool enabled) { LOG1("storeMetaDataInBuffers: %s", enabled? "true": "false"); @@ -938,7 +924,7 @@ void CameraService::Client::notifyCallback(int32_t msgType, int32_t ext1, switch (msgType) { case CAMERA_MSG_SHUTTER: // ext1 is the dimension of the yuv picture. - client->handleShutter((image_rect_type *)ext1); + client->handleShutter(); break; default: client->handleGenericNotify(msgType, ext1, ext2); @@ -997,9 +983,7 @@ void CameraService::Client::dataCallbackTimestamp(nsecs_t timestamp, } // snapshot taken callback -// "size" is the width and height of yuv picture for registerBuffer. -// If it is NULL, use the picture size from parameters. -void CameraService::Client::handleShutter(image_rect_type *size) { +void CameraService::Client::handleShutter(void) { if (mPlayShutterSound) { mCameraService->playSound(SOUND_SHUTTER); } diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h index 1c43b00..28e8cc0 100644 --- a/services/camera/libcameraservice/CameraService.h +++ b/services/camera/libcameraservice/CameraService.h @@ -99,8 +99,6 @@ private: virtual status_t startPreview(); virtual void stopPreview(); virtual bool previewEnabled(); - virtual int32_t getNumberOfVideoBuffers() const; - virtual sp<IMemory> getVideoBuffer(int32_t index) const; virtual status_t storeMetaDataInBuffers(bool enabled); virtual status_t startRecording(); virtual void stopRecording(); @@ -152,7 +150,7 @@ private: // convert client from cookie static sp<Client> getClientFromCookie(void* user); // handlers for messages - void handleShutter(image_rect_type *size); + void handleShutter(void); void handlePreviewData(const sp<IMemory>& mem); void handlePostview(const sp<IMemory>& mem); void handleRawPicture(const sp<IMemory>& mem); |