summaryrefslogtreecommitdiffstats
path: root/services/camera
diff options
context:
space:
mode:
authorShuzhen Wang <shuzhenw@codeaurora.org>2015-07-08 15:47:46 -0700
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:24:02 -0600
commitf462de9dac6a858ab42447a67ba5077e3effb04e (patch)
tree226386a8cfe63458b02757b0b0248dda9065f447 /services/camera
parent66296c4e99da5f2dd0a3dbf048be0d6ffc49a559 (diff)
downloadframeworks_av-f462de9dac6a858ab42447a67ba5077e3effb04e.zip
frameworks_av-f462de9dac6a858ab42447a67ba5077e3effb04e.tar.gz
frameworks_av-f462de9dac6a858ab42447a67ba5077e3effb04e.tar.bz2
Camera: Add extensions to CameraClient
This change includes the following gerrits: # This is a combination of 4 commits. # The first commit's message is: Camera: Enable Histogram feature. Link the histogram enable/disable commands from application to the HAL layer. Change-Id: I510c4e1798285ed1315bfb0d234fa76090659ba2 # This is the 2nd commit message: Camera: Add support for ZSL burst mode. Added ability to set number of snapshots in burst mode. Change-Id: Ie0e7c8c0117b7adc985cfc92df79747ee6a5ea51 # This is the 3rd commit message: CameraService: Adds support for longshot mode - This change introduces additional functionality inside CameraClient for supporting continuous compressed data callbacks. This is needed for 'Burst/Long shot' mode where we could have indefinite number of callbacks after capture is triggered. (cherrypicked from commit e4f502aa7cbe8875e8a1589024cdcf227c228a2b) Change-Id: Ia18ca9bdda7736c679db557e510870115089537a # This is the 4th commit message: CameraClient: Enables meta data notifications. Adds the needed functionality for enabling/disabling metadata messages depending on the camera client commands. Change-Id: I39d632b4742e83df5db5f86b12742aefc2480dfc Cherrypicked from 25bd97f5ec30e7942c3b1fdc96115da6028736f0 Change-Id: Ie930d20c962593e40a0767f9cf7d4385df8e2561
Diffstat (limited to 'services/camera')
-rw-r--r--services/camera/libcameraservice/api1/CameraClient.cpp33
-rw-r--r--services/camera/libcameraservice/api1/CameraClient.h3
2 files changed, 34 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp
index e552633..f3a7988 100644
--- a/services/camera/libcameraservice/api1/CameraClient.cpp
+++ b/services/camera/libcameraservice/api1/CameraClient.cpp
@@ -56,6 +56,9 @@ CameraClient::CameraClient(const sp<CameraService>& cameraService,
mOrientation = getOrientation(0, mCameraFacing == CAMERA_FACING_FRONT);
mLegacyMode = legacyMode;
mPlayShutterSound = true;
+
+ mLongshotEnabled = false;
+ mBurstCnt = 0;
LOG1("CameraClient::CameraClient X (pid %d, id %d)", callingPid, cameraId);
}
@@ -544,6 +547,10 @@ status_t CameraClient::takePicture(int msgType) {
CAMERA_MSG_COMPRESSED_IMAGE);
enableMsgType(picMsgType);
+ mBurstCnt = mHardware->getParameters().getInt("num-snaps-per-shutter");
+ if(mBurstCnt <= 0)
+ mBurstCnt = 1;
+ LOG1("mBurstCnt = %d", mBurstCnt);
return mHardware->takePicture();
}
@@ -646,6 +653,20 @@ status_t CameraClient::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) {
} else if (cmd == CAMERA_CMD_PING) {
// If mHardware is 0, checkPidAndHardware will return error.
return OK;
+ } else if (cmd == CAMERA_CMD_HISTOGRAM_ON) {
+ enableMsgType(CAMERA_MSG_STATS_DATA);
+ } else if (cmd == CAMERA_CMD_HISTOGRAM_OFF) {
+ disableMsgType(CAMERA_MSG_STATS_DATA);
+ } else if (cmd == CAMERA_CMD_METADATA_ON) {
+ enableMsgType(CAMERA_MSG_META_DATA);
+ } else if (cmd == CAMERA_CMD_METADATA_OFF) {
+ disableMsgType(CAMERA_MSG_META_DATA);
+ } else if ( cmd == CAMERA_CMD_LONGSHOT_ON ) {
+ mLongshotEnabled = true;
+ } else if ( cmd == CAMERA_CMD_LONGSHOT_OFF ) {
+ mLongshotEnabled = false;
+ disableMsgType(CAMERA_MSG_SHUTTER);
+ disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE);
}
return mHardware->sendCommand(cmd, arg1, arg2);
@@ -788,7 +809,9 @@ void CameraClient::handleShutter(void) {
c->notifyCallback(CAMERA_MSG_SHUTTER, 0, 0);
if (!lockIfMessageWanted(CAMERA_MSG_SHUTTER)) return;
}
- disableMsgType(CAMERA_MSG_SHUTTER);
+ if ( !mLongshotEnabled ) {
+ disableMsgType(CAMERA_MSG_SHUTTER);
+ }
mLock.unlock();
}
@@ -867,7 +890,13 @@ void CameraClient::handleRawPicture(const sp<IMemory>& mem) {
// picture callback - compressed picture ready
void CameraClient::handleCompressedPicture(const sp<IMemory>& mem) {
- disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE);
+ if (mBurstCnt)
+ mBurstCnt--;
+
+ if (!mBurstCnt && !mLongshotEnabled) {
+ LOG1("handleCompressedPicture mBurstCnt = %d", mBurstCnt);
+ disableMsgType(CAMERA_MSG_COMPRESSED_IMAGE);
+ }
sp<ICameraClient> c = mRemoteCallback;
mLock.unlock();
diff --git a/services/camera/libcameraservice/api1/CameraClient.h b/services/camera/libcameraservice/api1/CameraClient.h
index 95616b2..9d2d02f 100644
--- a/services/camera/libcameraservice/api1/CameraClient.h
+++ b/services/camera/libcameraservice/api1/CameraClient.h
@@ -162,6 +162,9 @@ private:
// This function keeps trying to grab mLock, or give up if the message
// is found to be disabled. It returns true if mLock is grabbed.
bool lockIfMessageWanted(int32_t msgType);
+
+ bool mLongshotEnabled;
+ int mBurstCnt;
};
}