FormatSupportAssumptions


@UnstableApi
class FormatSupportAssumptions


Utility methods for checking and assuming format support in instrumentation tests.

These methods are used to skip tests based on device capabilities for decoding and encoding specific media formats.

Summary

Public functions

java-static Unit
assumeFormatsSupported(
    context: Context!,
    testId: String!,
    inputFormat: Format?,
    outputFormat: Format?
)

Assumes that the device supports decoding the input format, and encoding/muxing the output format if needed.

java-static Unit
assumeFormatsSupported(
    context: Context!,
    testId: String!,
    inputFormat: Format?,
    outputFormat: Format?,
    isPortraitEncodingEnabled: Boolean
)

Assumes that the device supports decoding the input format, and encoding/muxing the output format if needed.

Public functions

assumeFormatsSupported

java-static fun assumeFormatsSupported(
    context: Context!,
    testId: String!,
    inputFormat: Format?,
    outputFormat: Format?
): Unit

Assumes that the device supports decoding the input format, and encoding/muxing the output format if needed.

This is equivalent to calling assumeFormatsSupported with isPortraitEncodingEnabled set to false.

assumeFormatsSupported

java-static fun assumeFormatsSupported(
    context: Context!,
    testId: String!,
    inputFormat: Format?,
    outputFormat: Format?,
    isPortraitEncodingEnabled: Boolean
): Unit

Assumes that the device supports decoding the input format, and encoding/muxing the output format if needed.

Parameters
context: Context!

The context.

testId: String!

The test ID.

inputFormat: Format?

The format to decode, or the input is not produced by MediaCodec, like an image.

outputFormat: Format?

The format to encode/mux or null if the output won't be encoded or muxed.

isPortraitEncodingEnabled: Boolean

Whether portrait encoding is enabled.

Throws
org.junit.AssumptionViolatedException

If the device does not support the formats. In this case, the reason for skipping the test is logged.

java.io.IOException
org.json.JSONException
androidx.media3.exoplayer.mediacodec.MediaCodecUtil.DecoderQueryException