diff options
author | Dave Sparks <davidsparks@android.com> | 2009-07-08 17:26:05 -0700 |
---|---|---|
committer | Dave Sparks <davidsparks@android.com> | 2009-07-08 17:26:05 -0700 |
commit | 6698d16b951370a0cc6aa87bcd2ca91122a57410 (patch) | |
tree | 7a411a1832eec82df97587fddc64b93b9fe909ff /libs/ui | |
parent | c3f60ddaeadb69c1e85198e609e575f55ecc28ac (diff) | |
parent | 04c7d0f842ae1d3b52c426fccf7178861493431d (diff) | |
download | frameworks_base-6698d16b951370a0cc6aa87bcd2ca91122a57410.zip frameworks_base-6698d16b951370a0cc6aa87bcd2ca91122a57410.tar.gz frameworks_base-6698d16b951370a0cc6aa87bcd2ca91122a57410.tar.bz2 |
resolved conflicts for merge of 04c7d0f8 to master
Diffstat (limited to 'libs/ui')
-rw-r--r-- | libs/ui/Camera.cpp | 13 | ||||
-rw-r--r-- | libs/ui/ICameraClient.cpp | 23 |
2 files changed, 35 insertions, 1 deletions
diff --git a/libs/ui/Camera.cpp b/libs/ui/Camera.cpp index 0aa77ff..12a7725 100644 --- a/libs/ui/Camera.cpp +++ b/libs/ui/Camera.cpp @@ -310,6 +310,19 @@ void Camera::dataCallback(int32_t msgType, const sp<IMemory>& dataPtr) } } +// callback from camera service when timestamped frame is ready +void Camera::dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& dataPtr) +{ + sp<CameraListener> listener; + { + Mutex::Autolock _l(mLock); + listener = mListener; + } + if (listener != NULL) { + listener->postDataTimestamp(timestamp, msgType, dataPtr); + } +} + void Camera::binderDied(const wp<IBinder>& who) { LOGW("ICamera died"); notifyCallback(CAMERA_MSG_ERROR, CAMERA_ERROR_SERVER_DIED, 0); diff --git a/libs/ui/ICameraClient.cpp b/libs/ui/ICameraClient.cpp index a88fd48..42b4da4 100644 --- a/libs/ui/ICameraClient.cpp +++ b/libs/ui/ICameraClient.cpp @@ -27,6 +27,7 @@ namespace android { enum { NOTIFY_CALLBACK = IBinder::FIRST_CALL_TRANSACTION, DATA_CALLBACK, + DATA_CALLBACK_TIMESTAMP, }; class BpCameraClient: public BpInterface<ICameraClient> @@ -60,6 +61,17 @@ public: remote()->transact(DATA_CALLBACK, data, &reply, IBinder::FLAG_ONEWAY); } + // generic data callback from camera service to app with image data + void dataCallbackTimestamp(nsecs_t timestamp, int32_t msgType, const sp<IMemory>& imageData) + { + LOGV("dataCallback"); + Parcel data, reply; + data.writeInterfaceToken(ICameraClient::getInterfaceDescriptor()); + data.writeInt64(timestamp); + data.writeInt32(msgType); + data.writeStrongBinder(imageData->asBinder()); + remote()->transact(DATA_CALLBACK_TIMESTAMP, data, &reply, IBinder::FLAG_ONEWAY); + } }; IMPLEMENT_META_INTERFACE(CameraClient, "android.hardware.ICameraClient"); @@ -80,13 +92,22 @@ status_t BnCameraClient::onTransact( return NO_ERROR; } break; case DATA_CALLBACK: { - LOGV("RAW_CALLBACK"); + LOGV("DATA_CALLBACK"); CHECK_INTERFACE(ICameraClient, data, reply); int32_t msgType = data.readInt32(); sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder()); dataCallback(msgType, imageData); return NO_ERROR; } break; + case DATA_CALLBACK_TIMESTAMP: { + LOGV("DATA_CALLBACK_TIMESTAMP"); + CHECK_INTERFACE(ICameraClient, data, reply); + nsecs_t timestamp = data.readInt64(); + int32_t msgType = data.readInt32(); + sp<IMemory> imageData = interface_cast<IMemory>(data.readStrongBinder()); + dataCallbackTimestamp(timestamp, msgType, imageData); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); } |