summaryrefslogtreecommitdiffstats
path: root/camera
diff options
context:
space:
mode:
authorChien-Yu Chen <cychen@google.com>2015-03-13 11:27:17 -0700
committerChien-Yu Chen <cychen@google.com>2015-04-13 17:25:36 -0700
commit618ff8a48a0c895a78f91f5692510c2a809425c3 (patch)
tree9473236e1e759aecf921b87e50302d933bae041d /camera
parent25f82752942b1c78aec8ee303d61afff85cff9d1 (diff)
downloadframeworks_av-618ff8a48a0c895a78f91f5692510c2a809425c3.zip
frameworks_av-618ff8a48a0c895a78f91f5692510c2a809425c3.tar.gz
frameworks_av-618ff8a48a0c895a78f91f5692510c2a809425c3.tar.bz2
camera2: add reprocess support
Add support to create input stream, submit reprocess capture requests, and receive reprocess capture results. Change-Id: Iee2d4313f3d52616a484eaea7a28f5ef9d8a674b
Diffstat (limited to 'camera')
-rw-r--r--camera/camera2/CaptureRequest.cpp9
-rw-r--r--camera/camera2/ICameraDeviceUser.cpp74
2 files changed, 83 insertions, 0 deletions
diff --git a/camera/camera2/CaptureRequest.cpp b/camera/camera2/CaptureRequest.cpp
index 66d6913..4217bc6 100644
--- a/camera/camera2/CaptureRequest.cpp
+++ b/camera/camera2/CaptureRequest.cpp
@@ -81,6 +81,13 @@ status_t CaptureRequest::readFromParcel(Parcel* parcel) {
mSurfaceList.push_back(surface);
}
+ int isReprocess = 0;
+ if ((err = parcel->readInt32(&isReprocess)) != OK) {
+ ALOGE("%s: Failed to read reprocessing from parcel", __FUNCTION__);
+ return err;
+ }
+ mIsReprocess = (isReprocess != 0);
+
return OK;
}
@@ -118,6 +125,8 @@ status_t CaptureRequest::writeToParcel(Parcel* parcel) const {
parcel->writeStrongBinder(binder);
}
+ parcel->writeInt32(mIsReprocess ? 1 : 0);
+
return OK;
}
diff --git a/camera/camera2/ICameraDeviceUser.cpp b/camera/camera2/ICameraDeviceUser.cpp
index 89c6fb7..2ec08a9 100644
--- a/camera/camera2/ICameraDeviceUser.cpp
+++ b/camera/camera2/ICameraDeviceUser.cpp
@@ -42,6 +42,8 @@ enum {
END_CONFIGURE,
DELETE_STREAM,
CREATE_STREAM,
+ CREATE_INPUT_STREAM,
+ GET_INPUT_SURFACE,
CREATE_DEFAULT_REQUEST,
GET_CAMERA_INFO,
WAIT_UNTIL_IDLE,
@@ -225,6 +227,50 @@ public:
return reply.readInt32();
}
+ virtual status_t createInputStream(int width, int height, int format)
+ {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor());
+ data.writeInt32(width);
+ data.writeInt32(height);
+ data.writeInt32(format);
+
+ remote()->transact(CREATE_INPUT_STREAM, data, &reply);
+
+ reply.readExceptionCode();
+ return reply.readInt32();
+ }
+
+ // get the buffer producer of the input stream
+ virtual status_t getInputBufferProducer(
+ sp<IGraphicBufferProducer> *producer) {
+ if (producer == NULL) {
+ return BAD_VALUE;
+ }
+
+ Parcel data, reply;
+ data.writeInterfaceToken(ICameraDeviceUser::getInterfaceDescriptor());
+
+ remote()->transact(GET_INPUT_SURFACE, data, &reply);
+
+ reply.readExceptionCode();
+ status_t result = reply.readInt32() ;
+ if (result != OK) {
+ return result;
+ }
+
+ sp<IGraphicBufferProducer> bp = NULL;
+ if (reply.readInt32() != 0) {
+ String16 name = readMaybeEmptyString16(reply);
+ bp = interface_cast<IGraphicBufferProducer>(
+ reply.readStrongBinder());
+ }
+
+ *producer = bp;
+
+ return *producer == NULL ? INVALID_OPERATION : OK;
+ }
+
// Create a request object from a template.
virtual status_t createDefaultRequest(int templateId,
/*out*/
@@ -409,7 +455,35 @@ status_t BnCameraDeviceUser::onTransact(
return NO_ERROR;
} break;
+ case CREATE_INPUT_STREAM: {
+ CHECK_INTERFACE(ICameraDeviceUser, data, reply);
+ int width, height, format;
+
+ width = data.readInt32();
+ height = data.readInt32();
+ format = data.readInt32();
+ status_t ret = createInputStream(width, height, format);
+
+ reply->writeNoException();
+ reply->writeInt32(ret);
+ return NO_ERROR;
+
+ } break;
+ case GET_INPUT_SURFACE: {
+ CHECK_INTERFACE(ICameraDeviceUser, data, reply);
+
+ sp<IGraphicBufferProducer> bp;
+ status_t ret = getInputBufferProducer(&bp);
+ sp<IBinder> b(IInterface::asBinder(ret == OK ? bp : NULL));
+
+ reply->writeNoException();
+ reply->writeInt32(ret);
+ reply->writeInt32(1);
+ reply->writeString16(String16("camera input")); // name of surface
+ reply->writeStrongBinder(b);
+ return NO_ERROR;
+ } break;
case CREATE_DEFAULT_REQUEST: {
CHECK_INTERFACE(ICameraDeviceUser, data, reply);