Merge "Allowing useStillCameraForTimeLapse to be set through MediaRecorder.java"

This commit is contained in:
Nipun Kwatra
2010-08-03 13:38:25 -07:00
committed by Android (Google) Code Review
3 changed files with 25 additions and 1 deletions

View File

@@ -288,9 +288,12 @@ public class MediaRecorder
* @hide
*/
public void setTimeLapseParameters(boolean enableTimeLapse,
boolean useStillCameraForTimeLapse,
int timeBetweenTimeLapseFrameCaptureMs, int encoderLevel) {
setParameter(String.format("time-lapse-enable=%d",
(enableTimeLapse) ? 1 : 0));
setParameter(String.format("use-still-camera-for-time-lapse=%d",
(useStillCameraForTimeLapse) ? 1 : 0));
setParameter(String.format("time-between-time-lapse-frame-capture=%d",
timeBetweenTimeLapseFrameCaptureMs));
setVideoEncoderLevel(encoderLevel);

View File

@@ -486,6 +486,19 @@ status_t StagefrightRecorder::setParamTimeLapseEnable(int32_t timeLapseEnable) {
return OK;
}
status_t StagefrightRecorder::setParamUseStillCameraForTimeLapse(int32_t useStillCamera) {
LOGV("setParamUseStillCameraForTimeLapse: %d", useStillCamera);
if(useStillCamera == 0) {
mUseStillCameraForTimeLapse= false;
} else if (useStillCamera == 1) {
mUseStillCameraForTimeLapse= true;
} else {
return BAD_VALUE;
}
return OK;
}
status_t StagefrightRecorder::setParamTimeBetweenTimeLapseFrameCapture(int64_t timeUs) {
LOGV("setParamTimeBetweenTimeLapseFrameCapture: %lld us", timeUs);
@@ -587,6 +600,11 @@ status_t StagefrightRecorder::setParameter(
if (safe_strtoi32(value.string(), &timeLapseEnable)) {
return setParamTimeLapseEnable(timeLapseEnable);
}
} else if (key == "use-still-camera-for-time-lapse") {
int32_t useStillCamera;
if (safe_strtoi32(value.string(), &useStillCamera)) {
return setParamUseStillCameraForTimeLapse(useStillCamera);
}
} else if (key == "time-between-time-lapse-frame-capture") {
int64_t timeBetweenTimeLapseFrameCaptureMs;
if (safe_strtoi64(value.string(), &timeBetweenTimeLapseFrameCaptureMs)) {
@@ -930,7 +948,7 @@ status_t StagefrightRecorder::setupVideoEncoder(const sp<MediaWriter>& writer) {
if (err != OK) return err;
sp<CameraSource> cameraSource = (mCaptureTimeLapse) ?
CameraSourceTimeLapse::CreateFromCamera(mCamera, true,
CameraSourceTimeLapse::CreateFromCamera(mCamera, mUseStillCameraForTimeLapse,
mTimeBetweenTimeLapseFrameCaptureUs, mVideoWidth, mVideoHeight, mFrameRate):
CameraSource::CreateFromCamera(mCamera);
CHECK(cameraSource != NULL);
@@ -1133,6 +1151,7 @@ status_t StagefrightRecorder::reset() {
mMaxFileSizeBytes = 0;
mTrackEveryTimeDurationUs = 0;
mCaptureTimeLapse = false;
mUseStillCameraForTimeLapse = true;
mTimeBetweenTimeLapseFrameCaptureUs = -1;
mEncoderProfiles = MediaProfiles::getInstance();

View File

@@ -93,6 +93,7 @@ private:
int64_t mTrackEveryTimeDurationUs;
bool mCaptureTimeLapse;
bool mUseStillCameraForTimeLapse;
int64_t mTimeBetweenTimeLapseFrameCaptureUs;
String8 mParams;
@@ -116,6 +117,7 @@ private:
status_t setParamAudioSamplingRate(int32_t sampleRate);
status_t setParamAudioTimeScale(int32_t timeScale);
status_t setParamTimeLapseEnable(int32_t timeLapseEnable);
status_t setParamUseStillCameraForTimeLapse(int32_t useStillCamera);
status_t setParamTimeBetweenTimeLapseFrameCapture(int64_t timeUs);
status_t setParamVideoEncodingBitRate(int32_t bitRate);
status_t setParamVideoIFramesInterval(int32_t seconds);