public final class Eia608TrackRenderer extends SampleSourceTrackRenderer implements Handler.Callback
TrackRenderer for EIA-608 closed captions in a media stream.END_OF_TRACK_US, MATCH_LONGEST_US, STATE_ENABLED, STATE_PREPARED, STATE_RELEASED, STATE_STARTED, STATE_UNPREPARED, UNKNOWN_TIME_US| Constructor and Description |
|---|
Eia608TrackRenderer(SampleSource source,
TextRenderer textRenderer,
Looper textRendererLooper) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doSomeWork(long positionUs,
long elapsedRealtimeUs,
boolean sourceIsReady)
|
protected long |
getBufferedPositionUs()
Returns an estimate of the absolute position in microseconds up to which data is buffered.
|
boolean |
handleMessage(Message msg) |
protected boolean |
handlesTrack(MediaFormat mediaFormat)
Returns whether this renderer is capable of handling the provided track.
|
protected boolean |
isEnded()
Whether the renderer is ready for the
ExoPlayer instance to transition to
ExoPlayer.STATE_ENDED. |
protected boolean |
isReady()
Whether the renderer is able to immediately render media from the current position.
|
protected void |
onDiscontinuity(long positionUs)
Invoked when a discontinuity is encountered.
|
protected void |
onEnabled(int track,
long positionUs,
boolean joining)
Called when the renderer is enabled.
|
doPrepare, doSomeWork, getDurationUs, getFormat, getTrackCount, maybeThrowError, onDisabled, onReleased, readSource, seekTo, shiftInputPositiongetMediaClock, getState, handleMessage, onStarted, onStoppedpublic Eia608TrackRenderer(SampleSource source, TextRenderer textRenderer, Looper textRendererLooper)
source - A source from which samples containing EIA-608 closed captions can be read.textRenderer - The text renderer.textRendererLooper - The looper associated with the thread on which textRenderer should be
invoked. If the renderer makes use of standard Android UI components, then this should
normally be the looper associated with the applications' main thread, which can be
obtained using ContextWrapper.getMainLooper(). Null may be passed if the
renderer should be invoked directly on the player's internal rendering thread.protected boolean handlesTrack(MediaFormat mediaFormat)
SampleSourceTrackRendererhandlesTrack in class SampleSourceTrackRenderermediaFormat - The format of the track.protected void onEnabled(int track,
long positionUs,
boolean joining)
throws ExoPlaybackException
TrackRendererThe default implementation is a no-op.
onEnabled in class SampleSourceTrackRenderertrack - The track for which the renderer is being enabled.positionUs - The player's current position.joining - Whether this renderer is being enabled to join an ongoing playback.ExoPlaybackException - If an error occurs.protected void onDiscontinuity(long positionUs)
SampleSourceTrackRendereronDiscontinuity in class SampleSourceTrackRendererpositionUs - The playback position after the discontinuity, or the position at which
the renderer is being enabled.protected void doSomeWork(long positionUs,
long elapsedRealtimeUs,
boolean sourceIsReady)
throws ExoPlaybackException
SampleSourceTrackRendererdoSomeWork in class SampleSourceTrackRendererpositionUs - The current media time in microseconds, measured at the start of the
current iteration of the rendering loop.elapsedRealtimeUs - SystemClock.elapsedRealtime() in microseconds,
measured at the start of the current iteration of the rendering loop.sourceIsReady - The result of the most recent call to
SampleSource.SampleSourceReader.continueBuffering(int, long).ExoPlaybackException - If an error occurs.protected long getBufferedPositionUs()
TrackRenderer
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
getBufferedPositionUs in class SampleSourceTrackRendererTrackRenderer.END_OF_TRACK_US if the track is fully buffered, or TrackRenderer.UNKNOWN_TIME_US if
no estimate is available.protected boolean isEnded()
TrackRendererExoPlayer instance to transition to
ExoPlayer.STATE_ENDED. The player will make this transition as soon as true is
returned by all of its TrackRenderers.
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
isEnded in class TrackRendererprotected boolean isReady()
TrackRenderer
If the renderer is in the TrackRenderer.STATE_STARTED state 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 TrackRenderer.STATE_ENABLED state 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:
TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
isReady in class TrackRendererpublic boolean handleMessage(Message msg)
handleMessage in interface Handler.Callback