# 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
public final 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 |
|---|
| `public final class https://developer.android.com/reference/androidx/media3/container/ObuParser.FrameHeader` An AV1 Frame Header. |
| `public final class https://developer.android.com/reference/androidx/media3/container/ObuParser.Metadata` An AV1 Metadata OBU |
| `public final class https://developer.android.com/reference/androidx/media3/container/ObuParser.Obu` Open bitstream unit. |
| `public final class https://developer.android.com/reference/androidx/media3/container/ObuParser.SequenceHeader` An AV1 Sequence header. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/media3/container/ObuParser#OBU_FRAME() = 6` OBU type frame. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/container/ObuParser#OBU_FRAME_HEADER() = 3` OBU type frame header. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/container/ObuParser#OBU_METADATA() = 5` OBU type metadata. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/container/ObuParser#OBU_PADDING() = 15` OBU type padding. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/container/ObuParser#OBU_SEQUENCE_HEADER() = 1` OBU type sequence header. |
| `static final int` | `https://developer.android.com/reference/androidx/media3/container/ObuParser#OBU_TEMPORAL_DELIMITER() = 2` OBU type temporal delimiter. |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/container/ObuParser.Obu>` | `https://developer.android.com/reference/androidx/media3/container/ObuParser#split(java.nio.ByteBuffer)(https://developer.android.com/reference/java/nio/ByteBuffer.html sample)` Splits the input sample into a list of OBUs. |

## Constants

### OBU_FRAME

```
public static final int OBU_FRAME = 6
```

OBU type frame.

### OBU_FRAME_HEADER

```
public static final int OBU_FRAME_HEADER = 3
```

OBU type frame header.

### OBU_METADATA

```
public static final int OBU_METADATA = 5
```

OBU type metadata.

### OBU_PADDING

```
public static final int OBU_PADDING = 15
```

OBU type padding.

### OBU_SEQUENCE_HEADER

```
public static final int OBU_SEQUENCE_HEADER = 1
```

OBU type sequence header.

### OBU_TEMPORAL_DELIMITER

```
public static final int OBU_TEMPORAL_DELIMITER = 2
```

OBU type temporal delimiter.

## Public methods

### split

```
public static List<ObuParser.Obu> split(ByteBuffer sample)
```

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 |
|---|---|
| `https://developer.android.com/reference/java/nio/ByteBuffer.html sample` | The sample data. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/container/ObuParser.Obu>` | The list of OBUs contained within the sample data. |