Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e618c893 authored by Nipun Kwatra's avatar Nipun Kwatra Committed by Android (Google) Code Review
Browse files

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

parents d4b50201 17e53043
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);
+20 −1
Original line number Diff line number Diff line
@@ -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();

+2 −0
Original line number Diff line number Diff line
@@ -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);