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

Commit 9560ddb4 authored by Chong Zhang's avatar Chong Zhang
Browse files

MediaCodec: rename usePersistentInputSurface to setInputSurface

bug: 21045402
Change-Id: I510a3a694367b8e5a21f4a4fa2a338031fed8991
parent a8dca228
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15370,6 +15370,7 @@ package android.media {
    method public final void reset();
    method public void setCallback(android.media.MediaCodec.Callback, android.os.Handler);
    method public void setCallback(android.media.MediaCodec.Callback);
    method public void setInputSurface(android.view.Surface);
    method public void setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler);
    method public final void setParameters(android.os.Bundle);
    method public void setSurface(android.view.Surface);
@@ -15377,7 +15378,6 @@ package android.media {
    method public final void signalEndOfInputStream();
    method public final void start();
    method public final void stop();
    method public void usePersistentInputSurface(android.view.Surface);
    field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2
    field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4
    field public static final int BUFFER_FLAG_KEY_FRAME = 1; // 0x1
@@ -16226,6 +16226,7 @@ package android.media {
    method public void setAudioSource(int) throws java.lang.IllegalStateException;
    method public deprecated void setCamera(android.hardware.Camera);
    method public void setCaptureRate(double);
    method public void setInputSurface(android.view.Surface);
    method public void setLocation(float, float);
    method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
    method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
@@ -16244,7 +16245,6 @@ package android.media {
    method public void setVideoSource(int) throws java.lang.IllegalStateException;
    method public void start() throws java.lang.IllegalStateException;
    method public void stop() throws java.lang.IllegalStateException;
    method public void usePersistentSurface(android.view.Surface);
    field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
    field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1
    field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320
+2 −2
Original line number Diff line number Diff line
@@ -16592,6 +16592,7 @@ package android.media {
    method public final void reset();
    method public void setCallback(android.media.MediaCodec.Callback, android.os.Handler);
    method public void setCallback(android.media.MediaCodec.Callback);
    method public void setInputSurface(android.view.Surface);
    method public void setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler);
    method public final void setParameters(android.os.Bundle);
    method public void setSurface(android.view.Surface);
@@ -16599,7 +16600,6 @@ package android.media {
    method public final void signalEndOfInputStream();
    method public final void start();
    method public final void stop();
    method public void usePersistentInputSurface(android.view.Surface);
    field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2
    field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4
    field public static final int BUFFER_FLAG_KEY_FRAME = 1; // 0x1
@@ -17449,6 +17449,7 @@ package android.media {
    method public void setAudioSource(int) throws java.lang.IllegalStateException;
    method public deprecated void setCamera(android.hardware.Camera);
    method public void setCaptureRate(double);
    method public void setInputSurface(android.view.Surface);
    method public void setLocation(float, float);
    method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
    method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
@@ -17467,7 +17468,6 @@ package android.media {
    method public void setVideoSource(int) throws java.lang.IllegalStateException;
    method public void start() throws java.lang.IllegalStateException;
    method public void stop() throws java.lang.IllegalStateException;
    method public void usePersistentSurface(android.view.Surface);
    field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
    field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1
    field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320
+4 −4
Original line number Diff line number Diff line
@@ -677,7 +677,7 @@ final public class MediaCodec {
     * <p>
     * The application is responsible for calling release() on the Surface when done.
     *
     * @return an input surface that can be used with {@link #usePersistentInputSurface}.
     * @return an input surface that can be used with {@link #setInputSurface}.
     */
    @NonNull
    public static Surface createPersistentInputSurface() {
@@ -707,17 +707,17 @@ final public class MediaCodec {
     * @throws IllegalArgumentException if the surface was not created by
     *           {@link #createPersistentInputSurface}.
     */
    public void usePersistentInputSurface(@NonNull Surface surface) {
    public void setInputSurface(@NonNull Surface surface) {
        if (!(surface instanceof PersistentSurface)) {
            throw new IllegalArgumentException("not a PersistentSurface");
        }
        native_usePersistentInputSurface(surface);
        native_setInputSurface(surface);
    }

    @NonNull
    private static native final PersistentSurface native_createPersistentInputSurface();
    private static native final void native_releasePersistentInputSurface(@NonNull Surface surface);
    private native final void native_usePersistentInputSurface(@NonNull Surface surface);
    private native final void native_setInputSurface(@NonNull Surface surface);

    private native final void native_setCallback(@Nullable Callback cb);

+3 −3
Original line number Diff line number Diff line
@@ -156,14 +156,14 @@ public class MediaRecorder
     * @see MediaCodec#createPersistentInputSurface
     * @see MediaRecorder.VideoSource
     */
    public void usePersistentSurface(@NonNull Surface surface) {
    public void setInputSurface(@NonNull Surface surface) {
        if (!(surface instanceof MediaCodec.PersistentSurface)) {
            throw new IllegalArgumentException("not a PersistentSurface");
        }
        native_usePersistentSurface(surface);
        native_setInputSurface(surface);
    }

    private native final void native_usePersistentSurface(@NonNull Surface surface);
    private native final void native_setInputSurface(@NonNull Surface surface);

    /**
     * Sets a Surface to show a preview of recorded media (video). Calls this
+7 −7
Original line number Diff line number Diff line
@@ -272,9 +272,9 @@ status_t JMediaCodec::createInputSurface(
    return mCodec->createInputSurface(bufferProducer);
}

status_t JMediaCodec::usePersistentInputSurface(
status_t JMediaCodec::setInputSurface(
        const sp<PersistentSurface> &surface) {
    return mCodec->usePersistentInputSurface(surface);
    return mCodec->setInputSurface(surface);
}

status_t JMediaCodec::start() {
@@ -1024,9 +1024,9 @@ static void android_media_MediaCodec_releasePersistentInputSurface(
    // no need to release surface as it will be released by Surface's jni
}

static void android_media_MediaCodec_usePersistentInputSurface(
static void android_media_MediaCodec_setInputSurface(
        JNIEnv* env, jobject thiz, jobject object) {
    ALOGV("android_media_MediaCodec_usePersistentInputSurface");
    ALOGV("android_media_MediaCodec_setInputSurface");

    sp<JMediaCodec> codec = getMediaCodec(env, thiz);
    if (codec == NULL) {
@@ -1037,7 +1037,7 @@ static void android_media_MediaCodec_usePersistentInputSurface(
    sp<PersistentSurface> persistentSurface =
        android_media_MediaCodec_getPersistentInputSurface(env, object);

    status_t err = codec->usePersistentInputSurface(persistentSurface);
    status_t err = codec->setInputSurface(persistentSurface);
    if (err != NO_ERROR) {
        throwExceptionAsNecessary(env, err);
    }
@@ -1726,8 +1726,8 @@ static JNINativeMethod gMethods[] = {
      "()Landroid/media/MediaCodec$PersistentSurface;",
      (void *)android_media_MediaCodec_createPersistentInputSurface },

    { "native_usePersistentInputSurface", "(Landroid/view/Surface;)V",
      (void *)android_media_MediaCodec_usePersistentInputSurface },
    { "native_setInputSurface", "(Landroid/view/Surface;)V",
      (void *)android_media_MediaCodec_setInputSurface },

    { "native_setCallback",
      "(Landroid/media/MediaCodec$Callback;)V",
Loading