Loading camera/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ LOCAL_SHARED_LIBRARIES := \ libbinder \ libhardware \ libsurfaceflinger_client \ libui libui \ libgui LOCAL_MODULE:= libcamera_client Loading camera/Camera.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,20 @@ status_t Camera::setPreviewDisplay(const sp<Surface>& surface) } } // pass the buffered ISurfaceTexture to the camera service status_t Camera::setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture) { LOGV("setPreviewTexture(%p)", surfaceTexture.get()); sp <ICamera> c = mCamera; if (c == 0) return NO_INIT; if (surfaceTexture != 0) { return c->setPreviewTexture(surfaceTexture); } else { LOGD("app passed NULL surface"); return c->setPreviewTexture(0); } } // start preview mode status_t Camera::startPreview() { Loading camera/ICamera.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ namespace android { enum { DISCONNECT = IBinder::FIRST_CALL_TRANSACTION, SET_PREVIEW_DISPLAY, SET_PREVIEW_TEXTURE, SET_PREVIEW_CALLBACK_FLAG, START_PREVIEW, STOP_PREVIEW, Loading Loading @@ -78,6 +79,18 @@ public: return reply.readInt32(); } // pass the buffered SurfaceTexture to the camera service status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture) { LOGV("setPreviewTexture"); Parcel data, reply; data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); sp<IBinder> b(surfaceTexture->asBinder()); data.writeStrongBinder(b); remote()->transact(SET_PREVIEW_TEXTURE, data, &reply); return reply.readInt32(); } // set the preview callback flag to affect how the received frames from // preview are handled. See Camera.h for details. void setPreviewCallbackFlag(int flag) Loading Loading @@ -296,6 +309,13 @@ status_t BnCamera::onTransact( reply->writeInt32(setPreviewDisplay(surface)); return NO_ERROR; } break; case SET_PREVIEW_TEXTURE: { LOGV("SET_PREVIEW_TEXTURE"); CHECK_INTERFACE(ICamera, data, reply); sp<ISurfaceTexture> st = interface_cast<ISurfaceTexture>(data.readStrongBinder()); reply->writeInt32(setPreviewTexture(st)); return NO_ERROR; } break; case SET_PREVIEW_CALLBACK_FLAG: { LOGV("SET_PREVIEW_CALLBACK_TYPE"); CHECK_INTERFACE(ICamera, data, reply); Loading include/camera/Camera.h +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/Timers.h> #include <camera/ICameraClient.h> #include <gui/ISurfaceTexture.h> namespace android { Loading Loading @@ -175,6 +176,9 @@ public: // pass the buffered Surface to the camera service status_t setPreviewDisplay(const sp<Surface>& surface); // pass the buffered ISurfaceTexture to the camera service status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture); // start preview mode, must call setPreviewDisplay first status_t startPreview(); Loading include/camera/ICamera.h +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <binder/IMemory.h> #include <utils/String8.h> #include <camera/Camera.h> #include <gui/ISurfaceTexture.h> namespace android { Loading @@ -48,6 +49,10 @@ public: // pass the buffered Surface to the camera service virtual status_t setPreviewDisplay(const sp<Surface>& surface) = 0; // pass the buffered ISurfaceTexture to the camera service virtual status_t 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; Loading Loading
camera/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ LOCAL_SHARED_LIBRARIES := \ libbinder \ libhardware \ libsurfaceflinger_client \ libui libui \ libgui LOCAL_MODULE:= libcamera_client Loading
camera/Camera.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,20 @@ status_t Camera::setPreviewDisplay(const sp<Surface>& surface) } } // pass the buffered ISurfaceTexture to the camera service status_t Camera::setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture) { LOGV("setPreviewTexture(%p)", surfaceTexture.get()); sp <ICamera> c = mCamera; if (c == 0) return NO_INIT; if (surfaceTexture != 0) { return c->setPreviewTexture(surfaceTexture); } else { LOGD("app passed NULL surface"); return c->setPreviewTexture(0); } } // start preview mode status_t Camera::startPreview() { Loading
camera/ICamera.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ namespace android { enum { DISCONNECT = IBinder::FIRST_CALL_TRANSACTION, SET_PREVIEW_DISPLAY, SET_PREVIEW_TEXTURE, SET_PREVIEW_CALLBACK_FLAG, START_PREVIEW, STOP_PREVIEW, Loading Loading @@ -78,6 +79,18 @@ public: return reply.readInt32(); } // pass the buffered SurfaceTexture to the camera service status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture) { LOGV("setPreviewTexture"); Parcel data, reply; data.writeInterfaceToken(ICamera::getInterfaceDescriptor()); sp<IBinder> b(surfaceTexture->asBinder()); data.writeStrongBinder(b); remote()->transact(SET_PREVIEW_TEXTURE, data, &reply); return reply.readInt32(); } // set the preview callback flag to affect how the received frames from // preview are handled. See Camera.h for details. void setPreviewCallbackFlag(int flag) Loading Loading @@ -296,6 +309,13 @@ status_t BnCamera::onTransact( reply->writeInt32(setPreviewDisplay(surface)); return NO_ERROR; } break; case SET_PREVIEW_TEXTURE: { LOGV("SET_PREVIEW_TEXTURE"); CHECK_INTERFACE(ICamera, data, reply); sp<ISurfaceTexture> st = interface_cast<ISurfaceTexture>(data.readStrongBinder()); reply->writeInt32(setPreviewTexture(st)); return NO_ERROR; } break; case SET_PREVIEW_CALLBACK_FLAG: { LOGV("SET_PREVIEW_CALLBACK_TYPE"); CHECK_INTERFACE(ICamera, data, reply); Loading
include/camera/Camera.h +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/Timers.h> #include <camera/ICameraClient.h> #include <gui/ISurfaceTexture.h> namespace android { Loading Loading @@ -175,6 +176,9 @@ public: // pass the buffered Surface to the camera service status_t setPreviewDisplay(const sp<Surface>& surface); // pass the buffered ISurfaceTexture to the camera service status_t setPreviewTexture(const sp<ISurfaceTexture>& surfaceTexture); // start preview mode, must call setPreviewDisplay first status_t startPreview(); Loading
include/camera/ICamera.h +5 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <binder/IMemory.h> #include <utils/String8.h> #include <camera/Camera.h> #include <gui/ISurfaceTexture.h> namespace android { Loading @@ -48,6 +49,10 @@ public: // pass the buffered Surface to the camera service virtual status_t setPreviewDisplay(const sp<Surface>& surface) = 0; // pass the buffered ISurfaceTexture to the camera service virtual status_t 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; Loading