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

Commit ab15bce9 authored by Nipun Kwatra's avatar Nipun Kwatra
Browse files

pass auxiliary video parameters.

- Added setAuxVideoParameters to pass the auxiliary video paramters.
- Also added enableTimeLapse(). The plan is for this function to replace
setTimeLapseParameters() since we never call setTimeLapseParameters() to
disable time lapse.
- removed calling setParameter for setting useStillCameraForTimeLapse from
setTimeLapseParameters as support has been removed from StagefrightRecorder.
This function needs to be removed when we change the API.

Change-Id: I92c7accbe9ba0b753ce780461ee55208d04703a6
parent 239f2e5b
Loading
Loading
Loading
Loading
+51 −6
Original line number Diff line number Diff line
@@ -299,13 +299,60 @@ public class MediaRecorder
            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);
    }

    /**
     * Enables time lapse capture and sets its parameters. This method should
     * be called after setProfile().
     *
     * @param timeBetweenTimeLapseFrameCaptureMs time between two captures of time lapse frames.
     * @hide
     */
    public void enableTimeLapse(int timeBetweenTimeLapseFrameCaptureMs) {
        setParameter(String.format("time-lapse-enable=1"));
        setParameter(String.format("time-between-time-lapse-frame-capture=%d",
                    timeBetweenTimeLapseFrameCaptureMs));
    }

    /**
     * Sets filename and parameters for auxiliary time lapse video.
     *
     * @param fd an open file descriptor to be written into.
     * @param videoFrameWidth width of the auxiliary video.
     * @param videoFrameHeight height of the auxiliary video.
     * @param videoBitRate bit rate of the auxiliary video
     * @hide
     * */
    public void setAuxVideoParameters(FileDescriptor fd,
            int videoFrameWidth, int videoFrameHeight,
            int videoBitRate) {
        setAuxiliaryOutputFile(fd);
        setParameter(String.format("video-aux-param-width=%d", videoFrameWidth));
        setParameter(String.format("video-aux-param-height=%d", videoFrameHeight));
        setParameter(String.format("video-aux-param-encoding-bitrate=%d", videoBitRate));
    }

    /**
     * Sets filename and parameters for auxiliary time lapse video.
     *
     * @param path The pathname to use for the auxiliary video.
     * @param videoFrameWidth width of the auxiliary video.
     * @param videoFrameHeight height of the auxiliary video.
     * @param videoBitRate bit rate of the auxiliary video
     * @hide
     * */
    public void setAuxVideoParameters(String path,
            int videoFrameWidth, int videoFrameHeight,
            int videoBitRate) {
        setAuxiliaryOutputFile(path);
        setParameter(String.format("video-aux-param-width=%d", videoFrameWidth));
        setParameter(String.format("video-aux-param-height=%d", videoFrameHeight));
        setParameter(String.format("video-aux-param-encoding-bitrate=%d", videoBitRate));
    }

    /**
     * Sets the format of the output file produced during recording. Call this
     * after setAudioSource()/setVideoSource() but before prepare().
@@ -489,9 +536,8 @@ public class MediaRecorder
     * @param fd an open file descriptor to be written into.
     * @throws IllegalStateException if it is called before
     * setOutputFormat() or after prepare()
     * @hide
     */
    public void setAuxiliaryOutputFile(FileDescriptor fd) throws IllegalStateException
    private void setAuxiliaryOutputFile(FileDescriptor fd) throws IllegalStateException
    {
        mPrepareAuxiliaryFile = true;
        mPathAux = null;
@@ -505,9 +551,8 @@ public class MediaRecorder
     * @param path The pathname to use.
     * @throws IllegalStateException if it is called before
     * setOutputFormat() or after prepare()
     * @hide
     */
    public void setAuxiliaryOutputFile(String path) throws IllegalStateException
    private void setAuxiliaryOutputFile(String path) throws IllegalStateException
    {
        mPrepareAuxiliaryFile = true;
        mFdAux = null;