# FormatSupportAssumptions

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/FormatSupportAssumptions.java+class:androidx.media3.test.utils.FormatSupportAssumptions)

*** ** * ** ***


```
@UnstableApi
class FormatSupportAssumptions
```

<br />

*** ** * ** ***

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 https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FormatSupportAssumptions#assumeAllFormatsSupported(android.content.Context,java.lang.String,java.util.List<androidx.media3.common.Format>,androidx.media3.common.Format)( context: https://developer.android.com/reference/android/content/Context.html!, testId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, inputFormats: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Format!>!, outputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format? )` `https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` that the device supports decoding the input formats, and encoding/muxing the output format if needed. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FormatSupportAssumptions#assumeFormatsSupported(android.content.Context,java.lang.String,androidx.media3.common.Format,androidx.media3.common.Format)( context: https://developer.android.com/reference/android/content/Context.html!, testId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, inputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?, outputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format? )` `https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` that the device supports decoding the input format, and encoding/muxing the output format if needed. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FormatSupportAssumptions#assumeFormatsSupported(android.content.Context,java.lang.String,androidx.media3.common.Format,androidx.media3.common.Format,boolean)( context: https://developer.android.com/reference/android/content/Context.html!, testId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, inputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?, outputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?, isPortraitEncodingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` `https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` that the device supports decoding the input format, and encoding/muxing the output format if needed. |

## Public functions

### assumeAllFormatsSupported

```
java-static fun assumeAllFormatsSupported(
    context: Context!,
    testId: String!,
    inputFormats: (Mutable)List<Format!>!,
    outputFormat: Format?
): Unit
```

`https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` that the device supports decoding the input formats, and encoding/muxing the output format if needed.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html`. |
| `testId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The test ID. |
| `inputFormats: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/common/Format!>!` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` to decode. |
| `outputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` to encode/mux or `null` if the output won't be encoded or muxed. |

| Throws |
|---|---|
| `https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` | If the device does not support the formats. In this case, the reason for skipping the test is logged. |
| `https://developer.android.com/reference/java/io/IOException.html` |   |
| `https://developer.android.com/reference/org/json/JSONException.html` |   |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` |   |

### assumeFormatsSupported

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

`https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` that the device supports decoding the input format, and encoding/muxing the output format if needed.

This is equivalent to calling `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/FormatSupportAssumptions#assumeFormatsSupported(android.content.Context,java.lang.String,androidx.media3.common.Format,androidx.media3.common.Format,boolean)` with `isPortraitEncodingEnabled` set to `false`.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` |   |
| `https://developer.android.com/reference/org/json/JSONException.html` |   |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` |   |

### assumeFormatsSupported

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

`https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` that the device supports decoding the input format, and encoding/muxing the output format if needed.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The `https://developer.android.com/reference/android/content/Context.html`. |
| `testId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | The test ID. |
| `inputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` to decode, or the input is not produced by MediaCodec, like an image. |
| `outputFormat: https://developer.android.com/reference/kotlin/androidx/media3/common/Format?` | The `https://developer.android.com/reference/kotlin/androidx/media3/common/Format` to encode/mux or `null` if the output won't be encoded or muxed. |
| `isPortraitEncodingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether portrait encoding is enabled. |

| Throws |
|---|---|
| `https://junit.org/junit4/javadoc/latest/org/junit/AssumptionViolatedException.html` | If the device does not support the formats. In this case, the reason for skipping the test is logged. |
| `https://developer.android.com/reference/java/io/IOException.html` |   |
| `https://developer.android.com/reference/org/json/JSONException.html` |   |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/mediacodec/MediaCodecUtil.DecoderQueryException` |   |