diff options
author | Ziyann <jaraidaniel@gmail.com> | 2014-11-24 21:31:16 +0100 |
---|---|---|
committer | Ziyan <jaraidaniel@gmail.com> | 2014-12-13 00:39:22 +0100 |
commit | 46658da7a37c43075b66575e639872b5ecce3155 (patch) | |
tree | 14430b68b4e2f21ceeeef6a75cbf0e342fc86c55 /camera/CameraProperties.cpp | |
parent | d744be2e69d3891fd9c9a83aafa857c590417e48 (diff) | |
download | device_samsung_tuna-46658da7a37c43075b66575e639872b5ecce3155.tar.gz device_samsung_tuna-46658da7a37c43075b66575e639872b5ecce3155.tar.bz2 device_samsung_tuna-46658da7a37c43075b66575e639872b5ecce3155.zip |
tuna: add open-source domx/camera stuff
Camera is still half-broken.
Credits to @MWisBest
Change-Id: I87a802abfacaf36ab22676f5284f0cc1996f6b03
Diffstat (limited to 'camera/CameraProperties.cpp')
-rw-r--r-- | camera/CameraProperties.cpp | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/camera/CameraProperties.cpp b/camera/CameraProperties.cpp new file mode 100644 index 0000000..5d3ff20 --- /dev/null +++ b/camera/CameraProperties.cpp @@ -0,0 +1,129 @@ +/* + * 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 CameraProperties.cpp +* +* This file maps the CameraHardwareInterface to the Camera interfaces on OMAP4 (mainly OMX). +* +*/ + +//#include "CameraHal.h" +#include <utils/threads.h> + +#include "DebugUtils.h" +#include "CameraProperties.h" + +#define CAMERA_ROOT "CameraRoot" +#define CAMERA_INSTANCE "CameraInstance" + +namespace android { + +// lower entries have higher priority +static const char* g_camera_adapters[] = { +#ifdef OMAP4_SUPPORT_OMX_CAMERA_ADAPTER + "libomxcameraadapter.so", +#endif +#ifdef OMAP4_SUPPORT_USB_CAMERA_ADAPTER + "libusbcameraadapter.so" +#endif +}; + +/********************************************************* + CameraProperties - public function implemetation +**********************************************************/ + +CameraProperties::CameraProperties() : mCamerasSupported(0) +{ + LOG_FUNCTION_NAME; + + mCamerasSupported = 0; + mInitialized = 0; + + LOG_FUNCTION_NAME_EXIT; +} + +CameraProperties::~CameraProperties() +{ + LOG_FUNCTION_NAME; + + LOG_FUNCTION_NAME_EXIT; +} + + +// Initializes the CameraProperties class +status_t CameraProperties::initialize() +{ + LOG_FUNCTION_NAME; + + status_t ret; + + Mutex::Autolock lock(mLock); + + if(mInitialized) + return NO_ERROR; + + ret = loadProperties(); + + mInitialized = 1; + + LOG_FUNCTION_NAME_EXIT; + + return ret; +} + +extern "C" int CameraAdapter_Capabilities(CameraProperties::Properties* properties_array, + const unsigned int starting_camera, + const unsigned int max_camera); + +///Loads all the Camera related properties +status_t CameraProperties::loadProperties() +{ + LOG_FUNCTION_NAME; + + status_t ret = NO_ERROR; + + // adapter updates capabilities and we update camera count + mCamerasSupported = CameraAdapter_Capabilities(mCameraProps, mCamerasSupported, MAX_CAMERAS_SUPPORTED); + + if((int)mCamerasSupported < 0) { + ALOGE("error while getting capabilities"); + ret = UNKNOWN_ERROR; + } else if (mCamerasSupported > MAX_CAMERAS_SUPPORTED) { + ALOGE("returned too many adapaters"); + ret = UNKNOWN_ERROR; + } else { + ALOGE("num_cameras = %d", mCamerasSupported); + + for (unsigned int i = 0; i < mCamerasSupported; i++) { + mCameraProps[i].set(CAMERA_SENSOR_INDEX, i); + mCameraProps[i].dump(); + } + } + + ALOGV("mCamerasSupported = %d", mCamerasSupported); + LOG_FUNCTION_NAME_EXIT; + return ret; +} + +// Returns the number of Cameras found +int CameraProperties::camerasSupported() +{ + LOG_FUNCTION_NAME; + return mCamerasSupported; +} + +}; |