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

Commit 2e6f49cc authored by Jamie Gennis's avatar Jamie Gennis Committed by Android (Google) Code Review
Browse files

Merge "MediaPlayer: remove the setTexture method"

parents 05dbb65d 83fb94d1
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -10684,7 +10684,6 @@ package android.media {
    method public void setOnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener);
    method public void setScreenOnWhilePlaying(boolean);
    method public void setSurface(android.view.Surface);
    method public void setTexture(android.graphics.SurfaceTexture);
    method public void setVolume(float, float);
    method public void setWakeMode(android.content.Context, int);
    method public void start() throws java.lang.IllegalStateException;
+0 −34
Original line number Diff line number Diff line
@@ -657,40 +657,6 @@ public class MediaPlayer
        updateSurfaceScreenOn();
    }

    /**
     * Sets the {@link SurfaceTexture} to be used as the sink for the
     * video portion of the media. Either a surface or surface texture
     * must be set if a video sink is needed.  The same surface texture
     * can be re-set without harm. Setting a surface texture will un-set
     * any surface that was set via {@link #setDisplay(SurfaceHolder)}.
     * Not calling this method or {@link #setDisplay(SurfaceHolder)}
     * when playing back a video will result in only the audio track
     * being played. Note that if a SurfaceTexture is used, the value
     * set via setScreenOnWhilePlaying has no effect.
     *
     * The timestamps provided by {@link SurfaceTexture#getTimestamp()} for a
     * SurfaceTexture set as the video sink have an unspecified zero point,
     * and cannot be directly compared between different media sources or different
     * instances of the same media source, or across multiple runs of the same
     * program.  The timestamp is normally monotonically increasing and unaffected
     * by time-of-day adjustments, but is reset when the position is set.
     */
    public void setTexture(SurfaceTexture st) {
        // TODO: This method should be hidden before it is published and setSurface
        // should be unhidden and made public instead.
        if (st != null) {
            Surface surface = new Surface(st);
            setSurface(surface);

            // It is safe and desired to release the newly created Surface here since the
            // native code will grab a reference to the underlying ISurfaceTexture. At that
            // point the Surface we just created is no longer needed.
            surface.release();
        } else {
            setSurface(null);
        }
    }

    /**
     * Convenience method to create a MediaPlayer for a given Uri.
     * On success, {@link #prepare()} will already have been called and must not be called again.