summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/camera/Camera.cpp26
-rw-r--r--modules/camera/Camera.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/modules/camera/Camera.cpp b/modules/camera/Camera.cpp
index 10464cb..1c307de 100644
--- a/modules/camera/Camera.cpp
+++ b/modules/camera/Camera.cpp
@@ -544,6 +544,7 @@ int Camera::processCaptureRequest(camera3_capture_request_t *request)
// TODO: return actual captured/reprocessed settings
result.result = request->settings;
// TODO: asynchronously return results
+ notifyShutter(request->frame_number, 0);
mCallbackOps->process_capture_result(mCallbackOps, &result);
return 0;
@@ -606,6 +607,31 @@ int Camera::processCaptureBuffer(const camera3_stream_buffer_t *in,
return 0;
}
+void Camera::notifyShutter(uint32_t frame_number, uint64_t timestamp)
+{
+ int res;
+ struct timespec ts;
+
+ // If timestamp is 0, get timestamp from right now instead
+ if (timestamp == 0) {
+ ALOGW("%s:%d: No timestamp provided, using CLOCK_BOOTTIME",
+ __func__, mId);
+ res = clock_gettime(CLOCK_BOOTTIME, &ts);
+ if (res == 0) {
+ timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec;
+ } else {
+ ALOGE("%s:%d: No timestamp and failed to get CLOCK_BOOTTIME %s(%d)",
+ __func__, mId, strerror(errno), errno);
+ }
+ }
+ camera3_notify_msg_t m;
+ memset(&m, 0, sizeof(m));
+ m.type = CAMERA3_MSG_SHUTTER;
+ m.message.shutter.frame_number = frame_number;
+ m.message.shutter.timestamp = timestamp;
+ mCallbackOps->notify(mCallbackOps, &m);
+}
+
void Camera::getMetadataVendorTagOps(vendor_tag_query_ops_t *ops)
{
ALOGV("%s:%d: ops=%p", __func__, mId, ops);
diff --git a/modules/camera/Camera.h b/modules/camera/Camera.h
index c7ee52d..16e1439 100644
--- a/modules/camera/Camera.h
+++ b/modules/camera/Camera.h
@@ -72,6 +72,8 @@ class Camera {
// Process an output buffer
int processCaptureBuffer(const camera3_stream_buffer_t *in,
camera3_stream_buffer_t *out);
+ // Send a shutter notify message with start of exposure time
+ void notifyShutter(uint32_t frame_number, uint64_t timestamp);
// Identifier used by framework to distinguish cameras
const int mId;