Merge changes I33f59705,Ia4c8c822,I2fb695ab,I2e587afc
* changes: MediaDump: use the MediaPlayer#setSurface method HTML5VideoView: switch to MediaPlayer#setSurface MediaPlayer: unhide the setSurface method Surface: unhide the SurfaceTexture ctor
This commit is contained in:
@@ -10681,6 +10681,7 @@ package android.media {
|
||||
method public void setOnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener);
|
||||
method public void setScreenOnWhilePlaying(boolean);
|
||||
method public void setTexture(android.graphics.SurfaceTexture);
|
||||
method public void setSurface(android.view.Surface);
|
||||
method public void setVolume(float, float);
|
||||
method public void setWakeMode(android.content.Context, int);
|
||||
method public void start() throws java.lang.IllegalStateException;
|
||||
@@ -22525,6 +22526,7 @@ package android.view {
|
||||
}
|
||||
|
||||
public class Surface implements android.os.Parcelable {
|
||||
ctor public Surface(android.graphics.SurfaceTexture);
|
||||
method public int describeContents();
|
||||
method public boolean isValid();
|
||||
method public android.graphics.Canvas lockCanvas(android.graphics.Rect) throws java.lang.IllegalArgumentException, android.view.Surface.OutOfResourcesException;
|
||||
|
||||
@@ -36,10 +36,14 @@ public class Surface implements Parcelable {
|
||||
public static final int ROTATION_270 = 3;
|
||||
|
||||
/**
|
||||
* Create Surface from a SurfaceTexture.
|
||||
* Create Surface from a {@link SurfaceTexture}.
|
||||
*
|
||||
* @param surfaceTexture The {@link SurfaceTexture} that is updated by this Surface.
|
||||
* @hide
|
||||
* Images drawn to the Surface will be made available to the {@link
|
||||
* SurfaceTexture}, which can attach them an OpenGL ES texture via {@link
|
||||
* SurfaceTexture#updateTexImage}.
|
||||
*
|
||||
* @param surfaceTexture The {@link SurfaceTexture} that is updated by this
|
||||
* Surface.
|
||||
*/
|
||||
public Surface(SurfaceTexture surfaceTexture) {
|
||||
if (DEBUG_RELEASE) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.graphics.SurfaceTexture;
|
||||
import android.media.MediaPlayer;
|
||||
import android.webkit.HTML5VideoView;
|
||||
import android.webkit.HTML5VideoViewProxy;
|
||||
import android.view.Surface;
|
||||
import android.opengl.GLES20;
|
||||
|
||||
/**
|
||||
@@ -38,7 +39,10 @@ public class HTML5VideoInline extends HTML5VideoView{
|
||||
|
||||
@Override
|
||||
public void decideDisplayMode() {
|
||||
mPlayer.setTexture(getSurfaceTexture(getVideoLayerId()));
|
||||
SurfaceTexture surfaceTexture = getSurfaceTexture(getVideoLayerId());
|
||||
Surface surface = new Surface(surfaceTexture);
|
||||
mPlayer.setSurface(surface);
|
||||
surface.release();
|
||||
}
|
||||
|
||||
// Normally called immediately after setVideoURI. But for full screen,
|
||||
|
||||
@@ -381,7 +381,7 @@ import java.lang.ref.WeakReference;
|
||||
* <td>{} </p></td>
|
||||
* <td>This method can be called in any state and calling it does not change
|
||||
* the object state. </p></td></tr>
|
||||
* <tr><td>setTexture </p></td>
|
||||
* <tr><td>setSurface </p></td>
|
||||
* <td>any </p></td>
|
||||
* <td>{} </p></td>
|
||||
* <td>This method can be called in any state and calling it does not change
|
||||
@@ -608,7 +608,7 @@ public class MediaPlayer
|
||||
* portion of the media.
|
||||
*
|
||||
* Either a surface holder or surface must be set if a display or video sink
|
||||
* is needed. Not calling this method or {@link #setTexture(SurfaceTexture)}
|
||||
* is needed. Not calling this method or {@link #setSurface(Surface)}
|
||||
* when playing back a video will result in only the audio track being played.
|
||||
* A null surface holder or surface will result in only the audio track being
|
||||
* played.
|
||||
@@ -629,14 +629,21 @@ public class MediaPlayer
|
||||
|
||||
/**
|
||||
* Sets the {@link Surface} to be used as the sink for the video portion of
|
||||
* the media. This is similar to {@link #setDisplay(SurfaceHolder)}, but does not
|
||||
* support {@link #setScreenOnWhilePlaying(boolean)} or {@link #updateSurfaceScreenOn()}.
|
||||
* Setting a Surface will un-set any Surface or SurfaceHolder that was previously set.
|
||||
* the media. This is similar to {@link #setDisplay(SurfaceHolder)}, but
|
||||
* does not support {@link #setScreenOnWhilePlaying(boolean)}. Setting a
|
||||
* Surface will un-set any Surface or SurfaceHolder that was previously set.
|
||||
* A null surface will result in only the audio track being played.
|
||||
*
|
||||
* @param surface The {@link Surface} to be used for the video portion of the media.
|
||||
* If the Surface sends frames to a {@link SurfaceTexture}, the timestamps
|
||||
* returned from {@link SurfaceTexture#getTimestamp()} will have an
|
||||
* unspecified zero point. These timestamps cannot be directly compared
|
||||
* between different media sources, different instances of the same media
|
||||
* source, or multiple runs of the same program. The timestamp is normally
|
||||
* monotonically increasing and is unaffected by time-of-day adjustments,
|
||||
* but it is reset when the position is set.
|
||||
*
|
||||
* @hide Pending review by API council.
|
||||
* @param surface The {@link Surface} to be used for the video portion of
|
||||
* the media.
|
||||
*/
|
||||
public void setSurface(Surface surface) {
|
||||
if (mScreenOnWhilePlaying && surface != null) {
|
||||
|
||||
@@ -49,6 +49,7 @@ import android.opengl.Matrix;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.View;
|
||||
import android.widget.MediaController;
|
||||
@@ -569,7 +570,9 @@ class VideoDumpView extends GLSurfaceView implements MediaPlayerControl {
|
||||
mSurface = new SurfaceTexture(mTextureID);
|
||||
mSurface.setOnFrameAvailableListener(this);
|
||||
|
||||
mMediaPlayer.setTexture(mSurface);
|
||||
Surface surface = new Surface(mSurface);
|
||||
mMediaPlayer.setSurface(surface);
|
||||
surface.release();
|
||||
|
||||
try {
|
||||
mMediaPlayer.prepare();
|
||||
|
||||
Reference in New Issue
Block a user