Package com.google.android.exoplayer2.source.dash

## Class DashUtil

- java.lang.Object
- - com.google.android.exoplayer2.source.dash.DashUtil

-     public final class DashUtil
      extends Object

  Utility methods for DASH streams.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static DataSpec` | `buildDataSpec​(Representation representation, RangedUri requestUri, int flags)` | Builds a `DataSpec` for a given `RangedUri` belonging to `Representation`.
    `static ChunkIndex` | `loadChunkIndex​(DataSource dataSource, int trackType, Representation representation)` | Loads initialization and index data for the `representation` and returns the `ChunkIndex`.
    `static Format` | `loadFormatWithDrmInitData​(DataSource dataSource, Period period)` | Loads a `Format` for acquiring keys for a given period in a DASH manifest.
    `static DashManifest` | `loadManifest​(DataSource dataSource, Uri uri)` | Loads a DASH manifest.
    `static Format` | `loadSampleFormat​(DataSource dataSource, int trackType, Representation representation)` | Loads initialization data for the `representation` and returns the sample `Format`.

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

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

- - ### Method Detail

    - #### buildDataSpec

          public static DataSpec buildDataSpec​(Representation representation,
                                               RangedUri requestUri,
                                               int flags)

      Builds a `DataSpec` for a given `RangedUri` belonging to `Representation`.
      Parameters:
        `representation` - The `Representation` to which the request belongs.
        `requestUri` - The `RangedUri` of the data to request.
        `flags` - Flags to be set on the returned `DataSpec`. See `DataSpec.Builder.setFlags(int)`.
      Returns:
        The `DataSpec`.

    - #### loadManifest

          public static DashManifest loadManifest​(DataSource dataSource,
                                                  Uri uri)
                                           throws IOException

      Loads a DASH manifest.
      Parameters:
        `dataSource` - The `HttpDataSource` from which the manifest should be read.
        `uri` - The `Uri` of the manifest to be read.
      Returns:
        An instance of `DashManifest`.
      Throws:
        `IOException` - Thrown when there is an error while loading.

    - #### loadFormatWithDrmInitData

          @Nullable
          public static Format loadFormatWithDrmInitData​(DataSource dataSource,
                                                         Period period)
                                                  throws IOException

      Loads a `Format` for acquiring keys for a given period in a DASH manifest.
      Parameters:
        `dataSource` - The `HttpDataSource` from which data should be loaded.
        `period` - The `Period`.
      Returns:
        The loaded `Format`, or null if none is defined.
      Throws:
        `IOException` - Thrown when there is an error while loading.

    - #### loadSampleFormat

          @Nullable
          public static Format loadSampleFormat​(DataSource dataSource,
                                                int trackType,
                                                Representation representation)
                                         throws IOException

      Loads initialization data for the `representation` and returns the sample `Format`.
      Parameters:
        `dataSource` - The source from which the data should be loaded.
        `trackType` - The type of the representation. Typically one of the `C` `TRACK_TYPE_*` constants.
        `representation` - The representation which initialization chunk belongs to.
      Returns:
        the sample `Format` of the given representation.
      Throws:
        `IOException` - Thrown when there is an error while loading.

    - #### loadChunkIndex

          @Nullable
          public static ChunkIndex loadChunkIndex​(DataSource dataSource,
                                                  int trackType,
                                                  Representation representation)
                                           throws IOException

      Loads initialization and index data for the `representation` and returns the `ChunkIndex`.
      Parameters:
        `dataSource` - The source from which the data should be loaded.
        `trackType` - The type of the representation. Typically one of the `C` `TRACK_TYPE_*` constants.
        `representation` - The representation which initialization chunk belongs to.
      Returns:
        The `ChunkIndex` of the given representation, or null if no initialization or index data exists.
      Throws:
        `IOException` - Thrown when there is an error while loading.