Merge remote-tracking branch 'origin/master'

pull/5/merge
Vadim Pisarevsky 13 years ago
commit 5f2ce22fbf
  1. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so
  2. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
  3. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so
  4. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so
  5. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so
  6. BIN
      3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so
  7. BIN
      3rdparty/lib/armeabi/libnative_camera_r2.2.0.so
  8. BIN
      3rdparty/lib/armeabi/libnative_camera_r2.3.3.so
  9. BIN
      3rdparty/lib/armeabi/libnative_camera_r3.0.1.so
  10. BIN
      3rdparty/lib/armeabi/libnative_camera_r4.0.0.so
  11. BIN
      3rdparty/lib/armeabi/libnative_camera_r4.0.3.so
  12. BIN
      3rdparty/lib/armeabi/libnative_camera_r4.1.1.so
  13. BIN
      3rdparty/lib/x86/libnative_camera_r2.3.3.so
  14. BIN
      3rdparty/lib/x86/libnative_camera_r3.0.1.so
  15. BIN
      3rdparty/lib/x86/libnative_camera_r4.0.3.so
  16. BIN
      3rdparty/lib/x86/libnative_camera_r4.1.1.so
  17. 13
      modules/androidcamera/camera_wrapper/CMakeLists.txt
  18. 42
      modules/androidcamera/camera_wrapper/camera_wrapper.cpp

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.

@ -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)

@ -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;
} }

Loading…
Cancel
Save