summaryrefslogtreecommitdiffstats
path: root/test/CameraHal/camera_test_surfacetexture.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/CameraHal/camera_test_surfacetexture.h')
-rw-r--r--test/CameraHal/camera_test_surfacetexture.h33
1 files changed, 19 insertions, 14 deletions
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 &params) {
-#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: