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

Commit 80283cd7 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "MediaCodec: rename usePersistentInputSurface to setInputSurface" into mnc-dev

parents b3345551 9560ddb4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15340,6 +15340,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);
@@ -15347,7 +15348,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
@@ -16196,6 +16196,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;
@@ -16214,7 +16215,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
@@ -16574,6 +16574,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);
@@ -16581,7 +16582,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
@@ -17431,6 +17431,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;
@@ -17449,7 +17450,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() {
@@ -1034,9 +1034,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) {
@@ -1047,7 +1047,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);
    }
@@ -1741,8 +1741,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