RendererCapabilities


@UnstableApi
public interface RendererCapabilities

Known direct subclasses
BaseRenderer

An abstract base class suitable for most Renderer implementations.

NoSampleRenderer

A Renderer implementation whose track type is TRACK_TYPE_NONE and does not consume data from its SampleStream.

Known indirect subclasses
CameraMotionRenderer

A Renderer that parses the camera motion track.

DecoderAudioRenderer

Decodes and renders audio using a Decoder.

DecoderVideoRenderer

Decodes and renders video using a Decoder.

FakeAudioRenderer

A FakeRenderer that supports TRACK_TYPE_AUDIO.

FakeMediaClockRenderer

Fake abstract Renderer which is also a MediaClock.

FakeRenderer

Fake Renderer that supports any format with the matching track type.

FakeVideoRenderer

A FakeRenderer that supports TRACK_TYPE_VIDEO.

ImageRenderer

A Renderer implementation for images.

MediaCodecAudioRenderer

Decodes and renders audio using MediaCodec and an AudioSink.

MediaCodecRenderer

An abstract renderer that uses MediaCodec to decode samples for rendering.

MediaCodecVideoRenderer

Decodes and renders video using MediaCodec.

MetadataRenderer

A renderer for metadata.

TextRenderer

A Renderer for text.


Defines the capabilities of a Renderer.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation RendererCapabilities.AdaptiveSupport

Level of renderer support for adaptive format switches.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation RendererCapabilities.AudioOffloadSupport

Level of renderer support for audio offload.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation RendererCapabilities.Capabilities

Combined renderer capabilities.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation RendererCapabilities.DecoderSupport

Level of decoder support.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation RendererCapabilities.HardwareAccelerationSupport

Level of renderer support for hardware acceleration.

Listener for renderer capabilities events.

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation RendererCapabilities.TunnelingSupport

Level of renderer support for tunneling.

Constants

default static final int

The Renderer can adapt between formats, but may suffer a brief discontinuity (~50-100ms) when adaptation occurs.

default static final int

The Renderer does not support adaptation between formats.

default static final int

The Renderer can seamlessly adapt between formats.

default static final int

A mask to apply to Capabilities to obtain the AdaptiveSupport only.

default static final int

The renderer supports audio offload and gapless transitions with this format.

default static final int

Audio offload is not supported with this format.

default static final int

The renderer supports audio offload and speed changes with this format.

default static final int

The renderer supports audio offload with this format.

default static final int

A mask to apply to Capabilities to obtain AudioOffloadSupport only.

default static final int

The format exceeds the primary decoder's capabilities but is supported by fallback decoder

default static final int

The format's MIME type is unsupported and the renderer may use a decoder for a fallback MIME type.

default static final int

A mask to apply to Capabilities to obtain DecoderSupport only.

default static final int

The renderer is able to use the primary decoder for the format's MIME type.

default static final int

A mask to apply to Capabilities to obtain the C.FormatSupport only.

default static final int

The renderer is not able to use hardware acceleration.

default static final int

The renderer is able to use hardware acceleration.

default static final int

A mask to apply to Capabilities to obtain HardwareAccelerationSupport only.

default static final int

The Renderer does not support tunneled output.

default static final int

The Renderer supports tunneled output.

default static final int

A mask to apply to Capabilities to obtain TunnelingSupport only.

Public methods

default void

Clears the Listener.

default static int

Returns Capabilities for the given C.FormatSupport.

default static int
@RendererCapabilities.Capabilities
create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport
)

Returns Capabilities combining the given C.FormatSupport, and TunnelingSupport.

default static int
@RendererCapabilities.Capabilities
create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport,
    @RendererCapabilities.AudioOffloadSupport int audioOffloadSupport
)

Returns Capabilities combining the given C.FormatSupport, , TunnelingSupport, and AudioOffloadSupport.

default static int
@RendererCapabilities.Capabilities
create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport,
    @RendererCapabilities.HardwareAccelerationSupport int hardwareAccelerationSupport,
    @RendererCapabilities.DecoderSupport int decoderSupport
)

Returns Capabilities combining the given C.FormatSupport, , TunnelingSupport, HardwareAccelerationSupport, and .

default static int
@RendererCapabilities.Capabilities
create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport,
    @RendererCapabilities.HardwareAccelerationSupport int hardwareAccelerationSupport,
    @RendererCapabilities.DecoderSupport int decoderSupport,
    @RendererCapabilities.AudioOffloadSupport int audioOffloadSupport
)

Returns Capabilities combining the given C.FormatSupport, , TunnelingSupport, HardwareAccelerationSupport, and AudioOffloadSupport.

default static int

Returns the AdaptiveSupport from the combined Capabilities.

default static int

Returns the AudioOffloadSupport from the combined Capabilities.

default static int

Returns the DecoderSupport from the combined Capabilities.

default static int

Returns the C.FormatSupport from the combined Capabilities.

default static int

Returns the HardwareAccelerationSupport from the combined Capabilities.

abstract String

Returns the name of the Renderer.

abstract int

Returns the track type that the Renderer handles.

default static int

Returns the TunnelingSupport from the combined Capabilities.

default static boolean
isFormatSupported(
    @RendererCapabilities.Capabilities int supportFlags,
    boolean allowExceedsCapabilities
)

Returns whether the C.FormatSupport from the combined Capabilities indicates the format is supported.

default void

Sets the Listener.

abstract int

Returns the extent to which the Renderer supports a given format.

abstract int

Returns the extent to which the Renderer supports adapting between supported formats that have different MIME types.

Constants

ADAPTIVE_NOT_SEAMLESS

default static final int ADAPTIVE_NOT_SEAMLESS = 8

The Renderer can adapt between formats, but may suffer a brief discontinuity (~50-100ms) when adaptation occurs.

ADAPTIVE_NOT_SUPPORTED

default static final int ADAPTIVE_NOT_SUPPORTED = 0

The Renderer does not support adaptation between formats.

ADAPTIVE_SEAMLESS

default static final int ADAPTIVE_SEAMLESS = 16

The Renderer can seamlessly adapt between formats.

ADAPTIVE_SUPPORT_MASK

default static final int ADAPTIVE_SUPPORT_MASK = 24

A mask to apply to Capabilities to obtain the AdaptiveSupport only.

AUDIO_OFFLOAD_GAPLESS_SUPPORTED

default static final int AUDIO_OFFLOAD_GAPLESS_SUPPORTED = 1024

The renderer supports audio offload and gapless transitions with this format.

AUDIO_OFFLOAD_NOT_SUPPORTED

default static final int AUDIO_OFFLOAD_NOT_SUPPORTED = 0

Audio offload is not supported with this format.

AUDIO_OFFLOAD_SPEED_CHANGE_SUPPORTED

default static final int AUDIO_OFFLOAD_SPEED_CHANGE_SUPPORTED = 2048

The renderer supports audio offload and speed changes with this format.

AUDIO_OFFLOAD_SUPPORTED

default static final int AUDIO_OFFLOAD_SUPPORTED = 512

The renderer supports audio offload with this format.

AUDIO_OFFLOAD_SUPPORT_MASK

default static final int AUDIO_OFFLOAD_SUPPORT_MASK = 3584

A mask to apply to Capabilities to obtain AudioOffloadSupport only.

DECODER_SUPPORT_FALLBACK

default static final int DECODER_SUPPORT_FALLBACK = 0

The format exceeds the primary decoder's capabilities but is supported by fallback decoder

DECODER_SUPPORT_FALLBACK_MIMETYPE

default static final int DECODER_SUPPORT_FALLBACK_MIMETYPE = 256

The format's MIME type is unsupported and the renderer may use a decoder for a fallback MIME type.

DECODER_SUPPORT_MASK

default static final int DECODER_SUPPORT_MASK = 384

A mask to apply to Capabilities to obtain DecoderSupport only.

DECODER_SUPPORT_PRIMARY

default static final int DECODER_SUPPORT_PRIMARY = 128

The renderer is able to use the primary decoder for the format's MIME type.

FORMAT_SUPPORT_MASK

default static final int FORMAT_SUPPORT_MASK = 7

A mask to apply to Capabilities to obtain the C.FormatSupport only.

HARDWARE_ACCELERATION_NOT_SUPPORTED

default static final int HARDWARE_ACCELERATION_NOT_SUPPORTED = 0

The renderer is not able to use hardware acceleration.

HARDWARE_ACCELERATION_SUPPORTED

default static final int HARDWARE_ACCELERATION_SUPPORTED = 64

The renderer is able to use hardware acceleration.

HARDWARE_ACCELERATION_SUPPORT_MASK

default static final int HARDWARE_ACCELERATION_SUPPORT_MASK = 64

A mask to apply to Capabilities to obtain HardwareAccelerationSupport only.

TUNNELING_NOT_SUPPORTED

default static final int TUNNELING_NOT_SUPPORTED = 0

The Renderer does not support tunneled output.

TUNNELING_SUPPORTED

default static final int TUNNELING_SUPPORTED = 32

The Renderer supports tunneled output.

TUNNELING_SUPPORT_MASK

default static final int TUNNELING_SUPPORT_MASK = 32

A mask to apply to Capabilities to obtain TunnelingSupport only.

Public methods

clearListener

default void clearListener()

Clears the Listener.

create

@RendererCapabilities.Capabilities
default static int create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport
)

Returns Capabilities combining the given C.FormatSupport, and TunnelingSupport.

HardwareAccelerationSupport is set to HARDWARE_ACCELERATION_NOT_SUPPORTED, DecoderSupport is set to DECODER_SUPPORT_PRIMARY, and is set to AUDIO_OFFLOAD_NOT_SUPPORTED.

Parameters
@C.FormatSupport int formatSupport

The C.FormatSupport.

@RendererCapabilities.AdaptiveSupport int adaptiveSupport

The AdaptiveSupport.

@RendererCapabilities.TunnelingSupport int tunnelingSupport

The TunnelingSupport.

Returns
int

The combined Capabilities.

create

@RendererCapabilities.Capabilities
default static int create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport,
    @RendererCapabilities.AudioOffloadSupport int audioOffloadSupport
)

Returns Capabilities combining the given C.FormatSupport, , TunnelingSupport, and AudioOffloadSupport.

HardwareAccelerationSupport is set to HARDWARE_ACCELERATION_NOT_SUPPORTED and DecoderSupport is set to DECODER_SUPPORT_PRIMARY.

Parameters
@C.FormatSupport int formatSupport

The C.FormatSupport.

@RendererCapabilities.AdaptiveSupport int adaptiveSupport

The AdaptiveSupport.

@RendererCapabilities.TunnelingSupport int tunnelingSupport

The TunnelingSupport.

@RendererCapabilities.AudioOffloadSupport int audioOffloadSupport

The AudioOffloadSupport.

Returns
int

The combined Capabilities.

create

@RendererCapabilities.Capabilities
default static int create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport,
    @RendererCapabilities.HardwareAccelerationSupport int hardwareAccelerationSupport,
    @RendererCapabilities.DecoderSupport int decoderSupport
)

Returns Capabilities combining the given C.FormatSupport, , TunnelingSupport, HardwareAccelerationSupport, and .

AudioOffloadSupport is set to AUDIO_OFFLOAD_NOT_SUPPORTED.

Returns
int

The combined Capabilities.

create

@RendererCapabilities.Capabilities
default static int create(
    @C.FormatSupport int formatSupport,
    @RendererCapabilities.AdaptiveSupport int adaptiveSupport,
    @RendererCapabilities.TunnelingSupport int tunnelingSupport,
    @RendererCapabilities.HardwareAccelerationSupport int hardwareAccelerationSupport,
    @RendererCapabilities.DecoderSupport int decoderSupport,
    @RendererCapabilities.AudioOffloadSupport int audioOffloadSupport
)

Returns Capabilities combining the given C.FormatSupport, , TunnelingSupport, HardwareAccelerationSupport, and AudioOffloadSupport.

Returns
int

The combined Capabilities.

getAdaptiveSupport

@RendererCapabilities.AdaptiveSupport
default static int getAdaptiveSupport(@RendererCapabilities.Capabilities int supportFlags)

Returns the AdaptiveSupport from the combined Capabilities.

Parameters
@RendererCapabilities.Capabilities int supportFlags

The combined Capabilities.

Returns
int

The AdaptiveSupport only.

getAudioOffloadSupport

@RendererCapabilities.AudioOffloadSupport
default static int getAudioOffloadSupport(
    @RendererCapabilities.Capabilities int supportFlags
)

Returns the AudioOffloadSupport from the combined Capabilities.

Parameters
@RendererCapabilities.Capabilities int supportFlags

The combined Capabilities.

Returns
int

The AudioOffloadSupport only.

getDecoderSupport

@RendererCapabilities.DecoderSupport
default static int getDecoderSupport(@RendererCapabilities.Capabilities int supportFlags)

Returns the DecoderSupport from the combined Capabilities.

Parameters
@RendererCapabilities.Capabilities int supportFlags

The combined Capabilities.

Returns
int

The DecoderSupport only.

getFormatSupport

@C.FormatSupport
default static int getFormatSupport(@RendererCapabilities.Capabilities int supportFlags)

Returns the C.FormatSupport from the combined Capabilities.

Parameters
@RendererCapabilities.Capabilities int supportFlags

The combined Capabilities.

Returns
int

The C.FormatSupport only.

getHardwareAccelerationSupport

@RendererCapabilities.HardwareAccelerationSupport
default static int getHardwareAccelerationSupport(
    @RendererCapabilities.Capabilities int supportFlags
)

Returns the HardwareAccelerationSupport from the combined Capabilities.

Parameters
@RendererCapabilities.Capabilities int supportFlags

The combined Capabilities.

Returns
int

The HardwareAccelerationSupport only.

getName

abstract String getName()

Returns the name of the Renderer.

getTrackType

@C.TrackType
abstract int getTrackType()

Returns the track type that the Renderer handles. For example, a video renderer will return TRACK_TYPE_VIDEO, an audio renderer will return TRACK_TYPE_AUDIO, a text renderer will return TRACK_TYPE_TEXT, and so on.

Returns
int

The track type.

See also
getTrackType

getTunnelingSupport

@RendererCapabilities.TunnelingSupport
default static int getTunnelingSupport(@RendererCapabilities.Capabilities int supportFlags)

Returns the TunnelingSupport from the combined Capabilities.

Parameters
@RendererCapabilities.Capabilities int supportFlags

The combined Capabilities.

Returns
int

The TunnelingSupport only.

isFormatSupported

default static boolean isFormatSupported(
    @RendererCapabilities.Capabilities int supportFlags,
    boolean allowExceedsCapabilities
)

Returns whether the C.FormatSupport from the combined Capabilities indicates the format is supported.

A format is considered supported if its C.FormatSupport value is FORMAT_HANDLED, or optionally FORMAT_EXCEEDS_CAPABILITIES if enabled by allowExceedsCapabilities.

Parameters
@RendererCapabilities.Capabilities int supportFlags

The combined Capabilities.

boolean allowExceedsCapabilities

Whether FORMAT_EXCEEDS_CAPABILITIES should be considered as supported.

Returns
boolean

Whether the Capabilities indicate a format is supported.

setListener

default void setListener(RendererCapabilities.Listener listener)

Sets the Listener.

Parameters
RendererCapabilities.Listener listener

The listener to be set.

supportsFormat

@RendererCapabilities.Capabilities
abstract int supportsFormat(Format format)

Returns the extent to which the Renderer supports a given format.

Parameters
Format format

The format.

Returns
int

The Capabilities for this format.

supportsMixedMimeTypeAdaptation

@RendererCapabilities.AdaptiveSupport
abstract int supportsMixedMimeTypeAdaptation()

Returns the extent to which the Renderer supports adapting between supported formats that have different MIME types.

Returns
int

The AdaptiveSupport for adapting between supported formats that have different MIME types.