Class VideoTrackQuality
java.lang.Object
com.castlabs.android.player.models.VideoTrackQuality
- All Implemented Interfaces:
Parcelable,Comparable<VideoTrackQuality>
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>, Parcelable.Creator<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Parcelable.Creator<VideoTrackQuality> Creator for theParcelableinterface.Fields inherited from interface android.os.Parcelable
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionVideoTrackQuality(int bitrate) Create a new video track quality with a bitrate > 0VideoTrackQuality(com.google.android.exoplayer2.Format format) Create a new video track quality based on the given format -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(VideoTrackQuality another) intbooleanintReturns the average bandwidth in bits per second orFormat.NO_VALUEif not known.Returns the codecs of this quality.getDrm()GetDrmof the current qualitycom.google.android.exoplayer2.drm.DrmInitDataReturns the DRM initialization data for this quality.Returns the DRM key status.com.google.android.exoplayer2.FormatReturns aFormatfor this quality.floatReturns the frame rate of this quality in frames per second or -1 if not known.intReturns the height of this quality in pixels or -1 if not known.getId()Set the id of this trackgetLabel()Returns the label for this quality.floatGets the maximum playout rate.Returns the media mime type of this quality.Returns the codec mime type of this quality.intReturns the original index of the corresponding track groupintReturns the original index of this track, when no filters were applied.floatReturns the picture width to height ratio.floatReturns the pixel width to height ratio.intReturns the index of this quality within the set of qualities on the parent track.intgetWidth()Returns the width of this quality in pixels or -1 if not known.inthashCode()booleanReturns false if the quality can be played and true otherwisebooleanmatchesFormat(com.google.android.exoplayer2.Format format) Returns true if this quality matches the given formats width, height, frameRate, codecs, bitrate, max playout rate and mimetypevoidSet the codecs of this quality.voidAssignDrmto the current qualityvoidsetDrmKeyStatus(KeyStatus drmKeyStatus) Sets the DRM key status.voidsetFrameRate(float frameRate) Sets the frame rate of this quality.voidsetHeight(int height) Sets the height of this quality in pixels.voidSet the id associated with this trackvoidsetMaxPlayoutRate(float maxPlayoutRate) Sets the maximum playout rate.voidsetMediaMimeType(String mimeType) Set the media mime type of this quality.voidsetMimeType(String mimeType) Set the codec mime type of this quality.voidsetOriginalGroupIndex(int originalGroupIndex) Set the original index of the corresponding track groupvoidsetOriginalTrackIndex(int originalTrackIndex) Set the original index of this trackvoidsetPictureWidthHeightRatio(float pictureWidthHeightRatio) Sets the picture width to height ratio.voidsetPixelWidthHeightRatio(float pixelWidthHeightRatio) Sets the pixel width to height ratio.voidsetTrackIndex(int trackIndex) Set the index of this quality within the set of qualities on the parent track.voidsetWidth(int width) Sets the width of this quality in pixels.toString()voidwriteToParcel(Parcel dest, int flags)
-
Field Details
-
CREATOR
Creator for theParcelableinterface.
-
-
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- Returns:
- false if the quality can be played and true otherwise
-
getId
Set the id of this track- Returns:
- The id associated with this track
-
setId
Set the id associated with this track- Parameters:
id- the id
-
getDrm
GetDrmof the current quality- Returns:
Drmornullfor clear content
-
setDrm
AssignDrmto the current quality- Parameters:
drm-Drmor null for clear content
-
getDrmKeyStatus
Returns the DRM key status.- Returns:
- The
KeyStatusor null for clear content
-
setDrmKeyStatus
Sets the DRM key status.- Parameters:
drmKeyStatus- TheKeyStatusor null for clear content
-
getBitrate
public int getBitrate()Returns the average bandwidth in bits per second orFormat.NO_VALUEif not known.- Returns:
- The average bandwidth in bits per second.
-
getWidth
public int getWidth()Returns the width of this quality in pixels or -1 if not known.- Returns:
- The width of this quality in pixel or -1
-
setWidth
public void setWidth(int width) Sets the width of this quality in pixels.- Parameters:
width- the width of this quality in pixel
-
getHeight
public int getHeight()Returns the height of this quality in pixels or -1 if not known.- Returns:
- The height of this quality in pixel or -1
-
setPixelWidthHeightRatio
public void setPixelWidthHeightRatio(float pixelWidthHeightRatio) Sets the pixel width to height ratio.- Parameters:
pixelWidthHeightRatio- the pixel width height ratio
-
getPixelWidthHeightRatio
public float getPixelWidthHeightRatio()Returns the pixel width to height ratio.- 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 to height ratio.- 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) Sets the picture width to height ratio.- Parameters:
pictureWidthHeightRatio- the picture width height ratio
-
setHeight
public void setHeight(int height) Sets the height of this quality in pixels.- Parameters:
height- the width of this quality in pixel
-
getFrameRate
public float getFrameRate()Returns the frame rate of this quality in frames per second or -1 if not known.- Returns:
- The frame rate of this quality or -1
-
setFrameRate
public void setFrameRate(float frameRate) Sets the frame rate of this quality.- Parameters:
frameRate- the framerate of this quality
-
getMaxPlayoutRate
public float getMaxPlayoutRate()Gets the maximum playout rate.- Returns:
- The maximum playout rate.
-
setMaxPlayoutRate
public void setMaxPlayoutRate(float maxPlayoutRate) Sets the maximum playout rate.- Parameters:
maxPlayoutRate- The maximum playout rate.
-
getCodecs
Returns the codecs of this quality.- Returns:
- A ist of codec of this quality or null
-
setCodecs
Set the codecs of this quality.- Parameters:
codecs- the codecs of this quality
-
getMediaMimeType
Returns the media mime type of this quality.- Returns:
- The media mime type of this quality. This is the type of the media container
-
setMediaMimeType
Set the media mime type of this quality.- Parameters:
mimeType- the media mime type of this quality.
-
getMimeType
Returns the codec mime type of this quality.- Returns:
- The codec mime type of this quality. This is the type of the elementary stream (i.e. the individual samples)
-
setMimeType
Set the codec mime type of this quality.- Parameters:
mimeType- the codec mime type of this quality
-
getTrackIndex
public int getTrackIndex()Returns the index of this quality within the set of qualities on the parent track.- Returns:
- The index of this quality within the set of qualities on the parent track
-
setTrackIndex
public void setTrackIndex(int trackIndex) Set the index of this quality within the set of qualities on the parent track.- Parameters:
trackIndex- the track index within the set of parent tracks
-
getOriginalTrackIndex
public int getOriginalTrackIndex()Returns the original index of this track, when no filters were applied.- 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 of the corresponding track group- Returns:
- The original index of 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()Returns aFormatfor this quality.- Returns:
- A
Formatfor this quality
-
getLabel
Returns the label for this quality.- 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()Returns the DRM initialization data for this quality.- Returns:
- the
DrmInitDatafor this quality or null if not available
-
compareTo
- Specified by:
compareToin interfaceComparable<VideoTrackQuality>
-
hashCode
public int hashCode() -
equals
-
toString
-
describeContents
public int describeContents()- Specified by:
describeContentsin interfaceParcelable
-
writeToParcel
- Specified by:
writeToParcelin interfaceParcelable
-