Class NoSampleRenderer
- java.lang.Object
-
- com.google.android.exoplayer2.NoSampleRenderer
-
- All Implemented Interfaces:
PlayerMessage.Target,Renderer,RendererCapabilities
@Deprecated public abstract class NoSampleRenderer extends Object implements Renderer, RendererCapabilities
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.ARendererimplementation whose track type isC.TRACK_TYPE_NONEand does not consume data from itsSampleStream.
-
-
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.Listener, RendererCapabilities.TunnelingSupport
-
-
Field Summary
-
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_PREFERRED_AUDIO_DEVICE, MSG_SET_SCALING_MODE, MSG_SET_SKIP_SILENCE_ENABLED, MSG_SET_VIDEO_EFFECTS, MSG_SET_VIDEO_FRAME_METADATA_LISTENER, MSG_SET_VIDEO_OUTPUT, MSG_SET_VIDEO_OUTPUT_RESOLUTION, 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_FALLBACK_MIMETYPE, 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 NoSampleRenderer()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddisable()Deprecated.Disable the renderer, transitioning it to theRenderer.STATE_DISABLEDstate.voidenable(RendererConfiguration configuration, Format[] formats, SampleStream stream, long positionUs, boolean joining, boolean mayRenderStartOfStream, long startPositionUs, long offsetUs)Deprecated.Enables the renderer to consume from the specifiedSampleStream.RendererCapabilitiesgetCapabilities()Deprecated.Returns the capabilities of the renderer.protected RendererConfigurationgetConfiguration()Deprecated.Returns the configuration set when the renderer was most recently enabled, ornullif the renderer has never been enabled.protected intgetIndex()Deprecated.Returns the index of the renderer within the player.MediaClockgetMediaClock()Deprecated.If the renderer advances its own playback position then this method returns a correspondingMediaClock.longgetReadingPositionUs()Deprecated.Returns the renderer time up to which the renderer has read samples, in microseconds, orC.TIME_END_OF_SOURCEif the renderer has read the currentSampleStreamto the end.intgetState()Deprecated.Returns the current state of the renderer.SampleStreamgetStream()Deprecated.Returns theSampleStreambeing consumed, or null if the renderer is disabled.@com.google.android.exoplayer2.C.TrackType intgetTrackType()Deprecated.Returns the track type that the renderer handles.voidhandleMessage(@com.google.android.exoplayer2.Renderer.MessageType int messageType, Object message)Deprecated.Handles a message delivered to the target.booleanhasReadStreamToEnd()Deprecated.Returns whether the renderer has read the currentSampleStreamto the end.voidinit(int index, PlayerId playerId)Deprecated.Initializes the renderer for playback with a player.booleanisCurrentStreamFinal()Deprecated.Returns whether the currentSampleStreamwill be the final one supplied before the renderer is next disabled or reset.booleanisEnded()Deprecated.Whether the renderer is ready for theExoPlayerinstance to transition toPlayer.STATE_ENDED.booleanisReady()Deprecated.Whether the renderer is able to immediately render media from the current position.voidmaybeThrowStreamError()Deprecated.Throws an error that's preventing the renderer from reading from itsSampleStream.protected voidonDisabled()Deprecated.Called when the renderer is disabled.protected voidonEnabled(boolean joining)Deprecated.Called when the renderer is enabled.protected voidonPositionReset(long positionUs, boolean joining)Deprecated.Called when the position is reset.protected voidonRendererOffsetChanged(long offsetUs)Deprecated.Called when the renderer's offset has been changed.protected voidonReset()Deprecated.Called when the renderer is reset.protected voidonStarted()Deprecated.Called when the renderer is started.protected voidonStopped()Deprecated.Called when the renderer is stopped.voidreplaceStream(Format[] formats, SampleStream stream, long startPositionUs, long offsetUs)Deprecated.Replaces theSampleStreamfrom which samples will be consumed.voidreset()Deprecated.Forces the renderer to give up any resources (e.g.voidresetPosition(long positionUs)Deprecated.Signals to the renderer that a position discontinuity has occurred.voidsetCurrentStreamFinal()Deprecated.Signals to the renderer that the currentSampleStreamwill be the final one supplied before it is next disabled or reset.voidstart()Deprecated.Starts the renderer, meaning that calls toRenderer.render(long, long)will cause media to be rendered.voidstop()Deprecated.Stops the renderer, transitioning it to theRenderer.STATE_ENABLEDstate.@com.google.android.exoplayer2.RendererCapabilities.Capabilities intsupportsFormat(Format format)Deprecated.Returns the extent to which theRenderersupports a given format.@com.google.android.exoplayer2.RendererCapabilities.AdaptiveSupport intsupportsMixedMimeTypeAdaptation()Deprecated.Returns the extent to which theRenderersupports adapting between supported formats that have different MIME types.-
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
getName, release, render, setPlaybackSpeed
-
Methods inherited from interface com.google.android.exoplayer2.RendererCapabilities
clearListener, getName, setListener
-
-
-
-
Method Detail
-
getTrackType
public final @com.google.android.exoplayer2.C.TrackType int getTrackType()
Deprecated.Description copied from interface:RendererReturns the track type that the renderer handles.- Specified by:
getTrackTypein interfaceRenderer- Specified by:
getTrackTypein interfaceRendererCapabilities- Returns:
- The
track type. - See Also:
ExoPlayer.getRendererType(int)
-
getCapabilities
public final RendererCapabilities getCapabilities()
Deprecated.Description copied from interface:RendererReturns the capabilities of the renderer.- Specified by:
getCapabilitiesin interfaceRenderer- Returns:
- The capabilities of the renderer.
-
init
public final void init(int index, PlayerId playerId)Deprecated.Description copied from interface:RendererInitializes the renderer for playback with a player.
-
getMediaClock
@Nullable public MediaClock getMediaClock()
Deprecated.Description copied from interface:RendererIf the renderer advances its own playback position then this method returns a correspondingMediaClock. If provided, the player will use the returnedMediaClockas its source of time during playback. A player may have at most one renderer that returns aMediaClockfrom this method.- Specified by:
getMediaClockin interfaceRenderer- Returns:
- The
MediaClocktracking the playback position of the renderer, or null.
-
getState
public final int getState()
Deprecated.Description copied from interface:RendererReturns the current state of the renderer.- Specified by:
getStatein interfaceRenderer- Returns:
- The current state. One of
Renderer.STATE_DISABLED,Renderer.STATE_ENABLEDandRenderer.STATE_STARTED.
-
enable
public final void enable(RendererConfiguration configuration, Format[] formats, SampleStream stream, long positionUs, boolean joining, boolean mayRenderStartOfStream, long startPositionUs, long offsetUs) throws ExoPlaybackException
Deprecated.Description copied from interface:RendererEnables the renderer to consume from the specifiedSampleStream.This method may be called when the renderer is in the following states:
Renderer.STATE_DISABLED.- Specified by:
enablein interfaceRenderer- Parameters:
configuration- The renderer configuration.formats- The enabled formats.stream- TheSampleStreamfrom which the renderer should consume.positionUs- The player's current position.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_STARTEDyet.startPositionUs- The start position of the stream in renderer time (microseconds).offsetUs- The offset to be added to timestamps of buffers read fromstreambefore they are rendered.- Throws:
ExoPlaybackException- If an error occurs.
-
start
public final void start() throws ExoPlaybackExceptionDeprecated.Description copied from interface:RendererStarts the renderer, meaning that calls toRenderer.render(long, long)will cause media to be rendered.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED.- Specified by:
startin interfaceRenderer- Throws:
ExoPlaybackException- If an error occurs.
-
replaceStream
public final void replaceStream(Format[] formats, SampleStream stream, long startPositionUs, long offsetUs) throws ExoPlaybackException
Deprecated.Description copied from interface:RendererReplaces theSampleStreamfrom which samples will be consumed.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.- Specified by:
replaceStreamin interfaceRenderer- Parameters:
formats- The enabled formats.stream- TheSampleStreamfrom which the renderer should consume.startPositionUs- The start position of the new stream in renderer time (microseconds).offsetUs- The offset to be added to timestamps of buffers read fromstreambefore they are rendered.- Throws:
ExoPlaybackException- If an error occurs.
-
getStream
@Nullable public final SampleStream getStream()
Deprecated.Description copied from interface:RendererReturns theSampleStreambeing consumed, or null if the renderer is disabled.
-
hasReadStreamToEnd
public final boolean hasReadStreamToEnd()
Deprecated.Description copied from interface:RendererReturns whether the renderer has read the currentSampleStreamto the end.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.- Specified by:
hasReadStreamToEndin interfaceRenderer
-
getReadingPositionUs
public long getReadingPositionUs()
Deprecated.Description copied from interface:RendererReturns the renderer time up to which the renderer has read samples, in microseconds, orC.TIME_END_OF_SOURCEif the renderer has read the currentSampleStreamto the end.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.- Specified by:
getReadingPositionUsin interfaceRenderer
-
setCurrentStreamFinal
public final void setCurrentStreamFinal()
Deprecated.Description copied from interface:RendererSignals to the renderer that the currentSampleStreamwill be the final one supplied before it is next disabled or reset.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.- Specified by:
setCurrentStreamFinalin interfaceRenderer
-
isCurrentStreamFinal
public final boolean isCurrentStreamFinal()
Deprecated.Description copied from interface:RendererReturns whether the currentSampleStreamwill be the final one supplied before the renderer is next disabled or reset.- Specified by:
isCurrentStreamFinalin interfaceRenderer
-
maybeThrowStreamError
public final void maybeThrowStreamError() throws IOExceptionDeprecated.Description copied from interface:RendererThrows an error that's preventing the renderer from reading from itsSampleStream. Does nothing if no such error exists.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.- Specified by:
maybeThrowStreamErrorin interfaceRenderer- Throws:
IOException- An error that's preventing the renderer from making progress or buffering more data.
-
resetPosition
public final void resetPosition(long positionUs) throws ExoPlaybackExceptionDeprecated.Description copied from interface:RendererSignals to the renderer that a position discontinuity has occurred.After a position discontinuity, the renderer's
SampleStreamis guaranteed to provide samples starting from a key frame.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.- Specified by:
resetPositionin interfaceRenderer- Parameters:
positionUs- The new playback position in microseconds.- Throws:
ExoPlaybackException- If an error occurs handling the reset.
-
stop
public final void stop()
Deprecated.Description copied from interface:RendererStops the renderer, transitioning it to theRenderer.STATE_ENABLEDstate.This method may be called when the renderer is in the following states:
Renderer.STATE_STARTED.
-
disable
public final void disable()
Deprecated.Description copied from interface:RendererDisable the renderer, transitioning it to theRenderer.STATE_DISABLEDstate.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED.
-
reset
public final void reset()
Deprecated.Description copied from interface:RendererForces the renderer to give up any resources (e.g. media decoders) that it may be holding. If the renderer is not holding any resources, the call is a no-op.This method may be called when the renderer is in the following states:
Renderer.STATE_DISABLED.
-
isReady
public boolean isReady()
Deprecated.Description copied from interface:RendererWhether the renderer is able to immediately render media from the current position.If the renderer is in the
Renderer.STATE_STARTEDstate then returning true indicates that the renderer has everything that it needs to continue playback. Returning false indicates that the player should pause until the renderer is ready.If the renderer is in the
Renderer.STATE_ENABLEDstate then returning true indicates that the renderer is ready for playback to be started. Returning false indicates that it is not.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.
-
isEnded
public boolean isEnded()
Deprecated.Description copied from interface:RendererWhether the renderer is ready for theExoPlayerinstance to transition toPlayer.STATE_ENDED. The player will make this transition as soon astrueis returned by all of its renderers.This method may be called when the renderer is in the following states:
Renderer.STATE_ENABLED,Renderer.STATE_STARTED.
-
supportsFormat
public @com.google.android.exoplayer2.RendererCapabilities.Capabilities int supportsFormat(Format format) throws ExoPlaybackException
Deprecated.Description copied from interface:RendererCapabilitiesReturns the extent to which theRenderersupports a given format.- Specified by:
supportsFormatin interfaceRendererCapabilities- Parameters:
format- The format.- Returns:
- The
RendererCapabilities.Capabilitiesfor this format. - Throws:
ExoPlaybackException- If an error occurs.
-
supportsMixedMimeTypeAdaptation
public @com.google.android.exoplayer2.RendererCapabilities.AdaptiveSupport int supportsMixedMimeTypeAdaptation() throws ExoPlaybackExceptionDeprecated.Description copied from interface:RendererCapabilitiesReturns the extent to which theRenderersupports adapting between supported formats that have different MIME types.- Specified by:
supportsMixedMimeTypeAdaptationin interfaceRendererCapabilities- Returns:
- The
RendererCapabilities.AdaptiveSupportfor adapting between supported formats that have different MIME types. - Throws:
ExoPlaybackException- If an error occurs.
-
handleMessage
public void handleMessage(@com.google.android.exoplayer2.Renderer.MessageType int messageType, @Nullable Object message) throws ExoPlaybackExceptionDeprecated.Description copied from interface:PlayerMessage.TargetHandles a message delivered to the target.- Specified by:
handleMessagein interfacePlayerMessage.Target- 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.
-
onEnabled
protected void onEnabled(boolean joining) throws ExoPlaybackExceptionDeprecated.Called when the renderer is enabled.The default implementation is a no-op.
- Parameters:
joining- Whether this renderer is being enabled to join an ongoing playback.- Throws:
ExoPlaybackException- If an error occurs.
-
onRendererOffsetChanged
protected void onRendererOffsetChanged(long offsetUs) throws ExoPlaybackExceptionDeprecated.Called when the renderer's offset has been changed.The default implementation is a no-op.
- Parameters:
offsetUs- The offset that should be subtracted frompositionUsinRenderer.render(long, long)to get the playback position with respect to the media.- Throws:
ExoPlaybackException- If an error occurs.
-
onPositionReset
protected void onPositionReset(long positionUs, boolean joining) throws ExoPlaybackExceptionDeprecated.Called when the position is reset. This occurs when the renderer is enabled afteronRendererOffsetChanged(long)has been called, and also when a position discontinuity is encountered.The default implementation is a no-op.
- 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.
-
onStarted
protected void onStarted() throws ExoPlaybackExceptionDeprecated.Called when the renderer is started.The default implementation is a no-op.
- Throws:
ExoPlaybackException- If an error occurs.
-
onStopped
protected void onStopped()
Deprecated.Called when the renderer is stopped.The default implementation is a no-op.
-
onDisabled
protected void onDisabled()
Deprecated.Called when the renderer is disabled.The default implementation is a no-op.
-
onReset
protected void onReset()
Deprecated.Called when the renderer is reset.The default implementation is a no-op.
-
getConfiguration
@Nullable protected final RendererConfiguration getConfiguration()
Deprecated.Returns the configuration set when the renderer was most recently enabled, ornullif the renderer has never been enabled.
-
getIndex
protected final int getIndex()
Deprecated.Returns the index of the renderer within the player.
-
-