Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
628e744e
authored
Aug 24, 2021
by
samrobinson
Committed by
kim-vde
Aug 25, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Deprecate ExoPlayer VideoComponent.
PiperOrigin-RevId: 392668736
parent
d3cc98d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
158 additions
and
120 deletions
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java
testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java
library/core/src/main/java/com/google/android/exoplayer2/ExoPlayer.java
View file @
628e744e
...
@@ -185,170 +185,94 @@ public interface ExoPlayer extends Player {
...
@@ -185,170 +185,94 @@ public interface ExoPlayer extends Player {
boolean
getSkipSilenceEnabled
();
boolean
getSkipSilenceEnabled
();
}
}
/** The video component of an {@link ExoPlayer}. */
/**
* @deprecated Use {@link ExoPlayer}, as the {@link VideoComponent} methods are defined by that
* interface.
*/
@Deprecated
interface
VideoComponent
{
interface
VideoComponent
{
/**
/** @deprecated Use {@link ExoPlayer#setVideoScalingMode(int)} instead. */
* Sets the {@link C.VideoScalingMode}.
@Deprecated
*
* <p>The scaling mode only applies if a {@link MediaCodec}-based video {@link Renderer} is
* enabled and if the output surface is owned by a {@link SurfaceView}.
*
* @param videoScalingMode The {@link C.VideoScalingMode}.
*/
void
setVideoScalingMode
(
@C
.
VideoScalingMode
int
videoScalingMode
);
void
setVideoScalingMode
(
@C
.
VideoScalingMode
int
videoScalingMode
);
/** Returns the {@link C.VideoScalingMode}. */
/** @deprecated Use {@link ExoPlayer#getVideoScalingMode()} instead. */
@Deprecated
@C
.
VideoScalingMode
@C
.
VideoScalingMode
int
getVideoScalingMode
();
int
getVideoScalingMode
();
/**
/** @deprecated Use {@link ExoPlayer#setVideoChangeFrameRateStrategy(int)} instead. */
* Sets a {@link C.VideoChangeFrameRateStrategy} that will be used by the player when provided
@Deprecated
* with a video output {@link Surface}.
*
* <p>The strategy only applies if a {@link MediaCodec}-based video {@link Renderer} is enabled.
* Applications wishing to use {@link Surface#CHANGE_FRAME_RATE_ALWAYS} should set the mode to
* {@link C#VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF} to disable calls to {@link
* Surface#setFrameRate} from ExoPlayer, and should then call {@link Surface#setFrameRate}
* directly from application code.
*
* @param videoChangeFrameRateStrategy A {@link C.VideoChangeFrameRateStrategy}.
*/
void
setVideoChangeFrameRateStrategy
(
void
setVideoChangeFrameRateStrategy
(
@C
.
VideoChangeFrameRateStrategy
int
videoChangeFrameRateStrategy
);
@C
.
VideoChangeFrameRateStrategy
int
videoChangeFrameRateStrategy
);
/** Returns the {@link C.VideoChangeFrameRateStrategy}. */
/** @deprecated Use {@link ExoPlayer#getVideoChangeFrameRateStrategy()} instead. */
@Deprecated
@C
.
VideoChangeFrameRateStrategy
@C
.
VideoChangeFrameRateStrategy
int
getVideoChangeFrameRateStrategy
();
int
getVideoChangeFrameRateStrategy
();
/**
/**
* Sets a listener to receive video frame metadata events.
* @deprecated Use {@link ExoPlayer#setVideoFrameMetadataListener(VideoFrameMetadataListener)}
*
* instead.
* <p>This method is intended to be called by the same component that sets the {@link Surface}
* onto which video will be rendered. If using ExoPlayer's standard UI components, this method
* should not be called directly from application code.
*
* @param listener The listener.
*/
*/
@Deprecated
void
setVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
);
void
setVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
);
/**
/**
* Clears the listener which receives video frame metadata events if it matches the one passed.
* @deprecated Use {@link ExoPlayer#clearVideoFrameMetadataListener(VideoFrameMetadataListener)}
* Else does nothing.
* instead.
*
* @param listener The listener to clear.
*/
*/
@Deprecated
void
clearVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
);
void
clearVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
);
/**
/** @deprecated Use {@link ExoPlayer#setCameraMotionListener(CameraMotionListener)} instead. */
* Sets a listener of camera motion events.
@Deprecated
*
* @param listener The listener.
*/
void
setCameraMotionListener
(
CameraMotionListener
listener
);
void
setCameraMotionListener
(
CameraMotionListener
listener
);
/**
/**
* Clears the listener which receives camera motion events if it matches the one passed. Else
* @deprecated Use {@link ExoPlayer#clearCameraMotionListener(CameraMotionListener)} instead.
* does nothing.
*
* @param listener The listener to clear.
*/
*/
@Deprecated
void
clearCameraMotionListener
(
CameraMotionListener
listener
);
void
clearCameraMotionListener
(
CameraMotionListener
listener
);
/**
/** @deprecated Use {@link Player#clearVideoSurface()} instead. */
* Clears any {@link Surface}, {@link SurfaceHolder}, {@link SurfaceView} or {@link TextureView}
@Deprecated
* currently set on the player.
*/
void
clearVideoSurface
();
void
clearVideoSurface
();
/**
/** @deprecated Use {@link Player#clearVideoSurface(Surface)} instead. */
* Clears the {@link Surface} onto which video is being rendered if it matches the one passed.
@Deprecated
* Else does nothing.
*
* @param surface The surface to clear.
*/
void
clearVideoSurface
(
@Nullable
Surface
surface
);
void
clearVideoSurface
(
@Nullable
Surface
surface
);
/**
/** @deprecated Use {@link Player#setVideoSurface(Surface)} instead. */
* Sets the {@link Surface} onto which video will be rendered. The caller is responsible for
@Deprecated
* tracking the lifecycle of the surface, and must clear the surface by calling {@code
* setVideoSurface(null)} if the surface is destroyed.
*
* <p>If the surface is held by a {@link SurfaceView}, {@link TextureView} or {@link
* SurfaceHolder} then it's recommended to use {@link #setVideoSurfaceView(SurfaceView)}, {@link
* #setVideoTextureView(TextureView)} or {@link #setVideoSurfaceHolder(SurfaceHolder)} rather
* than this method, since passing the holder allows the player to track the lifecycle of the
* surface automatically.
*
* @param surface The {@link Surface}.
*/
void
setVideoSurface
(
@Nullable
Surface
surface
);
void
setVideoSurface
(
@Nullable
Surface
surface
);
/**
/** @deprecated Use {@link Player#setVideoSurfaceHolder(SurfaceHolder)} instead. */
* Sets the {@link SurfaceHolder} that holds the {@link Surface} onto which video will be
@Deprecated
* rendered. The player will track the lifecycle of the surface automatically.
*
* <p>The thread that calls the {@link SurfaceHolder.Callback} methods must be the thread
* associated with {@link #getApplicationLooper()}.
*
* @param surfaceHolder The surface holder.
*/
void
setVideoSurfaceHolder
(
@Nullable
SurfaceHolder
surfaceHolder
);
void
setVideoSurfaceHolder
(
@Nullable
SurfaceHolder
surfaceHolder
);
/**
/** @deprecated Use {@link Player#clearVideoSurfaceHolder(SurfaceHolder)} instead. */
* Clears the {@link SurfaceHolder} that holds the {@link Surface} onto which video is being
@Deprecated
* rendered if it matches the one passed. Else does nothing.
*
* @param surfaceHolder The surface holder to clear.
*/
void
clearVideoSurfaceHolder
(
@Nullable
SurfaceHolder
surfaceHolder
);
void
clearVideoSurfaceHolder
(
@Nullable
SurfaceHolder
surfaceHolder
);
/**
/** @deprecated Use {@link Player#setVideoSurfaceView(SurfaceView)} instead. */
* Sets the {@link SurfaceView} onto which video will be rendered. The player will track the
@Deprecated
* lifecycle of the surface automatically.
*
* <p>The thread that calls the {@link SurfaceHolder.Callback} methods must be the thread
* associated with {@link #getApplicationLooper()}.
*
* @param surfaceView The surface view.
*/
void
setVideoSurfaceView
(
@Nullable
SurfaceView
surfaceView
);
void
setVideoSurfaceView
(
@Nullable
SurfaceView
surfaceView
);
/**
/** @deprecated Use {@link Player#clearVideoSurfaceView(SurfaceView)} instead. */
* Clears the {@link SurfaceView} onto which video is being rendered if it matches the one
@Deprecated
* passed. Else does nothing.
*
* @param surfaceView The texture view to clear.
*/
void
clearVideoSurfaceView
(
@Nullable
SurfaceView
surfaceView
);
void
clearVideoSurfaceView
(
@Nullable
SurfaceView
surfaceView
);
/**
/** @deprecated Use {@link Player#setVideoTextureView(TextureView)} instead. */
* Sets the {@link TextureView} onto which video will be rendered. The player will track the
@Deprecated
* lifecycle of the surface automatically.
*
* <p>The thread that calls the {@link TextureView.SurfaceTextureListener} methods must be the
* thread associated with {@link #getApplicationLooper()}.
*
* @param textureView The texture view.
*/
void
setVideoTextureView
(
@Nullable
TextureView
textureView
);
void
setVideoTextureView
(
@Nullable
TextureView
textureView
);
/**
/** @deprecated Use {@link Player#clearVideoTextureView(TextureView)} instead. */
* Clears the {@link TextureView} onto which video is being rendered if it matches the one
@Deprecated
* passed. Else does nothing.
*
* @param textureView The texture view to clear.
*/
void
clearVideoTextureView
(
@Nullable
TextureView
textureView
);
void
clearVideoTextureView
(
@Nullable
TextureView
textureView
);
/**
/** @deprecated Use {@link Player#getVideoSize()} instead. */
* Gets the size of the video.
@Deprecated
*
* <p>The width and height of size could be 0 if there is no video or the size has not been
* determined yet.
*
* @see Listener#onVideoSizeChanged(VideoSize)
*/
VideoSize
getVideoSize
();
VideoSize
getVideoSize
();
}
}
...
@@ -922,8 +846,12 @@ public interface ExoPlayer extends Player {
...
@@ -922,8 +846,12 @@ public interface ExoPlayer extends Player {
@Deprecated
@Deprecated
AudioComponent
getAudioComponent
();
AudioComponent
getAudioComponent
();
/** Returns the component of this player for video output, or null if video is not supported. */
/**
* @deprecated Use {@link ExoPlayer}, as the {@link VideoComponent} methods are part of the
* interface.
*/
@Nullable
@Nullable
@Deprecated
VideoComponent
getVideoComponent
();
VideoComponent
getVideoComponent
();
/**
/**
...
@@ -1140,6 +1068,73 @@ public interface ExoPlayer extends Player {
...
@@ -1140,6 +1068,73 @@ public interface ExoPlayer extends Player {
boolean
getSkipSilenceEnabled
();
boolean
getSkipSilenceEnabled
();
/**
/**
* Sets the {@link C.VideoScalingMode}.
*
* <p>The scaling mode only applies if a {@link MediaCodec}-based video {@link Renderer} is
* enabled and if the output surface is owned by a {@link SurfaceView}.
*
* @param videoScalingMode The {@link C.VideoScalingMode}.
*/
void
setVideoScalingMode
(
@C
.
VideoScalingMode
int
videoScalingMode
);
/** Returns the {@link C.VideoScalingMode}. */
@C
.
VideoScalingMode
int
getVideoScalingMode
();
/**
* Sets a {@link C.VideoChangeFrameRateStrategy} that will be used by the player when provided
* with a video output {@link Surface}.
*
* <p>The strategy only applies if a {@link MediaCodec}-based video {@link Renderer} is enabled.
* Applications wishing to use {@link Surface#CHANGE_FRAME_RATE_ALWAYS} should set the mode to
* {@link C#VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF} to disable calls to {@link Surface#setFrameRate}
* from ExoPlayer, and should then call {@link Surface#setFrameRate} directly from application
* code.
*
* @param videoChangeFrameRateStrategy A {@link C.VideoChangeFrameRateStrategy}.
*/
void
setVideoChangeFrameRateStrategy
(
@C
.
VideoChangeFrameRateStrategy
int
videoChangeFrameRateStrategy
);
/** Returns the {@link C.VideoChangeFrameRateStrategy}. */
@C
.
VideoChangeFrameRateStrategy
int
getVideoChangeFrameRateStrategy
();
/**
* Sets a listener to receive video frame metadata events.
*
* <p>This method is intended to be called by the same component that sets the {@link Surface}
* onto which video will be rendered. If using ExoPlayer's standard UI components, this method
* should not be called directly from application code.
*
* @param listener The listener.
*/
void
setVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
);
/**
* Clears the listener which receives video frame metadata events if it matches the one passed.
* Else does nothing.
*
* @param listener The listener to clear.
*/
void
clearVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
);
/**
* Sets a listener of camera motion events.
*
* @param listener The listener.
*/
void
setCameraMotionListener
(
CameraMotionListener
listener
);
/**
* Clears the listener which receives camera motion events if it matches the one passed. Else does
* nothing.
*
* @param listener The listener to clear.
*/
void
clearCameraMotionListener
(
CameraMotionListener
listener
);
/**
* Creates a message that can be sent to a {@link PlayerMessage.Target}. By default, the message
* Creates a message that can be sent to a {@link PlayerMessage.Target}. By default, the message
* will be delivered immediately without blocking on the playback thread. The default {@link
* will be delivered immediately without blocking on the playback thread. The default {@link
* PlayerMessage#getType()} is 0 and the default {@link PlayerMessage#getPayload()} is null. If a
* PlayerMessage#getType()} is 0 and the default {@link PlayerMessage#getPayload()} is null. If a
...
...
testutils/src/main/java/com/google/android/exoplayer2/testutil/StubExoPlayer.java
View file @
628e744e
...
@@ -42,7 +42,9 @@ import com.google.android.exoplayer2.text.Cue;
...
@@ -42,7 +42,9 @@ import com.google.android.exoplayer2.text.Cue;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
import
com.google.android.exoplayer2.trackselection.TrackSelectionArray
;
import
com.google.android.exoplayer2.trackselection.TrackSelector
;
import
com.google.android.exoplayer2.trackselection.TrackSelector
;
import
com.google.android.exoplayer2.util.Clock
;
import
com.google.android.exoplayer2.util.Clock
;
import
com.google.android.exoplayer2.video.VideoFrameMetadataListener
;
import
com.google.android.exoplayer2.video.VideoSize
;
import
com.google.android.exoplayer2.video.VideoSize
;
import
com.google.android.exoplayer2.video.spherical.CameraMotionListener
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -58,6 +60,7 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
...
@@ -58,6 +60,7 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
}
}
@Override
@Override
@Deprecated
public
VideoComponent
getVideoComponent
()
{
public
VideoComponent
getVideoComponent
()
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
...
@@ -314,6 +317,46 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
...
@@ -314,6 +317,46 @@ public class StubExoPlayer extends BasePlayer implements ExoPlayer {
}
}
@Override
@Override
public
void
setVideoScalingMode
(
int
videoScalingMode
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
int
getVideoScalingMode
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
setVideoChangeFrameRateStrategy
(
int
videoChangeFrameRateStrategy
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
int
getVideoChangeFrameRateStrategy
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
setVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
clearVideoFrameMetadataListener
(
VideoFrameMetadataListener
listener
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
setCameraMotionListener
(
CameraMotionListener
listener
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
clearCameraMotionListener
(
CameraMotionListener
listener
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
setShuffleModeEnabled
(
boolean
shuffleModeEnabled
)
{
public
void
setShuffleModeEnabled
(
boolean
shuffleModeEnabled
)
{
throw
new
UnsupportedOperationException
();
throw
new
UnsupportedOperationException
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment