diff options
author | Andriy Chepurnyy <x0155536@ti.com> | 2012-10-19 12:48:35 +0300 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:17:15 +0200 |
commit | 143c25c0f2ec3f84be5fe1c9aa85e0006a19707f (patch) | |
tree | 5daf441ce137296953c8e03700677efc32b93d43 /camera | |
parent | 1e610a23c8797a3ae0e933bd2a54b99e742badf9 (diff) | |
download | hardware_ti_omap4-143c25c0f2ec3f84be5fe1c9aa85e0006a19707f.zip hardware_ti_omap4-143c25c0f2ec3f84be5fe1c9aa85e0006a19707f.tar.gz hardware_ti_omap4-143c25c0f2ec3f84be5fe1c9aa85e0006a19707f.tar.bz2 |
CameraHAL: Synchronize public interface of V4LCameraAdapter.
Synchronize public interface of V4LCameraAdapter.
Change-Id: I5670151a69a58cd7db4e2eda401b3aac7bef18cb
Diffstat (limited to 'camera')
-rwxr-xr-x | camera/V4LCameraAdapter/V4LCameraAdapter.cpp | 27 | ||||
-rwxr-xr-x | camera/inc/V4LCameraAdapter/V4LCameraAdapter.h | 6 |
2 files changed, 25 insertions, 8 deletions
diff --git a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp index 7b29b31..e22d33b 100755 --- a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp +++ b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp @@ -293,6 +293,9 @@ status_t V4LCameraAdapter::initialize(CameraProperties::Properties* caps) char value[PROPERTY_VALUE_MAX]; LOG_FUNCTION_NAME; + + android::AutoMutex lock(mLock); + property_get("debug.camera.showfps", value, "0"); mDebugFps = atoi(value); @@ -346,11 +349,15 @@ status_t V4LCameraAdapter::fillThisBuffer(CameraBuffer *frameBuf, CameraFrame::F int idx = 0; LOG_FUNCTION_NAME; + android::AutoMutex lock(mLock); + if ( frameType == CameraFrame::IMAGE_FRAME) { //(1 > mCapturedFrames) // Signal end of image capture if ( NULL != mEndImageCaptureCallback) { CAMHAL_LOGDB("===========Signal End Image Capture=========="); + mLock.unlock(); mEndImageCaptureCallback(mEndCaptureData); + mLock.lock(); } goto EXIT; } @@ -416,6 +423,8 @@ status_t V4LCameraAdapter::setParameters(const android::CameraParameters ¶ms LOG_FUNCTION_NAME; + android::AutoMutex lock(mLock); + if(!mPreviewing && !mCapturing) { params.getPreviewSize(&width, &height); CAMHAL_LOGDB("Width * Height %d x %d format 0x%x", width, height, DEFAULT_PIXEL_FORMAT); @@ -447,6 +456,7 @@ void V4LCameraAdapter::getParameters(android::CameraParameters& params) { LOG_FUNCTION_NAME; + android::AutoMutex lock(mLock); // Return the current parameter set params = mParams; @@ -565,7 +575,7 @@ status_t V4LCameraAdapter::takePicture() { LOG_FUNCTION_NAME; - android::AutoMutex lock(mCaptureBufsLock); + android::AutoMutex lock(mLock); if(mCapturing) { CAMHAL_LOGEA("Already Capture in Progress..."); @@ -695,6 +705,8 @@ status_t V4LCameraAdapter::stopImageCapture() status_t ret = NO_ERROR; LOG_FUNCTION_NAME; + android::AutoMutex lock(mLock); + //Release image buffers if ( NULL != mReleaseImageBuffersCallback ) { mReleaseImageBuffersCallback(mReleaseData); @@ -722,7 +734,8 @@ status_t V4LCameraAdapter::startPreview() status_t ret = NO_ERROR; LOG_FUNCTION_NAME; - android::AutoMutex lock(mPreviewBufsLock); + + android::AutoMutex lock(mLock); if(mPreviewing) { ret = BAD_VALUE; @@ -767,7 +780,8 @@ status_t V4LCameraAdapter::stopPreview() int ret = NO_ERROR; LOG_FUNCTION_NAME; - android::AutoMutex lock(mStopPreviewLock); + + android::AutoMutex lock(mLock); if(!mPreviewing) { return NO_INIT; @@ -834,6 +848,8 @@ status_t V4LCameraAdapter::getFrameSize(size_t &width, size_t &height) status_t ret = NO_ERROR; LOG_FUNCTION_NAME; + android::AutoMutex lock(mLock); + // Just return the current preview size, nothing more to do here. mParams.getPreviewSize(( int * ) &width, ( int * ) &height); @@ -845,6 +861,7 @@ status_t V4LCameraAdapter::getFrameSize(size_t &width, size_t &height) status_t V4LCameraAdapter::getFrameDataSize(size_t &dataFrameSize, size_t bufferCount) { + android::AutoMutex lock(mLock); // We don't support meta data, so simply return return NO_ERROR; } @@ -857,6 +874,8 @@ status_t V4LCameraAdapter::getPictureBufferSize(CameraFrame &frame, size_t buffe LOG_FUNCTION_NAME; + android::AutoMutex lock(mLock); + mParams.getPictureSize( &width, &height ); frame.mLength = width * height * bytesPerPixel; frame.mWidth = width; @@ -923,6 +942,8 @@ void V4LCameraAdapter::onOrientationEvent(uint32_t orientation, uint32_t tilt) { LOG_FUNCTION_NAME; + android::AutoMutex lock(mLock); + LOG_FUNCTION_NAME_EXIT; } diff --git a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h index ace19e5..d1bc015 100755 --- a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h +++ b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h @@ -199,22 +199,18 @@ private: status_t restartPreview(); status_t applyFpsValue(); - int mPreviewBufferCount; int mPreviewBufferCountQueueable; int mCaptureBufferCount; int mCaptureBufferCountQueueable; CameraBuffer *mPreviewBufs[NB_BUFFER]; android::KeyedVector<CameraBuffer *, int> mCaptureBufs; - mutable android::Mutex mPreviewBufsLock; - mutable android::Mutex mCaptureBufsLock; - mutable android::Mutex mStopPreviewLock; android::CameraParameters mParams; bool mPreviewing; bool mCapturing; - android::Mutex mLock; + mutable android::Mutex mLock; int mFrameCount; int mLastFrameCount; |