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

Commit aba28e7f authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Deprecate two methods in MediaRecorder.java class"

parents a7cb8254 3ff98bee
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -10406,8 +10406,8 @@ package android.media {
    method public void setAudioEncodingBitRate(int);
    method public void setAudioSamplingRate(int);
    method public void setAudioSource(int) throws java.lang.IllegalStateException;
    method public void setAuxiliaryOutputFile(java.io.FileDescriptor);
    method public void setAuxiliaryOutputFile(java.lang.String);
    method public deprecated void setAuxiliaryOutputFile(java.io.FileDescriptor);
    method public deprecated void setAuxiliaryOutputFile(java.lang.String);
    method public void setCamera(android.hardware.Camera);
    method public void setCaptureRate(double);
    method public void setLocation(float, float);
+8 −89
Original line number Diff line number Diff line
@@ -81,9 +81,6 @@ public class MediaRecorder

    private String mPath;
    private FileDescriptor mFd;
    private boolean mPrepareAuxiliaryFile = false;
    private String mPathAux;
    private FileDescriptor mFdAux;
    private EventHandler mEventHandler;
    private OnErrorListener mOnErrorListener;
    private OnInfoListener mOnInfoListener;
@@ -557,84 +554,23 @@ public class MediaRecorder
    }

    /**
     * Sets the auxiliary time lapse video's resolution and bitrate.
     *
     * The auxiliary video's resolution and bitrate are determined by the CamcorderProfile
     * quality level {@link android.media.CamcorderProfile#QUALITY_HIGH}.
     */
    private void setAuxVideoParameters() {
        CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
        setParameter(String.format("video-aux-param-width=%d", profile.videoFrameWidth));
        setParameter(String.format("video-aux-param-height=%d", profile.videoFrameHeight));
        setParameter(String.format("video-aux-param-encoding-bitrate=%d", profile.videoBitRate));
    }

    /**
     * Pass in the file descriptor for the auxiliary time lapse video. Call this before
     * prepare().
     *
     * Sets file descriptor and parameters for auxiliary time lapse video. Time lapse mode
     * can capture video (using the still camera) at resolutions higher than that can be
     * played back on the device. This function or
     * {@link #setAuxiliaryOutputFile(String)} enable capture of a smaller video in
     * parallel with the main time lapse video, which can be used to play back on the
     * device. The smaller video is created by downsampling the main video. This call is
     * optional and does not have to be called if parallel capture of a downsampled video
     * is not desired.
     *
     * Note that while the main video resolution and bitrate is determined from the
     * CamcorderProfile in {@link #setProfile(CamcorderProfile)}, the auxiliary video's
     * resolution and bitrate are determined by the CamcorderProfile quality level
     * {@link android.media.CamcorderProfile#QUALITY_HIGH}. All other encoding parameters
     * remain the same for the main video and the auxiliary video.
     *
     * E.g. if the device supports the time lapse profile quality level
     * {@link android.media.CamcorderProfile#QUALITY_TIME_LAPSE_1080P} but can playback at
     * most 480p, the application might want to capture an auxiliary video of resolution
     * 480p using this call.
     *
     * @param fd an open file descriptor to be written into.
     * Currently not implemented. It does nothing.
     * @deprecated Time lapse mode video recording using camera still image capture
     * is not desirable, and will not be supported.
     */
    public void setAuxiliaryOutputFile(FileDescriptor fd)
    {
        mPrepareAuxiliaryFile = true;
        mPathAux = null;
        mFdAux = fd;
        setAuxVideoParameters();
        Log.w(TAG, "setAuxiliaryOutputFile(FileDescriptor) is no longer supported.");
    }

    /**
     * Pass in the file path for the auxiliary time lapse video. Call this before
     * prepare().
     *
     * Sets file path and parameters for auxiliary time lapse video. Time lapse mode can
     * capture video (using the still camera) at resolutions higher than that can be
     * played back on the device. This function or
     * {@link #setAuxiliaryOutputFile(FileDescriptor)} enable capture of a smaller
     * video in parallel with the main time lapse video, which can be used to play back on
     * the device. The smaller video is created by downsampling the main video. This call
     * is optional and does not have to be called if parallel capture of a downsampled
     * video is not desired.
     *
     * Note that while the main video resolution and bitrate is determined from the
     * CamcorderProfile in {@link #setProfile(CamcorderProfile)}, the auxiliary video's
     * resolution and bitrate are determined by the CamcorderProfile quality level
     * {@link android.media.CamcorderProfile#QUALITY_HIGH}. All other encoding parameters
     * remain the same for the main video and the auxiliary video.
     *
     * E.g. if the device supports the time lapse profile quality level
     * {@link android.media.CamcorderProfile#QUALITY_TIME_LAPSE_1080P} but can playback at
     * most 480p, the application might want to capture an auxiliary video of resolution
     * 480p using this call.
     *
     * @param path The pathname to use.
     * Currently not implemented. It does nothing.
     * @deprecated Time lapse mode video recording using camera still image capture
     * is not desirable, and will not be supported.
     */
    public void setAuxiliaryOutputFile(String path)
    {
        mPrepareAuxiliaryFile = true;
        mFdAux = null;
        mPathAux = path;
        setAuxVideoParameters();
        Log.w(TAG, "setAuxiliaryOutputFile(String) is no longer supported.");
    }

    /**
@@ -668,8 +604,6 @@ public class MediaRecorder
    // native implementation
    private native void _setOutputFile(FileDescriptor fd, long offset, long length)
        throws IllegalStateException, IOException;
    private native void _setOutputFileAux(FileDescriptor fd)
        throws IllegalStateException, IOException;
    private native void _prepare() throws IllegalStateException, IOException;

    /**
@@ -696,21 +630,6 @@ public class MediaRecorder
            throw new IOException("No valid output file");
        }

        if (mPrepareAuxiliaryFile) {
            if (mPathAux != null) {
                FileOutputStream fos = new FileOutputStream(mPathAux);
                try {
                    _setOutputFileAux(fos.getFD());
                } finally {
                    fos.close();
                }
            } else if (mFdAux != null) {
                _setOutputFileAux(mFdAux);
            } else {
                throw new IOException("No valid output file");
            }
        }

        _prepare();
    }

+0 −15
Original line number Diff line number Diff line
@@ -260,20 +260,6 @@ android_media_MediaRecorder_setOutputFileFD(JNIEnv *env, jobject thiz, jobject f
    process_media_recorder_call(env, opStatus, "java/io/IOException", "setOutputFile failed.");
}

static void
android_media_MediaRecorder_setOutputFileAuxFD(JNIEnv *env, jobject thiz, jobject fileDescriptor)
{
    LOGV("setOutputFile");
    if (fileDescriptor == NULL) {
        jniThrowException(env, "java/lang/IllegalArgumentException", NULL);
        return;
    }
    int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
    sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
    status_t opStatus = mr->setOutputFileAuxiliary(fd);
    process_media_recorder_call(env, opStatus, "java/io/IOException", "setOutputFile failed.");
}

static void
android_media_MediaRecorder_setVideoSize(JNIEnv *env, jobject thiz, jint width, jint height)
{
@@ -475,7 +461,6 @@ static JNINativeMethod gMethods[] = {
    {"setAudioEncoder",      "(I)V",                            (void *)android_media_MediaRecorder_setAudioEncoder},
    {"setParameter",         "(Ljava/lang/String;)V",           (void *)android_media_MediaRecorder_setParameter},
    {"_setOutputFile",       "(Ljava/io/FileDescriptor;JJ)V",   (void *)android_media_MediaRecorder_setOutputFileFD},
    {"_setOutputFileAux",    "(Ljava/io/FileDescriptor;)V",     (void *)android_media_MediaRecorder_setOutputFileAuxFD},
    {"setVideoSize",         "(II)V",                           (void *)android_media_MediaRecorder_setVideoSize},
    {"setVideoFrameRate",    "(I)V",                            (void *)android_media_MediaRecorder_setVideoFrameRate},
    {"setMaxDuration",       "(I)V",                            (void *)android_media_MediaRecorder_setMaxDuration},