From 72dbc3152137ec7b77deddede4229f73149e92c8 Mon Sep 17 00:00:00 2001 From: Akwasi Boateng Date: Tue, 18 Oct 2011 17:41:42 -0500 Subject: CameraHAL: Fixed line endings and file attributes Replaced line endings to UNIX in CameraHAL-related sources. No code changes. Signed-off-by: Daniel Levin Signed-off-by: Jean Johnson Signed-off-by: Iliyan Malchev Change-Id: Id32c429fe7527342cfa2a7b9b1724e5f088dbd3f --- camera/CameraHalUtilClasses.cpp | 724 +++++++++++++++---------------- camera/MemoryManager.cpp | 316 +++++++------- camera/OMXCameraAdapter/OMXExif.cpp | 0 camera/inc/ANativeWindowDisplayAdapter.h | 378 ++++++++-------- camera/inc/CameraProperties.h | 396 ++++++++--------- camera/inc/Encoder_libjpeg.h | 0 camera/inc/TICameraParameters.h | 484 ++++++++++----------- 7 files changed, 1149 insertions(+), 1149 deletions(-) mode change 100755 => 100644 camera/OMXCameraAdapter/OMXExif.cpp mode change 100755 => 100644 camera/inc/Encoder_libjpeg.h (limited to 'camera') diff --git a/camera/CameraHalUtilClasses.cpp b/camera/CameraHalUtilClasses.cpp index 3074bc4..073c2b8 100644 --- a/camera/CameraHalUtilClasses.cpp +++ b/camera/CameraHalUtilClasses.cpp @@ -1,362 +1,362 @@ -/* - * Copyright (C) Texas Instruments - http://www.ti.com/ - * - * 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. - */ - -/** -* @file CameraHalUtilClasses.cpp -* -* This file maps the CameraHardwareInterface to the Camera interfaces on OMAP4 (mainly OMX). -* -*/ - -#define LOG_TAG "CameraHAL" - - -#include "CameraHal.h" - -namespace android { - -/*--------------------FrameProvider Class STARTS here-----------------------------*/ - -int FrameProvider::enableFrameNotification(int32_t frameTypes) -{ - LOG_FUNCTION_NAME; - status_t ret = NO_ERROR; - - ///Enable the frame notification to CameraAdapter (which implements FrameNotifier interface) - mFrameNotifier->enableMsgType(frameTypes<disableMsgType(frameTypes<returnFrame(frameBuf, frameType); - - return ret; -} - -void FrameProvider::addFramePointers(void *frameBuf, void *buf) -{ - mFrameNotifier->addFramePointers(frameBuf, buf); - return; -} - -void FrameProvider::removeFramePointers() -{ - mFrameNotifier->removeFramePointers(); - return; -} - -/*--------------------FrameProvider Class ENDS here-----------------------------*/ - -/*--------------------EventProvider Class STARTS here-----------------------------*/ - -int EventProvider::enableEventNotification(int32_t frameTypes) -{ - LOG_FUNCTION_NAME; - status_t ret = NO_ERROR; - - ///Enable the frame notification to CameraAdapter (which implements FrameNotifier interface) - mEventNotifier->enableMsgType(frameTypes<disableMsgType(frameTypes< weight ) || ( CameraArea::WEIGHT_MAX < weight ) ) { - CAMHAL_LOGEB("Camera area weight is invalid %d", weight); - return -EINVAL; - } - - if ( ( CameraArea::TOP > top ) || ( CameraArea::BOTTOM < top ) ) { - CAMHAL_LOGEB("Camera area top coordinate is invalid %d", top ); - return -EINVAL; - } - - if ( ( CameraArea::TOP > bottom ) || ( CameraArea::BOTTOM < bottom ) ) { - CAMHAL_LOGEB("Camera area bottom coordinate is invalid %d", bottom ); - return -EINVAL; - } - - if ( ( CameraArea::LEFT > left ) || ( CameraArea::RIGHT < left ) ) { - CAMHAL_LOGEB("Camera area left coordinate is invalid %d", left ); - return -EINVAL; - } - - if ( ( CameraArea::LEFT > right ) || ( CameraArea::RIGHT < right ) ) { - CAMHAL_LOGEB("Camera area right coordinate is invalid %d", right ); - return -EINVAL; - } - - if ( left >= right ) { - CAMHAL_LOGEA("Camera area left larger than right"); - return -EINVAL; - } - - if ( top >= bottom ) { - CAMHAL_LOGEA("Camera area top larger than bottom"); - return -EINVAL; - } - - return NO_ERROR; -} - -status_t CameraArea::parseAreas(const char *area, - size_t areaLength, - Vector< sp > &areas) -{ - status_t ret = NO_ERROR; - char *ctx; - char *pArea = NULL; - char *pStart = NULL; - char *pEnd = NULL; - const char *startToken = "("; - const char endToken = ')'; - const char sep = ','; - ssize_t top, left, bottom, right, weight; - char *tmpBuffer = NULL; - sp currentArea; - - LOG_FUNCTION_NAME - - if ( ( NULL == area ) || - ( 0 >= areaLength ) ) - { - return -EINVAL; - } - - tmpBuffer = ( char * ) malloc(areaLength); - if ( NULL == tmpBuffer ) - { - return -ENOMEM; - } - - memcpy(tmpBuffer, area, areaLength); - - pArea = strtok_r(tmpBuffer, startToken, &ctx); - - do - { - - pStart = pArea; - if ( NULL == pStart ) - { - CAMHAL_LOGEA("Parsing of the left area coordinate failed!"); - ret = -EINVAL; - break; - } - else - { - left = static_cast(strtol(pStart, &pEnd, 10)); - } - - if ( sep != *pEnd ) - { - CAMHAL_LOGEA("Parsing of the top area coordinate failed!"); - ret = -EINVAL; - break; - } - else - { - top = static_cast(strtol(pEnd+1, &pEnd, 10)); - } - - if ( sep != *pEnd ) - { - CAMHAL_LOGEA("Parsing of the right area coordinate failed!"); - ret = -EINVAL; - break; - } - else - { - right = static_cast(strtol(pEnd+1, &pEnd, 10)); - } - - if ( sep != *pEnd ) - { - CAMHAL_LOGEA("Parsing of the bottom area coordinate failed!"); - ret = -EINVAL; - break; - } - else - { - bottom = static_cast(strtol(pEnd+1, &pEnd, 10)); - } - - if ( sep != *pEnd ) - { - CAMHAL_LOGEA("Parsing of the weight area coordinate failed!"); - ret = -EINVAL; - break; - } - else - { - weight = static_cast(strtol(pEnd+1, &pEnd, 10)); - } - - if ( endToken != *pEnd ) - { - CAMHAL_LOGEA("Malformed area!"); - ret = -EINVAL; - break; - } - - ret = checkArea(top, left, bottom, right, weight); - if ( NO_ERROR != ret ) { - break; - } - - currentArea = new CameraArea(top, left, bottom, right, weight); - CAMHAL_LOGDB("Area parsed [%dx%d, %dx%d] %d", - ( int ) top, - ( int ) left, - ( int ) bottom, - ( int ) right, - ( int ) weight); - if ( NULL != currentArea.get() ) - { - areas.add(currentArea); - } - else - { - ret = -ENOMEM; - break; - } - - pArea = strtok_r(NULL, startToken, &ctx); - - } - while ( NULL != pArea ); - - if ( NULL != tmpBuffer ) - { - free(tmpBuffer); - } - - LOG_FUNCTION_NAME_EXIT - - return ret; -} - -bool CameraArea::areAreasDifferent(Vector< sp > &area1, - Vector< sp > &area2) { - if (area1.size() != area2.size()) { - return true; - } - - // not going to care about sorting order for now - for (int i = 0; i < area1.size(); i++) { - if (!area1.itemAt(i)->compare(area2.itemAt(i))) { - return true; - } - } - - return false; -} - -bool CameraArea::compare(const sp &area) { - return ((mTop == area->mTop) && (mLeft == area->mLeft) && - (mBottom == area->mBottom) && (mRight == area->mRight) && - (mWeight == area->mWeight)); -} - - -/*--------------------CameraArea Class ENDS here-----------------------------*/ - -}; +/* + * Copyright (C) Texas Instruments - http://www.ti.com/ + * + * 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. + */ + +/** +* @file CameraHalUtilClasses.cpp +* +* This file maps the CameraHardwareInterface to the Camera interfaces on OMAP4 (mainly OMX). +* +*/ + +#define LOG_TAG "CameraHAL" + + +#include "CameraHal.h" + +namespace android { + +/*--------------------FrameProvider Class STARTS here-----------------------------*/ + +int FrameProvider::enableFrameNotification(int32_t frameTypes) +{ + LOG_FUNCTION_NAME; + status_t ret = NO_ERROR; + + ///Enable the frame notification to CameraAdapter (which implements FrameNotifier interface) + mFrameNotifier->enableMsgType(frameTypes<disableMsgType(frameTypes<returnFrame(frameBuf, frameType); + + return ret; +} + +void FrameProvider::addFramePointers(void *frameBuf, void *buf) +{ + mFrameNotifier->addFramePointers(frameBuf, buf); + return; +} + +void FrameProvider::removeFramePointers() +{ + mFrameNotifier->removeFramePointers(); + return; +} + +/*--------------------FrameProvider Class ENDS here-----------------------------*/ + +/*--------------------EventProvider Class STARTS here-----------------------------*/ + +int EventProvider::enableEventNotification(int32_t frameTypes) +{ + LOG_FUNCTION_NAME; + status_t ret = NO_ERROR; + + ///Enable the frame notification to CameraAdapter (which implements FrameNotifier interface) + mEventNotifier->enableMsgType(frameTypes<disableMsgType(frameTypes< weight ) || ( CameraArea::WEIGHT_MAX < weight ) ) { + CAMHAL_LOGEB("Camera area weight is invalid %d", weight); + return -EINVAL; + } + + if ( ( CameraArea::TOP > top ) || ( CameraArea::BOTTOM < top ) ) { + CAMHAL_LOGEB("Camera area top coordinate is invalid %d", top ); + return -EINVAL; + } + + if ( ( CameraArea::TOP > bottom ) || ( CameraArea::BOTTOM < bottom ) ) { + CAMHAL_LOGEB("Camera area bottom coordinate is invalid %d", bottom ); + return -EINVAL; + } + + if ( ( CameraArea::LEFT > left ) || ( CameraArea::RIGHT < left ) ) { + CAMHAL_LOGEB("Camera area left coordinate is invalid %d", left ); + return -EINVAL; + } + + if ( ( CameraArea::LEFT > right ) || ( CameraArea::RIGHT < right ) ) { + CAMHAL_LOGEB("Camera area right coordinate is invalid %d", right ); + return -EINVAL; + } + + if ( left >= right ) { + CAMHAL_LOGEA("Camera area left larger than right"); + return -EINVAL; + } + + if ( top >= bottom ) { + CAMHAL_LOGEA("Camera area top larger than bottom"); + return -EINVAL; + } + + return NO_ERROR; +} + +status_t CameraArea::parseAreas(const char *area, + size_t areaLength, + Vector< sp > &areas) +{ + status_t ret = NO_ERROR; + char *ctx; + char *pArea = NULL; + char *pStart = NULL; + char *pEnd = NULL; + const char *startToken = "("; + const char endToken = ')'; + const char sep = ','; + ssize_t top, left, bottom, right, weight; + char *tmpBuffer = NULL; + sp currentArea; + + LOG_FUNCTION_NAME + + if ( ( NULL == area ) || + ( 0 >= areaLength ) ) + { + return -EINVAL; + } + + tmpBuffer = ( char * ) malloc(areaLength); + if ( NULL == tmpBuffer ) + { + return -ENOMEM; + } + + memcpy(tmpBuffer, area, areaLength); + + pArea = strtok_r(tmpBuffer, startToken, &ctx); + + do + { + + pStart = pArea; + if ( NULL == pStart ) + { + CAMHAL_LOGEA("Parsing of the left area coordinate failed!"); + ret = -EINVAL; + break; + } + else + { + left = static_cast(strtol(pStart, &pEnd, 10)); + } + + if ( sep != *pEnd ) + { + CAMHAL_LOGEA("Parsing of the top area coordinate failed!"); + ret = -EINVAL; + break; + } + else + { + top = static_cast(strtol(pEnd+1, &pEnd, 10)); + } + + if ( sep != *pEnd ) + { + CAMHAL_LOGEA("Parsing of the right area coordinate failed!"); + ret = -EINVAL; + break; + } + else + { + right = static_cast(strtol(pEnd+1, &pEnd, 10)); + } + + if ( sep != *pEnd ) + { + CAMHAL_LOGEA("Parsing of the bottom area coordinate failed!"); + ret = -EINVAL; + break; + } + else + { + bottom = static_cast(strtol(pEnd+1, &pEnd, 10)); + } + + if ( sep != *pEnd ) + { + CAMHAL_LOGEA("Parsing of the weight area coordinate failed!"); + ret = -EINVAL; + break; + } + else + { + weight = static_cast(strtol(pEnd+1, &pEnd, 10)); + } + + if ( endToken != *pEnd ) + { + CAMHAL_LOGEA("Malformed area!"); + ret = -EINVAL; + break; + } + + ret = checkArea(top, left, bottom, right, weight); + if ( NO_ERROR != ret ) { + break; + } + + currentArea = new CameraArea(top, left, bottom, right, weight); + CAMHAL_LOGDB("Area parsed [%dx%d, %dx%d] %d", + ( int ) top, + ( int ) left, + ( int ) bottom, + ( int ) right, + ( int ) weight); + if ( NULL != currentArea.get() ) + { + areas.add(currentArea); + } + else + { + ret = -ENOMEM; + break; + } + + pArea = strtok_r(NULL, startToken, &ctx); + + } + while ( NULL != pArea ); + + if ( NULL != tmpBuffer ) + { + free(tmpBuffer); + } + + LOG_FUNCTION_NAME_EXIT + + return ret; +} + +bool CameraArea::areAreasDifferent(Vector< sp > &area1, + Vector< sp > &area2) { + if (area1.size() != area2.size()) { + return true; + } + + // not going to care about sorting order for now + for (int i = 0; i < area1.size(); i++) { + if (!area1.itemAt(i)->compare(area2.itemAt(i))) { + return true; + } + } + + return false; +} + +bool CameraArea::compare(const sp &area) { + return ((mTop == area->mTop) && (mLeft == area->mLeft) && + (mBottom == area->mBottom) && (mRight == area->mRight) && + (mWeight == area->mWeight)); +} + + +/*--------------------CameraArea Class ENDS here-----------------------------*/ + +}; diff --git a/camera/MemoryManager.cpp b/camera/MemoryManager.cpp index 55675d9..9ce40b9 100644 --- a/camera/MemoryManager.cpp +++ b/camera/MemoryManager.cpp @@ -1,51 +1,51 @@ -/* - * Copyright (C) Texas Instruments - http://www.ti.com/ - * - * 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_TAG "CameraHAL" - - -#include "CameraHal.h" -#include "TICameraParameters.h" - -extern "C" { - +/* + * Copyright (C) Texas Instruments - http://www.ti.com/ + * + * 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_TAG "CameraHAL" + + +#include "CameraHal.h" +#include "TICameraParameters.h" + +extern "C" { + #include -//#include -//#include - - -}; - -namespace android { - -///@todo Move these constants to a common header file, preferably in tiler.h -#define STRIDE_8BIT (4 * 1024) -#define STRIDE_16BIT (4 * 1024) - -#define ALLOCATION_2D 2 - -///Utility Macro Declarations - -/*--------------------MemoryManager Class STARTS here-----------------------------*/ -void* MemoryManager::allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs) -{ - LOG_FUNCTION_NAME; +//#include +//#include + + +}; + +namespace android { + +///@todo Move these constants to a common header file, preferably in tiler.h +#define STRIDE_8BIT (4 * 1024) +#define STRIDE_16BIT (4 * 1024) + +#define ALLOCATION_2D 2 + +///Utility Macro Declarations + +/*--------------------MemoryManager Class STARTS here-----------------------------*/ +void* MemoryManager::allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs) +{ + LOG_FUNCTION_NAME; if(mIonFd == 0) { @@ -57,111 +57,111 @@ void* MemoryManager::allocateBuffer(int width, int height, const char* format, i } } - ///We allocate numBufs+1 because the last entry will be marked NULL to indicate end of array, which is used when freeing - ///the buffers - const uint numArrayEntriesC = (uint)(numBufs+1); - - ///Allocate a buffer array - uint32_t *bufsArr = new uint32_t [numArrayEntriesC]; - if(!bufsArr) - { - CAMHAL_LOGEB("Allocation failed when creating buffers array of %d uint32_t elements", numArrayEntriesC); - LOG_FUNCTION_NAME_EXIT; - return NULL; - } - - ///Initialize the array with zeros - this will help us while freeing the array in case of error - ///If a value of an array element is NULL, it means we didnt allocate it - memset(bufsArr, 0, sizeof(*bufsArr) * numArrayEntriesC); - + ///We allocate numBufs+1 because the last entry will be marked NULL to indicate end of array, which is used when freeing + ///the buffers + const uint numArrayEntriesC = (uint)(numBufs+1); + + ///Allocate a buffer array + uint32_t *bufsArr = new uint32_t [numArrayEntriesC]; + if(!bufsArr) + { + CAMHAL_LOGEB("Allocation failed when creating buffers array of %d uint32_t elements", numArrayEntriesC); + LOG_FUNCTION_NAME_EXIT; + return NULL; + } + + ///Initialize the array with zeros - this will help us while freeing the array in case of error + ///If a value of an array element is NULL, it means we didnt allocate it + memset(bufsArr, 0, sizeof(*bufsArr) * numArrayEntriesC); + //2D Allocations are not supported currently if(bytes != 0) - { + { struct ion_handle *handle; int mmap_fd; - ///1D buffers - for (int i = 0; i < numBufs; i++) - { + ///1D buffers + for (int i = 0; i < numBufs; i++) + { int ret = ion_alloc(mIonFd, bytes, 0, 1 << ION_HEAP_TYPE_CARVEOUT, &handle); if(ret < 0) - { + { CAMHAL_LOGEB("ion_alloc resulted in error %d", ret); - goto error; - } + goto error; + } CAMHAL_LOGDB("Before mapping, handle = %x, nSize = %d", handle, bytes); if ((ret = ion_map(mIonFd, handle, bytes, PROT_READ | PROT_WRITE, MAP_SHARED, 0, (unsigned char**)&bufsArr[i], &mmap_fd)) < 0) - { + { CAMHAL_LOGEB("Userspace mapping of ION buffers returned error %d", ret); ion_free(mIonFd, handle); goto error; - } + } mIonHandleMap.add(bufsArr[i], (unsigned int)handle); mIonFdMap.add(bufsArr[i], (unsigned int) mmap_fd); mIonBufLength.add(bufsArr[i], (unsigned int) bytes); - } - - } + } + + } else // If bytes is not zero, then it is a 2-D tiler buffer request - { - } - - LOG_FUNCTION_NAME_EXIT; - - return (void*)bufsArr; - + { + } + + LOG_FUNCTION_NAME_EXIT; + + return (void*)bufsArr; + error: LOGE("Freeing buffers already allocated after error occurred"); freeBuffer(bufsArr); - + if ( NULL != mErrorNotifier.get() ) { mErrorNotifier->errorNotify(-ENOMEM); } - + + LOG_FUNCTION_NAME_EXIT; + return NULL; +} + +//TODO: Get needed data to map tiler buffers +//Return dummy data for now +uint32_t * MemoryManager::getOffsets() +{ + LOG_FUNCTION_NAME; + LOG_FUNCTION_NAME_EXIT; + return NULL; -} - -//TODO: Get needed data to map tiler buffers -//Return dummy data for now -uint32_t * MemoryManager::getOffsets() -{ - LOG_FUNCTION_NAME; - - LOG_FUNCTION_NAME_EXIT; - - return NULL; -} - -int MemoryManager::getFd() -{ - LOG_FUNCTION_NAME; - - LOG_FUNCTION_NAME_EXIT; - - return -1; -} - -int MemoryManager::freeBuffer(void* buf) -{ - status_t ret = NO_ERROR; - LOG_FUNCTION_NAME; - - uint32_t *bufEntry = (uint32_t*)buf; - - if(!bufEntry) - { - CAMHAL_LOGEA("NULL pointer passed to freebuffer"); - LOG_FUNCTION_NAME_EXIT; - return BAD_VALUE; - } - - while(*bufEntry) - { +} + +int MemoryManager::getFd() +{ + LOG_FUNCTION_NAME; + + LOG_FUNCTION_NAME_EXIT; + + return -1; +} + +int MemoryManager::freeBuffer(void* buf) +{ + status_t ret = NO_ERROR; + LOG_FUNCTION_NAME; + + uint32_t *bufEntry = (uint32_t*)buf; + + if(!bufEntry) + { + CAMHAL_LOGEA("NULL pointer passed to freebuffer"); + LOG_FUNCTION_NAME_EXIT; + return BAD_VALUE; + } + + while(*bufEntry) + { unsigned int ptr = (unsigned int) *bufEntry++; if(mIonBufLength.valueFor(ptr)) { @@ -176,12 +176,12 @@ int MemoryManager::freeBuffer(void* buf) { CAMHAL_LOGEA("Not a valid Memory Manager buffer"); } - } - - ///@todo Check if this way of deleting array is correct, else use malloc/free - uint32_t * bufArr = (uint32_t*)buf; - delete [] bufArr; - + } + + ///@todo Check if this way of deleting array is correct, else use malloc/free + uint32_t * bufArr = (uint32_t*)buf; + delete [] bufArr; + if(mIonBufLength.size() == 0) { if(mIonFd) @@ -190,33 +190,33 @@ int MemoryManager::freeBuffer(void* buf) mIonFd = 0; } } - LOG_FUNCTION_NAME_EXIT; - return ret; -} - -status_t MemoryManager::setErrorHandler(ErrorNotifier *errorNotifier) -{ - status_t ret = NO_ERROR; - - LOG_FUNCTION_NAME; - - if ( NULL == errorNotifier ) - { - CAMHAL_LOGEA("Invalid Error Notifier reference"); - ret = -EINVAL; - } - - if ( NO_ERROR == ret ) - { - mErrorNotifier = errorNotifier; - } - - LOG_FUNCTION_NAME_EXIT; - - return ret; -} - -}; - - -/*--------------------MemoryManager Class ENDS here-----------------------------*/ + LOG_FUNCTION_NAME_EXIT; + return ret; +} + +status_t MemoryManager::setErrorHandler(ErrorNotifier *errorNotifier) +{ + status_t ret = NO_ERROR; + + LOG_FUNCTION_NAME; + + if ( NULL == errorNotifier ) + { + CAMHAL_LOGEA("Invalid Error Notifier reference"); + ret = -EINVAL; + } + + if ( NO_ERROR == ret ) + { + mErrorNotifier = errorNotifier; + } + + LOG_FUNCTION_NAME_EXIT; + + return ret; +} + +}; + + +/*--------------------MemoryManager Class ENDS here-----------------------------*/ diff --git a/camera/OMXCameraAdapter/OMXExif.cpp b/camera/OMXCameraAdapter/OMXExif.cpp old mode 100755 new mode 100644 diff --git a/camera/inc/ANativeWindowDisplayAdapter.h b/camera/inc/ANativeWindowDisplayAdapter.h index e4698d0..acab47c 100644 --- a/camera/inc/ANativeWindowDisplayAdapter.h +++ b/camera/inc/ANativeWindowDisplayAdapter.h @@ -1,189 +1,189 @@ -/* - * Copyright (C) Texas Instruments - http://www.ti.com/ - * - * 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. - */ - - - -#include "CameraHal.h" -#include -#include -#include - -//temporarily define format here -#define HAL_PIXEL_FORMAT_TI_NV12 0x100 - -namespace android { - -/** - * Display handler class - This class basically handles the buffer posting to display - */ - -class ANativeWindowDisplayAdapter : public DisplayAdapter -{ -public: - - typedef struct - { - void *mBuffer; - void *mUser; - int mOffset; - int mWidth; - int mHeight; - int mWidthStride; - int mHeightStride; - int mLength; - CameraFrame::FrameType mType; - } DisplayFrame; - - enum DisplayStates - { - DISPLAY_INIT = 0, - DISPLAY_STARTED, - DISPLAY_STOPPED, - DISPLAY_EXITED - }; - -public: - - ANativeWindowDisplayAdapter(); - virtual ~ANativeWindowDisplayAdapter(); - - ///Initializes the display adapter creates any resources required - virtual status_t initialize(); - - virtual int setPreviewWindow(struct preview_stream_ops *window); - virtual int setFrameProvider(FrameNotifier *frameProvider); - virtual int setErrorHandler(ErrorNotifier *errorNotifier); - virtual int enableDisplay(int width, int height, struct timeval *refTime = NULL, S3DParameters *s3dParams = NULL); - virtual int disableDisplay(bool cancel_buffer = true); - virtual status_t pauseDisplay(bool pause); - -#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS - - //Used for shot to snapshot measurement - virtual status_t setSnapshotTimeRef(struct timeval *refTime = NULL); - -#endif - - virtual int useBuffers(void* bufArr, int num); - virtual bool supportsExternalBuffering(); - - //Implementation of inherited interfaces - virtual void* allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs); - virtual uint32_t * getOffsets() ; - virtual int getFd() ; - virtual int freeBuffer(void* buf); - - virtual int maxQueueableBuffers(unsigned int& queueable); - - ///Class specific functions - static void frameCallbackRelay(CameraFrame* caFrame); - void frameCallback(CameraFrame* caFrame); - - void displayThread(); - - private: - void destroy(); - bool processHalMsg(); - status_t PostFrame(ANativeWindowDisplayAdapter::DisplayFrame &dispFrame); - bool handleFrameReturn(); - status_t returnBuffersToWindow(); - -public: - - static const int DISPLAY_TIMEOUT; - static const int FAILED_DQS_TO_SUSPEND; - - class DisplayThread : public Thread - { - ANativeWindowDisplayAdapter* mDisplayAdapter; - TIUTILS::MessageQueue mDisplayThreadQ; - - public: - DisplayThread(ANativeWindowDisplayAdapter* da) - : Thread(false), mDisplayAdapter(da) { } - - ///Returns a reference to the display message Q for display adapter to post messages - TIUTILS::MessageQueue& msgQ() - { - return mDisplayThreadQ; - } - - virtual bool threadLoop() - { - mDisplayAdapter->displayThread(); - return false; - } - - enum DisplayThreadCommands - { - DISPLAY_START, - DISPLAY_STOP, - DISPLAY_FRAME, - DISPLAY_EXIT - }; - }; - - //friend declarations -friend class DisplayThread; - -private: - int postBuffer(void* displayBuf); - -private: - bool mFirstInit; - bool mSuspend; - int mFailedDQs; - bool mPaused; //Pause state - preview_stream_ops_t* mANativeWindow; - sp mDisplayThread; - FrameProvider *mFrameProvider; ///Pointer to the frame provider interface - TIUTILS::MessageQueue mDisplayQ; - unsigned int mDisplayState; - ///@todo Have a common class for these members - mutable Mutex mLock; - bool mDisplayEnabled; - int mBufferCount; - buffer_handle_t** mBufferHandleMap; - IMG_native_handle_t** mGrallocHandleMap; - uint32_t* mOffsetsMap; - int mFD; - KeyedVector mFramesWithCameraAdapterMap; - sp mErrorNotifier; - - uint32_t mFrameWidth; - uint32_t mFrameHeight; - uint32_t mPreviewWidth; - uint32_t mPreviewHeight; - - uint32_t mXOff; - uint32_t mYOff; - - const char *mPixelFormat; - -#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS - //Used for calculating standby to first shot - struct timeval mStandbyToShot; - bool mMeasureStandby; - //Used for shot to snapshot/shot calculation - struct timeval mStartCapture; - bool mShotToShot; - -#endif - -}; - -}; - +/* + * Copyright (C) Texas Instruments - http://www.ti.com/ + * + * 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. + */ + + + +#include "CameraHal.h" +#include +#include +#include + +//temporarily define format here +#define HAL_PIXEL_FORMAT_TI_NV12 0x100 + +namespace android { + +/** + * Display handler class - This class basically handles the buffer posting to display + */ + +class ANativeWindowDisplayAdapter : public DisplayAdapter +{ +public: + + typedef struct + { + void *mBuffer; + void *mUser; + int mOffset; + int mWidth; + int mHeight; + int mWidthStride; + int mHeightStride; + int mLength; + CameraFrame::FrameType mType; + } DisplayFrame; + + enum DisplayStates + { + DISPLAY_INIT = 0, + DISPLAY_STARTED, + DISPLAY_STOPPED, + DISPLAY_EXITED + }; + +public: + + ANativeWindowDisplayAdapter(); + virtual ~ANativeWindowDisplayAdapter(); + + ///Initializes the display adapter creates any resources required + virtual status_t initialize(); + + virtual int setPreviewWindow(struct preview_stream_ops *window); + virtual int setFrameProvider(FrameNotifier *frameProvider); + virtual int setErrorHandler(ErrorNotifier *errorNotifier); + virtual int enableDisplay(int width, int height, struct timeval *refTime = NULL, S3DParameters *s3dParams = NULL); + virtual int disableDisplay(bool cancel_buffer = true); + virtual status_t pauseDisplay(bool pause); + +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + + //Used for shot to snapshot measurement + virtual status_t setSnapshotTimeRef(struct timeval *refTime = NULL); + +#endif + + virtual int useBuffers(void* bufArr, int num); + virtual bool supportsExternalBuffering(); + + //Implementation of inherited interfaces + virtual void* allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs); + virtual uint32_t * getOffsets() ; + virtual int getFd() ; + virtual int freeBuffer(void* buf); + + virtual int maxQueueableBuffers(unsigned int& queueable); + + ///Class specific functions + static void frameCallbackRelay(CameraFrame* caFrame); + void frameCallback(CameraFrame* caFrame); + + void displayThread(); + + private: + void destroy(); + bool processHalMsg(); + status_t PostFrame(ANativeWindowDisplayAdapter::DisplayFrame &dispFrame); + bool handleFrameReturn(); + status_t returnBuffersToWindow(); + +public: + + static const int DISPLAY_TIMEOUT; + static const int FAILED_DQS_TO_SUSPEND; + + class DisplayThread : public Thread + { + ANativeWindowDisplayAdapter* mDisplayAdapter; + TIUTILS::MessageQueue mDisplayThreadQ; + + public: + DisplayThread(ANativeWindowDisplayAdapter* da) + : Thread(false), mDisplayAdapter(da) { } + + ///Returns a reference to the display message Q for display adapter to post messages + TIUTILS::MessageQueue& msgQ() + { + return mDisplayThreadQ; + } + + virtual bool threadLoop() + { + mDisplayAdapter->displayThread(); + return false; + } + + enum DisplayThreadCommands + { + DISPLAY_START, + DISPLAY_STOP, + DISPLAY_FRAME, + DISPLAY_EXIT + }; + }; + + //friend declarations +friend class DisplayThread; + +private: + int postBuffer(void* displayBuf); + +private: + bool mFirstInit; + bool mSuspend; + int mFailedDQs; + bool mPaused; //Pause state + preview_stream_ops_t* mANativeWindow; + sp mDisplayThread; + FrameProvider *mFrameProvider; ///Pointer to the frame provider interface + TIUTILS::MessageQueue mDisplayQ; + unsigned int mDisplayState; + ///@todo Have a common class for these members + mutable Mutex mLock; + bool mDisplayEnabled; + int mBufferCount; + buffer_handle_t** mBufferHandleMap; + IMG_native_handle_t** mGrallocHandleMap; + uint32_t* mOffsetsMap; + int mFD; + KeyedVector mFramesWithCameraAdapterMap; + sp mErrorNotifier; + + uint32_t mFrameWidth; + uint32_t mFrameHeight; + uint32_t mPreviewWidth; + uint32_t mPreviewHeight; + + uint32_t mXOff; + uint32_t mYOff; + + const char *mPixelFormat; + +#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS + //Used for calculating standby to first shot + struct timeval mStandbyToShot; + bool mMeasureStandby; + //Used for shot to snapshot/shot calculation + struct timeval mStartCapture; + bool mShotToShot; + +#endif + +}; + +}; + diff --git a/camera/inc/CameraProperties.h b/camera/inc/CameraProperties.h index a220af7..6f05877 100644 --- a/camera/inc/CameraProperties.h +++ b/camera/inc/CameraProperties.h @@ -1,198 +1,198 @@ -/* - * Copyright (C) Texas Instruments - http://www.ti.com/ - * - * 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. - */ - - - - -#ifndef CAMERA_PROPERTIES_H -#define CAMERA_PROPERTIES_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include "cutils/properties.h" - -namespace android { - -#define MAX_CAMERAS_SUPPORTED 2 -#define MAX_SIMUL_CAMERAS_SUPPORTED 1 -#define MAX_PROP_NAME_LENGTH 50 -#define MAX_PROP_VALUE_LENGTH 2048 - -#define EXIF_MAKE_DEFAULT "default_make" -#define EXIF_MODEL_DEFAULT "default_model" - -// Class that handles the Camera Properties -class CameraProperties -{ -public: - static const char INVALID[]; - static const char CAMERA_NAME[]; - static const char CAMERA_SENSOR_INDEX[]; - static const char ORIENTATION_INDEX[]; - static const char FACING_INDEX[]; - static const char S3D_SUPPORTED[]; - static const char SUPPORTED_PREVIEW_SIZES[]; - static const char SUPPORTED_PREVIEW_FORMATS[]; - static const char SUPPORTED_PREVIEW_FRAME_RATES[]; - static const char SUPPORTED_PICTURE_SIZES[]; - static const char SUPPORTED_PICTURE_FORMATS[]; - static const char SUPPORTED_THUMBNAIL_SIZES[]; - static const char SUPPORTED_WHITE_BALANCE[]; - static const char SUPPORTED_EFFECTS[]; - static const char SUPPORTED_ANTIBANDING[]; - static const char SUPPORTED_EXPOSURE_MODES[]; - static const char SUPPORTED_EV_MIN[]; - static const char SUPPORTED_EV_MAX[]; - static const char SUPPORTED_EV_STEP[]; - static const char SUPPORTED_ISO_VALUES[]; - static const char SUPPORTED_SCENE_MODES[]; - static const char SUPPORTED_FLASH_MODES[]; - static const char SUPPORTED_FOCUS_MODES[]; - static const char REQUIRED_PREVIEW_BUFS[]; - static const char REQUIRED_IMAGE_BUFS[]; - static const char SUPPORTED_ZOOM_RATIOS[]; - static const char SUPPORTED_ZOOM_STAGES[]; - static const char SUPPORTED_IPP_MODES[]; - static const char SMOOTH_ZOOM_SUPPORTED[]; - static const char ZOOM_SUPPORTED[]; - static const char PREVIEW_SIZE[]; - static const char PREVIEW_FORMAT[]; - static const char PREVIEW_FRAME_RATE[]; - static const char ZOOM[]; - static const char PICTURE_SIZE[]; - static const char PICTURE_FORMAT[]; - static const char JPEG_THUMBNAIL_SIZE[]; - static const char WHITEBALANCE[]; - static const char EFFECT[]; - static const char ANTIBANDING[]; - static const char EXPOSURE_MODE[]; - static const char EV_COMPENSATION[]; - static const char ISO_MODE[]; - static const char FOCUS_MODE[]; - static const char SCENE_MODE[]; - static const char FLASH_MODE[]; - static const char JPEG_QUALITY[]; - static const char BRIGHTNESS[]; - static const char SATURATION[]; - static const char SHARPNESS[]; - static const char CONTRAST[]; - static const char IPP[]; - static const char GBCE[]; - static const char AUTOCONVERGENCE[]; - static const char AUTOCONVERGENCE_MODE[]; - static const char MANUALCONVERGENCE_VALUES[]; - static const char SENSOR_ORIENTATION[]; - static const char SENSOR_ORIENTATION_VALUES[]; - static const char REVISION[]; - static const char FOCAL_LENGTH[]; - static const char HOR_ANGLE[]; - static const char VER_ANGLE[]; - static const char EXIF_MAKE[]; - static const char EXIF_MODEL[]; - static const char JPEG_THUMBNAIL_QUALITY[]; - static const char MAX_FOCUS_AREAS[]; - static const char MAX_FD_HW_FACES[]; - static const char MAX_FD_SW_FACES[]; - - static const char PARAMS_DELIMITER []; - - static const char S3D2D_PREVIEW[]; - static const char S3D2D_PREVIEW_MODES[]; - static const char VSTAB[]; - static const char VSTAB_SUPPORTED[]; - static const char FRAMERATE_RANGE[]; - static const char FRAMERATE_RANGE_IMAGE[]; - static const char FRAMERATE_RANGE_VIDEO[]; - static const char FRAMERATE_RANGE_SUPPORTED[]; - - static const char DEFAULT_VALUE[]; - - static const char AUTO_EXPOSURE_LOCK[]; - static const char AUTO_EXPOSURE_LOCK_SUPPORTED[]; - static const char AUTO_WHITEBALANCE_LOCK[]; - static const char AUTO_WHITEBALANCE_LOCK_SUPPORTED[]; - static const char MAX_NUM_METERING_AREAS[]; - static const char METERING_AREAS[]; - static const char MAX_NUM_FOCUS_AREAS[]; - - static const char VIDEO_SNAPSHOT_SUPPORTED[]; - - static const char VIDEO_SIZE[]; - static const char SUPPORTED_VIDEO_SIZES[]; - static const char PREFERRED_PREVIEW_SIZE_FOR_VIDEO[]; - - CameraProperties(); - ~CameraProperties(); - - // container class passed around for accessing properties - class Properties - { - public: - Properties() - { - mProperties = new DefaultKeyedVector(String8(DEFAULT_VALUE)); - char property[PROPERTY_VALUE_MAX]; - property_get("ro.product.manufacturer", property, EXIF_MAKE_DEFAULT); - property[0] = toupper(property[0]); - set(EXIF_MAKE, property); - property_get("ro.product.model", property, EXIF_MODEL_DEFAULT); - property[0] = toupper(property[0]); - set(EXIF_MODEL, property); - } - ~Properties() - { - delete mProperties; - } - ssize_t set(const char *prop, const char *value); - ssize_t set(const char *prop, int value); - const char* get(const char * prop); - void dump(); - - protected: - const char* keyAt(unsigned int); - const char* valueAt(unsigned int); - - private: - DefaultKeyedVector* mProperties; - - }; - - ///Initializes the CameraProperties class - status_t initialize(); - status_t loadProperties(); - int camerasSupported(); - int getProperties(int cameraIndex, Properties** properties); - -private: - - uint32_t mCamerasSupported; - int mInitialized; - mutable Mutex mLock; - - Properties mCameraProps[MAX_CAMERAS_SUPPORTED]; - -}; - -}; - -#endif //CAMERA_PROPERTIES_H - +/* + * Copyright (C) Texas Instruments - http://www.ti.com/ + * + * 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. + */ + + + + +#ifndef CAMERA_PROPERTIES_H +#define CAMERA_PROPERTIES_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "cutils/properties.h" + +namespace android { + +#define MAX_CAMERAS_SUPPORTED 2 +#define MAX_SIMUL_CAMERAS_SUPPORTED 1 +#define MAX_PROP_NAME_LENGTH 50 +#define MAX_PROP_VALUE_LENGTH 2048 + +#define EXIF_MAKE_DEFAULT "default_make" +#define EXIF_MODEL_DEFAULT "default_model" + +// Class that handles the Camera Properties +class CameraProperties +{ +public: + static const char INVALID[]; + static const char CAMERA_NAME[]; + static const char CAMERA_SENSOR_INDEX[]; + static const char ORIENTATION_INDEX[]; + static const char FACING_INDEX[]; + static const char S3D_SUPPORTED[]; + static const char SUPPORTED_PREVIEW_SIZES[]; + static const char SUPPORTED_PREVIEW_FORMATS[]; + static const char SUPPORTED_PREVIEW_FRAME_RATES[]; + static const char SUPPORTED_PICTURE_SIZES[]; + static const char SUPPORTED_PICTURE_FORMATS[]; + static const char SUPPORTED_THUMBNAIL_SIZES[]; + static const char SUPPORTED_WHITE_BALANCE[]; + static const char SUPPORTED_EFFECTS[]; + static const char SUPPORTED_ANTIBANDING[]; + static const char SUPPORTED_EXPOSURE_MODES[]; + static const char SUPPORTED_EV_MIN[]; + static const char SUPPORTED_EV_MAX[]; + static const char SUPPORTED_EV_STEP[]; + static const char SUPPORTED_ISO_VALUES[]; + static const char SUPPORTED_SCENE_MODES[]; + static const char SUPPORTED_FLASH_MODES[]; + static const char SUPPORTED_FOCUS_MODES[]; + static const char REQUIRED_PREVIEW_BUFS[]; + static const char REQUIRED_IMAGE_BUFS[]; + static const char SUPPORTED_ZOOM_RATIOS[]; + static const char SUPPORTED_ZOOM_STAGES[]; + static const char SUPPORTED_IPP_MODES[]; + static const char SMOOTH_ZOOM_SUPPORTED[]; + static const char ZOOM_SUPPORTED[]; + static const char PREVIEW_SIZE[]; + static const char PREVIEW_FORMAT[]; + static const char PREVIEW_FRAME_RATE[]; + static const char ZOOM[]; + static const char PICTURE_SIZE[]; + static const char PICTURE_FORMAT[]; + static const char JPEG_THUMBNAIL_SIZE[]; + static const char WHITEBALANCE[]; + static const char EFFECT[]; + static const char ANTIBANDING[]; + static const char EXPOSURE_MODE[]; + static const char EV_COMPENSATION[]; + static const char ISO_MODE[]; + static const char FOCUS_MODE[]; + static const char SCENE_MODE[]; + static const char FLASH_MODE[]; + static const char JPEG_QUALITY[]; + static const char BRIGHTNESS[]; + static const char SATURATION[]; + static const char SHARPNESS[]; + static const char CONTRAST[]; + static const char IPP[]; + static const char GBCE[]; + static const char AUTOCONVERGENCE[]; + static const char AUTOCONVERGENCE_MODE[]; + static const char MANUALCONVERGENCE_VALUES[]; + static const char SENSOR_ORIENTATION[]; + static const char SENSOR_ORIENTATION_VALUES[]; + static const char REVISION[]; + static const char FOCAL_LENGTH[]; + static const char HOR_ANGLE[]; + static const char VER_ANGLE[]; + static const char EXIF_MAKE[]; + static const char EXIF_MODEL[]; + static const char JPEG_THUMBNAIL_QUALITY[]; + static const char MAX_FOCUS_AREAS[]; + static const char MAX_FD_HW_FACES[]; + static const char MAX_FD_SW_FACES[]; + + static const char PARAMS_DELIMITER []; + + static const char S3D2D_PREVIEW[]; + static const char S3D2D_PREVIEW_MODES[]; + static const char VSTAB[]; + static const char VSTAB_SUPPORTED[]; + static const char FRAMERATE_RANGE[]; + static const char FRAMERATE_RANGE_IMAGE[]; + static const char FRAMERATE_RANGE_VIDEO[]; + static const char FRAMERATE_RANGE_SUPPORTED[]; + + static const char DEFAULT_VALUE[]; + + static const char AUTO_EXPOSURE_LOCK[]; + static const char AUTO_EXPOSURE_LOCK_SUPPORTED[]; + static const char AUTO_WHITEBALANCE_LOCK[]; + static const char AUTO_WHITEBALANCE_LOCK_SUPPORTED[]; + static const char MAX_NUM_METERING_AREAS[]; + static const char METERING_AREAS[]; + static const char MAX_NUM_FOCUS_AREAS[]; + + static const char VIDEO_SNAPSHOT_SUPPORTED[]; + + static const char VIDEO_SIZE[]; + static const char SUPPORTED_VIDEO_SIZES[]; + static const char PREFERRED_PREVIEW_SIZE_FOR_VIDEO[]; + + CameraProperties(); + ~CameraProperties(); + + // container class passed around for accessing properties + class Properties + { + public: + Properties() + { + mProperties = new DefaultKeyedVector(String8(DEFAULT_VALUE)); + char property[PROPERTY_VALUE_MAX]; + property_get("ro.product.manufacturer", property, EXIF_MAKE_DEFAULT); + property[0] = toupper(property[0]); + set(EXIF_MAKE, property); + property_get("ro.product.model", property, EXIF_MODEL_DEFAULT); + property[0] = toupper(property[0]); + set(EXIF_MODEL, property); + } + ~Properties() + { + delete mProperties; + } + ssize_t set(const char *prop, const char *value); + ssize_t set(const char *prop, int value); + const char* get(const char * prop); + void dump(); + + protected: + const char* keyAt(unsigned int); + const char* valueAt(unsigned int); + + private: + DefaultKeyedVector* mProperties; + + }; + + ///Initializes the CameraProperties class + status_t initialize(); + status_t loadProperties(); + int camerasSupported(); + int getProperties(int cameraIndex, Properties** properties); + +private: + + uint32_t mCamerasSupported; + int mInitialized; + mutable Mutex mLock; + + Properties mCameraProps[MAX_CAMERAS_SUPPORTED]; + +}; + +}; + +#endif //CAMERA_PROPERTIES_H + diff --git a/camera/inc/Encoder_libjpeg.h b/camera/inc/Encoder_libjpeg.h old mode 100755 new mode 100644 diff --git a/camera/inc/TICameraParameters.h b/camera/inc/TICameraParameters.h index 633e5b6..4701cae 100644 --- a/camera/inc/TICameraParameters.h +++ b/camera/inc/TICameraParameters.h @@ -1,242 +1,242 @@ -/* - * Copyright (C) Texas Instruments - http://www.ti.com/ - * - * 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. - */ - - - - -#ifndef TI_CAMERA_PARAMETERS_H -#define TI_CAMERA_PARAMETERS_H - -#include -#include - -namespace android { - -///TI Specific Camera Parameters -class TICameraParameters -{ -public: - -// Supported Camera indexes -// Example value: "0,1,2,3", where 0-primary, 1-secondary1, 2-secondary2, 3-sterocamera -static const char KEY_SUPPORTED_CAMERAS[]; -// Select logical Camera index -static const char KEY_CAMERA[]; -static const char KEY_CAMERA_NAME[]; -static const char KEY_S3D_SUPPORTED[]; -static const char KEY_BURST[]; -static const char KEY_CAP_MODE[]; -static const char KEY_VNF[]; -static const char KEY_SATURATION[]; -static const char KEY_BRIGHTNESS[]; -static const char KEY_EXPOSURE_MODE[]; -static const char KEY_SUPPORTED_EXPOSURE[]; -static const char KEY_CONTRAST[]; -static const char KEY_SHARPNESS[]; -static const char KEY_ISO[]; -static const char KEY_SUPPORTED_ISO_VALUES[]; -static const char KEY_SUPPORTED_IPP[]; -static const char KEY_IPP[]; -static const char KEY_MAN_EXPOSURE[]; -static const char KEY_METERING_MODE[]; -static const char KEY_PADDED_WIDTH[]; -static const char KEY_PADDED_HEIGHT[]; -static const char KEY_EXP_BRACKETING_RANGE[]; -static const char KEY_TEMP_BRACKETING[]; -static const char KEY_TEMP_BRACKETING_RANGE_POS[]; -static const char KEY_TEMP_BRACKETING_RANGE_NEG[]; -static const char KEY_SHUTTER_ENABLE[]; -static const char KEY_MEASUREMENT_ENABLE[]; -static const char KEY_INITIAL_VALUES[]; -static const char KEY_GBCE[]; -static const char KEY_GLBCE[]; -static const char KEY_MINFRAMERATE[]; -static const char KEY_MAXFRAMERATE[]; - -// TI recording hint to notify camera adapters of possible recording -static const char KEY_RECORDING_HINT[]; -static const char KEY_AUTO_FOCUS_LOCK[]; -static const char KEY_CURRENT_ISO[]; - -static const char KEY_SENSOR_ORIENTATION[]; -static const char KEY_SENSOR_ORIENTATION_VALUES[]; - -//TI extensions for zoom -static const char ZOOM_SUPPORTED[]; -static const char ZOOM_UNSUPPORTED[]; - -//TI extensions for camera capabilies -static const char INITIAL_VALUES_TRUE[]; -static const char INITIAL_VALUES_FALSE[]; - -//TI extensions for enabling/disabling measurements -static const char MEASUREMENT_ENABLE[]; -static const char MEASUREMENT_DISABLE[]; - -// TI extensions to add values for ManualConvergence and AutoConvergence mode -static const char KEY_AUTOCONVERGENCE[]; -static const char KEY_AUTOCONVERGENCE_MODE[]; -static const char KEY_MANUALCONVERGENCE_VALUES[]; - -//TI extensions for enabling/disabling GLBCE -static const char GLBCE_ENABLE[]; -static const char GLBCE_DISABLE[]; - -//TI extensions for enabling/disabling GBCE -static const char GBCE_ENABLE[]; -static const char GBCE_DISABLE[]; - -// TI extensions to add Min frame rate Values -static const char VIDEO_MINFRAMERATE_5[]; -static const char VIDEO_MINFRAMERATE_10[]; -static const char VIDEO_MINFRAMERATE_15[]; -static const char VIDEO_MINFRAMERATE_20[]; -static const char VIDEO_MINFRAMERATE_24[]; -static const char VIDEO_MINFRAMERATE_25[]; -static const char VIDEO_MINFRAMERATE_30[]; -static const char VIDEO_MINFRAMERATE_33[]; - -// TI extensions for Manual Gain and Manual Exposure -static const char KEY_MANUAL_EXPOSURE_LEFT[]; -static const char KEY_MANUAL_EXPOSURE_RIGHT[]; -static const char KEY_MANUAL_EXPOSURE_MODES[]; -static const char KEY_MANUAL_GAIN_EV_RIGHT[]; -static const char KEY_MANUAL_GAIN_EV_LEFT[]; -static const char KEY_MANUAL_GAIN_ISO_RIGHT[]; -static const char KEY_MANUAL_GAIN_ISO_LEFT[]; -static const char KEY_MANUAL_GAIN_MODES[]; - -//TI extensions for setting EXIF tags -static const char KEY_EXIF_MODEL[]; -static const char KEY_EXIF_MAKE[]; - -//TI extensions for additional GPS data -static const char KEY_GPS_MAPDATUM[]; -static const char KEY_GPS_VERSION[]; -static const char KEY_GPS_DATESTAMP[]; - -//TI extensions for enabling/disabling shutter sound -static const char SHUTTER_ENABLE[]; -static const char SHUTTER_DISABLE[]; - -//TI extensions for Temporal bracketing -static const char BRACKET_ENABLE[]; -static const char BRACKET_DISABLE[]; - -//TI extensions to Image post-processing -static const char IPP_LDCNSF[]; -static const char IPP_LDC[]; -static const char IPP_NSF[]; -static const char IPP_NONE[]; - -//TI extensions to camera mode -static const char HIGH_PERFORMANCE_MODE[]; -static const char HIGH_QUALITY_MODE[]; -static const char HIGH_QUALITY_ZSL_MODE[]; -static const char VIDEO_MODE[]; - - -// TI extensions to standard android pixel formats -static const char PIXEL_FORMAT_RAW[]; -static const char PIXEL_FORMAT_JPS[]; -static const char PIXEL_FORMAT_MPO[]; -static const char PIXEL_FORMAT_RAW_JPEG[]; -static const char PIXEL_FORMAT_RAW_MPO[]; - -// TI extensions to standard android scene mode settings -static const char SCENE_MODE_SPORT[]; -static const char SCENE_MODE_CLOSEUP[]; -static const char SCENE_MODE_AQUA[]; -static const char SCENE_MODE_SNOWBEACH[]; -static const char SCENE_MODE_MOOD[]; -static const char SCENE_MODE_NIGHT_INDOOR[]; -static const char SCENE_MODE_DOCUMENT[]; -static const char SCENE_MODE_BARCODE[]; -static const char SCENE_MODE_VIDEO_SUPER_NIGHT[]; -static const char SCENE_MODE_VIDEO_CINE[]; -static const char SCENE_MODE_VIDEO_OLD_FILM[]; - -// TI extensions to standard android white balance settings. -static const char WHITE_BALANCE_TUNGSTEN[]; -static const char WHITE_BALANCE_HORIZON[]; -static const char WHITE_BALANCE_SUNSET[]; -static const char WHITE_BALANCE_FACE[]; - -// TI extensions to add exposure preset modes to android api -static const char EXPOSURE_MODE_OFF[]; -static const char EXPOSURE_MODE_AUTO[]; -static const char EXPOSURE_MODE_NIGHT[]; -static const char EXPOSURE_MODE_BACKLIGHT[]; -static const char EXPOSURE_MODE_SPOTLIGHT[]; -static const char EXPOSURE_MODE_SPORTS[]; -static const char EXPOSURE_MODE_SNOW[]; -static const char EXPOSURE_MODE_BEACH[]; -static const char EXPOSURE_MODE_APERTURE[]; -static const char EXPOSURE_MODE_SMALL_APERTURE[]; -static const char EXPOSURE_MODE_FACE[]; - -// TI extensions to standard android focus presets. -static const char FOCUS_MODE_PORTRAIT[]; -static const char FOCUS_MODE_EXTENDED[]; -static const char FOCUS_MODE_FACE[]; - -// TI extensions to add iso values -static const char ISO_MODE_AUTO[]; -static const char ISO_MODE_100[]; -static const char ISO_MODE_200[]; -static const char ISO_MODE_400[]; -static const char ISO_MODE_800[]; -static const char ISO_MODE_1000[]; -static const char ISO_MODE_1200[]; -static const char ISO_MODE_1600[]; - -// TI extensions to add values for effect settings. -static const char EFFECT_NATURAL[]; -static const char EFFECT_VIVID[]; -static const char EFFECT_COLOR_SWAP[]; -static const char EFFECT_BLACKWHITE[]; - -static const char KEY_S3D2D_PREVIEW[]; -static const char KEY_S3D2D_PREVIEW_MODE[]; - -// TI extensions to add values for AutoConvergence settings. -static const char AUTOCONVERGENCE_MODE_DISABLE[]; -static const char AUTOCONVERGENCE_MODE_FRAME[]; -static const char AUTOCONVERGENCE_MODE_CENTER[]; -static const char AUTOCONVERGENCE_MODE_FFT[]; -static const char AUTOCONVERGENCE_MODE_MANUAL[]; - - -//TI extensions for flash mode settings -static const char FLASH_MODE_FILL_IN[]; - -//TI extensions to add sensor orientation parameters -static const char ORIENTATION_SENSOR_NONE[]; -static const char ORIENTATION_SENSOR_90[]; -static const char ORIENTATION_SENSOR_180[]; -static const char ORIENTATION_SENSOR_270[]; - - -//TI values for camera direction -static const char FACING_FRONT[]; -static const char FACING_BACK[]; - -}; - -}; - -#endif - +/* + * Copyright (C) Texas Instruments - http://www.ti.com/ + * + * 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. + */ + + + + +#ifndef TI_CAMERA_PARAMETERS_H +#define TI_CAMERA_PARAMETERS_H + +#include +#include + +namespace android { + +///TI Specific Camera Parameters +class TICameraParameters +{ +public: + +// Supported Camera indexes +// Example value: "0,1,2,3", where 0-primary, 1-secondary1, 2-secondary2, 3-sterocamera +static const char KEY_SUPPORTED_CAMERAS[]; +// Select logical Camera index +static const char KEY_CAMERA[]; +static const char KEY_CAMERA_NAME[]; +static const char KEY_S3D_SUPPORTED[]; +static const char KEY_BURST[]; +static const char KEY_CAP_MODE[]; +static const char KEY_VNF[]; +static const char KEY_SATURATION[]; +static const char KEY_BRIGHTNESS[]; +static const char KEY_EXPOSURE_MODE[]; +static const char KEY_SUPPORTED_EXPOSURE[]; +static const char KEY_CONTRAST[]; +static const char KEY_SHARPNESS[]; +static const char KEY_ISO[]; +static const char KEY_SUPPORTED_ISO_VALUES[]; +static const char KEY_SUPPORTED_IPP[]; +static const char KEY_IPP[]; +static const char KEY_MAN_EXPOSURE[]; +static const char KEY_METERING_MODE[]; +static const char KEY_PADDED_WIDTH[]; +static const char KEY_PADDED_HEIGHT[]; +static const char KEY_EXP_BRACKETING_RANGE[]; +static const char KEY_TEMP_BRACKETING[]; +static const char KEY_TEMP_BRACKETING_RANGE_POS[]; +static const char KEY_TEMP_BRACKETING_RANGE_NEG[]; +static const char KEY_SHUTTER_ENABLE[]; +static const char KEY_MEASUREMENT_ENABLE[]; +static const char KEY_INITIAL_VALUES[]; +static const char KEY_GBCE[]; +static const char KEY_GLBCE[]; +static const char KEY_MINFRAMERATE[]; +static const char KEY_MAXFRAMERATE[]; + +// TI recording hint to notify camera adapters of possible recording +static const char KEY_RECORDING_HINT[]; +static const char KEY_AUTO_FOCUS_LOCK[]; +static const char KEY_CURRENT_ISO[]; + +static const char KEY_SENSOR_ORIENTATION[]; +static const char KEY_SENSOR_ORIENTATION_VALUES[]; + +//TI extensions for zoom +static const char ZOOM_SUPPORTED[]; +static const char ZOOM_UNSUPPORTED[]; + +//TI extensions for camera capabilies +static const char INITIAL_VALUES_TRUE[]; +static const char INITIAL_VALUES_FALSE[]; + +//TI extensions for enabling/disabling measurements +static const char MEASUREMENT_ENABLE[]; +static const char MEASUREMENT_DISABLE[]; + +// TI extensions to add values for ManualConvergence and AutoConvergence mode +static const char KEY_AUTOCONVERGENCE[]; +static const char KEY_AUTOCONVERGENCE_MODE[]; +static const char KEY_MANUALCONVERGENCE_VALUES[]; + +//TI extensions for enabling/disabling GLBCE +static const char GLBCE_ENABLE[]; +static const char GLBCE_DISABLE[]; + +//TI extensions for enabling/disabling GBCE +static const char GBCE_ENABLE[]; +static const char GBCE_DISABLE[]; + +// TI extensions to add Min frame rate Values +static const char VIDEO_MINFRAMERATE_5[]; +static const char VIDEO_MINFRAMERATE_10[]; +static const char VIDEO_MINFRAMERATE_15[]; +static const char VIDEO_MINFRAMERATE_20[]; +static const char VIDEO_MINFRAMERATE_24[]; +static const char VIDEO_MINFRAMERATE_25[]; +static const char VIDEO_MINFRAMERATE_30[]; +static const char VIDEO_MINFRAMERATE_33[]; + +// TI extensions for Manual Gain and Manual Exposure +static const char KEY_MANUAL_EXPOSURE_LEFT[]; +static const char KEY_MANUAL_EXPOSURE_RIGHT[]; +static const char KEY_MANUAL_EXPOSURE_MODES[]; +static const char KEY_MANUAL_GAIN_EV_RIGHT[]; +static const char KEY_MANUAL_GAIN_EV_LEFT[]; +static const char KEY_MANUAL_GAIN_ISO_RIGHT[]; +static const char KEY_MANUAL_GAIN_ISO_LEFT[]; +static const char KEY_MANUAL_GAIN_MODES[]; + +//TI extensions for setting EXIF tags +static const char KEY_EXIF_MODEL[]; +static const char KEY_EXIF_MAKE[]; + +//TI extensions for additional GPS data +static const char KEY_GPS_MAPDATUM[]; +static const char KEY_GPS_VERSION[]; +static const char KEY_GPS_DATESTAMP[]; + +//TI extensions for enabling/disabling shutter sound +static const char SHUTTER_ENABLE[]; +static const char SHUTTER_DISABLE[]; + +//TI extensions for Temporal bracketing +static const char BRACKET_ENABLE[]; +static const char BRACKET_DISABLE[]; + +//TI extensions to Image post-processing +static const char IPP_LDCNSF[]; +static const char IPP_LDC[]; +static const char IPP_NSF[]; +static const char IPP_NONE[]; + +//TI extensions to camera mode +static const char HIGH_PERFORMANCE_MODE[]; +static const char HIGH_QUALITY_MODE[]; +static const char HIGH_QUALITY_ZSL_MODE[]; +static const char VIDEO_MODE[]; + + +// TI extensions to standard android pixel formats +static const char PIXEL_FORMAT_RAW[]; +static const char PIXEL_FORMAT_JPS[]; +static const char PIXEL_FORMAT_MPO[]; +static const char PIXEL_FORMAT_RAW_JPEG[]; +static const char PIXEL_FORMAT_RAW_MPO[]; + +// TI extensions to standard android scene mode settings +static const char SCENE_MODE_SPORT[]; +static const char SCENE_MODE_CLOSEUP[]; +static const char SCENE_MODE_AQUA[]; +static const char SCENE_MODE_SNOWBEACH[]; +static const char SCENE_MODE_MOOD[]; +static const char SCENE_MODE_NIGHT_INDOOR[]; +static const char SCENE_MODE_DOCUMENT[]; +static const char SCENE_MODE_BARCODE[]; +static const char SCENE_MODE_VIDEO_SUPER_NIGHT[]; +static const char SCENE_MODE_VIDEO_CINE[]; +static const char SCENE_MODE_VIDEO_OLD_FILM[]; + +// TI extensions to standard android white balance settings. +static const char WHITE_BALANCE_TUNGSTEN[]; +static const char WHITE_BALANCE_HORIZON[]; +static const char WHITE_BALANCE_SUNSET[]; +static const char WHITE_BALANCE_FACE[]; + +// TI extensions to add exposure preset modes to android api +static const char EXPOSURE_MODE_OFF[]; +static const char EXPOSURE_MODE_AUTO[]; +static const char EXPOSURE_MODE_NIGHT[]; +static const char EXPOSURE_MODE_BACKLIGHT[]; +static const char EXPOSURE_MODE_SPOTLIGHT[]; +static const char EXPOSURE_MODE_SPORTS[]; +static const char EXPOSURE_MODE_SNOW[]; +static const char EXPOSURE_MODE_BEACH[]; +static const char EXPOSURE_MODE_APERTURE[]; +static const char EXPOSURE_MODE_SMALL_APERTURE[]; +static const char EXPOSURE_MODE_FACE[]; + +// TI extensions to standard android focus presets. +static const char FOCUS_MODE_PORTRAIT[]; +static const char FOCUS_MODE_EXTENDED[]; +static const char FOCUS_MODE_FACE[]; + +// TI extensions to add iso values +static const char ISO_MODE_AUTO[]; +static const char ISO_MODE_100[]; +static const char ISO_MODE_200[]; +static const char ISO_MODE_400[]; +static const char ISO_MODE_800[]; +static const char ISO_MODE_1000[]; +static const char ISO_MODE_1200[]; +static const char ISO_MODE_1600[]; + +// TI extensions to add values for effect settings. +static const char EFFECT_NATURAL[]; +static const char EFFECT_VIVID[]; +static const char EFFECT_COLOR_SWAP[]; +static const char EFFECT_BLACKWHITE[]; + +static const char KEY_S3D2D_PREVIEW[]; +static const char KEY_S3D2D_PREVIEW_MODE[]; + +// TI extensions to add values for AutoConvergence settings. +static const char AUTOCONVERGENCE_MODE_DISABLE[]; +static const char AUTOCONVERGENCE_MODE_FRAME[]; +static const char AUTOCONVERGENCE_MODE_CENTER[]; +static const char AUTOCONVERGENCE_MODE_FFT[]; +static const char AUTOCONVERGENCE_MODE_MANUAL[]; + + +//TI extensions for flash mode settings +static const char FLASH_MODE_FILL_IN[]; + +//TI extensions to add sensor orientation parameters +static const char ORIENTATION_SENSOR_NONE[]; +static const char ORIENTATION_SENSOR_90[]; +static const char ORIENTATION_SENSOR_180[]; +static const char ORIENTATION_SENSOR_270[]; + + +//TI values for camera direction +static const char FACING_FRONT[]; +static const char FACING_BACK[]; + +}; + +}; + +#endif + -- cgit v1.1