Tegra3 package support enabled; Service version code incremented.
authorAndrey Pavlenko <andrey.pavlenko@itseez.com>
Tue, 31 Jul 2012 11:22:58 +0000 (15:22 +0400)
committerAndrey Pavlenko <andrey.pavlenko@itseez.com>
Tue, 31 Jul 2012 11:22:58 +0000 (15:22 +0400)
Android 4.1.1 native camera fix (shared libraries for native Android camera updated).

21 files changed:
3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so
3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so
3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so
3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so
3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so [new file with mode: 0644]
3rdparty/lib/armeabi/libnative_camera_r2.2.0.so
3rdparty/lib/armeabi/libnative_camera_r2.3.3.so
3rdparty/lib/armeabi/libnative_camera_r3.0.1.so
3rdparty/lib/armeabi/libnative_camera_r4.0.0.so
3rdparty/lib/armeabi/libnative_camera_r4.0.3.so
3rdparty/lib/armeabi/libnative_camera_r4.1.1.so [new file with mode: 0644]
3rdparty/lib/x86/libnative_camera_r2.3.3.so
3rdparty/lib/x86/libnative_camera_r3.0.1.so
3rdparty/lib/x86/libnative_camera_r4.0.3.so
3rdparty/lib/x86/libnative_camera_r4.1.1.so [new file with mode: 0644]
android/service/engine/AndroidManifest.xml
android/service/engine/jni/Android.mk
android/service/engine/jni/Tests/Tests.mk
modules/androidcamera/camera_wrapper/CMakeLists.txt
modules/androidcamera/camera_wrapper/camera_wrapper.cpp

index cd429b9..ba36efc 100755 (executable)
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
index 9fec924..1868ed2 100644 (file)
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
index 7a3d126..295cbc6 100755 (executable)
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
index 12f2181..d34fa65 100755 (executable)
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
index bc26834..b6b8f4d 100755 (executable)
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 (file)
index 0000000..1fec795
Binary files /dev/null and b/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so differ
index 2ff9434..f26d26a 100755 (executable)
Binary files a/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so and b/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so differ
index 475a986..78c104c 100755 (executable)
Binary files a/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so and b/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so differ
index 1dbabe4..c5532e3 100755 (executable)
Binary files a/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so and b/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so differ
index 40ebc69..fae5d9b 100755 (executable)
Binary files a/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so and b/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so differ
index 03b77bb..8543503 100755 (executable)
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 (file)
index 0000000..352461f
Binary files /dev/null and b/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so differ
index 0a8b0fa..4e04a3e 100755 (executable)
Binary files a/3rdparty/lib/x86/libnative_camera_r2.3.3.so and b/3rdparty/lib/x86/libnative_camera_r2.3.3.so differ
index 564c284..6d3a898 100755 (executable)
Binary files a/3rdparty/lib/x86/libnative_camera_r3.0.1.so and b/3rdparty/lib/x86/libnative_camera_r3.0.1.so differ
index 7ab3736..c00c957 100755 (executable)
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 (file)
index 0000000..df22898
Binary files /dev/null and b/3rdparty/lib/x86/libnative_camera_r4.1.1.so differ
index 9512c7b..5fee38f 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="org.opencv.engine"
-    android:versionCode="12"
-    android:versionName="1.2" >
+    android:versionCode="13"
+    android:versionName="1.3" >
 
     <uses-sdk android:minSdkVersion="8" />
     <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>
index be73f6c..4ba3176 100644 (file)
@@ -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
index 3dab5f0..9027e15 100644 (file)
@@ -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
index 058a2cb..9398635 100644 (file)
@@ -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)
 
index 727ae6a..c7a55fb 100644 (file)
@@ -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
 
 #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 <gui/SurfaceTexture.h>
 # 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 <gui/ISurface.h>
+#include <gui/BufferQueue.h>
+#else
 # include <surfaceflinger/ISurface.h>
+#endif  // defined(ANDROID_r4_1_1)
 #endif  // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
 
 #include <string>
 
 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<IMemory>& 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> bufferQueue = new BufferQueue();
+    sp<BufferQueue::ConsumerListener> 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;
 }