summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2013-02-20 19:02:36 -0800
committerIgor Murashkin <iam@google.com>2013-02-22 10:50:14 -0800
commit3261fd3f1d8f798fab2f1b3efaa92d5a35cd42e7 (patch)
tree9a0cb4915b6a53e828285e868da097f4c4575124 /services
parent985fd30a10f6fec4293f071fd258c4726cff5a3d (diff)
downloadframeworks_av-3261fd3f1d8f798fab2f1b3efaa92d5a35cd42e7.zip
frameworks_av-3261fd3f1d8f798fab2f1b3efaa92d5a35cd42e7.tar.gz
frameworks_av-3261fd3f1d8f798fab2f1b3efaa92d5a35cd42e7.tar.bz2
Camera: ProCamera2Client implement createStream,createDefaultRequest
The StreamingImage unit test should now work when TEST_DISPLAY_SECS is set. Change-Id: I9cf3ad5bd5a76096ab21bd39e631d636c4ff3d3f
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/ProCamera2Client.cpp68
-rw-r--r--services/camera/libcameraservice/ProCamera2Client.h1
2 files changed, 54 insertions, 15 deletions
diff --git a/services/camera/libcameraservice/ProCamera2Client.cpp b/services/camera/libcameraservice/ProCamera2Client.cpp
index d6389a1..5ebe713 100644
--- a/services/camera/libcameraservice/ProCamera2Client.cpp
+++ b/services/camera/libcameraservice/ProCamera2Client.cpp
@@ -194,8 +194,15 @@ status_t ProCamera2Client::submitRequest(camera_metadata_t* request,
return PERMISSION_DENIED;
}
- ALOGE("%s: not fully implemented yet", __FUNCTION__);
- free_camera_metadata(request);
+ CameraMetadata metadata(request);
+
+ if (streaming) {
+ return mDevice->setStreamingRequest(metadata);
+ } else {
+ return mDevice->capture(metadata);
+ }
+
+ // unreachable. thx gcc for a useless warning
return OK;
}
@@ -209,7 +216,7 @@ status_t ProCamera2Client::cancelRequest(int requestId) {
}
ALOGE("%s: not fully implemented yet", __FUNCTION__);
- return OK;
+ return INVALID_OPERATION;
}
status_t ProCamera2Client::requestStream(int streamId) {
@@ -219,31 +226,62 @@ status_t ProCamera2Client::requestStream(int streamId) {
}
status_t ProCamera2Client::cancelStream(int streamId) {
- ALOGE("%s: not implemented yet", __FUNCTION__);
+ ATRACE_CALL();
+ ALOGV("%s (streamId = 0x%x)", __FUNCTION__, streamId);
- return INVALID_OPERATION;
+ status_t res;
+ if ( (res = checkPid(__FUNCTION__) ) != OK) return res;
+
+ Mutex::Autolock icl(mIProCameraUserLock);
+
+ return mDevice->deleteStream(streamId);
}
status_t ProCamera2Client::createStream(int width, int height, int format,
- const sp<Surface>& surface,
- /*out*/
- int* streamId) {
- ALOGE("%s: not implemented yet", __FUNCTION__);
+ const sp<Surface>& surface,
+ /*out*/
+ int* streamId)
+{
+ if (streamId) {
+ *streamId = -1;
+ }
- return INVALID_OPERATION;
+ ATRACE_CALL();
+ ALOGV("%s (w = %d, h = %d, f = 0x%x)", __FUNCTION__, width, height, format);
+
+ status_t res;
+ if ( (res = checkPid(__FUNCTION__) ) != OK) return res;
+
+ Mutex::Autolock icl(mIProCameraUserLock);
+
+ return mDevice->createStream(surface, width, height, format, /*size*/1, streamId);
}
+// Create a request object from a template.
+// -- Caller owns the newly allocated metadata
status_t ProCamera2Client::createDefaultRequest(int templateId,
- /*out*/
- camera_metadata** request) {
- ALOGE("%s: not implemented yet", __FUNCTION__);
+ /*out*/
+ camera_metadata** request)
+{
+ ATRACE_CALL();
+ ALOGV("%s (templateId = 0x%x)", __FUNCTION__, templateId);
- return INVALID_OPERATION;
-}
+ if (request) {
+ *request = NULL;
+ }
+ status_t res;
+ if ( (res = checkPid(__FUNCTION__) ) != OK) return res;
+ Mutex::Autolock icl(mIProCameraUserLock);
+ CameraMetadata metadata;
+ if ( (res = mDevice->createDefaultRequest(templateId, &metadata) ) == OK) {
+ *request = metadata.release();
+ }
+ return res;
+}
status_t ProCamera2Client::dump(int fd, const Vector<String16>& args) {
String8 result;
diff --git a/services/camera/libcameraservice/ProCamera2Client.h b/services/camera/libcameraservice/ProCamera2Client.h
index 8f76819..ed42e22 100644
--- a/services/camera/libcameraservice/ProCamera2Client.h
+++ b/services/camera/libcameraservice/ProCamera2Client.h
@@ -58,6 +58,7 @@ public:
int* streamId);
// Create a request object from a template.
+ // -- Caller owns the newly allocated metadata
virtual status_t createDefaultRequest(int templateId,
/*out*/
camera_metadata** request);