Loading camera/CameraParameters.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint"; const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported"; const char CameraParameters::KEY_VIDEO_STABILIZATION[] = "video-stabilization"; const char CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED[] = "video-stabilization-supported"; const char CameraParameters::KEY_LIGHTFX[] = "light-fx"; const char CameraParameters::TRUE[] = "true"; const char CameraParameters::FALSE[] = "false"; Loading Loading @@ -166,6 +167,10 @@ const char CameraParameters::FOCUS_MODE_EDOF[] = "edof"; const char CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO[] = "continuous-video"; const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-picture"; // Values for light fx settings const char CameraParameters::LIGHTFX_LOWLIGHT[] = "low-light"; const char CameraParameters::LIGHTFX_HDR[] = "high-dynamic-range"; CameraParameters::CameraParameters() : mMap() { Loading include/camera/CameraParameters.h +12 −2 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ public: // Example value: "42.5". Read only. static const char KEY_VERTICAL_VIEW_ANGLE[]; // Exposure compensation index. 0 means exposure is not adjusted. // Example value: "0" or "5". Read/write. // Example value: "-5" or "5". Read/write. static const char KEY_EXPOSURE_COMPENSATION[]; // The maximum exposure compensation index (>=0). // Example value: "6". Read only. Loading @@ -307,7 +307,7 @@ public: // Example value: "-6". Read only. static const char KEY_MIN_EXPOSURE_COMPENSATION[]; // The exposure compensation step. Exposure compensation index multiply by // step eqals to EV. Ex: if exposure compensation index is 6 and step is // step eqals to EV. Ex: if exposure compensation index is -6 and step is // 0.3333, EV is -2. // Example value: "0.333333333" or "0.5". Read only. static const char KEY_EXPOSURE_COMPENSATION_STEP[]; Loading Loading @@ -525,6 +525,10 @@ public: // stream and record stabilized videos. static const char KEY_VIDEO_STABILIZATION_SUPPORTED[]; // Supported modes for special effects with light. // Example values: "lowlight,hdr". static const char KEY_LIGHTFX[]; // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED. static const char TRUE[]; static const char FALSE[]; Loading Loading @@ -660,6 +664,12 @@ public: // other modes. static const char FOCUS_MODE_CONTINUOUS_PICTURE[]; // Values for light special effects // Low-light enhancement mode static const char LIGHTFX_LOWLIGHT[]; // High-dynamic range mode static const char LIGHTFX_HDR[]; private: DefaultKeyedVector<String8,String8> mMap; }; Loading services/camera/libcameraservice/Android.mk +7 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ LOCAL_SRC_FILES:= \ camera2/JpegProcessor.cpp \ camera2/CallbackProcessor.cpp \ camera2/ZslProcessor.cpp \ camera2/CaptureSequencer.cpp \ camera2/BurstCapture.cpp \ camera2/JpegCompressor.cpp \ camera2/CaptureSequencer.cpp LOCAL_SHARED_LIBRARIES:= \ libui \ Loading @@ -30,10 +32,12 @@ LOCAL_SHARED_LIBRARIES:= \ libgui \ libhardware \ libsync \ libcamera_metadata libcamera_metadata \ libjpeg LOCAL_C_INCLUDES += \ system/media/camera/include system/media/camera/include \ external/jpeg LOCAL_MODULE:= libcameraservice Loading services/camera/libcameraservice/Camera2Client.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -25,14 +25,12 @@ #include <gui/SurfaceTextureClient.h> #include <gui/Surface.h> #include <media/hardware/MetadataBufferType.h> #include "Camera2Client.h" #include "camera2/Parameters.h" #define ALOG1(...) ALOGD_IF(gLogLevel >= 1, __VA_ARGS__); #define ALOG2(...) ALOGD_IF(gLogLevel >= 2, __VA_ARGS__); namespace android { using namespace camera2; static int getCallingPid() { Loading services/camera/libcameraservice/camera2/BurstCapture.cpp 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_NDEBUG 0 #define LOG_TAG "BurstCapture" #include <utils/Log.h> #include <utils/Trace.h> #include "BurstCapture.h" #include "JpegCompressor.h" #include "../Camera2Client.h" namespace android { namespace camera2 { BurstCapture::BurstCapture(wp<Camera2Client> client, wp<CaptureSequencer> sequencer): mCaptureStreamId(NO_STREAM), mClient(client), mSequencer(sequencer) { } BurstCapture::~BurstCapture() { } status_t BurstCapture::start(Vector<CameraMetadata> &metadatas, int32_t firstCaptureId) { ALOGE("Not completely implemented"); return INVALID_OPERATION; } void BurstCapture::onFrameAvailable() { ALOGV("%s", __FUNCTION__); Mutex::Autolock l(mInputMutex); if(!mInputChanged) { mInputChanged = true; mInputSignal.signal(); } } bool BurstCapture::threadLoop() { status_t res; { Mutex::Autolock l(mInputMutex); while(!mInputChanged) { res = mInputSignal.waitRelative(mInputMutex, kWaitDuration); if(res == TIMED_OUT) return true; } mInputChanged = false; } do { sp<Camera2Client> client = mClient.promote(); if(client == 0) return false; ALOGV("%s: Calling processFrameAvailable()", __FUNCTION__); res = processFrameAvailable(client); } while(res == OK); return true; } CpuConsumer::LockedBuffer* BurstCapture::jpegEncode( CpuConsumer::LockedBuffer *imgBuffer, int quality) { ALOGV("%s", __FUNCTION__); CpuConsumer::LockedBuffer *imgEncoded = new CpuConsumer::LockedBuffer; uint8_t *data = new uint8_t[ANDROID_JPEG_MAX_SIZE]; imgEncoded->data = data; imgEncoded->width = imgBuffer->width; imgEncoded->height = imgBuffer->height; imgEncoded->stride = imgBuffer->stride; Vector<CpuConsumer::LockedBuffer*> buffers; buffers.push_back(imgBuffer); buffers.push_back(imgEncoded); sp<JpegCompressor> jpeg = new JpegCompressor(); status_t res = jpeg->start(buffers, 1); bool success = jpeg->waitForDone(10 * 1e9); if(success) { return buffers[1]; } else { ALOGE("%s: JPEG encode timed out", __FUNCTION__); return NULL; // TODO: maybe change function return value to status_t } } status_t BurstCapture::processFrameAvailable(sp<Camera2Client> &client) { ALOGE("Not implemented"); return INVALID_OPERATION; } } // namespace camera2 } // namespace android Loading
camera/CameraParameters.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ const char CameraParameters::KEY_RECORDING_HINT[] = "recording-hint"; const char CameraParameters::KEY_VIDEO_SNAPSHOT_SUPPORTED[] = "video-snapshot-supported"; const char CameraParameters::KEY_VIDEO_STABILIZATION[] = "video-stabilization"; const char CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED[] = "video-stabilization-supported"; const char CameraParameters::KEY_LIGHTFX[] = "light-fx"; const char CameraParameters::TRUE[] = "true"; const char CameraParameters::FALSE[] = "false"; Loading Loading @@ -166,6 +167,10 @@ const char CameraParameters::FOCUS_MODE_EDOF[] = "edof"; const char CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO[] = "continuous-video"; const char CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE[] = "continuous-picture"; // Values for light fx settings const char CameraParameters::LIGHTFX_LOWLIGHT[] = "low-light"; const char CameraParameters::LIGHTFX_HDR[] = "high-dynamic-range"; CameraParameters::CameraParameters() : mMap() { Loading
include/camera/CameraParameters.h +12 −2 Original line number Diff line number Diff line Loading @@ -298,7 +298,7 @@ public: // Example value: "42.5". Read only. static const char KEY_VERTICAL_VIEW_ANGLE[]; // Exposure compensation index. 0 means exposure is not adjusted. // Example value: "0" or "5". Read/write. // Example value: "-5" or "5". Read/write. static const char KEY_EXPOSURE_COMPENSATION[]; // The maximum exposure compensation index (>=0). // Example value: "6". Read only. Loading @@ -307,7 +307,7 @@ public: // Example value: "-6". Read only. static const char KEY_MIN_EXPOSURE_COMPENSATION[]; // The exposure compensation step. Exposure compensation index multiply by // step eqals to EV. Ex: if exposure compensation index is 6 and step is // step eqals to EV. Ex: if exposure compensation index is -6 and step is // 0.3333, EV is -2. // Example value: "0.333333333" or "0.5". Read only. static const char KEY_EXPOSURE_COMPENSATION_STEP[]; Loading Loading @@ -525,6 +525,10 @@ public: // stream and record stabilized videos. static const char KEY_VIDEO_STABILIZATION_SUPPORTED[]; // Supported modes for special effects with light. // Example values: "lowlight,hdr". static const char KEY_LIGHTFX[]; // Value for KEY_ZOOM_SUPPORTED or KEY_SMOOTH_ZOOM_SUPPORTED. static const char TRUE[]; static const char FALSE[]; Loading Loading @@ -660,6 +664,12 @@ public: // other modes. static const char FOCUS_MODE_CONTINUOUS_PICTURE[]; // Values for light special effects // Low-light enhancement mode static const char LIGHTFX_LOWLIGHT[]; // High-dynamic range mode static const char LIGHTFX_HDR[]; private: DefaultKeyedVector<String8,String8> mMap; }; Loading
services/camera/libcameraservice/Android.mk +7 −3 Original line number Diff line number Diff line Loading @@ -17,7 +17,9 @@ LOCAL_SRC_FILES:= \ camera2/JpegProcessor.cpp \ camera2/CallbackProcessor.cpp \ camera2/ZslProcessor.cpp \ camera2/CaptureSequencer.cpp \ camera2/BurstCapture.cpp \ camera2/JpegCompressor.cpp \ camera2/CaptureSequencer.cpp LOCAL_SHARED_LIBRARIES:= \ libui \ Loading @@ -30,10 +32,12 @@ LOCAL_SHARED_LIBRARIES:= \ libgui \ libhardware \ libsync \ libcamera_metadata libcamera_metadata \ libjpeg LOCAL_C_INCLUDES += \ system/media/camera/include system/media/camera/include \ external/jpeg LOCAL_MODULE:= libcameraservice Loading
services/camera/libcameraservice/Camera2Client.cpp +1 −3 Original line number Diff line number Diff line Loading @@ -25,14 +25,12 @@ #include <gui/SurfaceTextureClient.h> #include <gui/Surface.h> #include <media/hardware/MetadataBufferType.h> #include "Camera2Client.h" #include "camera2/Parameters.h" #define ALOG1(...) ALOGD_IF(gLogLevel >= 1, __VA_ARGS__); #define ALOG2(...) ALOGD_IF(gLogLevel >= 2, __VA_ARGS__); namespace android { using namespace camera2; static int getCallingPid() { Loading
services/camera/libcameraservice/camera2/BurstCapture.cpp 0 → 100644 +112 −0 Original line number Diff line number Diff line /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_NDEBUG 0 #define LOG_TAG "BurstCapture" #include <utils/Log.h> #include <utils/Trace.h> #include "BurstCapture.h" #include "JpegCompressor.h" #include "../Camera2Client.h" namespace android { namespace camera2 { BurstCapture::BurstCapture(wp<Camera2Client> client, wp<CaptureSequencer> sequencer): mCaptureStreamId(NO_STREAM), mClient(client), mSequencer(sequencer) { } BurstCapture::~BurstCapture() { } status_t BurstCapture::start(Vector<CameraMetadata> &metadatas, int32_t firstCaptureId) { ALOGE("Not completely implemented"); return INVALID_OPERATION; } void BurstCapture::onFrameAvailable() { ALOGV("%s", __FUNCTION__); Mutex::Autolock l(mInputMutex); if(!mInputChanged) { mInputChanged = true; mInputSignal.signal(); } } bool BurstCapture::threadLoop() { status_t res; { Mutex::Autolock l(mInputMutex); while(!mInputChanged) { res = mInputSignal.waitRelative(mInputMutex, kWaitDuration); if(res == TIMED_OUT) return true; } mInputChanged = false; } do { sp<Camera2Client> client = mClient.promote(); if(client == 0) return false; ALOGV("%s: Calling processFrameAvailable()", __FUNCTION__); res = processFrameAvailable(client); } while(res == OK); return true; } CpuConsumer::LockedBuffer* BurstCapture::jpegEncode( CpuConsumer::LockedBuffer *imgBuffer, int quality) { ALOGV("%s", __FUNCTION__); CpuConsumer::LockedBuffer *imgEncoded = new CpuConsumer::LockedBuffer; uint8_t *data = new uint8_t[ANDROID_JPEG_MAX_SIZE]; imgEncoded->data = data; imgEncoded->width = imgBuffer->width; imgEncoded->height = imgBuffer->height; imgEncoded->stride = imgBuffer->stride; Vector<CpuConsumer::LockedBuffer*> buffers; buffers.push_back(imgBuffer); buffers.push_back(imgEncoded); sp<JpegCompressor> jpeg = new JpegCompressor(); status_t res = jpeg->start(buffers, 1); bool success = jpeg->waitForDone(10 * 1e9); if(success) { return buffers[1]; } else { ALOGE("%s: JPEG encode timed out", __FUNCTION__); return NULL; // TODO: maybe change function return value to status_t } } status_t BurstCapture::processFrameAvailable(sp<Camera2Client> &client) { ALOGE("Not implemented"); return INVALID_OPERATION; } } // namespace camera2 } // namespace android