Handler.Callback, PlayerMessage.Target, Renderer, RendererCapabilitiespublic final class MetadataRenderer extends BaseRenderer implements Handler.Callback
Renderer.State, Renderer.VideoScalingMode, Renderer.WakeupListenerRendererCapabilities.AdaptiveSupport, RendererCapabilities.Capabilities, RendererCapabilities.FormatSupport, RendererCapabilities.TunnelingSupportMSG_CUSTOM_BASE, MSG_SET_AUDIO_ATTRIBUTES, MSG_SET_AUDIO_SESSION_ID, MSG_SET_AUX_EFFECT_INFO, MSG_SET_CAMERA_MOTION_LISTENER, MSG_SET_SCALING_MODE, MSG_SET_SKIP_SILENCE_ENABLED, MSG_SET_SURFACE, MSG_SET_VIDEO_DECODER_OUTPUT_BUFFER_RENDERER, MSG_SET_VIDEO_FRAME_METADATA_LISTENER, MSG_SET_VOLUME, MSG_SET_WAKEUP_LISTENER, STATE_DISABLED, STATE_ENABLED, STATE_STARTED, VIDEO_SCALING_MODE_DEFAULT, VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPINGADAPTIVE_NOT_SEAMLESS, ADAPTIVE_NOT_SUPPORTED, ADAPTIVE_SEAMLESS, ADAPTIVE_SUPPORT_MASK, FORMAT_EXCEEDS_CAPABILITIES, FORMAT_HANDLED, FORMAT_SUPPORT_MASK, FORMAT_UNSUPPORTED_DRM, FORMAT_UNSUPPORTED_SUBTYPE, FORMAT_UNSUPPORTED_TYPE, TUNNELING_NOT_SUPPORTED, TUNNELING_SUPPORT_MASK, TUNNELING_SUPPORTED| Constructor | Description |
|---|---|
MetadataRenderer(MetadataOutput output,
Looper outputLooper) |
|
MetadataRenderer(MetadataOutput output,
Looper outputLooper,
MetadataDecoderFactory decoderFactory) |
| Modifier and Type | Method | Description |
|---|---|---|
String |
getName() |
Returns the name of this renderer, for logging and debugging purposes.
|
boolean |
handleMessage(Message msg) |
|
boolean |
isEnded() |
Whether the renderer is ready for the
ExoPlayer instance to transition to Player.STATE_ENDED. |
boolean |
isReady() |
Whether the renderer is able to immediately render media from the current position.
|
protected void |
onDisabled() |
Called when the renderer is disabled.
|
protected void |
onPositionReset(long positionUs,
boolean joining) |
Called when the position is reset.
|
protected void |
onStreamChanged(Format[] formats,
long startPositionUs,
long offsetUs) |
Called when the renderer's stream has changed.
|
void |
render(long positionUs,
long elapsedRealtimeUs) |
Incrementally renders the
SampleStream. |
int |
supportsFormat(Format format) |
Returns the extent to which the
Renderer supports a given format. |
createRendererException, createRendererException, disable, enable, getCapabilities, getConfiguration, getFormatHolder, getIndex, getLastResetPositionUs, getMediaClock, getReadingPositionUs, getState, getStream, getStreamFormats, getTrackType, handleMessage, hasReadStreamToEnd, isCurrentStreamFinal, isSourceReady, maybeThrowStreamError, onEnabled, onReset, onStarted, onStopped, readSource, replaceStream, reset, resetPosition, setCurrentStreamFinal, setIndex, skipSource, start, stop, supportsMixedMimeTypeAdaptationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetPlaybackSpeedpublic MetadataRenderer(MetadataOutput output, @Nullable Looper outputLooper)
output - The output.outputLooper - The looper associated with the thread on which the output should be called.
If the output makes use of standard Android UI components, then this should normally be the
looper associated with the application's main thread, which can be obtained using ContextWrapper.getMainLooper(). Null may be passed if the output should be called
directly on the player's internal rendering thread.public MetadataRenderer(MetadataOutput output, @Nullable Looper outputLooper, MetadataDecoderFactory decoderFactory)
output - The output.outputLooper - The looper associated with the thread on which the output should be called.
If the output makes use of standard Android UI components, then this should normally be the
looper associated with the application's main thread, which can be obtained using ContextWrapper.getMainLooper(). Null may be passed if the output should be called
directly on the player's internal rendering thread.decoderFactory - A factory from which to obtain MetadataDecoder instances.public String getName()
RenderergetName in interface RenderergetName in interface RendererCapabilities@Capabilities public int supportsFormat(Format format)
RendererCapabilitiesRenderer supports a given format.supportsFormat in interface RendererCapabilitiesformat - The format.RendererCapabilities.Capabilities for this format.protected void onStreamChanged(Format[] formats, long startPositionUs, long offsetUs)
BaseRendererBaseRenderer.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.
onStreamChanged in class BaseRendererformats - 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 via BaseRenderer.readSource(FormatHolder, DecoderInputBuffer, boolean) so that decoder input buffers have
monotonically increasing timestamps.protected void onPositionReset(long positionUs,
boolean joining)
BaseRendererBaseRenderer.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.
onPositionReset in class BaseRendererpositionUs - The new playback position in microseconds.joining - Whether this renderer is being enabled to join an ongoing playback.public void render(long positionUs,
long elapsedRealtimeUs)
RendererSampleStream.
If the renderer is in the Renderer.STATE_ENABLED state then each call to this method will do
work toward being ready to render the SampleStream when the renderer is started. If the
renderer is in the Renderer.STATE_STARTED state then calls to this method will render the
SampleStream in sync with the specified media positions.
The renderer may also render the very start of the media at the current position (e.g. the
first frame of a video stream) while still in the Renderer.STATE_ENABLED state, unless it's the
initial start of the media after calling Renderer.enable(RendererConfiguration, Format[],
SampleStream, long, boolean, boolean, long, long) with mayRenderStartOfStream set to
false.
This method should return quickly, and should not block if the renderer is unable to make useful progress.
This method may be called when the renderer is in the following states: Renderer.STATE_ENABLED, Renderer.STATE_STARTED.
render in interface RendererpositionUs - 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.protected void onDisabled()
BaseRendererThe default implementation is a no-op.
onDisabled in class BaseRendererpublic boolean isEnded()
RendererExoPlayer instance to transition to Player.STATE_ENDED. The player will make this transition as soon as true is 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.
public boolean isReady()
Renderer
If the renderer is in the Renderer.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 Renderer.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:
Renderer.STATE_ENABLED, Renderer.STATE_STARTED.
public boolean handleMessage(Message msg)
handleMessage in interface Handler.Callback