# ObuParser

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

*** ** * ** ***


```
@UnstableApi
class ObuParser
```

<br />

*** ** * ** ***

Utility methods for parsing AV1 Open Bitstream Units or OBUs.

[AV1 Bitstream and Decoding Process Specification](https://aomediacodec.github.io/av1-spec/)

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser.FrameHeader` An AV1 Frame Header. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser.Metadata` An AV1 Metadata OBU |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser.Obu` Open bitstream unit. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser.SequenceHeader` An AV1 Sequence header. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser#OBU_FRAME() = 6` OBU type frame. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser#OBU_FRAME_HEADER() = 3` OBU type frame header. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser#OBU_METADATA() = 5` OBU type metadata. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser#OBU_PADDING() = 15` OBU type padding. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser#OBU_SEQUENCE_HEADER() = 1` OBU type sequence header. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser#OBU_TEMPORAL_DELIMITER() = 2` OBU type temporal delimiter. |

| ### Public functions |
|---|---|
| `java-static (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/container/ObuParser.Obu!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/ObuParser#split(java.nio.ByteBuffer)(sample: https://developer.android.com/reference/java/nio/ByteBuffer.html!)` Splits the input sample into a list of OBUs. |

## Constants

### OBU_FRAME

```
const val OBU_FRAME = 6: Int
```

OBU type frame.

### OBU_FRAME_HEADER

```
const val OBU_FRAME_HEADER = 3: Int
```

OBU type frame header.

### OBU_METADATA

```
const val OBU_METADATA = 5: Int
```

OBU type metadata.

### OBU_PADDING

```
const val OBU_PADDING = 15: Int
```

OBU type padding.

### OBU_SEQUENCE_HEADER

```
const val OBU_SEQUENCE_HEADER = 1: Int
```

OBU type sequence header.

### OBU_TEMPORAL_DELIMITER

```
const val OBU_TEMPORAL_DELIMITER = 2: Int
```

OBU type temporal delimiter.

## Public functions

### split

```
java-static fun split(sample: ByteBuffer!): (Mutable)List<ObuParser.Obu!>!
```

Splits the input sample into a list of OBUs.

Expects the AV1 sample format specified by the [AV1 Codec ISO Media File Format Binding](https://aomediacodec.github.io/av1-isobmff/#sampleformat). That is, each OBU has the `obu_has_size_field` set to 1 except for the last OBU in the sample, for which `obu_has_size_field` may be set to 0.

If the provided sample is truncated, only returns the OBUs that are fully contained in the sample.

| Parameters |
|---|---|
| `sample: https://developer.android.com/reference/java/nio/ByteBuffer.html!` | The sample data. |

| Returns |
|---|---|
| `(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/container/ObuParser.Obu!>!` | The list of OBUs contained within the sample data. |