diff options
author | Tyler Luu <tluu@ti.com> | 2012-06-21 14:22:06 -0500 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 20:05:28 +0200 |
commit | fcc59393c2711ba35dfc09da2ec5d746b5ce621e (patch) | |
tree | 6afa055053bd8aa8fc5dd3b912b086da8b01351e /test | |
parent | 0d138066844dfb381c0504f6a20ecd3805670da6 (diff) | |
download | hardware_ti_omap4-fcc59393c2711ba35dfc09da2ec5d746b5ce621e.zip hardware_ti_omap4-fcc59393c2711ba35dfc09da2ec5d746b5ce621e.tar.gz hardware_ti_omap4-fcc59393c2711ba35dfc09da2ec5d746b5ce621e.tar.bz2 |
Camera_test: Pre-set buffer source
- Change camera_test to pre-set all buffer sources during
start preview instead of during takePicture/reprocess.
- Omit pre-setting tap-in/-outs if the client
doesn't use raw picture format.
Depends on frameworks/native change I20c0f4a8:
http://review.omapzoom.org/#/c/28901/
Change-Id: I8c0d29ffc5b21c56a2d79bc80cab910f55c7ca21
Signed-off-by: Tyler Luu <tluu@ti.com>
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/CameraHal/camera_test.h | 7 | ||||
-rw-r--r-- | test/CameraHal/camera_test_bufferqueue.h | 24 | ||||
-rw-r--r-- | test/CameraHal/camera_test_menu.cpp | 20 | ||||
-rw-r--r-- | test/CameraHal/camera_test_script.cpp | 6 | ||||
-rw-r--r-- | test/CameraHal/camera_test_surfacetexture.cpp | 30 | ||||
-rw-r--r-- | test/CameraHal/camera_test_surfacetexture.h | 17 |
6 files changed, 91 insertions, 13 deletions
diff --git a/test/CameraHal/camera_test.h b/test/CameraHal/camera_test.h index 468b6c4..6dc1a7c 100644 --- a/test/CameraHal/camera_test.h +++ b/test/CameraHal/camera_test.h @@ -75,6 +75,9 @@ #define KEY_ALGO_THREELINCOLORMAP "ti-algo-threelinecolormap" #define KEY_ALGO_GIC "ti-algo-gic" +#define KEY_TAP_OUT_SURFACES "tap-out" +#define KEY_TAP_IN_SURFACE "tap-in" + #define BRACKETING_IDX_DEFAULT 0 #define BRACKETING_IDX_STREAM 1 #define BRACKETING_STREAM_BUFFERS 9 @@ -396,7 +399,7 @@ public: virtual bool threadLoop() { return false;} virtual void requestExit() {}; - virtual void setBuffer() {}; + virtual void setBuffer(android::ShotParameters ¶ms) {}; virtual void onHandled(sp<GraphicBuffer> &g, unsigned int slot) {}; bool toggleStreamCapture(int expBracketIdx) { @@ -465,7 +468,7 @@ public: virtual void init() = 0; - virtual void setInput(buffer_info_t, const char *format); + virtual void setInput(buffer_info_t, const char *format, ShotParameters ¶ms); protected: sp<BufferSourceThread> mTapOut; diff --git a/test/CameraHal/camera_test_bufferqueue.h b/test/CameraHal/camera_test_bufferqueue.h index 68b9b34..8833535 100644 --- a/test/CameraHal/camera_test_bufferqueue.h +++ b/test/CameraHal/camera_test_bufferqueue.h @@ -96,8 +96,17 @@ public: mFW->onFrameAvailable(); } - virtual void setBuffer() { + virtual void setBuffer(android::ShotParameters ¶ms) { mCamera->setBufferSource(NULL, mBufferQueue); + { + String8 id = mBufferQueue->getId(); + + if (!id.isEmpty()) { + params.set(KEY_TAP_OUT_SURFACES, id); + } else { + params.remove(KEY_TAP_OUT_SURFACES); + } + } } virtual void onHandled(sp<GraphicBuffer> &gbuf, unsigned int slot) { @@ -124,10 +133,19 @@ public: mWindowTapIn = new SurfaceTextureClient(surfaceTexture); } - virtual void setInput(buffer_info_t bufinfo, const char *format) { + virtual void setInput(buffer_info_t bufinfo, const char *format, android::ShotParameters ¶ms) { mBufferQueue->setDefaultBufferSize(bufinfo.width, bufinfo.height); - BufferSourceInput::setInput(bufinfo, format); + BufferSourceInput::setInput(bufinfo, format, params); mCamera->setBufferSource(mBufferQueue, NULL); + { + String8 id = mBufferQueue->getId(); + + if (!id.isEmpty()) { + params.set(KEY_TAP_IN_SURFACE, id); + } else { + params.remove(KEY_TAP_IN_SURFACE); + } + } } private: diff --git a/test/CameraHal/camera_test_menu.cpp b/test/CameraHal/camera_test_menu.cpp index 23e691d..c286e74 100644 --- a/test/CameraHal/camera_test_menu.cpp +++ b/test/CameraHal/camera_test_menu.cpp @@ -1334,6 +1334,19 @@ int startPreview() { previewRunning = true; reSizePreview = false; + const char *format = params.getPictureFormat(); + if((NULL != format) && isRawPixelFormat(format)) { + createBufferOutputSource(); + if (!bufferSourceInput.get()) { +#ifdef ANDROID_API_JB_OR_LATER + bufferSourceInput = new BQ_BufferSourceInput(1234, camera); +#else + bufferSourceInput = new ST_BufferSourceInput(1234, camera); +#endif + bufferSourceInput->init(); + } + } + return 0; } @@ -3457,7 +3470,7 @@ int functional_menu() { if(isRawPixelFormat(pictureFormatArray[pictureFormat])) { createBufferOutputSource(); if (bufferSourceOutputThread.get()) { - bufferSourceOutputThread->setBuffer(); + bufferSourceOutputThread->setBuffer(shotParams); } } else { msgType = CAMERA_MSG_COMPRESSED_IMAGE | @@ -3498,6 +3511,7 @@ int functional_menu() { case 'P': { int msgType = CAMERA_MSG_COMPRESSED_IMAGE; + ShotParameters reprocParams; gettimeofday(&picture_start, 0); if (!bufferSourceInput.get()) { @@ -3516,8 +3530,8 @@ int functional_menu() { if (bufferSourceInput.get()) { buffer_info_t info = bufferSourceOutputThread->popBuffer(); - bufferSourceInput->setInput(info, pictureFormatArray[pictureFormat]); - if (hardwareActive) camera->reprocess(msgType, String8()); + bufferSourceInput->setInput(info, pictureFormatArray[pictureFormat], reprocParams); + if (hardwareActive) camera->reprocess(msgType, reprocParams.flatten()); } } break; diff --git a/test/CameraHal/camera_test_script.cpp b/test/CameraHal/camera_test_script.cpp index 97d765c..64ced44 100644 --- a/test/CameraHal/camera_test_script.cpp +++ b/test/CameraHal/camera_test_script.cpp @@ -1190,7 +1190,7 @@ int execute_functional_script(char *script) { if((NULL != format) && isRawPixelFormat(format)) { createBufferOutputSource(); if (bufferSourceOutputThread.get()) { - bufferSourceOutputThread->setBuffer(); + bufferSourceOutputThread->setBuffer(shotParams); } } else if(strcmp(modevalues[capture_mode], "video-mode") == 0) { msgType = CAMERA_MSG_COMPRESSED_IMAGE | @@ -1249,6 +1249,8 @@ int execute_functional_script(char *script) { case 'P': { int msgType = CAMERA_MSG_COMPRESSED_IMAGE; + ShotParameters reprocParams; + gettimeofday(&picture_start, 0); if (!bufferSourceInput.get()) { #ifdef ANDROID_API_JB_OR_LATER @@ -1266,7 +1268,7 @@ int execute_functional_script(char *script) { if (bufferSourceInput.get()) { buffer_info_t info = bufferSourceOutputThread->popBuffer(); - bufferSourceInput->setInput(info, params.getPictureFormat()); + bufferSourceInput->setInput(info, params.getPictureFormat(), reprocParams); if (hardwareActive) camera->reprocess(msgType, String8()); } } diff --git a/test/CameraHal/camera_test_surfacetexture.cpp b/test/CameraHal/camera_test_surfacetexture.cpp index cec076a..897ded7 100644 --- a/test/CameraHal/camera_test_surfacetexture.cpp +++ b/test/CameraHal/camera_test_surfacetexture.cpp @@ -306,6 +306,17 @@ void SurfaceTextureBase::deinit() { mST.clear(); } +void SurfaceTextureBase::getId(const char **name) { + sp<ANativeWindow> windowTapOut = mSTC; + + *name = NULL; + if (windowTapOut.get()) { + windowTapOut->perform(windowTapOut.get(), NATIVE_WINDOW_GET_ID, name); + } + + windowTapOut.clear(); +} + // SurfaceTexture with GL specific void SurfaceTextureGL::initialize(int display, int tex_id) { @@ -454,7 +465,7 @@ void BufferSourceThread::handleBuffer(sp<GraphicBuffer> &graphic_buffer, uint8_t } } -void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format) { +void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format, ShotParameters ¶ms) { ANativeWindowBuffer* anb; GraphicBufferMapper &mapper = GraphicBufferMapper::get(); void *data = NULL; @@ -533,6 +544,23 @@ void BufferSourceInput::setInput(buffer_info_t bufinfo, const char *format) { } mWindowTapIn->queueBuffer(mWindowTapIn.get(), anb); + + { + sp<ANativeWindow> windowTapIn = mWindowTapIn; + const char* id = NULL; + + if (windowTapIn.get()) { + windowTapIn->perform(windowTapIn.get(), NATIVE_WINDOW_GET_ID, &id); + } + + if (id) { + params.set(KEY_TAP_IN_SURFACE, id); + } else { + params.remove(KEY_TAP_IN_SURFACE); + } + + windowTapIn.clear(); + } } void BufferSourceThread::showMetadata(sp<IMemory> data) { diff --git a/test/CameraHal/camera_test_surfacetexture.h b/test/CameraHal/camera_test_surfacetexture.h index 03a0fa5..4be568e 100644 --- a/test/CameraHal/camera_test_surfacetexture.h +++ b/test/CameraHal/camera_test_surfacetexture.h @@ -97,6 +97,7 @@ public: void initialize(int tex_id, EGLenum tex_target = EGL_NONE); void deinit(); + void getId(const char **name); virtual sp<SurfaceTexture> getST(); @@ -165,10 +166,21 @@ public: mFW->onFrameAvailable(); } - virtual void setBuffer() { + virtual void setBuffer(android::ShotParameters ¶ms) { #ifndef ANDROID_API_JB_OR_LATER mCamera->setBufferSource(NULL, mSurfaceTexture); #endif + { + const char* id = NULL; + + mSurfaceTextureBase->getId(&id); + + if (id) { + params.set(KEY_TAP_OUT_SURFACES, id); + } else { + params.remove(KEY_TAP_OUT_SURFACES); + } + } } private: @@ -197,8 +209,9 @@ public: } virtual void setInput(buffer_info_t bufinfo, const char *format) { + android::ShotParameters params; mSurfaceTexture->getST()->setDefaultBufferSize(bufinfo.width, bufinfo.height); - BufferSourceInput::setInput(bufinfo, format); + BufferSourceInput::setInput(bufinfo, format, params); #ifndef ANDROID_API_JB_OR_LATER mCamera->setBufferSource(mSurfaceTexture->getST(), NULL); #else |