public final class LibvpxVideoRenderer extends BaseRenderer
| Modifier and Type | Field and Description |
|---|---|
static int |
MSG_SET_OUTPUT_BUFFER_RENDERER
The type of a message that can be passed to an instance of this class via
ExoPlayer.sendMessages(com.google.android.exoplayer2.ExoPlayer.ExoPlayerMessage...) or ExoPlayer.blockingSendMessages(com.google.android.exoplayer2.ExoPlayer.ExoPlayerMessage...). |
STATE_DISABLED, STATE_ENABLED, STATE_STARTEDADAPTIVE_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 and Description |
|---|
LibvpxVideoRenderer(boolean scaleToFit,
long allowedJoiningTimeMs) |
LibvpxVideoRenderer(boolean scaleToFit,
long allowedJoiningTimeMs,
Handler eventHandler,
VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify) |
LibvpxVideoRenderer(boolean scaleToFit,
long allowedJoiningTimeMs,
Handler eventHandler,
VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify,
DrmSessionManager<ExoMediaCrypto> drmSessionManager,
boolean playClearSamplesWithoutKeys) |
| Modifier and Type | Method and Description |
|---|---|
void |
handleMessage(int messageType,
Object message)
Handles a message delivered to the component.
|
boolean |
isEnded()
Whether the renderer is ready for the
ExoPlayer instance to transition to
ExoPlayer.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 |
onEnabled(boolean joining)
Called when the renderer is enabled.
|
protected void |
onPositionReset(long positionUs,
boolean joining)
Called when the position is reset.
|
protected void |
onStarted()
Called when the renderer is started.
|
protected void |
onStopped()
Called when the renderer is stopped.
|
void |
render(long positionUs,
long elapsedRealtimeUs)
Incrementally renders the
SampleStream. |
protected boolean |
shouldDropOutputBuffer(long outputBufferTimeUs,
long nextOutputBufferTimeUs,
long positionUs,
long joiningDeadlineMs)
Returns whether the current frame should be dropped.
|
int |
supportsFormat(Format format)
Returns the extent to which the
Renderer supports a given format. |
disable, enable, getCapabilities, getConfiguration, getIndex, getMediaClock, getState, getStream, getTrackType, hasReadStreamToEnd, isCurrentStreamFinal, isSourceReady, maybeThrowStreamError, onStreamChanged, readSource, replaceStream, resetPosition, setCurrentStreamFinal, setIndex, skipSource, start, stop, supportsMixedMimeTypeAdaptationpublic static final int MSG_SET_OUTPUT_BUFFER_RENDERER
ExoPlayer.sendMessages(com.google.android.exoplayer2.ExoPlayer.ExoPlayerMessage...) or ExoPlayer.blockingSendMessages(com.google.android.exoplayer2.ExoPlayer.ExoPlayerMessage...). The message object
should be the target VpxOutputBufferRenderer, or null.public LibvpxVideoRenderer(boolean scaleToFit,
long allowedJoiningTimeMs)
scaleToFit - Whether video frames should be scaled to fit when rendering.allowedJoiningTimeMs - The maximum duration in milliseconds for which this video renderer
can attempt to seamlessly join an ongoing playback.public LibvpxVideoRenderer(boolean scaleToFit,
long allowedJoiningTimeMs,
Handler eventHandler,
VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify)
scaleToFit - Whether video frames should be scaled to fit when rendering.allowedJoiningTimeMs - The maximum duration in milliseconds for which this video renderer
can attempt to seamlessly join an ongoing playback.eventHandler - A handler to use when delivering events to eventListener. May be
null if delivery of events is not required.eventListener - A listener of events. May be null if delivery of events is not required.maxDroppedFramesToNotify - The maximum number of frames that can be dropped between
invocations of VideoRendererEventListener.onDroppedFrames(int, long).public LibvpxVideoRenderer(boolean scaleToFit,
long allowedJoiningTimeMs,
Handler eventHandler,
VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify,
DrmSessionManager<ExoMediaCrypto> drmSessionManager,
boolean playClearSamplesWithoutKeys)
scaleToFit - Whether video frames should be scaled to fit when rendering.allowedJoiningTimeMs - The maximum duration in milliseconds for which this video renderer
can attempt to seamlessly join an ongoing playback.eventHandler - A handler to use when delivering events to eventListener. May be
null if delivery of events is not required.eventListener - A listener of events. May be null if delivery of events is not required.maxDroppedFramesToNotify - The maximum number of frames that can be dropped between
invocations of VideoRendererEventListener.onDroppedFrames(int, long).drmSessionManager - For use with encrypted media. May be null if support for encrypted
media is not required.playClearSamplesWithoutKeys - Encrypted media may contain clear (un-encrypted) regions.
For example a media file may start with a short clear region so as to allow playback to
begin in parallel with key acquisition. This parameter specifies whether the renderer is
permitted to play clear regions of encrypted media files before drmSessionManager
has obtained the keys necessary to decrypt encrypted regions of the media.public int supportsFormat(Format format)
RendererCapabilitiesRenderer supports a given format. The returned value is
the bitwise OR of three properties:
RendererCapabilities.FORMAT_HANDLED,
RendererCapabilities.FORMAT_EXCEEDS_CAPABILITIES, RendererCapabilities.FORMAT_UNSUPPORTED_SUBTYPE and
RendererCapabilities.FORMAT_UNSUPPORTED_TYPE.RendererCapabilities.ADAPTIVE_SEAMLESS, RendererCapabilities.ADAPTIVE_NOT_SEAMLESS and
RendererCapabilities.ADAPTIVE_NOT_SUPPORTED.RendererCapabilities.TUNNELING_SUPPORTED and
RendererCapabilities.TUNNELING_NOT_SUPPORTED.RendererCapabilities.FORMAT_SUPPORT_MASK, RendererCapabilities.ADAPTIVE_SUPPORT_MASK and
RendererCapabilities.TUNNELING_SUPPORT_MASK respectively.format - The format.public void render(long positionUs,
long elapsedRealtimeUs)
throws ExoPlaybackException
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. It may
also render the very start of the media, for example the first frame of a video stream. 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.
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.
positionUs - 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.ExoPlaybackException - If an error occurs.protected boolean shouldDropOutputBuffer(long outputBufferTimeUs,
long nextOutputBufferTimeUs,
long positionUs,
long joiningDeadlineMs)
outputBufferTimeUs - The timestamp of the current output buffer.nextOutputBufferTimeUs - The timestamp of the next output buffer or
C.TIME_UNSET if the next output buffer is unavailable.positionUs - The current playback position.joiningDeadlineMs - The joining deadline.public boolean isEnded()
RendererExoPlayer instance to transition to
ExoPlayer.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.
protected void onEnabled(boolean joining)
throws ExoPlaybackException
BaseRendererThe default implementation is a no-op.
onEnabled in class BaseRendererjoining - Whether this renderer is being enabled to join an ongoing playback.ExoPlaybackException - If an error occurs.protected void onPositionReset(long positionUs,
boolean joining)
throws ExoPlaybackException
BaseRendererBaseRenderer.onStreamChanged(Format[], 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.ExoPlaybackException - If an error occurs.protected void onStarted()
BaseRendererThe default implementation is a no-op.
onStarted in class BaseRendererprotected void onStopped()
BaseRendererThe default implementation is a no-op.
onStopped in class BaseRendererprotected void onDisabled()
BaseRendererThe default implementation is a no-op.
onDisabled in class BaseRendererpublic void handleMessage(int messageType,
Object message)
throws ExoPlaybackException
ExoPlayer.ExoPlayerComponenthandleMessage in interface ExoPlayer.ExoPlayerComponenthandleMessage in class BaseRenderermessageType - The message type.message - The message.ExoPlaybackException - If an error occurred whilst handling the message.