diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so index d445715b6..fb34509bd 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so index 4cf009f0d..fce58145c 100644 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so index 311d52726..2498763d0 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so index b030e06d5..9a7047b55 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so index a8ad60aa9..98e0d9ea0 100755 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so differ diff --git a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so index f5e32965c..fe147823e 100644 Binary files a/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so b/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so index 20950214e..a0db0d199 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so and b/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so b/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so index 1d608cfe4..6f167cb0c 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so and b/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so b/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so index 77c8137b2..26d286a18 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so and b/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so b/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so index caca67fe2..f29707cae 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so and b/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so b/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so index ddb72eed8..85e0320a9 100755 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so and b/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so differ diff --git a/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so b/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so index 7474653d0..35c5141b9 100644 Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so and b/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r2.3.3.so b/3rdparty/lib/x86/libnative_camera_r2.3.3.so index 4b8cc0313..d40409f22 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r2.3.3.so and b/3rdparty/lib/x86/libnative_camera_r2.3.3.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r3.0.1.so b/3rdparty/lib/x86/libnative_camera_r3.0.1.so index ead2036fb..221b833a5 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r3.0.1.so and b/3rdparty/lib/x86/libnative_camera_r3.0.1.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r4.0.3.so b/3rdparty/lib/x86/libnative_camera_r4.0.3.so index bbc5bc34d..786d6dccb 100755 Binary files a/3rdparty/lib/x86/libnative_camera_r4.0.3.so and b/3rdparty/lib/x86/libnative_camera_r4.0.3.so differ diff --git a/3rdparty/lib/x86/libnative_camera_r4.1.1.so b/3rdparty/lib/x86/libnative_camera_r4.1.1.so index cf4733058..8ec6cb74d 100644 Binary files a/3rdparty/lib/x86/libnative_camera_r4.1.1.so and b/3rdparty/lib/x86/libnative_camera_r4.1.1.so differ diff --git a/modules/androidcamera/camera_wrapper/camera_wrapper.cpp b/modules/androidcamera/camera_wrapper/camera_wrapper.cpp index 78d223635..c7a55fb39 100644 --- a/modules/androidcamera/camera_wrapper/camera_wrapper.cpp +++ b/modules/androidcamera/camera_wrapper/camera_wrapper.cpp @@ -357,25 +357,26 @@ const char* CameraHandler::antibandingModesNames[ANDROID_CAMERA_ANTIBANDING_MODE CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, int cameraId, void* userData, CameraParameters* prevCameraParameters) { + typedef sp (*Android22ConnectFuncType)(); typedef sp (*Android23ConnectFuncType)(int); typedef sp (*Android3DConnectFuncType)(int, int); - + enum { CAMERA_SUPPORT_MODE_2D = 0x01, /* Camera Sensor supports 2D mode. */ CAMERA_SUPPORT_MODE_3D = 0x02, /* Camera Sensor supports 3D mode. */ CAMERA_SUPPORT_MODE_NONZSL = 0x04, /* Camera Sensor in NON-ZSL mode. */ CAMERA_SUPPORT_MODE_ZSL = 0x08 /* Camera Sensor supports ZSL mode. */ }; - + const char Android22ConnectName[] = "_ZN7android6Camera7connectEv"; const char Android23ConnectName[] = "_ZN7android6Camera7connectEi"; const char Android3DConnectName[] = "_ZN7android6Camera7connectEii"; - + LOGD("CameraHandler::initCameraConnect(%p, %d, %p, %p)", callback, cameraId, userData, prevCameraParameters); - + sp camera = 0; - + void* CameraHALHandle = dlopen("libcamera_client.so", RTLD_LAZY); if (!CameraHALHandle) @@ -383,7 +384,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, LOGE("Cannot link to \"libcamera_client.so\""); return NULL; } - + // reset errors dlerror(); @@ -391,19 +392,16 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, { LOGD("Connecting to CameraService v 2.2"); camera = Android22Connect(); - LOGD("Connection to CameraService v 2.2 established"); } else if (Android23ConnectFuncType Android23Connect = (Android23ConnectFuncType)dlsym(CameraHALHandle, Android23ConnectName)) { LOGD("Connecting to CameraService v 2.3"); camera = Android23Connect(cameraId); - LOGD("Connection to CameraService v 2.3 established"); } else if (Android3DConnectFuncType Android3DConnect = (Android3DConnectFuncType)dlsym(CameraHALHandle, Android3DConnectName)) { LOGD("Connecting to CameraService v 3D"); camera = Android3DConnect(cameraId, CAMERA_SUPPORT_MODE_2D); - LOGD("Connection to CameraService v 3D established"); } else { @@ -414,23 +412,19 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, dlclose(CameraHALHandle); - if ( NULL == camera.get() ) + if ( 0 == camera.get() ) { LOGE("initCameraConnect: Unable to connect to CameraService\n"); return 0; } - LOGD("Creating camera handler"); CameraHandler* handler = new CameraHandler(callback, userData); - LOGD("Setting camera listener"); camera->setListener(handler); - LOGD("Updating camera handler"); handler->camera = camera; handler->cameraId = cameraId; - LOGD("Checking previous camera parameters"); - if (NULL != prevCameraParameters) + if (prevCameraParameters != 0) { LOGI("initCameraConnect: Setting paramers from previous camera handler"); camera->setParameters(prevCameraParameters->flatten()); @@ -460,7 +454,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, #if !defined(ANDROID_r2_2_0) // Set focus mode to continuous-video if supported const char* available_focus_modes = handler->params.get(CameraParameters::KEY_SUPPORTED_FOCUS_MODES); - if (NULL != available_focus_modes) + if (available_focus_modes != 0) { if (strstr(available_focus_modes, "continuous-video") != NULL) { @@ -468,7 +462,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, status_t resParams = handler->camera->setParameters(handler->params.flatten()); - if (0 != resParams) + if (resParams != 0) { LOGE("initCameraConnect: failed to set autofocus mode to \"continuous-video\""); } @@ -566,7 +560,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, { LOGD("Preview started successfully"); } - + return handler; } @@ -582,7 +576,7 @@ void CameraHandler::closeCameraConnect() camera->disconnect(); camera.clear(); - camera = NULL; + camera=NULL; // ATTENTION!!!!!!!!!!!!!!!!!!!!!!!!!! // When we set // camera=NULL @@ -814,50 +808,43 @@ void CameraHandler::applyProperties(CameraHandler** ppcameraHandler) { LOGD("CameraHandler::applyProperties()"); - if (NULL == ppcameraHandler) + if (ppcameraHandler == 0) { LOGE("applyProperties: Passed NULL ppcameraHandler"); return; } - if (NULL == *ppcameraHandler) + if (*ppcameraHandler == 0) { LOGE("applyProperties: Passed null *ppcameraHandler"); return; } LOGD("CameraHandler::applyProperties()"); - -#if defined(ANDROID_r4_0_3) - LOGD("Reconnect camera"); - (*ppcameraHandler)->camera->reconnect(); - (*ppcameraHandler)->params = (*ppcameraHandler)->camera->getParameters(); -#else - CameraHandler* previousCameraHandler = *ppcameraHandler; + CameraHandler* previousCameraHandler=*ppcameraHandler; CameraParameters curCameraParameters(previousCameraHandler->params.flatten()); - CameraCallback cameraCallback = previousCameraHandler->cameraCallback; - void* userData = previousCameraHandler->userData; - int cameraId = previousCameraHandler->cameraId; + CameraCallback cameraCallback=previousCameraHandler->cameraCallback; + void* userData=previousCameraHandler->userData; + int cameraId=previousCameraHandler->cameraId; LOGD("CameraHandler::applyProperties(): before previousCameraHandler->closeCameraConnect"); previousCameraHandler->closeCameraConnect(); LOGD("CameraHandler::applyProperties(): after previousCameraHandler->closeCameraConnect"); + LOGD("CameraHandler::applyProperties(): before initCameraConnect"); - CameraHandler* handler = initCameraConnect(cameraCallback, cameraId, userData, &curCameraParameters); + CameraHandler* handler=initCameraConnect(cameraCallback, cameraId, userData, &curCameraParameters); LOGD("CameraHandler::applyProperties(): after initCameraConnect, handler=0x%x", (int)handler); if (handler == NULL) { LOGE("ERROR in applyProperties --- cannot reinit camera"); - handler = initCameraConnect(cameraCallback, cameraId, userData, NULL); + handler=initCameraConnect(cameraCallback, cameraId, userData, NULL); LOGD("CameraHandler::applyProperties(): repeate initCameraConnect after ERROR, handler=0x%x", (int)handler); if (handler == NULL) { LOGE("ERROR in applyProperties --- cannot reinit camera AGAIN --- cannot do anything else"); } } - - (*ppcameraHandler) = handler; -#endif + (*ppcameraHandler)=handler; }