summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Levin <dendy@ti.com>2012-10-16 21:28:49 +0300
committerDaniel Levin <dendy@ti.com>2012-11-22 16:11:53 +0200
commit951922ea212639e0fe5f97a0e704c3baab8672e6 (patch)
tree431de1f81dd59ad0b993f6ce29135b9cd6f33880 /test
parentad76a7189cf1777b873f9f3a45705dac67e5e589 (diff)
downloadhardware_ti_omap4-951922ea212639e0fe5f97a0e704c3baab8672e6.zip
hardware_ti_omap4-951922ea212639e0fe5f97a0e704c3baab8672e6.tar.gz
hardware_ti_omap4-951922ea212639e0fe5f97a0e704c3baab8672e6.tar.bz2
Camera: Fix JB MR1 API changes in VTC tests
Change-Id: Ia9e1381136a2479a5b230c31f97348fd982b3778 Signed-off-by: Daniel Levin <dendy@ti.com>
Diffstat (limited to 'test')
-rw-r--r--test/CameraHal/Android.mk15
-rw-r--r--test/CameraHal/surfacetexture_test.cpp8
-rw-r--r--test/VTC/CameraHardwareInterfaceTest.cpp6
-rw-r--r--test/VTC/IOMXDecoder.cpp18
-rw-r--r--test/VTC/VTCLoopback.cpp14
-rw-r--r--test/VTC/VTCTestApp.cpp47
-rw-r--r--test/VTC/VtcCommon.h4
7 files changed, 107 insertions, 5 deletions
diff --git a/test/CameraHal/Android.mk b/test/CameraHal/Android.mk
index 0121e24..43e5114 100644
--- a/test/CameraHal/Android.mk
+++ b/test/CameraHal/Android.mk
@@ -67,15 +67,22 @@ LOCAL_SHARED_LIBRARIES:= \
libgui \
libcamera_client \
libEGL \
- libGLESv2 \
- libion
+ libGLESv2
+
+ifdef ANDROID_API_JB_MR1_OR_LATER
+LOCAL_SHARED_LIBRARIES += \
+ libion_ti
+else
+LOCAL_SHARED_LIBRARIES += \
+ libion
+endif
LOCAL_C_INCLUDES += \
+ hardware/ti/omap4xxx/include \
frameworks/base/include/ui \
frameworks/base/include/surfaceflinger \
frameworks/base/include/camera \
- frameworks/base/include/media \
- hardware/ti/omap4xxx/ion
+ frameworks/base/include/media
LOCAL_MODULE:= surfacetexture_test
LOCAL_MODULE_TAGS:= tests
diff --git a/test/CameraHal/surfacetexture_test.cpp b/test/CameraHal/surfacetexture_test.cpp
index bfb232d..afb08e3 100644
--- a/test/CameraHal/surfacetexture_test.cpp
+++ b/test/CameraHal/surfacetexture_test.cpp
@@ -73,7 +73,11 @@
#include <gui/ISurfaceComposer.h>
#include <gui/ISurfaceComposerClient.h>
#include <gui/SurfaceComposerClient.h>
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+#include <ion_ti/ion.h>
+#else
#include <ion/ion.h>
+#endif
#else
#include <surfaceflinger/Surface.h>
#include <surfaceflinger/ISurface.h>
@@ -167,7 +171,11 @@ test_format (int format, int page_mode, int width, int height)
}
for(i=0;i<N_BUFFERS;i++) {
if (anb[i]) {
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ anw->cancelBuffer_DEPRECATED (anw.get(), anb[i]);
+#else
anw->cancelBuffer (anw.get(), anb[i]);
+#endif
}
}
diff --git a/test/VTC/CameraHardwareInterfaceTest.cpp b/test/VTC/CameraHardwareInterfaceTest.cpp
index dd01a36..b6aeb77 100644
--- a/test/VTC/CameraHardwareInterfaceTest.cpp
+++ b/test/VTC/CameraHardwareInterfaceTest.cpp
@@ -113,9 +113,15 @@ void surfaceInit() {
return;
}
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mSurfaceControl = mComposerClient->createSurface(String8("NativeSurface"),
+ mWidth, mHeight,
+ PIXEL_FORMAT_OPAQUE, ISurfaceComposerClient::eFXSurfaceNormal);
+#else
mSurfaceControl = mComposerClient->createSurface(String8("NativeSurface"),
0, mWidth, mHeight,
PIXEL_FORMAT_OPAQUE, ISurfaceComposer::eFXSurfaceNormal);
+#endif
if (mSurfaceControl == NULL) {
VTC_LOGE("mComposerClient->createSurface failed");
diff --git a/test/VTC/IOMXDecoder.cpp b/test/VTC/IOMXDecoder.cpp
index cd1ab2a..3f69268 100644
--- a/test/VTC/IOMXDecoder.cpp
+++ b/test/VTC/IOMXDecoder.cpp
@@ -711,7 +711,11 @@ status_t OMXDecoder::FillBufferDone(OMX_BUFFERHEADERTYPE* pBufferHdr) {
PortBufferInfo *info = &mOutputBuffers.editItemAt(i);
info->mStatus = OWNED_BY_US;
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ err = mNativeWindow->queueBuffer_DEPRECATED(mNativeWindow.get(), mOutputBuffers[i].gb.get());
+#else
err = mNativeWindow->queueBuffer(mNativeWindow.get(), mOutputBuffers[i].gb.get());
+#endif
if (err != 0) {
VTC_LOGE("queueBuffer failed with error %s (%d)", strerror(-err), -err);
return -1;
@@ -831,8 +835,13 @@ status_t OMXDecoder::createPlaybackSurface() {
mSurfaceComposerClient = new SurfaceComposerClient();
CHECK_EQ(mSurfaceComposerClient->initCheck(), (status_t)OK);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mSurfaceControl = mSurfaceComposerClient->createSurface(String8(),
+ 320, 320, HAL_PIXEL_FORMAT_RGB_565);
+#else
mSurfaceControl = mSurfaceComposerClient->createSurface(0,
320, 320, HAL_PIXEL_FORMAT_RGB_565);
+#endif
mNativeWindow = mSurfaceControl->getSurface();
@@ -1035,8 +1044,13 @@ status_t OMXDecoder::allocateOutputBuffersFromNativeWindow() {
for (OMX_U32 i = cancelStart; i < cancelEnd; i++) {
PortBufferInfo *info = &mOutputBuffers.editItemAt(i);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ err = mNativeWindow->cancelBuffer_DEPRECATED(
+ mNativeWindow.get(), info->gb.get());
+#else
err = mNativeWindow->cancelBuffer(
mNativeWindow.get(), info->gb.get());
+#endif
if (err != 0) {
VTC_LOGE("cancelBuffer failed w/ error 0x%08x", err);
return err;
@@ -1071,7 +1085,11 @@ status_t OMXDecoder::freeOutputBuffers() {
// Cancel the buffer if it belongs to an ANativeWindow.
if (mOutputBuffers[i].mStatus == OWNED_BY_US && mOutputBuffers[i].gb != 0) {
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ err = mNativeWindow->cancelBuffer_DEPRECATED(mNativeWindow.get(), mOutputBuffers[i].gb.get());
+#else
err = mNativeWindow->cancelBuffer(mNativeWindow.get(), mOutputBuffers[i].gb.get());
+#endif
if (err != 0)VTC_LOGE("\n\n\nCancel Buffer for Output Port buffer:%d failed:%d\n\n\n",i,err);
}
diff --git a/test/VTC/VTCLoopback.cpp b/test/VTC/VTCLoopback.cpp
index d424401..087f40d 100644
--- a/test/VTC/VTCLoopback.cpp
+++ b/test/VTC/VTCLoopback.cpp
@@ -220,13 +220,27 @@ int createPreviewSurface() {
gSurfaceComposerClient = new SurfaceComposerClient();
CHECK_EQ(gSurfaceComposerClient->initCheck(), (status_t)OK);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ DisplayInfo displayInfo;
+ gSurfaceComposerClient->getDisplayInfo(0, &displayInfo);
+ int gCameraSurfaceWidth = displayInfo.w;
+ int gCameraSurfaceHeight = displayInfo.h;
+#else
gCameraSurfaceWidth = gSurfaceComposerClient->getDisplayWidth(0);
gCameraSurfaceHeight = gSurfaceComposerClient->getDisplayHeight(0);
+#endif
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ gSurfaceControl = gSurfaceComposerClient->createSurface(String8(),
+ gCameraSurfaceWidth,
+ gCameraSurfaceHeight,
+ HAL_PIXEL_FORMAT_RGB_565);
+#else
gSurfaceControl = gSurfaceComposerClient->createSurface(0,
gCameraSurfaceWidth,
gCameraSurfaceHeight,
HAL_PIXEL_FORMAT_RGB_565);
+#endif
gPreviewSurface = gSurfaceControl->getSurface();
diff --git a/test/VTC/VTCTestApp.cpp b/test/VTC/VTCTestApp.cpp
index 0755b6b..ad30f8d 100644
--- a/test/VTC/VTCTestApp.cpp
+++ b/test/VTC/VTCTestApp.cpp
@@ -268,8 +268,11 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t * mutex, int
}
int startPlayback() {
-
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ playbackSurfaceControl = playbackComposerClient->createSurface(String8(), playbackSurfaceWidth, playbackSurfaceHeight, PIXEL_FORMAT_RGB_565);
+#else
playbackSurfaceControl = playbackComposerClient->createSurface(0, playbackSurfaceWidth, playbackSurfaceHeight, PIXEL_FORMAT_RGB_565);
+#endif
CHECK(playbackSurfaceControl != NULL);
CHECK(playbackSurfaceControl->isValid());
@@ -325,8 +328,15 @@ int verfiyByPlayback() {
playbackComposerClient = new SurfaceComposerClient();
CHECK_EQ(playbackComposerClient->initCheck(), (status_t)OK);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ DisplayInfo displayInfo;
+ playbackComposerClient->getDisplayInfo(0, &displayInfo);
+ playbackSurfaceWidth = displayInfo.w;
+ playbackSurfaceHeight = displayInfo.h;
+#else
playbackSurfaceWidth = playbackComposerClient->getDisplayWidth(0);
playbackSurfaceHeight = playbackComposerClient->getDisplayHeight(0);
+#endif
VTC_LOGD("Panel WxH = %d x %d", playbackSurfaceWidth, playbackSurfaceHeight);
startPlayback();
@@ -345,14 +355,28 @@ int createPreviewSurface() {
CHECK_EQ(client->initCheck(), (status_t)OK);
if ((cameraSurfaceWidth == 0) || (cameraSurfaceHeight == 0)){
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ DisplayInfo displayInfo;
+ client->getDisplayInfo(0, &displayInfo);
+ cameraSurfaceWidth = displayInfo.w;
+ cameraSurfaceHeight = displayInfo.h;
+#else
cameraSurfaceWidth = client->getDisplayWidth(0);
cameraSurfaceHeight = client->getDisplayHeight(0);
+#endif
}
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ surfaceControl = client->createSurface(String8(),
+ cameraSurfaceWidth,
+ cameraSurfaceHeight,
+ HAL_PIXEL_FORMAT_RGB_565);
+#else
surfaceControl = client->createSurface(0,
cameraSurfaceWidth,
cameraSurfaceHeight,
HAL_PIXEL_FORMAT_RGB_565);
+#endif
previewSurface = surfaceControl->getSurface();
@@ -708,8 +732,15 @@ int test_PlaybackAndRecord_sidebyside() {
playbackComposerClient = new SurfaceComposerClient();
CHECK_EQ(playbackComposerClient->initCheck(), (status_t)OK);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ DisplayInfo displayInfo;
+ playbackComposerClient->getDisplayInfo(0, &displayInfo);
+ int panelwidth = displayInfo.w;
+ int panelheight = displayInfo.h;
+#else
int panelwidth = playbackComposerClient->getDisplayWidth(0);
int panelheight = playbackComposerClient->getDisplayHeight(0);
+#endif
VTC_LOGD("Panel WxH = %d x %d", panelwidth, panelheight);
if (panelwidth < panelheight) {//Portrait Phone
VTC_LOGD("\nPortrait Device\n");
@@ -762,8 +793,15 @@ int test_PlaybackAndRecord_PIP() {
playbackComposerClient = new SurfaceComposerClient();
CHECK_EQ(playbackComposerClient->initCheck(), (status_t)OK);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ DisplayInfo displayInfo;
+ playbackComposerClient->getDisplayInfo(0, &displayInfo);
+ uint32_t panelwidth = displayInfo.w;
+ uint32_t panelheight = displayInfo.h;
+#else
uint32_t panelwidth = playbackComposerClient->getDisplayWidth(0);
uint32_t panelheight = playbackComposerClient->getDisplayHeight(0);
+#endif
VTC_LOGD("Panel WxH = %d x %d", panelwidth, panelheight);
if (panelwidth < panelheight) {//Portrait Phone
VTC_LOGD("\nPortrait Device\n");
@@ -838,8 +876,15 @@ int test_PlaybackOnly()
playbackComposerClient = new SurfaceComposerClient();
CHECK_EQ(playbackComposerClient->initCheck(), (status_t)OK);
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ DisplayInfo displayInfo;
+ playbackComposerClient->getDisplayInfo(0, &displayInfo);
+ int panelwidth = displayInfo.w;
+ int panelheight = displayInfo.h;
+#else
int panelwidth = playbackComposerClient->getDisplayWidth(0);
int panelheight = playbackComposerClient->getDisplayHeight(0);
+#endif
VTC_LOGD("Panel WxH = %d x %d", panelwidth, panelheight);
if (panelwidth < panelheight) {//Portrait Phone
VTC_LOGD("\nPortrait Device\n");
diff --git a/test/VTC/VtcCommon.h b/test/VTC/VtcCommon.h
index 04e4562..07b8672 100644
--- a/test/VTC/VtcCommon.h
+++ b/test/VTC/VtcCommon.h
@@ -19,6 +19,10 @@
#include <cutils/log.h>
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+#include <ui/DisplayInfo.h>
+#endif
+