# OggOpusAudioPacketizer

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

*** ** * ** ***


```
@UnstableApi
public final class OggOpusAudioPacketizer
```

<br />

*** ** * ** ***

A packetizer that encapsulates Opus audio encodings in Ogg packets.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/audio/OggOpusAudioPacketizer#OggOpusAudioPacketizer()()` Creates an instance. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/OggOpusAudioPacketizer#packetize(androidx.media3.decoder.DecoderInputBuffer,java.util.List<byte[]>)( https://developer.android.com/reference/androidx/media3/decoder/DecoderInputBuffer inputBuffer, https://developer.android.com/reference/java/util/List.html<byte[]> initializationData )` Packetizes the audio data between the position and limit of the `inputBuffer`. |
| `void` | `https://developer.android.com/reference/androidx/media3/exoplayer/audio/OggOpusAudioPacketizer#reset()()` Resets the packetizer. |

## Public constructors

### OggOpusAudioPacketizer

```
public OggOpusAudioPacketizer()
```

Creates an instance.

## Public methods

### packetize

```
public void packetize(
    DecoderInputBuffer inputBuffer,
    List<byte[]> initializationData
)
```

Packetizes the audio data between the position and limit of the `inputBuffer`.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/decoder/DecoderInputBuffer inputBuffer` | The input buffer to packetize. It must be a direct `https://developer.android.com/reference/java/nio/ByteBuffer.html` with LITTLE_ENDIAN order. The contents will be overwritten with the Ogg packet. The caller retains ownership of the provided buffer. |
| `https://developer.android.com/reference/java/util/List.html<byte[]> initializationData` | contains set-up data for the Opus Decoder. The data will be provided in an Ogg ID Header Page prepended to the bitstream. The list should contain either one or three byte arrays. The first item is the payload for the Ogg ID Header Page. If three items, then it also contains the Opus pre-skip and seek pre-roll values in that order. |

### reset

```
public void reset()
```

Resets the packetizer.