summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Petrov <vppetrov@mm-sol.com>2012-10-03 10:56:13 +0300
committerJason Simmons <jsimmons@google.com>2012-11-07 14:36:33 -0800
commit5207a2fbeaaa21c45d4d6bba782f7029f4be3315 (patch)
treec907cde64aeb7d34eb640fc1252966fca797b818
parent11308f1fc42a01958b9c13fad908141028fda9ad (diff)
downloadomap4-aah-5207a2fbeaaa21c45d4d6bba782f7029f4be3315.tar.gz
Camera_test: Add mechanism to explicitly set image streaming
- Add ability to explicitly set image streaming mode on buffer source thread. Change-Id: I96ad1b7b2a72b4d4764b6fc292730de99e084bb6 Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
-rw-r--r--test/CameraHal/camera_test.h4
-rw-r--r--test/CameraHal/camera_test_menu.cpp56
-rw-r--r--test/CameraHal/camera_test_script.cpp89
3 files changed, 78 insertions, 71 deletions
diff --git a/test/CameraHal/camera_test.h b/test/CameraHal/camera_test.h
index d08b0a0..f23ad3d 100644
--- a/test/CameraHal/camera_test.h
+++ b/test/CameraHal/camera_test.h
@@ -410,10 +410,10 @@ public:
virtual void setBuffer(android::ShotParameters &params) {};
virtual void onHandled(sp<GraphicBuffer> &g, unsigned int slot) {};
- bool toggleStreamCapture(int expBracketIdx) {
+ bool setStreamCapture(bool restart, int expBracketIdx) {
Mutex::Autolock lock(mToggleStateMutex);
mExpBracketIdx = expBracketIdx;
- mRestartCapture = !mRestartCapture;
+ mRestartCapture = restart;
return mRestartCapture;
}
diff --git a/test/CameraHal/camera_test_menu.cpp b/test/CameraHal/camera_test_menu.cpp
index 5b44824..dd099db 100644
--- a/test/CameraHal/camera_test_menu.cpp
+++ b/test/CameraHal/camera_test_menu.cpp
@@ -88,6 +88,7 @@ bool vnftoggle = false;
bool faceDetectToggle = false;
bool metaDataToggle = false;
bool shotConfigFlush = false;
+bool streamCapture = false;
int saturation = 0;
int zoomIDX = 0;
int videoCodecIDX = 0;
@@ -2138,6 +2139,7 @@ void initDefaults() {
caf_mode = 0;
shotConfigFlush = false;
+ streamCapture = false;
vstabtoggle = false;
vnftoggle = false;
AutoExposureLocktoggle = false;
@@ -3495,43 +3497,45 @@ int functional_menu() {
{
int msgType = 0;
- if(isRawPixelFormat(pictureFormatArray[pictureFormat])) {
- createBufferOutputSource();
- if (bufferSourceOutputThread.get()) {
- bufferSourceOutputThread->setBuffer(shotParams);
- }
- } else {
- msgType = CAMERA_MSG_COMPRESSED_IMAGE |
- CAMERA_MSG_RAW_IMAGE;
-#ifdef OMAP_ENHANCEMENT_BURST_CAPTURE
- msgType |= CAMERA_MSG_RAW_BURST;
-#endif
- }
-
if((0 == strcmp(modevalues[capture_mode], "video-mode")) &&
(0 != strcmp(videosnapshotstr, "true"))) {
printf("Video Snapshot is not supported\n");
- } else {
- gettimeofday(&picture_start, 0);
- if ( hardwareActive ) {
- camera->setParameters(params.flatten());
- camera->takePictureWithParameters(msgType, shotParams.flatten());
+ } else if ( hardwareActive ) {
+ if(isRawPixelFormat(pictureFormatArray[pictureFormat])) {
+ createBufferOutputSource();
+ if (bufferSourceOutputThread.get()) {
+ bufferSourceOutputThread->setBuffer(shotParams);
+ bufferSourceOutputThread->setStreamCapture(streamCapture, expBracketIdx);
+ }
+ } else {
+ msgType = CAMERA_MSG_COMPRESSED_IMAGE |
+ CAMERA_MSG_RAW_IMAGE;
+#ifdef OMAP_ENHANCEMENT_BURST_CAPTURE
+ msgType |= CAMERA_MSG_RAW_BURST;
+#endif
}
+
+ gettimeofday(&picture_start, 0);
+ camera->setParameters(params.flatten());
+ camera->takePictureWithParameters(msgType, shotParams.flatten());
}
break;
}
case 'S':
{
- createBufferOutputSource();
- if (bufferSourceOutputThread.get()) {
- if (bufferSourceOutputThread->toggleStreamCapture(expBracketIdx)) {
- setSingleExpGainPreset(shotParams, expBracketIdx, 0, 0);
- // Queue more frames initially
- shotParams.set(ShotParameters::KEY_BURST, BRACKETING_STREAM_BUFFERS);
- } else {
- setDefaultExpGainPreset(shotParams, expBracketIdx);
+ if (streamCapture) {
+ streamCapture = false;
+ setDefaultExpGainPreset(shotParams, expBracketIdx);
+ // Stop streaming
+ if (bufferSourceOutputThread.get()) {
+ bufferSourceOutputThread->setStreamCapture(streamCapture, expBracketIdx);
}
+ } else {
+ streamCapture = true;
+ setSingleExpGainPreset(shotParams, expBracketIdx, 0, 0);
+ // Queue more frames initially
+ shotParams.set(ShotParameters::KEY_BURST, BRACKETING_STREAM_BUFFERS);
}
break;
}
diff --git a/test/CameraHal/camera_test_script.cpp b/test/CameraHal/camera_test_script.cpp
index 4a017bc..ef43ff9 100644
--- a/test/CameraHal/camera_test_script.cpp
+++ b/test/CameraHal/camera_test_script.cpp
@@ -36,6 +36,7 @@ extern sp<BufferSourceInput> bufferSourceInput;
extern CameraParameters params;
extern ShotParameters shotParams;
extern bool shotConfigFlush;
+extern bool streamCapture;
extern bool recordingMode;
extern int camera_index;
extern int rotation;
@@ -1191,46 +1192,45 @@ int execute_functional_script(char *script) {
case 'p':
{
- int msgType = 0;
- const char *format = params.getPictureFormat();
+ int msgType = 0;
+ const char *format = params.getPictureFormat();
- if((NULL != format) && isRawPixelFormat(format)) {
- createBufferOutputSource();
- if (bufferSourceOutputThread.get()) {
- bufferSourceOutputThread->setBuffer(shotParams);
- }
- } else if(strcmp(modevalues[capture_mode], "video-mode") == 0) {
- msgType = CAMERA_MSG_COMPRESSED_IMAGE |
- CAMERA_MSG_RAW_IMAGE;
+ if((0 == strcmp(modevalues[capture_mode], "video-mode")) &&
+ (0 != strcmp(videosnapshotstr, "true"))) {
+ printf("Video Snapshot is not supported\n");
+ } else if ( hardwareActive ) {
+ if((NULL != format) && isRawPixelFormat(format)) {
+ createBufferOutputSource();
+ if (bufferSourceOutputThread.get()) {
+ bufferSourceOutputThread->setBuffer(shotParams);
+ bufferSourceOutputThread->setStreamCapture(streamCapture, expBracketIdx);
+ }
+ } else if(strcmp(modevalues[capture_mode], "video-mode") == 0) {
+ msgType = CAMERA_MSG_COMPRESSED_IMAGE |
+ CAMERA_MSG_RAW_IMAGE;
#ifdef OMAP_ENHANCEMENT_BURST_CAPTURE
- msgType |= CAMERA_MSG_RAW_BURST;
+ msgType |= CAMERA_MSG_RAW_BURST;
#endif
- } else {
- msgType = CAMERA_MSG_POSTVIEW_FRAME |
- CAMERA_MSG_RAW_IMAGE_NOTIFY |
- CAMERA_MSG_COMPRESSED_IMAGE |
- CAMERA_MSG_SHUTTER;
+ } else {
+ msgType = CAMERA_MSG_POSTVIEW_FRAME |
+ CAMERA_MSG_RAW_IMAGE_NOTIFY |
+ CAMERA_MSG_COMPRESSED_IMAGE |
+ CAMERA_MSG_SHUTTER;
#ifdef OMAP_ENHANCEMENT_BURST_CAPTURE
- msgType |= CAMERA_MSG_RAW_BURST;
+ msgType |= CAMERA_MSG_RAW_BURST;
#endif
- }
+ }
- if((0 == strcmp(modevalues[capture_mode], "video-mode")) &&
- (0 != strcmp(videosnapshotstr, "true"))) {
- printf("Video Snapshot is not supported\n");
- } else {
gettimeofday(&picture_start, 0);
- if ( hardwareActive ) {
- ret = camera->setParameters(params.flatten());
- if ( ret != NO_ERROR ) {
- printf("Error returned while setting parameters");
- break;
- }
- ret = camera->takePictureWithParameters(msgType, shotParams.flatten());
- if ( ret != NO_ERROR ) {
- printf("Error returned while taking a picture");
- break;
- }
+ ret = camera->setParameters(params.flatten());
+ if ( ret != NO_ERROR ) {
+ printf("Error returned while setting parameters");
+ break;
+ }
+ ret = camera->takePictureWithParameters(msgType, shotParams.flatten());
+ if ( ret != NO_ERROR ) {
+ printf("Error returned while taking a picture");
+ break;
}
}
break;
@@ -1238,17 +1238,20 @@ int execute_functional_script(char *script) {
case 'S':
{
- createBufferOutputSource();
- if (bufferSourceOutputThread.get()) {
- if (bufferSourceOutputThread->toggleStreamCapture(expBracketIdx)) {
- expBracketIdx = BRACKETING_IDX_STREAM;
- setSingleExpGainPreset(shotParams, expBracketIdx, 0, 0);
- // Queue more frames initially
- shotParams.set(ShotParameters::KEY_BURST, BRACKETING_STREAM_BUFFERS);
- } else {
- expBracketIdx = BRACKETING_IDX_DEFAULT;
- setDefaultExpGainPreset(shotParams, expBracketIdx);
+ if (streamCapture) {
+ streamCapture = false;
+ expBracketIdx = BRACKETING_IDX_DEFAULT;
+ setDefaultExpGainPreset(shotParams, expBracketIdx);
+ // Stop streaming
+ if (bufferSourceOutputThread.get()) {
+ bufferSourceOutputThread->setStreamCapture(streamCapture, expBracketIdx);
}
+ } else {
+ streamCapture = true;
+ expBracketIdx = BRACKETING_IDX_STREAM;
+ setSingleExpGainPreset(shotParams, expBracketIdx, 0, 0);
+ // Queue more frames initially
+ shotParams.set(ShotParameters::KEY_BURST, BRACKETING_STREAM_BUFFERS);
}
break;
}