summaryrefslogtreecommitdiffstats
path: root/test/CameraHal
diff options
context:
space:
mode:
authorDaniel Levin <dendy@ti.com>2012-10-16 19:17:54 +0300
committerDaniel Levin <dendy@ti.com>2012-11-22 16:11:53 +0200
commitad76a7189cf1777b873f9f3a45705dac67e5e589 (patch)
tree14b8f73c6ae9e527b811f107ceebee3e296cd23a /test/CameraHal
parente1fbcc3c33dddd8392895a2ac694d0eeb2d68d8f (diff)
downloadhardware_ti_omap4-ad76a7189cf1777b873f9f3a45705dac67e5e589.zip
hardware_ti_omap4-ad76a7189cf1777b873f9f3a45705dac67e5e589.tar.gz
hardware_ti_omap4-ad76a7189cf1777b873f9f3a45705dac67e5e589.tar.bz2
Camera: Fix the camera_test code for new ANW API
Source compatibility with JB MR0 ANW API is preserved by using the ANDROID_API_JB_MR1_OR_LATER conditional build. Change-Id: Ic67af4cf31a058e3cbddafb44b5c33fd8ab9d348 Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'test/CameraHal')
-rw-r--r--test/CameraHal/camera_test_bufferqueue.h14
-rw-r--r--test/CameraHal/camera_test_menu.cpp9
-rw-r--r--test/CameraHal/camera_test_surfacetexture.cpp15
-rw-r--r--test/CameraHal/surfacetexture_test.cpp4
4 files changed, 39 insertions, 3 deletions
diff --git a/test/CameraHal/camera_test_bufferqueue.h b/test/CameraHal/camera_test_bufferqueue.h
index 68b9b34..c81b1ee 100644
--- a/test/CameraHal/camera_test_bufferqueue.h
+++ b/test/CameraHal/camera_test_bufferqueue.h
@@ -51,7 +51,12 @@ public:
class BQ_BufferSourceThread : public BufferSourceThread {
public:
BQ_BufferSourceThread(int tex_id, sp<Camera> camera) : BufferSourceThread(camera) {
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mBufferQueue = new BufferQueue(true);
+ mBufferQueue->setMaxAcquiredBufferCount(1);
+#else
mBufferQueue = new BufferQueue(true, 1);
+#endif
mFW = new FrameConsumer();
mBufferQueue->setSynchronousMode(true);
mBufferQueue->consumerConnect(mFW);
@@ -101,7 +106,11 @@ public:
}
virtual void onHandled(sp<GraphicBuffer> &gbuf, unsigned int slot) {
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mBufferQueue->releaseBuffer(slot, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, Fence::NO_FENCE);
+#else
mBufferQueue->releaseBuffer(slot, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR);
+#endif
}
private:
@@ -114,7 +123,12 @@ class BQ_BufferSourceInput : public BufferSourceInput {
public:
BQ_BufferSourceInput(int tex_id, sp<Camera> camera) :
BufferSourceInput(camera), mTexId(tex_id) {
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mBufferQueue = new BufferQueue(true);
+ mBufferQueue->setMaxAcquiredBufferCount(1);
+#else
mBufferQueue = new BufferQueue(true, 1);
+#endif
}
virtual ~BQ_BufferSourceInput() {
}
diff --git a/test/CameraHal/camera_test_menu.cpp b/test/CameraHal/camera_test_menu.cpp
index da8732f..06030a1 100644
--- a/test/CameraHal/camera_test_menu.cpp
+++ b/test/CameraHal/camera_test_menu.cpp
@@ -879,10 +879,13 @@ int createPreviewSurface(unsigned int width, unsigned int height, int32_t pixFor
return -1;
}
+#ifdef ANDROID_API_JB_MR1_OR_LATER
surfaceControl = client->createSurface(String8("camera_test_menu"),
- previewWidth,
- previewHeight,
- pixFormat, 0);
+ previewWidth, previewHeight, pixFormat, 0);
+#else
+ surfaceControl = client->createSurface(0,
+ previewWidth, previewHeight, pixFormat, 0);
+#endif
previewSurface = surfaceControl->getSurface();
diff --git a/test/CameraHal/camera_test_surfacetexture.cpp b/test/CameraHal/camera_test_surfacetexture.cpp
index 4f1066a..1108caf 100644
--- a/test/CameraHal/camera_test_surfacetexture.cpp
+++ b/test/CameraHal/camera_test_surfacetexture.cpp
@@ -119,9 +119,15 @@ void GLSurface::initialize(int display) {
if (display) {
mComposerClient = new SurfaceComposerClient;
ASSERT(NO_ERROR == mComposerClient->initCheck());
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mSurfaceControl = mComposerClient->createSurface(
+ String8("Test Surface"),
+ 800, 480, HAL_PIXEL_FORMAT_YCrCb_420_SP, 0);
+#else
mSurfaceControl = mComposerClient->createSurface(
String8("Test Surface"), 0,
800, 480, HAL_PIXEL_FORMAT_YCrCb_420_SP, 0);
+#endif
ASSERT(mSurfaceControl != NULL);
ASSERT(mSurfaceControl->isValid());
@@ -483,7 +489,11 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format) {
native_window_set_buffer_count(mWindowTapIn.get(), 1);
native_window_set_buffers_geometry(mWindowTapIn.get(),
aligned_width, aligned_height, bufinfo.format);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mWindowTapIn->dequeueBuffer_DEPRECATED(mWindowTapIn.get(), &anb);
+#else
mWindowTapIn->dequeueBuffer(mWindowTapIn.get(), &anb);
+#endif
mapper.lock(anb->handle, GRALLOC_USAGE_SW_READ_RARELY, bounds, &data);
// copy buffer to input buffer if available
if (bufinfo.buf.get()) {
@@ -521,7 +531,12 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format) {
}
mapper.unlock(anb->handle);
+
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mWindowTapIn->queueBuffer_DEPRECATED(mWindowTapIn.get(), anb);
+#else
mWindowTapIn->queueBuffer(mWindowTapIn.get(), anb);
+#endif
}
void BufferSourceThread::showMetadata(sp<IMemory> data) {
diff --git a/test/CameraHal/surfacetexture_test.cpp b/test/CameraHal/surfacetexture_test.cpp
index b25853e..bfb232d 100644
--- a/test/CameraHal/surfacetexture_test.cpp
+++ b/test/CameraHal/surfacetexture_test.cpp
@@ -145,7 +145,11 @@ test_format (int format, int page_mode, int width, int height)
Rect bounds(width, height);
anb[i] = NULL;
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ anw->dequeueBuffer_DEPRECATED(anw.get(), &anb[i]);
+#else
anw->dequeueBuffer(anw.get(), &anb[i]);
+#endif
printf("%d: %p\n", i, anb[i]);
if (anb[i] == NULL) {
printf ("FAILED: buffer should be non-NULL\n");