summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorAndriy Chepurnyy <x0155536@ti.com>2012-11-02 18:10:36 +0200
committerDaniel Levin <dendy@ti.com>2012-11-26 20:17:15 +0200
commit5e855a17a032fbb6dffb921958ca887d22eabf88 (patch)
tree0d70d014ad9d610f4ec13ab41fe8d42f34895975 /camera
parent45588315e9b4abc53b7fbf4f5032eed54730e40f (diff)
downloadhardware_ti_omap4-5e855a17a032fbb6dffb921958ca887d22eabf88.zip
hardware_ti_omap4-5e855a17a032fbb6dffb921958ca887d22eabf88.tar.gz
hardware_ti_omap4-5e855a17a032fbb6dffb921958ca887d22eabf88.tar.bz2
CameraHAL: Correctly set frame length for preview data callbacks
This patch fix preview data callbacks for V4LCameraAdapter, when used HW MJPEG Decoder. Change-Id: I8994549f4706a2a704fc5e1eb30c4c3afd987d3f Signed-off-by: Andriy Chepurnyy <x0155536@ti.com>
Diffstat (limited to 'camera')
-rwxr-xr-xcamera/V4LCameraAdapter/V4LCameraAdapter.cpp12
-rwxr-xr-xcamera/V4LCameraAdapter/V4LCapabilities.cpp4
2 files changed, 12 insertions, 4 deletions
diff --git a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
index 3ba0fa9..2c641ce 100755
--- a/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
+++ b/camera/V4LCameraAdapter/V4LCameraAdapter.cpp
@@ -1328,11 +1328,12 @@ void V4LCameraAdapter::returnOutputBuffer(int index)
{
LOG_FUNCTION_NAME;
- int width, height;
+ size_t width, height;
int stride = 4096;
CameraFrame frame;
- mParams.getPreviewSize(&width, &height);
+ getFrameSize(width, height);
+
android::Mutex::Autolock slock(mSubscriberLock);
android::sp<MediaBuffer>& buffer = mOutBuffers.editItemAt(index);
@@ -1341,7 +1342,12 @@ void V4LCameraAdapter::returnOutputBuffer(int index)
frame.mFrameType = CameraFrame::PREVIEW_FRAME_SYNC;
frame.mBuffer = cbuffer;
- frame.mLength = width*height*3/2;
+ if (isNeedToUseDecoder()) {
+ //We always get NV12 on out, when using decoder.
+ frame.mLength = height * stride * 3 / 2;
+ } else {
+ frame.mLength = CameraHal::calculateBufferSize(mParams.getPreviewFormat(), width, height);
+ }
frame.mAlignment = stride;
frame.mOffset = buffer->getOffset();
frame.mTimestamp = buffer->getTimestamp();
diff --git a/camera/V4LCameraAdapter/V4LCapabilities.cpp b/camera/V4LCameraAdapter/V4LCapabilities.cpp
index ff3708f..f632cdf 100755
--- a/camera/V4LCameraAdapter/V4LCapabilities.cpp
+++ b/camera/V4LCameraAdapter/V4LCapabilities.cpp
@@ -43,7 +43,7 @@ static const char PARAM_SEP[] = ",";
//Camera defaults
const char V4LCameraAdapter::DEFAULT_PICTURE_FORMAT[] = "jpeg";
const char V4LCameraAdapter::DEFAULT_PICTURE_SIZE[] = "640x480";
-const char V4LCameraAdapter::DEFAULT_PREVIEW_FORMAT[] = "yuv422i-yuyv";
+const char V4LCameraAdapter::DEFAULT_PREVIEW_FORMAT[] = "yuv420sp";
const char V4LCameraAdapter::DEFAULT_PREVIEW_SIZE[] = "640x480";
const char V4LCameraAdapter::DEFAULT_NUM_PREV_BUFS[] = "6";
const char V4LCameraAdapter::DEFAULT_FRAMERATE[] = "30";
@@ -115,6 +115,8 @@ status_t V4LCameraAdapter::insertPreviewFormats(CameraProperties::Properties* pa
}
}
strncat(supported, android::CameraParameters::PIXEL_FORMAT_YUV420P, MAX_PROP_VALUE_LENGTH - 1);
+ strncat (supported, PARAM_SEP, 1 );
+ strncat(supported, android::CameraParameters::PIXEL_FORMAT_YUV420SP, MAX_PROP_VALUE_LENGTH - 1);
params->set(CameraProperties::SUPPORTED_PREVIEW_FORMATS, supported);
return NO_ERROR;
}