diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2015-04-11 13:15:45 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2015-04-15 10:51:33 -0700 |
commit | 4d44cad22ea925a651463f2d51d6586c14d4b787 (patch) | |
tree | 3e9fa49f6f98a8deee591f58054488ddc6e46505 /camera/camera2 | |
parent | 4123d6db0642cd13e69230705b12d6b6fee6f73f (diff) | |
download | frameworks_av-4d44cad22ea925a651463f2d51d6586c14d4b787.zip frameworks_av-4d44cad22ea925a651463f2d51d6586c14d4b787.tar.gz frameworks_av-4d44cad22ea925a651463f2d51d6586c14d4b787.tar.bz2 |
Camera2: Add prepare for output streams
The prepare call asynchronously pre-allocates buffers for a given
output stream, and then fires the onPrepared callback.
Not implemented for Camera2Device or used in Camera2Client.
Change-Id: I1cccdfff846dd6985133c591dbdceed823929ade
Diffstat (limited to 'camera/camera2')
-rw-r--r-- | camera/camera2/ICameraDeviceCallbacks.cpp | 22 | ||||
-rw-r--r-- | camera/camera2/ICameraDeviceUser.cpp | 25 |
2 files changed, 45 insertions, 2 deletions
diff --git a/camera/camera2/ICameraDeviceCallbacks.cpp b/camera/camera2/ICameraDeviceCallbacks.cpp index 4cc7b5d..f599879 100644 --- a/camera/camera2/ICameraDeviceCallbacks.cpp +++ b/camera/camera2/ICameraDeviceCallbacks.cpp @@ -37,6 +37,7 @@ enum { CAMERA_IDLE, CAPTURE_STARTED, RESULT_RECEIVED, + PREPARED }; class BpCameraDeviceCallbacks: public BpInterface<ICameraDeviceCallbacks> @@ -80,7 +81,6 @@ public: data.writeNoException(); } - void onResultReceived(const CameraMetadata& metadata, const CaptureResultExtras& resultExtras) { ALOGV("onResultReceived"); @@ -93,6 +93,17 @@ public: remote()->transact(RESULT_RECEIVED, data, &reply, IBinder::FLAG_ONEWAY); data.writeNoException(); } + + void onPrepared(int streamId) + { + ALOGV("onPrepared"); + Parcel data, reply; + data.writeInterfaceToken(ICameraDeviceCallbacks::getInterfaceDescriptor()); + data.writeInt32(streamId); + remote()->transact(PREPARED, data, &reply, IBinder::FLAG_ONEWAY); + data.writeNoException(); + } + }; IMPLEMENT_META_INTERFACE(CameraDeviceCallbacks, @@ -160,6 +171,15 @@ status_t BnCameraDeviceCallbacks::onTransact( data.readExceptionCode(); return NO_ERROR; } break; + case PREPARED: { + ALOGV("onPrepared"); + CHECK_INTERFACE(ICameraDeviceCallbacks, data, reply); + CaptureResultExtras result; + int streamId = data.readInt32(); + onPrepared(streamId); + data.readExceptionCode(); + return NO_ERROR; + } break; default: return BBinder::onTransact(code, data, reply, flags); } diff --git a/camera/camera2/ICameraDeviceUser.cpp b/camera/camera2/ICameraDeviceUser.cpp index 2ec08a9..9700258 100644 --- a/camera/camera2/ICameraDeviceUser.cpp +++ b/camera/camera2/ICameraDeviceUser.cpp @@ -47,7 +47,8 @@ enum { CREATE_DEFAULT_REQUEST, GET_CAMERA_INFO, WAIT_UNTIL_IDLE, - FLUSH + FLUSH, + PREPARE }; namespace { @@ -348,6 +349,20 @@ public: return res; } + virtual status_t prepare(int streamId) + { + ALOGV("prepare"); + Parcel data, reply; + + data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor()); + data.writeInt32(streamId); + + remote()->transact(PREPARE, data, &reply); + + reply.readExceptionCode(); + return reply.readInt32(); + } + private: @@ -545,6 +560,14 @@ status_t BnCameraDeviceUser::onTransact( reply->writeInt32(endConfigure()); return NO_ERROR; } break; + case PREPARE: { + CHECK_INTERFACE(ICameraDeviceUser, data, reply); + int streamId = data.readInt32(); + reply->writeNoException(); + reply->writeInt32(prepare(streamId)); + return NO_ERROR; + } break; + default: return BBinder::onTransact(code, data, reply, flags); } |