diff options
Diffstat (limited to 'camera')
-rwxr-xr-x | camera/V4LCameraAdapter/V4LCameraAdapter.cpp | 12 | ||||
-rwxr-xr-x | camera/V4LCameraAdapter/V4LCapabilities.cpp | 4 |
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; } |