First version of native camera support for Android 3.x.x and 4.0.x

This commit is contained in:
Andrey Kamaev
2012-01-18 14:33:39 +00:00
parent 2bdd395357
commit a43c47d6cf
16 changed files with 286 additions and 67 deletions

View File

@@ -0,0 +1,70 @@
*** src2.3.3/frameworks/base/include/camera/Camera.h 2011-04-04 20:18:36.718480237 +0400
--- src_mock3.0.1/frameworks/base/include/camera/Camera.h 2012-01-15 20:51:36.000000000 +0400
***************
*** 20,25 ****
--- 20,27 ----
#include <utils/Timers.h>
#include <camera/ICameraClient.h>
+ #include <gui/ISurfaceTexture.h>
+
namespace android {
class ISurface;
***************
*** 76,81 ****
--- 78,90 ----
CAMERA_MSG_POSTVIEW_FRAME = 0x040,
CAMERA_MSG_RAW_IMAGE = 0x080,
CAMERA_MSG_COMPRESSED_IMAGE = 0x100,
+
+ #ifdef OMAP_ENHANCEMENT
+
+ CAMERA_MSG_BURST_IMAGE = 0x200,
+
+ #endif
+
CAMERA_MSG_ALL_MSGS = 0x1FF
};
***************
*** 144,150 ****
--- 153,164 ----
public:
virtual void notify(int32_t msgType, int32_t ext1, int32_t ext2) = 0;
virtual void postData(int32_t msgType, const sp<IMemory>& dataPtr) = 0;
+ #ifdef OMAP_ENHANCEMENT
+ virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr,
+ uint32_t offset=0, uint32_t stride=0) = 0;
+ #else
virtual void postDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) = 0;
+ #endif
};
class Camera : public BnCameraClient, public IBinder::DeathRecipient
***************
*** 170,175 ****
--- 184,191 ----
status_t setPreviewDisplay(const sp<Surface>& surface);
status_t setPreviewDisplay(const sp<ISurface>& surface);
+ // pass the SurfaceTexture object to the Camera
+ status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture);
// start preview mode, must call setPreviewDisplay first
status_t startPreview();
***************
*** 215,221 ****
--- 231,242 ----
// ICameraClient interface
virtual void notifyCallback(int32_t msgType, int32_t ext, int32_t ext2);
virtual void dataCallback(int32_t msgType, const sp<IMemory>& dataPtr);
+ #ifdef OMAP_ENHANCEMENT
+ virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr,
+ uint32_t offset=0, uint32_t stride=0);
+ #else
virtual void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr);
+ #endif
sp<ICamera> remote();

View File

@@ -0,0 +1,14 @@
*** src2.3.3/frameworks/base/include/camera/ICamera.h 2011-04-04 20:18:36.718480237 +0400
--- src_mock3.0.1/frameworks/base/include/camera/ICamera.h 2012-01-15 20:50:30.000000000 +0400
***************
*** 48,53 ****
--- 48,56 ----
// pass the buffered ISurface to the camera service
virtual status_t setPreviewDisplay(const sp<ISurface>& surface) = 0;
+ // pass the preview texture. This is for 3.0 and higher versions of Android
+ setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture) = 0;
+
// set the preview callback flag to affect how the received frames from
// preview are handled.
virtual void setPreviewCallbackFlag(int flag) = 0;

View File

@@ -0,0 +1,8 @@
Building camera wrapper for Android 3.0.1:
1) Get sources of Android 2.3.x (2.3.3 were used)
2) Apply patches provided with this instruction to frameworks/base/include/camera/ICamera.h and frameworks/base/include/camera/Camera.h
3) Get frameworks/base/include/gui/ISurfaceTexture.h and frameworks/base/include/gui/SurfaceTexture.h from Android 4.0.x (4.0.3 were used) sources and add them to your source tree.
4) Apply provided patch to the frameworks/base/include/gui/SurfaceTexture.h.
5) Pull /system/lib from your device running Andoid 3.x.x
6) Build wrapper as normal using this modified source tree.

View File

@@ -0,0 +1,37 @@
*** src4.0.3/src/frameworks/base/include/gui/SurfaceTexture.h 2012-01-18 16:32:41.424750385 +0400
--- src_mock3.0.1/frameworks/base/include/gui/SurfaceTexture.h 2012-01-12 21:28:14.000000000 +0400
***************
*** 68,75 ****
// texture will be bound in updateTexImage. useFenceSync specifies whether
// fences should be used to synchronize access to buffers if that behavior
// is enabled at compile-time.
! SurfaceTexture(GLuint tex, bool allowSynchronousMode = true,
! GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true);
virtual ~SurfaceTexture();
--- 68,74 ----
// texture will be bound in updateTexImage. useFenceSync specifies whether
// fences should be used to synchronize access to buffers if that behavior
// is enabled at compile-time.
! SurfaceTexture(GLuint tex);
virtual ~SurfaceTexture();
***************
*** 280,286 ****
mBufferState(BufferSlot::FREE),
mRequestBufferCalled(false),
mTransform(0),
! mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mTimestamp(0),
mFrameNumber(0),
mFence(EGL_NO_SYNC_KHR) {
--- 279,285 ----
mBufferState(BufferSlot::FREE),
mRequestBufferCalled(false),
mTransform(0),
! mScalingMode(0),
mTimestamp(0),
mFrameNumber(0),
mFence(EGL_NO_SYNC_KHR) {