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 cd429b923e..ba36efcdf5 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 9fec924b9b..1868ed2c8c 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 7a3d126cf9..295cbc6b03 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 12f2181374..d34fa65d81 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 bc26834779..b6b8f4df50 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 new file mode 100644 index 0000000000..1fec795114 Binary files /dev/null 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 2ff9434603..f26d26a252 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 475a986010..78c104c114 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 1dbabe4063..c5532e36b5 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 40ebc69461..fae5d9bad0 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 03b77bba57..8543503106 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 new file mode 100644 index 0000000000..352461f82c Binary files /dev/null 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 0a8b0faee1..4e04a3e23f 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 564c2846e4..6d3a898061 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 7ab37360e0..c00c957015 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 new file mode 100644 index 0000000000..df22898b45 Binary files /dev/null and b/3rdparty/lib/x86/libnative_camera_r4.1.1.so differ diff --git a/android/service/engine/AndroidManifest.xml b/android/service/engine/AndroidManifest.xml index 9512c7b6cd..5fee38f1b4 100644 --- a/android/service/engine/AndroidManifest.xml +++ b/android/service/engine/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="13" + android:versionName="1.3" > diff --git a/android/service/engine/jni/Android.mk b/android/service/engine/jni/Android.mk index be73f6c5bd..4ba317603d 100644 --- a/android/service/engine/jni/Android.mk +++ b/android/service/engine/jni/Android.mk @@ -25,7 +25,7 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS += -DPLATFORM_ANDROID LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES -#LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 +LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES LOCAL_PRELINK_MODULE := false @@ -66,7 +66,7 @@ LOCAL_PRELINK_MODULE := false LOCAL_CFLAGS += -DPLATFORM_ANDROID LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES -#LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 +LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES LOCAL_MODULE := libOpenCVEngine_jni diff --git a/android/service/engine/jni/Tests/Tests.mk b/android/service/engine/jni/Tests/Tests.mk index 3dab5f010a..9027e15fbc 100644 --- a/android/service/engine/jni/Tests/Tests.mk +++ b/android/service/engine/jni/Tests/Tests.mk @@ -32,7 +32,7 @@ LOCAL_C_INCLUDES := \ LOCAL_CFLAGS += -O0 -DGTEST_HAS_CLONE=0 -DGTEST_OS_LINUX_ANDROID=1 -DGTEST_HAS_TR1_TUPLE=0 LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES -#LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 +LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES LOCAL_LDFLAGS = -Wl,-allow-shlib-undefined diff --git a/modules/androidcamera/camera_wrapper/CMakeLists.txt b/modules/androidcamera/camera_wrapper/CMakeLists.txt index 058a2cb6db..9398635c88 100644 --- a/modules/androidcamera/camera_wrapper/CMakeLists.txt +++ b/modules/androidcamera/camera_wrapper/CMakeLists.txt @@ -4,18 +4,27 @@ project(${the_target}) link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib") -INCLUDE_DIRECTORIES(BEFORE +if (ANDROID_VERSION VERSION_LESS "4.1") + INCLUDE_DIRECTORIES(BEFORE ${ANDROID_SOURCE_TREE} ${ANDROID_SOURCE_TREE}/frameworks/base/include/ui ${ANDROID_SOURCE_TREE}/frameworks/base/include/surfaceflinger ${ANDROID_SOURCE_TREE}/frameworks/base/include/camera ${ANDROID_SOURCE_TREE}/frameworks/base/include/media - ${ANDROID_SOURCE_TREE}/frameworks/base/include/camera ${ANDROID_SOURCE_TREE}/frameworks/base/include ${ANDROID_SOURCE_TREE}/system/core/include ${ANDROID_SOURCE_TREE}/hardware/libhardware/include ${ANDROID_SOURCE_TREE}/frameworks/base/native/include ) +else() + INCLUDE_DIRECTORIES(BEFORE + ${ANDROID_SOURCE_TREE} + ${ANDROID_SOURCE_TREE}/frameworks/native/include + ${ANDROID_SOURCE_TREE}/frameworks/av/include + ${ANDROID_SOURCE_TREE}/system/core/include + ${ANDROID_SOURCE_TREE}/hardware/libhardware/include + ) +endif() set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) diff --git a/modules/androidcamera/camera_wrapper/camera_wrapper.cpp b/modules/androidcamera/camera_wrapper/camera_wrapper.cpp index 727ae6ad77..c7a55fb39b 100644 --- a/modules/androidcamera/camera_wrapper/camera_wrapper.cpp +++ b/modules/androidcamera/camera_wrapper/camera_wrapper.cpp @@ -1,4 +1,4 @@ -#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) +#if !defined(ANDROID_r2_2_0) && !defined(ANDROID_r2_3_3) && !defined(ANDROID_r3_0_1) && !defined(ANDROID_r4_0_0) && !defined(ANDROID_r4_0_3) && !defined(ANDROID_r4_1_1) # error Building camera wrapper for your version of Android is not supported by OpenCV. You need to modify OpenCV sources in order to compile camera wrapper for your version of Android. #endif @@ -12,13 +12,18 @@ #include "camera_wrapper.h" #include "../include/camera_properties.h" -#if defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) +#if defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) //Include SurfaceTexture.h file with the SurfaceTexture class # include # define MAGIC_OPENCV_TEXTURE_ID (0x10) #else // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) //TODO: This is either 2.2 or 2.3. Include the headers for ISurface.h access +#if defined(ANDROID_r4_1_1) +#include +#include +#else # include +#endif // defined(ANDROID_r4_1_1) #endif // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) #include @@ -53,6 +58,21 @@ using namespace android; +void debugShowFPS(); + +#if defined(ANDROID_r4_1_1) +class ConsumerListenerStub: public BufferQueue::ConsumerListener +{ +public: + virtual void onFrameAvailable() + { + } + virtual void onBuffersReleased() + { + } +}; +#endif + void debugShowFPS() { static int mFrameCount = 0; @@ -260,8 +280,8 @@ public: } virtual void postData(int32_t msgType, const sp& dataPtr -#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) - ,camera_frame_metadata_t* metadata +#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1) + ,camera_frame_metadata_t* #endif ) { @@ -506,9 +526,16 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, pdstatus = camera->setPreviewTexture(surfaceTexture); if (pdstatus != 0) LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly"); +#elif defined(ANDROID_r4_1_1) + sp bufferQueue = new BufferQueue(); + sp queueListener = new ConsumerListenerStub(); + bufferQueue->consumerConnect(queueListener); + pdstatus = camera->setPreviewTexture(bufferQueue); + if (pdstatus != 0) + LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly"); #endif -#if !(defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)) +#if (defined(ANDROID_r2_2_0) || defined(ANDROID_r2_3_3) || defined(ANDROID_r3_0_1)) # if 1 ////ATTENTION: switching between two versions: with and without copying memory inside Android OS //// see the method CameraService::Client::copyFrameAndPostCopiedFrame and where it is used @@ -520,6 +547,7 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, camera->setPreviewCallbackFlags( CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK | CAMERA_FRAME_CALLBACK_FLAG_COPY_OUT_MASK);//with copy #endif //!(defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)) + LOGD("Starting preview"); status_t resStart = camera->startPreview(); if (resStart != 0) @@ -528,6 +556,10 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback, handler->closeCameraConnect(); handler = 0; } + else + { + LOGD("Preview started successfully"); + } return handler; }