summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--services/camera/libcameraservice/camera2/CaptureSequencer.cpp40
-rw-r--r--services/camera/libcameraservice/camera2/Parameters.cpp42
-rw-r--r--services/camera/libcameraservice/camera2/Parameters.h3
-rw-r--r--services/camera/libcameraservice/camera2/ZslProcessor.cpp22
-rw-r--r--services/camera/libcameraservice/camera2/ZslProcessor.h2
5 files changed, 75 insertions, 34 deletions
diff --git a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
index 98aa380..d56af64 100644
--- a/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
+++ b/services/camera/libcameraservice/camera2/CaptureSequencer.cpp
@@ -586,40 +586,12 @@ status_t CaptureSequencer::updateCaptureRequest(const Parameters &params,
return res;
}
- res = mCaptureRequest.update(ANDROID_JPEG_THUMBNAIL_SIZE,
- params.jpegThumbSize, 2);
- if (res != OK) return res;
- res = mCaptureRequest.update(ANDROID_JPEG_THUMBNAIL_QUALITY,
- &params.jpegThumbQuality, 1);
- if (res != OK) return res;
- res = mCaptureRequest.update(ANDROID_JPEG_QUALITY,
- &params.jpegQuality, 1);
- if (res != OK) return res;
- res = mCaptureRequest.update(
- ANDROID_JPEG_ORIENTATION,
- &params.jpegRotation, 1);
- if (res != OK) return res;
-
- if (params.gpsEnabled) {
- res = mCaptureRequest.update(
- ANDROID_JPEG_GPS_COORDINATES,
- params.gpsCoordinates, 3);
- if (res != OK) return res;
- res = mCaptureRequest.update(
- ANDROID_JPEG_GPS_TIMESTAMP,
- &params.gpsTimestamp, 1);
- if (res != OK) return res;
- res = mCaptureRequest.update(
- ANDROID_JPEG_GPS_PROCESSING_METHOD,
- params.gpsProcessingMethod);
- if (res != OK) return res;
- } else {
- res = mCaptureRequest.erase(ANDROID_JPEG_GPS_COORDINATES);
- if (res != OK) return res;
- res = mCaptureRequest.erase(ANDROID_JPEG_GPS_TIMESTAMP);
- if (res != OK) return res;
- res = mCaptureRequest.erase(ANDROID_JPEG_GPS_PROCESSING_METHOD);
- if (res != OK) return res;
+ res = params.updateRequestJpeg(&mCaptureRequest);
+ if (res != OK) {
+ ALOGE("%s: Camera %d: Unable to update JPEG entries of capture "
+ "request: %s (%d)", __FUNCTION__, client->getCameraId(),
+ strerror(-res), res);
+ return res;
}
return OK;
diff --git a/services/camera/libcameraservice/camera2/Parameters.cpp b/services/camera/libcameraservice/camera2/Parameters.cpp
index 74f4a7e..7740df2 100644
--- a/services/camera/libcameraservice/camera2/Parameters.cpp
+++ b/services/camera/libcameraservice/camera2/Parameters.cpp
@@ -1668,6 +1668,48 @@ status_t Parameters::updateRequest(CameraMetadata *request) const {
return OK;
}
+status_t Parameters::updateRequestJpeg(CameraMetadata *request) const {
+ status_t res;
+
+ res = request->update(ANDROID_JPEG_THUMBNAIL_SIZE,
+ jpegThumbSize, 2);
+ if (res != OK) return res;
+ res = request->update(ANDROID_JPEG_THUMBNAIL_QUALITY,
+ &jpegThumbQuality, 1);
+ if (res != OK) return res;
+ res = request->update(ANDROID_JPEG_QUALITY,
+ &jpegQuality, 1);
+ if (res != OK) return res;
+ res = request->update(
+ ANDROID_JPEG_ORIENTATION,
+ &jpegRotation, 1);
+ if (res != OK) return res;
+
+ if (gpsEnabled) {
+ res = request->update(
+ ANDROID_JPEG_GPS_COORDINATES,
+ gpsCoordinates, 3);
+ if (res != OK) return res;
+ res = request->update(
+ ANDROID_JPEG_GPS_TIMESTAMP,
+ &gpsTimestamp, 1);
+ if (res != OK) return res;
+ res = request->update(
+ ANDROID_JPEG_GPS_PROCESSING_METHOD,
+ gpsProcessingMethod);
+ if (res != OK) return res;
+ } else {
+ res = request->erase(ANDROID_JPEG_GPS_COORDINATES);
+ if (res != OK) return res;
+ res = request->erase(ANDROID_JPEG_GPS_TIMESTAMP);
+ if (res != OK) return res;
+ res = request->erase(ANDROID_JPEG_GPS_PROCESSING_METHOD);
+ if (res != OK) return res;
+ }
+ return OK;
+}
+
+
const char* Parameters::getStateName(State state) {
#define CASE_ENUM_TO_CHAR(x) case x: return(#x); break;
switch(state) {
diff --git a/services/camera/libcameraservice/camera2/Parameters.h b/services/camera/libcameraservice/camera2/Parameters.h
index 47eb993..a85500f 100644
--- a/services/camera/libcameraservice/camera2/Parameters.h
+++ b/services/camera/libcameraservice/camera2/Parameters.h
@@ -216,6 +216,9 @@ struct Parameters {
// Update passed-in request for common parameters
status_t updateRequest(CameraMetadata *request) const;
+ // Add/update JPEG entries in metadata
+ status_t updateRequestJpeg(CameraMetadata *request) const;
+
// Calculate the crop region rectangle based on current stream sizes
struct CropRegion {
float left;
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
index 7977f9d..56e9743 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
@@ -313,6 +313,20 @@ status_t ZslProcessor::pushToReprocess(int32_t requestId) {
return res;
}
+ // Update JPEG settings
+ {
+ SharedParameters::Lock l(client->getParameters());
+ res = l.mParameters.updateRequestJpeg(&request);
+ if (res != OK) {
+ ALOGE("%s: Camera %d: Unable to update JPEG entries of ZSL "
+ "capture request: %s (%d)", __FUNCTION__,
+ client->getCameraId(),
+ strerror(-res), res);
+ return res;
+ }
+ }
+
+ mLatestCapturedRequest = request;
res = client->getCameraDevice()->capture(request);
if (res != OK ) {
ALOGE("%s: Unable to send ZSL reprocess request to capture: %s (%d)",
@@ -350,6 +364,14 @@ status_t ZslProcessor::clearZslQueueLocked() {
void ZslProcessor::dump(int fd, const Vector<String16>& args) const {
Mutex::Autolock l(mInputMutex);
+ if (!mLatestCapturedRequest.isEmpty()) {
+ String8 result(" Latest ZSL capture request:\n");
+ write(fd, result.string(), result.size());
+ mLatestCapturedRequest.dump(fd, 2, 6);
+ } else {
+ String8 result(" Latest ZSL capture request: none yet\n");
+ write(fd, result.string(), result.size());
+ }
dumpZslQueue(fd);
}
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.h b/services/camera/libcameraservice/camera2/ZslProcessor.h
index 96ad5fb..1f433ce 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.h
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.h
@@ -105,6 +105,8 @@ class ZslProcessor:
size_t mZslQueueHead;
size_t mZslQueueTail;
+ CameraMetadata mLatestCapturedRequest;
+
virtual bool threadLoop();
status_t processNewZslBuffer(sp<Camera2Client> &client);