PlayerMessage.Target
, Renderer
, RendererCapabilities
public class Libgav1VideoRenderer extends DecoderVideoRenderer
Renderer.State, Renderer.VideoScalingMode, Renderer.WakeupListener
RendererCapabilities.AdaptiveSupport, RendererCapabilities.Capabilities, RendererCapabilities.FormatSupport, RendererCapabilities.TunnelingSupport
Modifier and Type | Field | Description |
---|---|---|
static int |
THREAD_COUNT_AUTODETECT |
Attempts to use as many threads as performance processors available on the device.
|
decoderCounters
MSG_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_CROPPING
ADAPTIVE_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 |
---|---|
Libgav1VideoRenderer(long allowedJoiningTimeMs,
Handler eventHandler,
VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify) |
Creates a new instance.
|
Libgav1VideoRenderer(long allowedJoiningTimeMs,
Handler eventHandler,
VideoRendererEventListener eventListener,
int maxDroppedFramesToNotify,
int threads,
int numInputBuffers,
int numOutputBuffers) |
Creates a new instance.
|
Modifier and Type | Method | Description |
---|---|---|
protected boolean |
canKeepCodec(Format oldFormat,
Format newFormat) |
Returns whether the existing decoder can be kept for a new format.
|
protected com.google.android.exoplayer2.ext.av1.Gav1Decoder |
createDecoder(Format format,
ExoMediaCrypto mediaCrypto) |
Creates a decoder for the given format.
|
String |
getName() |
Returns the name of this renderer, for logging and debugging purposes.
|
protected void |
renderOutputBufferToSurface(VideoDecoderOutputBuffer outputBuffer,
Surface surface) |
Renders the specified output buffer to the passed surface.
|
protected void |
setDecoderOutputMode(int outputMode) |
Sets output mode of the decoder.
|
int |
supportsFormat(Format format) |
Returns the extent to which the
Renderer supports a given format. |
createRendererException, disable, enable, getCapabilities, getConfiguration, getFormatHolder, getIndex, getLastResetPositionUs, getMediaClock, getReadingPositionUs, getState, getStream, getStreamFormats, getTrackType, hasReadStreamToEnd, isCurrentStreamFinal, isSourceReady, maybeThrowStreamError, onReset, readSource, replaceStream, reset, resetPosition, setCurrentStreamFinal, setIndex, skipSource, start, stop, supportsMixedMimeTypeAdaptation
dropOutputBuffer, flushDecoder, handleMessage, isEnded, isReady, maybeDropBuffersToKeyframe, onDecoderInitialized, onDisabled, onEnabled, onInputFormatChanged, onPositionReset, onProcessedOutputBuffer, onQueueInputBuffer, onStarted, onStopped, onStreamChanged, releaseDecoder, render, renderOutputBuffer, setOutputBufferRenderer, setOutputSurface, shouldDropBuffersToKeyframe, shouldDropOutputBuffer, shouldForceRenderOutputBuffer, skipOutputBuffer, updateDroppedBufferCounters
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setOperatingRate
public static final int THREAD_COUNT_AUTODETECT
public Libgav1VideoRenderer(long allowedJoiningTimeMs, @Nullable Handler eventHandler, @Nullable VideoRendererEventListener eventListener, int maxDroppedFramesToNotify)
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 Libgav1VideoRenderer(long allowedJoiningTimeMs, @Nullable Handler eventHandler, @Nullable VideoRendererEventListener eventListener, int maxDroppedFramesToNotify, int threads, int numInputBuffers, int numOutputBuffers)
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)
.threads
- Number of threads libgav1 will use to decode. If THREAD_COUNT_AUTODETECT
is passed, then the number of threads to use is autodetected
based on CPU capabilities.numInputBuffers
- Number of input buffers.numOutputBuffers
- Number of output buffers.public String getName()
Renderer
@Capabilities public final int supportsFormat(Format format)
RendererCapabilities
Renderer
supports a given format.format
- The format.RendererCapabilities.Capabilities
for this format.protected com.google.android.exoplayer2.ext.av1.Gav1Decoder createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto) throws Gav1DecoderException
DecoderVideoRenderer
createDecoder
in class DecoderVideoRenderer
format
- The format for which a decoder is required.mediaCrypto
- The ExoMediaCrypto
object required for decoding encrypted content.
May be null and can be ignored if decoder does not handle encrypted content.Gav1DecoderException
protected void renderOutputBufferToSurface(VideoDecoderOutputBuffer outputBuffer, Surface surface) throws Gav1DecoderException
DecoderVideoRenderer
The implementation of this method takes ownership of the output buffer and is responsible
for calling VideoDecoderOutputBuffer.release()
either immediately or in the future.
renderOutputBufferToSurface
in class DecoderVideoRenderer
outputBuffer
- VideoDecoderOutputBuffer
to render.surface
- Output Surface
.Gav1DecoderException
protected void setDecoderOutputMode(@VideoOutputMode int outputMode)
DecoderVideoRenderer
setDecoderOutputMode
in class DecoderVideoRenderer
outputMode
- Output mode.protected boolean canKeepCodec(Format oldFormat, Format newFormat)
DecoderVideoRenderer
canKeepCodec
in class DecoderVideoRenderer
oldFormat
- The previous format.newFormat
- The new format.