From ab15bce98d44b67f221b6fb8a377744940dda46c Mon Sep 17 00:00:00 2001 From: Nipun Kwatra Date: Tue, 31 Aug 2010 15:42:04 -0700 Subject: [PATCH] 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 --- media/java/android/media/MediaRecorder.java | 57 ++++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java index ca364f5b745cb..19b0c178ecc69 100644 --- a/media/java/android/media/MediaRecorder.java +++ b/media/java/android/media/MediaRecorder.java @@ -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;