Package com.castlabs.android.player.models

# Class VideoTrackQuality

java.lang.Object
com.castlabs.android.player.models.VideoTrackQuality

All Implemented Interfaces:
  `Parcelable`, `Comparable<VideoTrackQuality>`

public class VideoTrackQuality extends Object implements Comparable<VideoTrackQuality>, Parcelable
Represents a single quality of a video track. This is typically generated from a Representation for DASH streams, a QualityLevel for SmoothStreaming, and a Variant for HLS. The model contains at least the information about the quality bitrate as this is used to compare instances of VideoTrackQuality. Video qualities are sorted by bitrate in decreasing order with the `Comparable` implementation in this class. Other attributes should be set if the information is available, but they are not mandatory. If the information is missing, the value is either -1 or null.

Since:
  3.0.0

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface android.os.Parcelable

  `Parcelable.ClassLoaderCreator<T extends Object>, Parcelable.Creator<T extends Object>`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Parcelable.Creator<VideoTrackQuality>`
  `CREATOR`

  ### Fields inherited from interface android.os.Parcelable

  `CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VideoTrackQuality(int bitrate)`
  Create a new video track quality with a bitrate > 0
  `VideoTrackQuality(com.google.android.exoplayer2.Format format)`
  Create a new video track quality based on the given format

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(VideoTrackQuality another)`
  `int`
  `describeContents()`
  `boolean`
  `equals(Object obj)`
  `int`
  `getBitrate()`
  `String`
  `getCodecs()`
  `Drm`
  `getDrm()`
  Get `Drm` of the current quality
  `com.google.android.exoplayer2.drm.DrmInitData`
  `getDrmInitData()`
  `KeyStatus`
  `getDrmKeyStatus()`
  `com.google.android.exoplayer2.Format`
  `getFormat()`
  `float`
  `getFrameRate()`
  `int`
  `getHeight()`
  `String`
  `getId()`
  Set the id of this track
  `String`
  `getLabel()`
  `float`
  `getMaxPlayoutRate()`
  `String`
  `getMimeType()`
  `int`
  `getOriginalGroupIndex()`
  `int`
  `getOriginalTrackIndex()`
  `float`
  `getPictureWidthHeightRatio()`
  `float`
  `getPixelWidthHeightRatio()`
  `int`
  `getTrackIndex()`
  `int`
  `getWidth()`
  `int`
  `hashCode()`
  `boolean`
  `isDisabled()`
  `boolean`
  `matchesFormat(com.google.android.exoplayer2.Format format)`
  Returns true if this quality matches the given formats width, height, frameRate, codecs, bitrate, max playout rate and mimetype
  `void`
  `setCodecs(String codecs)`
  `void`
  `setDrm(Drm drm)`
  Assign `Drm` to the current quality
  `void`
  `setDrmKeyStatus(KeyStatus drmKeyStatus)`
  `void`
  `setFrameRate(float frameRate)`
  `void`
  `setHeight(int height)`
  `void`
  `setId(String id)`
  Set the id associated with this track
  `void`
  `setMaxPlayoutRate(float maxPlayoutRate)`
  `void`
  `setMimeType(String mimeType)`
  `void`
  `setOriginalGroupIndex(int originalGroupIndex)`
  Set the original index of the corresponding track group
  `void`
  `setOriginalTrackIndex(int originalTrackIndex)`
  Set the original index of this track
  `void`
  `setPictureWidthHeightRatio(float pictureWidthHeightRatio)`
  `void`
  `setPixelWidthHeightRatio(float pixelWidthHeightRatio)`
  `void`
  `setTrackIndex(int trackIndex)`
  `void`
  `setWidth(int width)`
  `String`
  `toString()`
  `void`
  `writeToParcel(Parcel dest, int flags)`

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

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### CREATOR

    public static final Parcelable.Creator<VideoTrackQuality> CREATOR

- ## Constructor Details

  - ### VideoTrackQuality

    public VideoTrackQuality(int bitrate)
    Create a new video track quality with a bitrate > 0
    Parameters:
      `bitrate` - the bitrate

  - ### VideoTrackQuality

    public VideoTrackQuality(@NonNull com.google.android.exoplayer2.Format format)
    Create a new video track quality based on the given format
    Parameters:
      `format` - the format

- ## Method Details

  - ### isDisabled

    public boolean isDisabled()
    Returns:
      false if the quality can be played and true otherwise

  - ### getId

    @Nullable public String getId()
    Set the id of this track
    Returns:
      The id associated with this track

  - ### setId

    public void setId(@Nullable String id)
    Set the id associated with this track
    Parameters:
      `id` - the id

  - ### getDrm

    @Nullable public Drm getDrm()
    Get `Drm` of the current quality
    Returns:
      `Drm` or `null` for clear content

  - ### setDrm

    public void setDrm(@Nullable Drm drm)
    Assign `Drm` to the current quality
    Parameters:
      `drm` - `Drm` or null for clear content

  - ### getDrmKeyStatus

    @Nullable public KeyStatus getDrmKeyStatus()
    Returns:
      The `KeyStatus` or null for clear content

  - ### setDrmKeyStatus

    public void setDrmKeyStatus(@Nullable KeyStatus drmKeyStatus)

  - ### getBitrate

    public int getBitrate()
    Returns:
      The average bandwidth in bits per second.

  - ### getWidth

    public int getWidth()
    Returns:
      The width of this quality in pixel or -1

  - ### setWidth

    public void setWidth(int width)
    Parameters:
      `width` - the width of this quality in pixel

  - ### getHeight

    public int getHeight()
    Returns:
      The height of this quality in pixel or -1

  - ### setPixelWidthHeightRatio

    public void setPixelWidthHeightRatio(float pixelWidthHeightRatio)
    Parameters:
      `pixelWidthHeightRatio` - the pixel width height ratio

  - ### getPixelWidthHeightRatio

    public float getPixelWidthHeightRatio()
    Returns:
      The pixel width height ratio of this quality if known or 1.0f The value equals to DASH sar value

  - ### getPictureWidthHeightRatio

    public float getPictureWidthHeightRatio()
    Returns:
      The picture width height ratio of this quality if known or 1.0f The value equals to DASH par value

  - ### setPictureWidthHeightRatio

    public void setPictureWidthHeightRatio(float pictureWidthHeightRatio)
    Parameters:
      `pictureWidthHeightRatio` - the picture width height ratio

  - ### setHeight

    public void setHeight(int height)
    Parameters:
      `height` - the width of this quality in pixel

  - ### getFrameRate

    public float getFrameRate()
    Returns:
      The frame rate of this quality or -1

  - ### setFrameRate

    public void setFrameRate(float frameRate)
    Parameters:
      `frameRate` - the framerate of this quality

  - ### getMaxPlayoutRate

    public float getMaxPlayoutRate()

  - ### setMaxPlayoutRate

    public void setMaxPlayoutRate(float maxPlayoutRate)

  - ### getCodecs

    @Nullable public String getCodecs()
    Returns:
      A ist of codec of this quality or null

  - ### setCodecs

    public void setCodecs(@Nullable String codecs)
    Parameters:
      `codecs` - the codecs of this quality

  - ### getMimeType

    @Nullable public String getMimeType()
    Returns:
      The mime type of this quality

  - ### setMimeType

    public void setMimeType(@Nullable String mimeType)
    Parameters:
      `mimeType` - the mime type of this quality

  - ### getTrackIndex

    public int getTrackIndex()
    Returns:
      The index of this quality within the set of qualities on the parent track

  - ### setTrackIndex

    public void setTrackIndex(int trackIndex)
    Parameters:
      `trackIndex` - the track index within the set of parent tracks

  - ### getOriginalTrackIndex

    public int getOriginalTrackIndex()
    Returns:
      The original index if this track, when no filters where applied

  - ### setOriginalTrackIndex

    public void setOriginalTrackIndex(int originalTrackIndex)
    Set the original index of this track
    Parameters:
      `originalTrackIndex` - The original index

  - ### getOriginalGroupIndex

    public int getOriginalGroupIndex()
    Returns:
      The original index if the corresponding track group, when no filters where applied

  - ### setOriginalGroupIndex

    public void setOriginalGroupIndex(int originalGroupIndex)
    Set the original index of the corresponding track group
    Parameters:
      `originalGroupIndex` - The original index

  - ### matchesFormat

    public boolean matchesFormat(@NonNull com.google.android.exoplayer2.Format format)
    Returns true if this quality matches the given formats width, height, frameRate, codecs, bitrate, max playout rate and mimetype
    Parameters:
      `format` - the format
    Returns:
      True if this quality matches the given format properties

  - ### getFormat

    @NonNull public com.google.android.exoplayer2.Format getFormat()

  - ### getLabel

    public String getLabel()
    Returns:
      The label for this quality as DASH label if available or width x height

  - ### getDrmInitData

    @Nullable public com.google.android.exoplayer2.drm.DrmInitData getDrmInitData()

  - ### compareTo

    public int compareTo(@NonNull VideoTrackQuality another)
    Specified by:
      `compareTo` in interface `Comparable<VideoTrackQuality>`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(@Nullable Object obj)
    Overrides:
      `equals` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### describeContents

    public int describeContents()
    Specified by:
      `describeContents` in interface `Parcelable`

  - ### writeToParcel

    public void writeToParcel(Parcel dest, int flags)
    Specified by:
      `writeToParcel` in interface `Parcelable`