diff options
author | Keith Deacon <kdeacon@ti.com> | 2012-09-21 18:18:51 -0500 |
---|---|---|
committer | Daniel Levin <dendy@ti.com> | 2012-11-26 18:42:16 +0200 |
commit | 0b2e0f2ffa0102de14856e16bb2ce8df30b71d10 (patch) | |
tree | 1b7f13e91df2a2d9fb60f8ac79bcb3ca0e12f8a6 /camera/BufferSourceAdapter.cpp | |
parent | 2a358c2f010664425dc8ba4695cc1132ef2affc9 (diff) | |
parent | f25f76de80ce7ff4f942d53867277815ef767f21 (diff) | |
download | hardware_ti_omap4-0b2e0f2ffa0102de14856e16bb2ce8df30b71d10.tar.gz hardware_ti_omap4-0b2e0f2ffa0102de14856e16bb2ce8df30b71d10.tar.bz2 hardware_ti_omap4-0b2e0f2ffa0102de14856e16bb2ce8df30b71d10.zip |
Merge p-jb-release into d-jb-release
Change-Id: I649b0c53d1c0e8f56e059a3cb24a38089d8fccc4
Diffstat (limited to 'camera/BufferSourceAdapter.cpp')
-rw-r--r-- | camera/BufferSourceAdapter.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/camera/BufferSourceAdapter.cpp b/camera/BufferSourceAdapter.cpp index d6de80c..b92f46e 100644 --- a/camera/BufferSourceAdapter.cpp +++ b/camera/BufferSourceAdapter.cpp @@ -96,6 +96,19 @@ static CameraFrame::FrameType formatToOutputFrameType(const char* format) { return CameraFrame::RAW_FRAME; } +static int getHeightFromFormat(const char* format, int stride, int size) { + CAMHAL_ASSERT((NULL != format) && (0 <= stride) && (0 <= size)); + switch (getANWFormat(format)) { + case HAL_PIXEL_FORMAT_TI_NV12: + return (size / (3 * stride)) * 2; + case HAL_PIXEL_FORMAT_TI_Y16: + return (size / stride) / 2; + default: + break; + } + return 0; +} + /*--------------------BufferSourceAdapter Class STARTS here-----------------------------*/ @@ -294,7 +307,7 @@ void BufferSourceAdapter::destroy() LOG_FUNCTION_NAME_EXIT; } -CameraBuffer* BufferSourceAdapter::allocateBufferList(int width, int height, const char* format, +CameraBuffer* BufferSourceAdapter::allocateBufferList(int width, int dummyHeight, const char* format, int &bytes, int numBufs) { LOG_FUNCTION_NAME; @@ -345,6 +358,9 @@ CameraBuffer* BufferSourceAdapter::allocateBufferList(int width, int height, con CAMHAL_LOGDB("Configuring %d buffers for ANativeWindow", numBufs); mBufferCount = numBufs; + // re-calculate height depending on stride and size + int height = getHeightFromFormat(format, width, bytes); + // Set window geometry err = mBufferSource->set_buffers_geometry(mBufferSource, width, height, |