summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CameraHal/Android.mk15
-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.cpp14
-rw-r--r--test/CameraHal/surfacetexture_test.cpp12
-rw-r--r--test/VTC/CameraHardwareInterfaceTest.cpp6
-rw-r--r--test/VTC/IOMXDecoder.cpp26
-rw-r--r--test/VTC/VTCLoopback.cpp14
-rw-r--r--test/VTC/VTCTestApp.cpp47
-rw-r--r--test/VTC/VtcCommon.h4
10 files changed, 153 insertions, 8 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/camera_test_bufferqueue.h b/test/CameraHal/camera_test_bufferqueue.h
index cc53086..e0542fa 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);
@@ -112,7 +117,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:
@@ -125,7 +134,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
sp<ISurfaceTexture> surfaceTexture = mBufferQueue;
mWindowTapIn = new SurfaceTextureClient(surfaceTexture);
mCamera->setBufferSource(mBufferQueue, NULL);
diff --git a/test/CameraHal/camera_test_menu.cpp b/test/CameraHal/camera_test_menu.cpp
index 0c961ca..3de29b9 100644
--- a/test/CameraHal/camera_test_menu.cpp
+++ b/test/CameraHal/camera_test_menu.cpp
@@ -977,10 +977,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);
+#else
surfaceControl = client->createSurface(0,
- previewWidth,
- previewHeight,
- pixFormat);
+ 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 de50950..af9c904 100644
--- a/test/CameraHal/camera_test_surfacetexture.cpp
+++ b/test/CameraHal/camera_test_surfacetexture.cpp
@@ -328,9 +328,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());
@@ -787,7 +793,11 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format, Shot
void *src[3] = { 0 };
Rect bounds(aligned_width, aligned_height);
+#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_WRITE_OFTEN, bounds, dest);
// copy buffer to input buffer if available
if (bufinfo.buf.get()) {
@@ -831,7 +841,11 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format, Shot
anb = bufinfo.buf->getNativeBuffer();
}
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ mWindowTapIn->queueBuffer_DEPRECATED(mWindowTapIn.get(), anb);
+#else
mWindowTapIn->queueBuffer(mWindowTapIn.get(), anb);
+#endif
#ifndef ANDROID_API_JB_OR_LATER
{
diff --git a/test/CameraHal/surfacetexture_test.cpp b/test/CameraHal/surfacetexture_test.cpp
index b25853e..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>
@@ -145,7 +149,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");
@@ -163,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 723bca9..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;
@@ -721,7 +725,11 @@ status_t OMXDecoder::FillBufferDone(OMX_BUFFERHEADERTYPE* pBufferHdr) {
if (mDebugFlags & FPS_DECODER) PrintDecoderFPS();
ANativeWindowBuffer* buf;
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ err = mNativeWindow->dequeueBuffer_DEPRECATED(mNativeWindow.get(), &buf);
+#else
err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf);
+#endif
if (err != 0) {
VTC_LOGE("dequeueBuffer failed w/ error 0x%08x", err);
return -1;
@@ -827,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();
@@ -983,7 +996,11 @@ status_t OMXDecoder::allocateOutputBuffersFromNativeWindow() {
// Dequeue buffers and send them to OMX
for (i = 0; i < nBufferCnt; i++) {
ANativeWindowBuffer* buf;
+#ifdef ANDROID_API_JB_MR1_OR_LATER
+ err = mNativeWindow->dequeueBuffer_DEPRECATED(mNativeWindow.get(), &buf);
+#else
err = mNativeWindow->dequeueBuffer(mNativeWindow.get(), &buf);
+#endif
if (err != 0) {
VTC_LOGE("dequeueBuffer failed: %s (%d)", strerror(-err), -err);
break;
@@ -1027,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;
@@ -1063,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
+