@UnstableApi
class ShadowMediaCodecConfig : ExternalResource


A JUnit @Rule to configure Robolectric's ShadowMediaCodec.

Registers a org.robolectric.shadows.ShadowMediaCodec.CodecConfig for each audio/video MIME type known by ExoPlayer.

Summary

Nested types

Class that holds information about a CodecImpl configuration.

Public functions

Unit
addCodec(
    codecInfo: ShadowMediaCodecConfig.CodecInfo!,
    isEncoder: Boolean,
    codecConfig: ShadowMediaCodec.CodecConfig!
)

Configures and publishes a ShadowMediaCodec codec.

Unit

Configures and publishes shadow decoders based on decoders.

Unit

Configures and publishes shadow encoders based on encoders.

java-static Unit
configureShadowMediaCodec(
    codecName: String!,
    mimeType: String!,
    isEncoder: Boolean,
    profileLevels: ImmutableList<MediaCodecInfo.CodecProfileLevel!>!,
    colorFormats: ImmutableList<Int!>!,
    codecConfig: ShadowMediaCodec.CodecConfig!
)

Configures a shadow MediaCodec.

java-static ShadowMediaCodecConfig!

This function is deprecated.

Use withAllDefaultSupportedCodecs instead.

java-static ShadowMediaCodecConfig!

Returns a ShadowMediaCodecConfig instance populated with a default list of supported decoders using a default codec configuration.

java-static ShadowMediaCodecConfig!

Returns a ShadowMediaCodecConfig instance configured with the provided decoders and encoders.

java-static ShadowMediaCodecConfig!

Returns a ShadowMediaCodecConfig instance populated with no shadow codecs.

java-static ShadowMediaCodecConfig!

This function is deprecated.

Use withNoDefaultSupportedCodecs instead.

Protected functions

Unit
Unit

Inherited functions

From org.junit.rules.ExternalResource
Statement!
apply(base: Statement!, description: Description!)

Constants

CODEC_INFO_AAC

const val CODEC_INFO_AACShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_AC3

const val CODEC_INFO_AC3ShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_AC4

const val CODEC_INFO_AC4ShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_AMR_NB

const val CODEC_INFO_AMR_NBShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_AV1

const val CODEC_INFO_AV1ShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_AVC

const val CODEC_INFO_AVCShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_E_AC3

const val CODEC_INFO_E_AC3ShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_E_AC3_JOC

const val CODEC_INFO_E_AC3_JOCShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_FLAC

const val CODEC_INFO_FLACShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_HEVC

const val CODEC_INFO_HEVCShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_MPEG

const val CODEC_INFO_MPEGShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_MPEG2

const val CODEC_INFO_MPEG2ShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_MPEG_L2

const val CODEC_INFO_MPEG_L2ShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_OPUS

const val CODEC_INFO_OPUSShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_RAW

const val CODEC_INFO_RAWShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_VORBIS

const val CODEC_INFO_VORBISShadowMediaCodecConfig.CodecInfo!

CODEC_INFO_VP9

const val CODEC_INFO_VP9ShadowMediaCodecConfig.CodecInfo!

Public functions

addCodec

fun addCodec(
    codecInfo: ShadowMediaCodecConfig.CodecInfo!,
    isEncoder: Boolean,
    codecConfig: ShadowMediaCodec.CodecConfig!
): Unit

Configures and publishes a ShadowMediaCodec codec.

Input buffers are handled according to the ShadowMediaCodec.CodecConfig provided.

Parameters
codecInfo: ShadowMediaCodecConfig.CodecInfo!

Basic codec information.

isEncoder: Boolean

Whether the codecs registered are encoders or decoders.

codecConfig: ShadowMediaCodec.CodecConfig!

Codec configuration implementation of the shadow.

addDecoders

fun addDecoders(decoders: Array<ShadowMediaCodecConfig.CodecInfo!>!): Unit

Configures and publishes shadow decoders based on decoders.

This method configures frame-dropping decoders.

addEncoders

fun addEncoders(encoders: Array<ShadowMediaCodecConfig.CodecInfo!>!): Unit

Configures and publishes shadow encoders based on encoders.

This method configures pass-through encoders.

configureShadowMediaCodec

java-static fun configureShadowMediaCodec(
    codecName: String!,
    mimeType: String!,
    isEncoder: Boolean,
    profileLevels: ImmutableList<MediaCodecInfo.CodecProfileLevel!>!,
    colorFormats: ImmutableList<Int!>!,
    codecConfig: ShadowMediaCodec.CodecConfig!
): Unit

Configures a shadow MediaCodec.

Parameters
codecName: String!

The name of the codec.

mimeType: String!

The MIME type of the codec.

isEncoder: Boolean

Whether the codec is an encoder or a decoder.

profileLevels: ImmutableList<MediaCodecInfo.CodecProfileLevel!>!

A list of profiles and levels supported by the codec.

colorFormats: ImmutableList<Int!>!

A list of color formats supported by the codec.

codecConfig: ShadowMediaCodec.CodecConfig!

The ShadowMediaCodec.CodecConfig for the codec, specifying its behavior.

forAllSupportedMimeTypes

java-static fun forAllSupportedMimeTypes(): ShadowMediaCodecConfig!

withAllDefaultSupportedCodecs

java-static fun withAllDefaultSupportedCodecs(): ShadowMediaCodecConfig!

Returns a ShadowMediaCodecConfig instance populated with a default list of supported decoders using a default codec configuration.

The default codec configuration drops all samples on audio decoders and works as passthrough on video decoders.

withCodecs

java-static fun withCodecs(
    decoders: (Mutable)List<ShadowMediaCodecConfig.CodecInfo!>!,
    encoders: (Mutable)List<ShadowMediaCodecConfig.CodecInfo!>!
): ShadowMediaCodecConfig!

Returns a ShadowMediaCodecConfig instance configured with the provided decoders and encoders.

All codecs will work as passthrough, regardless of type.

withNoDefaultSupportedCodecs

java-static fun withNoDefaultSupportedCodecs(): ShadowMediaCodecConfig!

Returns a ShadowMediaCodecConfig instance populated with no shadow codecs.

withNoDefaultSupportedMimeTypes

java-static fun withNoDefaultSupportedMimeTypes(): ShadowMediaCodecConfig!

Protected functions

after

protected fun after(): Unit

before

protected fun before(): Unit