Tegra3 package support enabled; Service version code incremented.

Android 4.1.1 native camera fix (shared libraries for native Android camera updated).
This commit is contained in:
Andrey Pavlenko 2012-07-31 15:22:58 +04:00
parent dea7f92c86
commit 73f95e59f3
21 changed files with 53 additions and 12 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.opencv.engine" package="org.opencv.engine"
android:versionCode="12" android:versionCode="13"
android:versionName="1.2" > android:versionName="1.3" >
<uses-sdk android:minSdkVersion="8" /> <uses-sdk android:minSdkVersion="8" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false"/> <uses-feature android:name="android.hardware.touchscreen" android:required="false"/>

View File

@ -25,7 +25,7 @@ LOCAL_C_INCLUDES := \
LOCAL_CFLAGS += -DPLATFORM_ANDROID LOCAL_CFLAGS += -DPLATFORM_ANDROID
LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
#LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 LOCAL_CFLAGS += -D__SUPPORT_TEGRA3
#LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES
LOCAL_PRELINK_MODULE := false LOCAL_PRELINK_MODULE := false
@ -66,7 +66,7 @@ LOCAL_PRELINK_MODULE := false
LOCAL_CFLAGS += -DPLATFORM_ANDROID LOCAL_CFLAGS += -DPLATFORM_ANDROID
LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_V7A_FEATURES
#LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 LOCAL_CFLAGS += -D__SUPPORT_TEGRA3
#LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES
LOCAL_MODULE := libOpenCVEngine_jni LOCAL_MODULE := libOpenCVEngine_jni

View 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 += -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_ARMEABI_V7A_FEATURES
#LOCAL_CFLAGS += -D__SUPPORT_TEGRA3 LOCAL_CFLAGS += -D__SUPPORT_TEGRA3
#LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES #LOCAL_CFLAGS += -D__SUPPORT_ARMEABI_FEATURES
LOCAL_LDFLAGS = -Wl,-allow-shlib-undefined LOCAL_LDFLAGS = -Wl,-allow-shlib-undefined

View File

@ -4,18 +4,27 @@ project(${the_target})
link_directories("${ANDROID_SOURCE_TREE}/out/target/product/generic/system/lib") 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}
${ANDROID_SOURCE_TREE}/frameworks/base/include/ui ${ANDROID_SOURCE_TREE}/frameworks/base/include/ui
${ANDROID_SOURCE_TREE}/frameworks/base/include/surfaceflinger ${ANDROID_SOURCE_TREE}/frameworks/base/include/surfaceflinger
${ANDROID_SOURCE_TREE}/frameworks/base/include/camera ${ANDROID_SOURCE_TREE}/frameworks/base/include/camera
${ANDROID_SOURCE_TREE}/frameworks/base/include/media ${ANDROID_SOURCE_TREE}/frameworks/base/include/media
${ANDROID_SOURCE_TREE}/frameworks/base/include/camera
${ANDROID_SOURCE_TREE}/frameworks/base/include ${ANDROID_SOURCE_TREE}/frameworks/base/include
${ANDROID_SOURCE_TREE}/system/core/include ${ANDROID_SOURCE_TREE}/system/core/include
${ANDROID_SOURCE_TREE}/hardware/libhardware/include ${ANDROID_SOURCE_TREE}/hardware/libhardware/include
${ANDROID_SOURCE_TREE}/frameworks/base/native/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) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)

View 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. # 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 #endif
@ -12,13 +12,18 @@
#include "camera_wrapper.h" #include "camera_wrapper.h"
#include "../include/camera_properties.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 SurfaceTexture.h file with the SurfaceTexture class
# include <gui/SurfaceTexture.h> # include <gui/SurfaceTexture.h>
# define MAGIC_OPENCV_TEXTURE_ID (0x10) # define MAGIC_OPENCV_TEXTURE_ID (0x10)
#else // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) #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 //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> # 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) #endif // defined(ANDROID_r3_0_1) || defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3)
#include <string> #include <string>
@ -53,6 +58,21 @@
using namespace android; 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() void debugShowFPS()
{ {
static int mFrameCount = 0; static int mFrameCount = 0;
@ -260,8 +280,8 @@ public:
} }
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr
#if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) #if defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3) || defined(ANDROID_r4_1_1)
,camera_frame_metadata_t* metadata ,camera_frame_metadata_t*
#endif #endif
) )
{ {
@ -506,9 +526,16 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
pdstatus = camera->setPreviewTexture(surfaceTexture); pdstatus = camera->setPreviewTexture(surfaceTexture);
if (pdstatus != 0) if (pdstatus != 0)
LOGE("initCameraConnect: failed setPreviewTexture call; camera migth not work correctly"); 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 #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 # if 1
////ATTENTION: switching between two versions: with and without copying memory inside Android OS ////ATTENTION: switching between two versions: with and without copying memory inside Android OS
//// see the method CameraService::Client::copyFrameAndPostCopiedFrame and where it is used //// 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 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)) #endif //!(defined(ANDROID_r4_0_0) || defined(ANDROID_r4_0_3))
LOGD("Starting preview");
status_t resStart = camera->startPreview(); status_t resStart = camera->startPreview();
if (resStart != 0) if (resStart != 0)
@ -528,6 +556,10 @@ CameraHandler* CameraHandler::initCameraConnect(const CameraCallback& callback,
handler->closeCameraConnect(); handler->closeCameraConnect();
handler = 0; handler = 0;
} }
else
{
LOGD("Preview started successfully");
}
return handler; return handler;
} }