# NalUnitUtil

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/NalUnitUtil.java+class:androidx.media3.container.NalUnitUtil)

*** ** * ** ***


```
@UnstableApi
class NalUnitUtil
```

<br />

*** ** * ** ***

Utility methods for handling H.264/AVC and H.265/HEVC NAL units.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265LayerInfo` Holds data that maps NAL unit header layer ID to the internal layer info specified in VPS. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265NalHeader` Holds data parsed from a H.265 NAL unit header. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265ProfileTierLevel` Holds data parsed from a H.265 profile_tier_level() of either VPS or SPS. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265ProfileTierLevelsAndIndices` Holds a list of H.265 profile_tier_level()s and a corresponding list of indices. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265RepFormat` Holds data parsed from a H.265 rep_format() of VPS extension - vps_extension(). |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265RepFormatsAndIndices` Holds a list of H.265 rep_format()s and a corresponding list of indices. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265Sei3dRefDisplayInfoData` Holds data parsed from a H.265 3D reference displays information SEI message. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265SpsData` Holds data parsed from a H.265 sequence parameter set NAL unit. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VideoSignalInfo` Holds data parsed from a H.265 video_signal_info() of vps_vui() of vps_extension(). |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VideoSignalInfosAndIndices` Holds a list of H.265 video_signal_info()s and a corresponding list of indices. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VpsData` Holds data parsed from a H.265 video parameter set NAL unit. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.PpsData` Holds data parsed from a picture parameter set NAL unit. |
| `class https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.SpsData` Holds data parsed from a H.264 sequence parameter set NAL unit. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#ASPECT_RATIO_IDC_VALUES()` Aspect ratios indexed by aspect_ratio_idc, in H.264 and H.265 SPSs. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#EXTENDED_SAR() = 255` Value for aspect_ratio_idc indicating an extended aspect ratio, in H.264 and H.265 SPSs. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_AUD() = 9` H.264 access unit delimiter. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_IDR() = 5` H.264 coded slice of an IDR picture. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_NON_IDR() = 1` H.264 coded slice of a non-IDR picture. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PARTITION_A() = 2` H.264 coded slice data partition A. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PPS() = 8` H.264 picture parameter set. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PREFIX() = 14` H.264 prefix NAL unit. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_SEI() = 6` H.264 supplemental enhancement information. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_SPS() = 7` H.264 sequence parameter set. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_UNSPECIFIED() = 24` H.264 unspecified NAL unit. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_AUD() = 35` H.265 access unit delimiter (AUD_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_BLA_W_LP() = 16` H.265 coded slice segment of a broken link access picture (BLA_W_LP). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_CRA() = 21` H.265 coded slice segment of a clean random access picture (CRA_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_PPS() = 34` H.265 picture parameter set (PPS_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_PREFIX_SEI() = 39` H.265 prefixed supplemental enhancement information (PREFIX_SEI_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_RASL_R() = 9` H.265 coded slice segment of a random access skipped leading picture (RASL_R). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_SPS() = 33` H.265 sequence parameter set (SPS_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_SUFFIX_SEI() = 40` H.265 suffixed supplemental enhancement information (SUFFIX_SEI_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_UNSPECIFIED() = 48` H.265 unspecified NAL unit. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H265_NAL_UNIT_TYPE_VPS() = 32` H.265 video parameter set (VPS_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_START_CODE()` Four initial bytes that must prefix NAL units for decoding. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_AUD() = 9` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_AUD()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_IDR() = 5` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_IDR()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_NON_IDR() = 1` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_NON_IDR()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_PARTITION_A() = 2` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PARTITION_A()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_PPS() = 8` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PPS()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_PREFIX() = 14` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PREFIX()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_SEI() = 6` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_SEI()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#NAL_UNIT_TYPE_SPS() = 7` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_SPS()` <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#VVC_NAL_UNIT_TYPE_DCI() = 13` VVC decoding capability information (DCI_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#VVC_NAL_UNIT_TYPE_OPI() = 12` VVC operating point information (OPI_NUT). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#VVC_NAL_UNIT_TYPE_PREFIX_SEI() = 23` VVC prefixed supplemental enhancement information (PREFIX_SEI_NUT). |

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#clearPrefixFlags(boolean[])(prefixFlags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>!)` Clears prefix flags, as used by `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#findNalUnit(byte[],int,int,boolean[])`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#discardToSps(java.nio.ByteBuffer)(data: https://developer.android.com/reference/java/nio/ByteBuffer.html!)` Discards data from the buffer up to the first SPS, where `data.position()` is interpreted as the length of the buffer. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#findNalUnit(byte[],int,int,boolean[])( data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, startOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, endOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, prefixFlags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>! )` Finds the first NAL unit in `data`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#getH265BaseLayerCodecsString(java.util.List<byte[]>)( csdBuffers: (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://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>! )` Returns a new RFC 6381 codecs description string specifically for the single-layer HEVC case. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#getH265NalUnitType(byte[],int)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the type of the H.265 NAL unit in `data` that starts at `offset`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#getNalUnitType(byte[],int)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the type of the NAL unit in `data` that starts at `offset`. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isDependedOn(byte[],int,int,androidx.media3.common.Format)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Returns whether the NAL unit starting with the given bytes can be depended on by subsequent NAL units in decoding order. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isH264NalUnitDependedOn(byte)(nalUnitHeaderFirstByte: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html)` Returns whether the H.264 NAL unit can be depended on by subsequent NAL units in decoding order. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[isNalUnitSei](https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(androidx.media3.common.Format,byte))(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, nalUnitHeaderFirstByte: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(androidx.media3.common.Format,byte[],int)` instead. <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `[isNalUnitSei](https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(java.lang.String,byte))(mimeType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, nalUnitHeaderFirstByte: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(androidx.media3.common.Format,byte[],int)` in order to support `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_DOLBY_VISION()` tracks with backwards compatible `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_H264()` or `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_H265()` data. <br /> |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(androidx.media3.common.Format,byte[],int)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!, data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns whether the NAL unit with the specified header contains supplemental enhancement information. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#numberOfBytesInNalUnitHeader(androidx.media3.common.Format)(format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!)` Returns the number of bytes in the NAL unit header. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265Sei3dRefDisplayInfoData?` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parseH265Sei3dRefDisplayInfo(byte[],int,int)( nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Parses a H.265 3D reference displays information SEI message syntax defined in ITU-T Recommendation H.265 (2019) subsection G.14.2.3. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265SpsData!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parseH265SpsNalUnit(byte[],int,int,androidx.media3.container.NalUnitUtil.H265VpsData)( nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, vpsData: https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VpsData? )` Parses a H.265 SPS NAL unit using the syntax defined in ITU-T Recommendation H.265 (2019) subsections 7.3.2.2.1 and F.7.3.2.2.1. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265SpsData!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parseH265SpsNalUnitPayload(byte[],int,int,androidx.media3.container.NalUnitUtil.H265NalHeader,androidx.media3.container.NalUnitUtil.H265VpsData)( nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalHeader: https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265NalHeader!, vpsData: https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VpsData? )` Parses a H.265 SPS NAL unit payload (excluding the NAL unit header) using the syntax defined in ITU-T Recommendation H.265 (2019) subsections 7.3.2.2.1 and F.7.3.2.2.1. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VpsData!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parseH265VpsNalUnit(byte[],int,int)( nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Parses a H.265 VPS NAL unit using the syntax defined in ITU-T Recommendation H.265 (2019) subsections 7.3.2.1 and F.7.3.2.1. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.PpsData!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parsePpsNalUnit(byte[],int,int)(nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Parses a PPS NAL unit using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.2. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.PpsData!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parsePpsNalUnitPayload(byte[],int,int)( nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Parses a PPS NAL unit payload (excluding the NAL unit header) using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.2. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/media3/common/C.StereoMode https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parseSeiStereoMode(byte[],int,int)(seiData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, limit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Parses the unescaped RBSP data of an H.264 or H.265 SEI NAL unit (excluding the NAL unit start code and NAL unit header) to extract the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.StereoMode` from a ` frame_packing_arrangement` SEI message (payload type 45), if present. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.SpsData!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parseSpsNalUnit(byte[],int,int)(nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Parses a SPS NAL unit using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.1.1. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.SpsData!` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#parseSpsNalUnitPayload(byte[],int,int)( nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Parses a SPS NAL unit payload (excluding the NAL unit header) using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.1.1. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#unescapeStream(byte[],int)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!, limit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Unescapes `data` up to the specified limit, replacing occurrences of \[0, 0, 3\] with \[0, 0\]. |

## Constants

### ASPECT_RATIO_IDC_VALUES

```
const val ASPECT_RATIO_IDC_VALUES: Array<Float>!
```

Aspect ratios indexed by aspect_ratio_idc, in H.264 and H.265 SPSs.

### EXTENDED_SAR

```
const val EXTENDED_SAR = 255: Int
```

Value for aspect_ratio_idc indicating an extended aspect ratio, in H.264 and H.265 SPSs.

### H264_NAL_UNIT_TYPE_AUD

```
const val H264_NAL_UNIT_TYPE_AUD = 9: Int
```

H.264 access unit delimiter.

### H264_NAL_UNIT_TYPE_IDR

```
const val H264_NAL_UNIT_TYPE_IDR = 5: Int
```

H.264 coded slice of an IDR picture.

### H264_NAL_UNIT_TYPE_NON_IDR

```
const val H264_NAL_UNIT_TYPE_NON_IDR = 1: Int
```

H.264 coded slice of a non-IDR picture.

### H264_NAL_UNIT_TYPE_PARTITION_A

```
const val H264_NAL_UNIT_TYPE_PARTITION_A = 2: Int
```

H.264 coded slice data partition A.

### H264_NAL_UNIT_TYPE_PPS

```
const val H264_NAL_UNIT_TYPE_PPS = 8: Int
```

H.264 picture parameter set.

### H264_NAL_UNIT_TYPE_PREFIX

```
const val H264_NAL_UNIT_TYPE_PREFIX = 14: Int
```

H.264 prefix NAL unit.

### H264_NAL_UNIT_TYPE_SEI

```
const val H264_NAL_UNIT_TYPE_SEI = 6: Int
```

H.264 supplemental enhancement information.

### H264_NAL_UNIT_TYPE_SPS

```
const val H264_NAL_UNIT_TYPE_SPS = 7: Int
```

H.264 sequence parameter set.

### H264_NAL_UNIT_TYPE_UNSPECIFIED

```
const val H264_NAL_UNIT_TYPE_UNSPECIFIED = 24: Int
```

H.264 unspecified NAL unit.

### H265_NAL_UNIT_TYPE_AUD

```
const val H265_NAL_UNIT_TYPE_AUD = 35: Int
```

H.265 access unit delimiter (AUD_NUT).

### H265_NAL_UNIT_TYPE_BLA_W_LP

```
const val H265_NAL_UNIT_TYPE_BLA_W_LP = 16: Int
```

H.265 coded slice segment of a broken link access picture (BLA_W_LP).

### H265_NAL_UNIT_TYPE_CRA

```
const val H265_NAL_UNIT_TYPE_CRA = 21: Int
```

H.265 coded slice segment of a clean random access picture (CRA_NUT).

### H265_NAL_UNIT_TYPE_PPS

```
const val H265_NAL_UNIT_TYPE_PPS = 34: Int
```

H.265 picture parameter set (PPS_NUT).

### H265_NAL_UNIT_TYPE_PREFIX_SEI

```
const val H265_NAL_UNIT_TYPE_PREFIX_SEI = 39: Int
```

H.265 prefixed supplemental enhancement information (PREFIX_SEI_NUT).

### H265_NAL_UNIT_TYPE_RASL_R

```
const val H265_NAL_UNIT_TYPE_RASL_R = 9: Int
```

H.265 coded slice segment of a random access skipped leading picture (RASL_R).

### H265_NAL_UNIT_TYPE_SPS

```
const val H265_NAL_UNIT_TYPE_SPS = 33: Int
```

H.265 sequence parameter set (SPS_NUT).

### H265_NAL_UNIT_TYPE_SUFFIX_SEI

```
const val H265_NAL_UNIT_TYPE_SUFFIX_SEI = 40: Int
```

H.265 suffixed supplemental enhancement information (SUFFIX_SEI_NUT).

### H265_NAL_UNIT_TYPE_UNSPECIFIED

```
const val H265_NAL_UNIT_TYPE_UNSPECIFIED = 48: Int
```

H.265 unspecified NAL unit.

### H265_NAL_UNIT_TYPE_VPS

```
const val H265_NAL_UNIT_TYPE_VPS = 32: Int
```

H.265 video parameter set (VPS_NUT).

### NAL_START_CODE

```
const val NAL_START_CODE: Array<Byte>!
```

Four initial bytes that must prefix NAL units for decoding.

### NAL_UNIT_TYPE_AUD

```
const val NAL_UNIT_TYPE_AUD = 9: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_AUD()`

### NAL_UNIT_TYPE_IDR

```
const val NAL_UNIT_TYPE_IDR = 5: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_IDR()`

### NAL_UNIT_TYPE_NON_IDR

```
const val NAL_UNIT_TYPE_NON_IDR = 1: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_NON_IDR()`

### NAL_UNIT_TYPE_PARTITION_A

```
const val NAL_UNIT_TYPE_PARTITION_A = 2: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PARTITION_A()`

### NAL_UNIT_TYPE_PPS

```
const val NAL_UNIT_TYPE_PPS = 8: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PPS()`

### NAL_UNIT_TYPE_PREFIX

```
const val NAL_UNIT_TYPE_PREFIX = 14: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_PREFIX()`

### NAL_UNIT_TYPE_SEI

```
const val NAL_UNIT_TYPE_SEI = 6: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_SEI()`

### NAL_UNIT_TYPE_SPS

```
const val NAL_UNIT_TYPE_SPS = 7: Int
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#H264_NAL_UNIT_TYPE_SPS()`

### VVC_NAL_UNIT_TYPE_DCI

```
const val VVC_NAL_UNIT_TYPE_DCI = 13: Int
```

VVC decoding capability information (DCI_NUT).

### VVC_NAL_UNIT_TYPE_OPI

```
const val VVC_NAL_UNIT_TYPE_OPI = 12: Int
```

VVC operating point information (OPI_NUT).

### VVC_NAL_UNIT_TYPE_PREFIX_SEI

```
const val VVC_NAL_UNIT_TYPE_PREFIX_SEI = 23: Int
```

VVC prefixed supplemental enhancement information (PREFIX_SEI_NUT).

## Public functions

### clearPrefixFlags

```
java-static fun clearPrefixFlags(prefixFlags: BooleanArray<Boolean>!): Unit
```

Clears prefix flags, as used by `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#findNalUnit(byte[],int,int,boolean[])`.

| Parameters |
|---|---|
| `prefixFlags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>!` | The flags to clear. |

### discardToSps

```
java-static fun discardToSps(data: ByteBuffer!): Unit
```

Discards data from the buffer up to the first SPS, where `data.position()` is interpreted as the length of the buffer.

When the method returns, `data.position()` will contain the new length of the buffer. If the buffer is not empty it is guaranteed to start with an SPS.

| Parameters |
|---|---|
| `data: https://developer.android.com/reference/java/nio/ByteBuffer.html!` | Buffer containing start code delimited NAL units. |

### findNalUnit

```
java-static fun findNalUnit(
    data: ByteArray<Byte>!,
    startOffset: Int,
    endOffset: Int,
    prefixFlags: BooleanArray<Boolean>!
): Int
```

Finds the first NAL unit in `data`.

If `prefixFlags` is null then the first three bytes of a NAL unit must be entirely contained within the part of the array being searched in order for it to be found.

When `prefixFlags` is non-null, this method supports finding NAL units whose first four bytes span `data` arrays passed to successive calls. To use this feature, pass the same `prefixFlags` parameter to successive calls. State maintained in this parameter enables the detection of such NAL units. Note that when using this feature, the return value may be 3, 2 or 1 less than `startOffset`, to indicate a NAL unit starting 3, 2 or 1 bytes before the first byte in the current array.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The data to search. |
| `startOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset (inclusive) in the data to start the search. |
| `endOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset (exclusive) in the data to end the search. |
| `prefixFlags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>!` | A boolean array whose first three elements are used to store the state required to detect NAL units where the NAL unit prefix spans array boundaries. The array must be at least 3 elements long. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit, or `endOffset` if a NAL unit was not found. |

### getH265BaseLayerCodecsString

```
java-static fun getH265BaseLayerCodecsString(
    csdBuffers: (Mutable)List<ByteArray<Byte>!>!
): String?
```

Returns a new RFC 6381 codecs description string specifically for the single-layer HEVC case. When falling back to single-layer HEVC from L-HEVC, both profile and level should be adjusted for the base layer case and the codecs description string should represent that. For the single-layer HEVC case, the string is derived from the SPS of the base layer.

| Parameters |
|---|---|
| `csdBuffers: (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://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>!` | The CSD buffers that include the SPS of the base layer. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | A RFC 6381 codecs string derived from the SPS of the base layer if such information is available, or null otherwise. |

### getH265NalUnitType

```
java-static fun getH265NalUnitType(data: ByteArray<Byte>!, offset: Int): Int
```

Returns the type of the H.265 NAL unit in `data` that starts at `offset`.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The data to search. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The start offset of a NAL unit. Must lie between `-3` (inclusive) and `data.length - 3` (exclusive). |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The type of the unit. |

### getNalUnitType

```
java-static fun getNalUnitType(data: ByteArray<Byte>!, offset: Int): Int
```

Returns the type of the NAL unit in `data` that starts at `offset`.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The data to search. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The start offset of a NAL unit. Must lie between `-3` (inclusive) and `data.length - 3` (exclusive). |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The type of the unit. |

### isDependedOn

```
java-static fun isDependedOn(data: ByteArray<Byte>!, offset: Int, length: Int, format: Format!): Boolean
```

Returns whether the NAL unit starting with the given bytes can be depended on by subsequent NAL units in decoding order.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The array holding the first `length` bytes of the NAL unit. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset in `data` at which the NAL unit starts. |
| `length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of bytes available. |
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The sample `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`. |

### isH264NalUnitDependedOn

```
java-static fun isH264NalUnitDependedOn(nalUnitHeaderFirstByte: Byte): Boolean
```

Returns whether the H.264 NAL unit can be depended on by subsequent NAL units in decoding order.

| Parameters |
|---|---|
| `nalUnitHeaderFirstByte: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html` | The first byte of nal_unit(). |

### isNalUnitSei

```
java-static fun [isNalUnitSei](https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(androidx.media3.common.Format,byte))(format: Format!, nalUnitHeaderFirstByte: Byte): Boolean
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(androidx.media3.common.Format,byte[],int)` instead.

### isNalUnitSei

```
java-static fun [isNalUnitSei](https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(java.lang.String,byte))(mimeType: String?, nalUnitHeaderFirstByte: Byte): Boolean
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil#isNalUnitSei(androidx.media3.common.Format,byte[],int)` in order to support `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_DOLBY_VISION()` tracks with backwards compatible `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_H264()` or `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#VIDEO_H265()` data.

### isNalUnitSei

```
java-static fun isNalUnitSei(format: Format!, data: ByteArray<Byte>!, offset: Int): Boolean
```

Returns whether the NAL unit with the specified header contains supplemental enhancement information.

| Parameters |
|---|---|
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The sample `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`. |
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The buffer containing the NAL unit header. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit header in `data`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether the NAL unit with the specified header is an SEI NAL unit. False is returned if the `MimeType` is `null`. |

### numberOfBytesInNalUnitHeader

```
java-static fun numberOfBytesInNalUnitHeader(format: Format!): Int
```

Returns the number of bytes in the NAL unit header.

The NAL unit header can be used to determine the NAL unit type and whether subsequent NAL units can depend on the current NAL unit.

This is `nalUnitHeaderBytes` from the H.264 spec, or the size of `
nal_unit_header()` in H.265.

| Parameters |
|---|---|
| `format: https://developer.android.com/reference/kotlin/androidx/media3/common/Format!` | The sample `https://developer.android.com/reference/kotlin/androidx/media3/common/Format`. |

### parseH265Sei3dRefDisplayInfo

```
java-static fun parseH265Sei3dRefDisplayInfo(
    nalData: ByteArray<Byte>!,
    nalOffset: Int,
    nalLimit: Int
): NalUnitUtil.H265Sei3dRefDisplayInfoData?
```

Parses a H.265 3D reference displays information SEI message syntax defined in ITU-T Recommendation H.265 (2019) subsection G.14.2.3. Given a generic PREFIX_SEI NAL unit, only 3D reference displays information SEI is parsed, if exists.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped prefix SEI data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit header in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265Sei3dRefDisplayInfoData?` | A parsed representation of the PPS data. |

### parseH265SpsNalUnit

```
java-static fun parseH265SpsNalUnit(
    nalData: ByteArray<Byte>!,
    nalOffset: Int,
    nalLimit: Int,
    vpsData: NalUnitUtil.H265VpsData?
): NalUnitUtil.H265SpsData!
```

Parses a H.265 SPS NAL unit using the syntax defined in ITU-T Recommendation H.265 (2019) subsections 7.3.2.2.1 and F.7.3.2.2.1.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped SPS data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit header in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |
| `vpsData: https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VpsData?` | The VPS that the SPS refers to or `null` if unavailable. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265SpsData!` | A parsed representation of the SPS data. |

### parseH265SpsNalUnitPayload

```
java-static fun parseH265SpsNalUnitPayload(
    nalData: ByteArray<Byte>!,
    nalOffset: Int,
    nalLimit: Int,
    nalHeader: NalUnitUtil.H265NalHeader!,
    vpsData: NalUnitUtil.H265VpsData?
): NalUnitUtil.H265SpsData!
```

Parses a H.265 SPS NAL unit payload (excluding the NAL unit header) using the syntax defined in ITU-T Recommendation H.265 (2019) subsections 7.3.2.2.1 and F.7.3.2.2.1.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped SPS data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit payload in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |
| `nalHeader: https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265NalHeader!` | The parsed representation of the NAL header. |
| `vpsData: https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VpsData?` | The VPS that the SPS refers to or `null` if unavailable. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265SpsData!` | A parsed representation of the SPS data. |

### parseH265VpsNalUnit

```
java-static fun parseH265VpsNalUnit(
    nalData: ByteArray<Byte>!,
    nalOffset: Int,
    nalLimit: Int
): NalUnitUtil.H265VpsData!
```

Parses a H.265 VPS NAL unit using the syntax defined in ITU-T Recommendation H.265 (2019) subsections 7.3.2.1 and F.7.3.2.1.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped VPS data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit header in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.H265VpsData!` | A parsed representation of the VPS data. |

### parsePpsNalUnit

```
java-static fun parsePpsNalUnit(nalData: ByteArray<Byte>!, nalOffset: Int, nalLimit: Int): NalUnitUtil.PpsData!
```

Parses a PPS NAL unit using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.2.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped PPS data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit header in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.PpsData!` | A parsed representation of the PPS data. |

### parsePpsNalUnitPayload

```
java-static fun parsePpsNalUnitPayload(
    nalData: ByteArray<Byte>!,
    nalOffset: Int,
    nalLimit: Int
): NalUnitUtil.PpsData!
```

Parses a PPS NAL unit payload (excluding the NAL unit header) using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.2.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped PPS data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit payload in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.PpsData!` | A parsed representation of the PPS data. |

### parseSeiStereoMode

```
@C.StereoMode
java-static fun parseSeiStereoMode(seiData: ByteArray<Byte>!, offset: Int, limit: Int): Int
```

Parses the unescaped RBSP data of an H.264 or H.265 SEI NAL unit (excluding the NAL unit start code and NAL unit header) to extract the `https://developer.android.com/reference/kotlin/androidx/media3/common/C.StereoMode` from a `
frame_packing_arrangement` SEI message (payload type 45), if present.

Value is one of the following:

- `Format.NO_VALUE`

<br />

| Parameters |
|---|---|
| `seiData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing unescaped SEI RBSP data. |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the SEI RBSP payload (after the NAL unit header) in ` seiData`. |
| `limit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit (exclusive) of the SEI RBSP payload in `seiData`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The parsed `https://developer.android.com/reference/kotlin/androidx/media3/common/C.StereoMode`, or `https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE()` if no supported ` frame_packing_arrangement` SEI message is present. |

### parseSpsNalUnit

```
java-static fun parseSpsNalUnit(nalData: ByteArray<Byte>!, nalOffset: Int, nalLimit: Int): NalUnitUtil.SpsData!
```

Parses a SPS NAL unit using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.1.1.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped SPS data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit header in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.SpsData!` | A parsed representation of the SPS data. |

### parseSpsNalUnitPayload

```
java-static fun parseSpsNalUnitPayload(
    nalData: ByteArray<Byte>!,
    nalOffset: Int,
    nalLimit: Int
): NalUnitUtil.SpsData!
```

Parses a SPS NAL unit payload (excluding the NAL unit header) using the syntax defined in ITU-T Recommendation H.264 (2013) subsection 7.3.2.1.1.

| Parameters |
|---|---|
| `nalData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | A buffer containing escaped SPS data. |
| `nalOffset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The offset of the NAL unit payload in `nalData`. |
| `nalLimit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit of the NAL unit in `nalData`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/container/NalUnitUtil.SpsData!` | A parsed representation of the SPS data. |

### unescapeStream

```
java-static fun unescapeStream(data: ByteArray<Byte>!, limit: Int): Int
```

Unescapes `data` up to the specified limit, replacing occurrences of \[0, 0, 3\] with \[0, 0\]. The unescaped data is returned in-place, with the return value indicating its length.

Executions of this method are mutually exclusive, so it should not be called with very large buffers.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The data to unescape. |
| `limit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The limit (exclusive) of the data to unescape. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The length of the unescaped data. |