diff options
author | Vladimir Petrov <vppetrov@mm-sol.com> | 2012-08-16 19:13:03 +0300 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:05:28 +0200 |
commit | 04cb6b811376b5b956d2f9d2ba10f0729ce7ddca (patch) | |
tree | 757a2577f81985e4f1ff15f964b83e7af1093761 | |
parent | 602fb4e4e64f43577a5aff516a0e2d8bf400738f (diff) | |
download | hardware_ti_omap4-04cb6b811376b5b956d2f9d2ba10f0729ce7ddca.zip hardware_ti_omap4-04cb6b811376b5b956d2f9d2ba10f0729ce7ddca.tar.gz hardware_ti_omap4-04cb6b811376b5b956d2f9d2ba10f0729ce7ddca.tar.bz2 |
Camera_test: Add support to release tap in/outs
- Tell Camera hardware to release buffer sources
befor sestroying them.
Change-Id: I2a7e1c801516b14c9277a415d377131cc4443f6a
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
-rw-r--r-- | test/CameraHal/camera_test.h | 2 | ||||
-rw-r--r-- | test/CameraHal/camera_test_bufferqueue.h | 13 | ||||
-rw-r--r-- | test/CameraHal/camera_test_menu.cpp | 1 | ||||
-rw-r--r-- | test/CameraHal/camera_test_surfacetexture.h | 33 |
4 files changed, 25 insertions, 24 deletions
diff --git a/test/CameraHal/camera_test.h b/test/CameraHal/camera_test.h index f5d7faf..89e89ce 100644 --- a/test/CameraHal/camera_test.h +++ b/test/CameraHal/camera_test.h @@ -468,8 +468,6 @@ public: mTapOut.clear(); } - virtual void init() = 0; - virtual void setInput(buffer_info_t, const char *format, ShotParameters ¶ms); protected: diff --git a/test/CameraHal/camera_test_bufferqueue.h b/test/CameraHal/camera_test_bufferqueue.h index 8833535..f696f67 100644 --- a/test/CameraHal/camera_test_bufferqueue.h +++ b/test/CameraHal/camera_test_bufferqueue.h @@ -55,8 +55,10 @@ public: mFW = new FrameConsumer(); mBufferQueue->setSynchronousMode(true); mBufferQueue->consumerConnect(mFW); + mCamera->setBufferSource(NULL, mBufferQueue); } virtual ~BQ_BufferSourceThread() { + mCamera->releaseBufferSource(NULL, mBufferQueue); } virtual bool threadLoop() { @@ -97,7 +99,6 @@ public: } virtual void setBuffer(android::ShotParameters ¶ms) { - mCamera->setBufferSource(NULL, mBufferQueue); { String8 id = mBufferQueue->getId(); @@ -124,19 +125,17 @@ public: BQ_BufferSourceInput(int tex_id, sp<Camera> camera) : BufferSourceInput(camera), mTexId(tex_id) { mBufferQueue = new BufferQueue(true, 1); - } - virtual ~BQ_BufferSourceInput() { - } - - virtual void init() { sp<ISurfaceTexture> surfaceTexture = mBufferQueue; mWindowTapIn = new SurfaceTextureClient(surfaceTexture); + mCamera->setBufferSource(mBufferQueue, NULL); + } + virtual ~BQ_BufferSourceInput() { + mCamera->releaseBufferSource(mBufferQueue, NULL); } virtual void setInput(buffer_info_t bufinfo, const char *format, android::ShotParameters ¶ms) { mBufferQueue->setDefaultBufferSize(bufinfo.width, bufinfo.height); BufferSourceInput::setInput(bufinfo, format, params); - mCamera->setBufferSource(mBufferQueue, NULL); { String8 id = mBufferQueue->getId(); diff --git a/test/CameraHal/camera_test_menu.cpp b/test/CameraHal/camera_test_menu.cpp index b5f2293..5b44824 100644 --- a/test/CameraHal/camera_test_menu.cpp +++ b/test/CameraHal/camera_test_menu.cpp @@ -1262,7 +1262,6 @@ void createBufferInputSource() { #else bufferSourceInput = new ST_BufferSourceInput(1234, camera); #endif - bufferSourceInput->init(); } bufferSourceInputReset = false; } diff --git a/test/CameraHal/camera_test_surfacetexture.h b/test/CameraHal/camera_test_surfacetexture.h index 4be568e..fd125df 100644 --- a/test/CameraHal/camera_test_surfacetexture.h +++ b/test/CameraHal/camera_test_surfacetexture.h @@ -134,8 +134,14 @@ public: mSurfaceTexture->setSynchronousMode(true); mFW = new FrameWaiter(); mSurfaceTexture->setFrameAvailableListener(mFW); +#ifndef ANDROID_API_JB_OR_LATER + mCamera->setBufferSource(NULL, mSurfaceTexture); +#endif } virtual ~ST_BufferSourceThread() { +#ifndef ANDROID_API_JB_OR_LATER + mCamera->releaseBufferSource(NULL, mSurfaceTexture); +#endif mSurfaceTextureBase->deinit(); delete mSurfaceTextureBase; } @@ -167,9 +173,6 @@ public: } virtual void setBuffer(android::ShotParameters ¶ms) { -#ifndef ANDROID_API_JB_OR_LATER - mCamera->setBufferSource(NULL, mSurfaceTexture); -#endif { const char* id = NULL; @@ -194,29 +197,31 @@ public: ST_BufferSourceInput(int tex_id, sp<Camera> camera) : BufferSourceInput(camera), mTexId(tex_id) { mSurfaceTexture = new SurfaceTextureBase(); - } - virtual ~ST_BufferSourceInput() { - delete mSurfaceTexture; - } - - virtual void init() { sp<SurfaceTexture> surface_texture; mSurfaceTexture->initialize(mTexId); surface_texture = mSurfaceTexture->getST(); surface_texture->setSynchronousMode(true); mWindowTapIn = new SurfaceTextureClient(surface_texture); +#ifndef ANDROID_API_JB_OR_LATER + mCamera->setBufferSource(mSurfaceTexture->getST(), NULL); +#else + mCamera->setBufferSource(mSurfaceTexture->getST()->getBufferQueue(), NULL); +#endif + } + virtual ~ST_BufferSourceInput() { +#ifndef ANDROID_API_JB_OR_LATER + mCamera->releaseBufferSource(mSurfaceTexture->getST(), NULL); +#else + mCamera->releaseBufferSource(mSurfaceTexture->getST()->getBufferQueue(), NULL); +#endif + delete mSurfaceTexture; } virtual void setInput(buffer_info_t bufinfo, const char *format) { android::ShotParameters params; mSurfaceTexture->getST()->setDefaultBufferSize(bufinfo.width, bufinfo.height); BufferSourceInput::setInput(bufinfo, format, params); -#ifndef ANDROID_API_JB_OR_LATER - mCamera->setBufferSource(mSurfaceTexture->getST(), NULL); -#else - mCamera->setBufferSource(mSurfaceTexture->getST()->getBufferQueue(), NULL); -#endif } private: |