Class FakeVideoRenderer
- java.lang.Object
-
- com.google.android.exoplayer2.BaseRenderer
-
- com.google.android.exoplayer2.testutil.FakeRenderer
-
- com.google.android.exoplayer2.testutil.FakeVideoRenderer
-
- All Implemented Interfaces:
PlayerMessage.Target
,Renderer
,RendererCapabilities
public class FakeVideoRenderer extends FakeRenderer
AFakeRenderer
that supportsC.TRACK_TYPE_VIDEO
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.Renderer
Renderer.MessageType, Renderer.State, Renderer.WakeupListener
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.RendererCapabilities
RendererCapabilities.AdaptiveSupport, RendererCapabilities.Capabilities, RendererCapabilities.DecoderSupport, RendererCapabilities.FormatSupport, RendererCapabilities.HardwareAccelerationSupport, RendererCapabilities.TunnelingSupport
-
-
Field Summary
-
Fields inherited from class com.google.android.exoplayer2.testutil.FakeRenderer
enabledCount, isEnded, positionResetCount, resetCount, sampleBufferReadCount
-
Fields inherited from interface com.google.android.exoplayer2.Renderer
MSG_CUSTOM_BASE, MSG_SET_AUDIO_ATTRIBUTES, MSG_SET_AUDIO_SESSION_ID, MSG_SET_AUX_EFFECT_INFO, MSG_SET_CAMERA_MOTION_LISTENER, MSG_SET_CHANGE_FRAME_RATE_STRATEGY, MSG_SET_SCALING_MODE, MSG_SET_SKIP_SILENCE_ENABLED, MSG_SET_VIDEO_FRAME_METADATA_LISTENER, MSG_SET_VIDEO_OUTPUT, MSG_SET_VOLUME, MSG_SET_WAKEUP_LISTENER, STATE_DISABLED, STATE_ENABLED, STATE_STARTED
-
Fields inherited from interface com.google.android.exoplayer2.RendererCapabilities
ADAPTIVE_NOT_SEAMLESS, ADAPTIVE_NOT_SUPPORTED, ADAPTIVE_SEAMLESS, ADAPTIVE_SUPPORT_MASK, DECODER_SUPPORT_FALLBACK, DECODER_SUPPORT_PRIMARY, FORMAT_EXCEEDS_CAPABILITIES, FORMAT_HANDLED, FORMAT_SUPPORT_MASK, FORMAT_UNSUPPORTED_DRM, FORMAT_UNSUPPORTED_SUBTYPE, FORMAT_UNSUPPORTED_TYPE, HARDWARE_ACCELERATION_NOT_SUPPORTED, HARDWARE_ACCELERATION_SUPPORT_MASK, HARDWARE_ACCELERATION_SUPPORTED, MODE_SUPPORT_MASK, TUNNELING_NOT_SUPPORTED, TUNNELING_SUPPORT_MASK, TUNNELING_SUPPORTED
-
-
Constructor Summary
Constructors Constructor Description FakeVideoRenderer(Handler handler, VideoRendererEventListener eventListener)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
handleMessage(@com.google.android.exoplayer2.Renderer.MessageType int messageType, Object message)
Handles a message delivered to the target.protected void
onDisabled()
Called when the renderer is disabled.protected void
onEnabled(boolean joining, boolean mayRenderStartOfStream)
Called when the renderer is enabled.protected void
onFormatChanged(Format format)
Called when the renderer reads a new format.protected void
onPositionReset(long positionUs, boolean joining)
Called when the position is reset.protected void
onStopped()
Called when the renderer is stopped.protected void
onStreamChanged(Format[] formats, long startPositionUs, long offsetUs)
Called when the renderer's stream has changed.protected boolean
shouldProcessBuffer(long bufferTimeUs, long playbackPositionUs)
Called before the renderer processes a buffer.-
Methods inherited from class com.google.android.exoplayer2.testutil.FakeRenderer
getFormatsRead, getName, isEnded, isReady, onReset, render, supportsFormat
-
Methods inherited from class com.google.android.exoplayer2.BaseRenderer
createRendererException, createRendererException, disable, enable, getCapabilities, getConfiguration, getFormatHolder, getIndex, getLastResetPositionUs, getMediaClock, getPlayerId, getReadingPositionUs, getState, getStream, getStreamFormats, getTrackType, hasReadStreamToEnd, init, isCurrentStreamFinal, isSourceReady, maybeThrowStreamError, onStarted, readSource, replaceStream, reset, resetPosition, setCurrentStreamFinal, skipSource, start, stop, supportsMixedMimeTypeAdaptation
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.android.exoplayer2.Renderer
setPlaybackSpeed
-
-
-
-
Constructor Detail
-
FakeVideoRenderer
public FakeVideoRenderer(Handler handler, VideoRendererEventListener eventListener)
-
-
Method Detail
-
onEnabled
protected void onEnabled(boolean joining, boolean mayRenderStartOfStream) throws ExoPlaybackException
Description copied from class:BaseRenderer
Called when the renderer is enabled.The default implementation is a no-op.
- Overrides:
onEnabled
in classFakeRenderer
- Parameters:
joining
- Whether this renderer is being enabled to join an ongoing playback.mayRenderStartOfStream
- Whether this renderer is allowed to render the start of the stream even if the state is notRenderer.STATE_STARTED
yet.- Throws:
ExoPlaybackException
- If an error occurs.
-
onStreamChanged
protected void onStreamChanged(Format[] formats, long startPositionUs, long offsetUs) throws ExoPlaybackException
Description copied from class:BaseRenderer
Called when the renderer's stream has changed. This occurs when the renderer is enabled afterBaseRenderer.onEnabled(boolean, boolean)
has been called, and also when the stream has been replaced whilst the renderer is enabled or started.The default implementation is a no-op.
- Overrides:
onStreamChanged
in classBaseRenderer
- Parameters:
formats
- The enabled formats.startPositionUs
- The start position of the new stream in renderer time (microseconds).offsetUs
- The offset that will be added to the timestamps of buffers read viaBaseRenderer.readSource(com.google.android.exoplayer2.FormatHolder, com.google.android.exoplayer2.decoder.DecoderInputBuffer, @com.google.android.exoplayer2.source.SampleStream.ReadFlags int)
so that decoder input buffers have monotonically increasing timestamps.- Throws:
ExoPlaybackException
- If an error occurs.
-
onStopped
protected void onStopped()
Description copied from class:BaseRenderer
Called when the renderer is stopped.The default implementation is a no-op.
- Overrides:
onStopped
in classBaseRenderer
-
onDisabled
protected void onDisabled()
Description copied from class:BaseRenderer
Called when the renderer is disabled.The default implementation is a no-op.
- Overrides:
onDisabled
in classFakeRenderer
-
onPositionReset
protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackException
Description copied from class:BaseRenderer
Called when the position is reset. This occurs when the renderer is enabled afterBaseRenderer.onStreamChanged(Format[], long, long)
has been called, and also when a position discontinuity is encountered.After a position reset, the renderer's
SampleStream
is guaranteed to provide samples starting from a key frame.The default implementation is a no-op.
- Overrides:
onPositionReset
in classFakeRenderer
- Parameters:
positionUs
- The new playback position in microseconds.joining
- Whether this renderer is being enabled to join an ongoing playback.- Throws:
ExoPlaybackException
- If an error occurs.
-
onFormatChanged
protected void onFormatChanged(Format format)
Description copied from class:FakeRenderer
Called when the renderer reads a new format.- Overrides:
onFormatChanged
in classFakeRenderer
-
handleMessage
public void handleMessage(@com.google.android.exoplayer2.Renderer.MessageType int messageType, @Nullable Object message) throws ExoPlaybackException
Description copied from interface:PlayerMessage.Target
Handles a message delivered to the target.- Specified by:
handleMessage
in interfacePlayerMessage.Target
- Overrides:
handleMessage
in classBaseRenderer
- Parameters:
messageType
- The message type.message
- The message payload.- Throws:
ExoPlaybackException
- If an error occurred whilst handling the message. Should only be thrown by targets that handle messages on the playback thread.
-
shouldProcessBuffer
protected boolean shouldProcessBuffer(long bufferTimeUs, long playbackPositionUs)
Description copied from class:FakeRenderer
Called before the renderer processes a buffer.- Overrides:
shouldProcessBuffer
in classFakeRenderer
- Parameters:
bufferTimeUs
- The buffer timestamp, in microseconds.playbackPositionUs
- The playback position, in microseconds- Returns:
- Whether the buffer should be processed.
-
-