Package com.google.android.exoplayer2.audio

## Class DtsUtil

- java.lang.Object
- - com.google.android.exoplayer2.audio.DtsUtil

-     public final class DtsUtil
      extends Object

  Utility methods for parsing DTS frames.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static int` | `DTS_HD_MAX_RATE_BYTES_PER_SECOND` | Maximum rate for a DTS-HD audio stream, in bytes per second.
    `static int` | `DTS_MAX_RATE_BYTES_PER_SECOND` | Maximum rate for a DTS audio stream, in bytes per second.

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static int` | `getDtsFrameSize​(byte[] data)` | Returns the size in bytes of the given DTS frame.
    `static boolean` | `isSyncWord​(int word)` | Returns whether a given integer matches a DTS sync word.
    `static int` | `parseDtsAudioSampleCount​(byte[] data)` | Returns the number of audio samples represented by the given DTS frame.
    `static int` | `parseDtsAudioSampleCount​(ByteBuffer buffer)` | Like `parseDtsAudioSampleCount(byte[])` but reads from a `ByteBuffer`.
    `static Format` | `parseDtsFormat​(byte[] frame, String trackId, String language, DrmInitData drmInitData)` | Returns the DTS format given `data` containing the DTS frame according to ETSI TS 102 114 subsections 5.3/5.4.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DTS_MAX_RATE_BYTES_PER_SECOND

          public static final int DTS_MAX_RATE_BYTES_PER_SECOND

      Maximum rate for a DTS audio stream, in bytes per second.

      DTS allows an 'open' bitrate, but we assume the maximum listed value: 1536 kbit/s.

      See Also:
        Constant Field Values

    - #### DTS_HD_MAX_RATE_BYTES_PER_SECOND

          public static final int DTS_HD_MAX_RATE_BYTES_PER_SECOND

      Maximum rate for a DTS-HD audio stream, in bytes per second.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### isSyncWord

          public static boolean isSyncWord​(int word)

      Returns whether a given integer matches a DTS sync word. Synchronization and storage modes are defined in ETSI TS 102 114 V1.1.1 (2002-08), Section 5.3.
      Parameters:
        `word` - An integer.
      Returns:
        Whether a given integer matches a DTS sync word.

    - #### parseDtsFormat

          public static Format parseDtsFormat​(byte[] frame,
                                              @Nullable
                                              String trackId,
                                              @Nullable
                                              String language,
                                              @Nullable
                                              DrmInitData drmInitData)

      Returns the DTS format given `data` containing the DTS frame according to ETSI TS 102 114 subsections 5.3/5.4.
      Parameters:
        `frame` - The DTS frame to parse.
        `trackId` - The track identifier to set on the format.
        `language` - The language to set on the format.
        `drmInitData` - `DrmInitData` to be included in the format.
      Returns:
        The DTS format parsed from data in the header.

    - #### parseDtsAudioSampleCount

          public static int parseDtsAudioSampleCount​(byte[] data)

      Returns the number of audio samples represented by the given DTS frame.
      Parameters:
        `data` - The frame to parse.
      Returns:
        The number of audio samples represented by the frame.

    - #### parseDtsAudioSampleCount

          public static int parseDtsAudioSampleCount​(ByteBuffer buffer)

      Like `parseDtsAudioSampleCount(byte[])` but reads from a `ByteBuffer`. The buffer's position is not modified.
      Parameters:
        `buffer` - The `ByteBuffer` from which to read.
      Returns:
        The number of audio samples represented by the syncframe.

    - #### getDtsFrameSize

          public static int getDtsFrameSize​(byte[] data)

      Returns the size in bytes of the given DTS frame.
      Parameters:
        `data` - The frame to parse.
      Returns:
        The frame's size in bytes.