diff options
author | Tyler Luu <tluu@ti.com> | 2012-06-21 11:01:09 -0500 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:03:35 +0200 |
commit | c143e22be6a85a75d247fea47c4aba577fb0002d (patch) | |
tree | 653dc6799473871ef682afe1686540a6b0166530 /camera | |
parent | 1ab75b00b552802f470fc9a7174af05212b90f4c (diff) | |
download | hardware_ti_omap4-c143e22be6a85a75d247fea47c4aba577fb0002d.zip hardware_ti_omap4-c143e22be6a85a75d247fea47c4aba577fb0002d.tar.gz hardware_ti_omap4-c143e22be6a85a75d247fea47c4aba577fb0002d.tar.bz2 |
CameraHal: Add support for matching tap in/out surface by name
- API has changed so applications need to specify the name of the tap
in/out surfaces they want to use for a particular shot/reprocess
call.
Depends on frameworks/av change I7c8c17cf:
http://review.omapzoom.org/#/c/28898/
Depends on hardware/libhardware change I859c6e87:
http://review.omapzoom.org/#/c/28141/
Change-Id: I785286be77970679f8d9cc8bfd9befe4a63191ac
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
Diffstat (limited to 'camera')
-rw-r--r-- | camera/BufferSourceAdapter.cpp | 13 | ||||
-rw-r--r-- | camera/CameraHal.cpp | 30 | ||||
-rw-r--r-- | camera/inc/BufferSourceAdapter.h | 1 | ||||
-rw-r--r-- | camera/inc/CameraHal.h | 5 |
4 files changed, 47 insertions, 2 deletions
diff --git a/camera/BufferSourceAdapter.cpp b/camera/BufferSourceAdapter.cpp index 3b0d480..214d4ed 100644 --- a/camera/BufferSourceAdapter.cpp +++ b/camera/BufferSourceAdapter.cpp @@ -210,6 +210,19 @@ int BufferSourceAdapter::setPreviewWindow(preview_stream_ops_t *source) return NO_ERROR; } +bool BufferSourceAdapter::match(const char * str) { + char id1[OP_STR_SIZE]; + status_t ret; + + ret = extendedOps()->get_id(mBufferSource, id1, sizeof(id1)); + + if (ret != 0) { + CAMHAL_LOGE("Surface::getId returned error %d", ret); + } + + return strcmp(id1, str) == 0; +} + int BufferSourceAdapter::setFrameProvider(FrameNotifier *frameProvider) { LOG_FUNCTION_NAME; diff --git a/camera/CameraHal.cpp b/camera/CameraHal.cpp index 00b8b13..3b8ee85 100644 --- a/camera/CameraHal.cpp +++ b/camera/CameraHal.cpp @@ -2985,7 +2985,7 @@ status_t CameraHal::__takePicture(const char *params) // check if camera application is using shots parameters // api. parameters set here override anything set using setParameters // TODO(XXX): Just going to use legacy TI parameters for now. Need - // add new APIs in CameraHal to utilize ShotParameters later, so + // add new APIs in CameraHal to utilize android::ShotParameters later, so // we don't have to parse through the whole set of parameters // in camera adapter if (strlen(params) > 0) { @@ -3025,6 +3025,14 @@ status_t CameraHal::__takePicture(const char *params) } } + valStr = shotParams.get(android::ShotParameters::KEY_CURRENT_TAP_OUT); + if (valStr != NULL) { + if(!mBufferSourceAdapter_Out->match(valStr)) { + CAMHAL_LOGE("Invalid tap out surface passed to camerahal"); + return BAD_VALUE; + } + } + mCameraAdapter->setParameters(mParameters); } else #endif @@ -3050,7 +3058,7 @@ status_t CameraHal::__takePicture(const char *params) if ( !mBracketingRunning ) { - // if application didn't set burst through ShotParameters + // if application didn't set burst through android::ShotParameters // then query from TICameraParameters if ((burst == -1) && (NO_ERROR == ret)) { burst = mParameters.getInt(TICameraParameters::KEY_BURST); @@ -3300,11 +3308,29 @@ status_t CameraHal::reprocess(const char *params) CameraAdapter::BuffersDescriptor desc; CameraBuffer *reprocBuffers = NULL; android::ShotParameters shotParams; + const char *valStr = NULL; android::AutoMutex lock(mLock); LOG_FUNCTION_NAME; + // 0. Get tap in surface + if (strlen(params) > 0) { + android::String8 shotParams8(params); + shotParams.unflatten(shotParams8); + } + + valStr = shotParams.get(android::ShotParameters::KEY_CURRENT_TAP_IN); + if (valStr != NULL) { + if(!mBufferSourceAdapter_In->match(valStr)) { + CAMHAL_LOGE("Invalid tap in surface passed to camerahal"); + return BAD_VALUE; + } + } else { + CAMHAL_LOGE("No tap in surface sent with shot config!"); + return BAD_VALUE; + } + // 1. Get buffers if (mBufferSourceAdapter_In.get()) { reprocBuffers = mBufferSourceAdapter_In->getBufferList(&bufferCount); diff --git a/camera/inc/BufferSourceAdapter.h b/camera/inc/BufferSourceAdapter.h index 89e9a22..7c16f5e 100644 --- a/camera/inc/BufferSourceAdapter.h +++ b/camera/inc/BufferSourceAdapter.h @@ -163,6 +163,7 @@ public: virtual int freeBufferList(CameraBuffer * buflist); virtual int maxQueueableBuffers(unsigned int& queueable); virtual int minUndequeueableBuffers(int& unqueueable); + virtual bool match(const char * str); static void frameCallback(CameraFrame* caFrame); void addFrame(CameraFrame* caFrame); diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h index 54fdeae..1b5466d 100644 --- a/camera/inc/CameraHal.h +++ b/camera/inc/CameraHal.h @@ -94,6 +94,8 @@ #define LOCK_BUFFER_TRIES 5 #define HAL_PIXEL_FORMAT_NV12 0x100 +#define OP_STR_SIZE 100 + #define NONNEG_ASSIGN(x,y) \ if(x > -1) \ y = x @@ -1030,6 +1032,9 @@ public: // Get min buffers display needs at any given time virtual status_t minUndequeueableBuffers(int& unqueueable) = 0; + // Given a vector of DisplayAdapters find the one corresponding to str + virtual bool match(const char * str) { return false; } + private: #ifdef OMAP_ENHANCEMENT preview_stream_extended_ops_t * mExtendedOps; |