OSDN Git Service

modules: camera: Input buffer reprocessing scaffolding
authorAlex Ray <aray@google.com>
Fri, 26 Apr 2013 21:47:08 +0000 (14:47 -0700)
committerAlexander Ray <aray@google.com>
Wed, 29 May 2013 03:38:20 +0000 (03:38 +0000)
Change-Id: I158ba833549aee47ca3be5673f6f5d33e455ef59

modules/camera/Camera.cpp
modules/camera/Camera.h

index 7f53c2e..4a45a2e 100644 (file)
@@ -310,6 +310,25 @@ int Camera::processCaptureRequest(camera3_capture_request_t *request)
         setSettings(request->settings);
     }
 
+    if (request->input_buffer != NULL) {
+        ALOGV("%s:%d: Reprocessing input buffer %p", __func__, mId,
+                request->input_buffer);
+
+        if (!isValidReprocessSettings(request->settings)) {
+            ALOGE("%s:%d: Invalid settings for reprocess request: %p",
+                    __func__, mId, request->settings);
+            return -EINVAL;
+        }
+    } else {
+        ALOGV("%s:%d: Capturing new frame.", __func__, mId);
+
+        if (!isValidCaptureSettings(request->settings)) {
+            ALOGE("%s:%d: Invalid settings for capture request: %p",
+                    __func__, mId, request->settings);
+            return -EINVAL;
+        }
+    }
+
     // TODO: verify request; submit request to hardware
     return 0;
 }
@@ -325,6 +344,20 @@ void Camera::setSettings(const camera_metadata_t *new_settings)
         mSettings = clone_camera_metadata(new_settings);
 }
 
+bool Camera::isValidCaptureSettings(const camera_metadata_t *settings)
+{
+    // TODO: reject settings that cannot be captured
+    return true;
+}
+
+bool Camera::isValidReprocessSettings(const camera_metadata_t *settings)
+{
+    // TODO: reject settings that cannot be reprocessed
+    // input buffers unimplemented, use this to reject reprocessing requests
+    ALOGE("%s:%d: Input buffer reprocessing not implemented", __func__, mId);
+    return false;
+}
+
 void Camera::getMetadataVendorTagOps(vendor_tag_query_ops_t *ops)
 {
     ALOGV("%s:%d: ops=%p", __func__, mId, ops);
index 1d88cf3..39e47f7 100644 (file)
@@ -61,6 +61,10 @@ class Camera {
         void setupStreams(Stream **array, int count);
         // Copy new settings for re-use and clean up old settings.
         void setSettings(const camera_metadata_t *new_settings);
+        // Verify settings are valid for a capture
+        bool isValidCaptureSettings(const camera_metadata_t *settings);
+        // Verify settings are valid for reprocessing an input buffer
+        bool isValidReprocessSettings(const camera_metadata_t *settings);
 
         // Identifier used by framework to distinguish cameras
         const int mId;