Package com.castlabs.android.player
Class TrackTypeProvider
java.lang.Object
com.castlabs.android.player.TrackTypeProvider
- Direct Known Subclasses:
DefaultTrackTypeProvider
The implementations of this interface should provide the track types, track group types and their
weights according to some desired model. This is to facilitate the merging video tracks
algorithm when the video merging option
PlayerSDK.MERGE_VIDEO_TRACKS
or
SdkConsts.INTENT_MERGE_VIDEO_TRACKS
is enabled. The type weights are used
to assign scores to tracks and track groups and then to select the default track group having the highest
score.
For instance, the video tracks could be defined to have the following types: SD and HD.
Then, having three input track groups with track types SD, SD-HD and HD will result in two merged
video tracks: SD + HD and SD-HD. The default video track with the highest score will then be selected.- Since:
- 4.0.7
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Defines the unknown or not applicable track or track group type. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract int
getGroupType
(int type1, int type2) Gets the track group type by provided track or track group types.abstract int
getTrackType
(com.google.android.exoplayer2.Format format) Defines the type of the track with the provided format.abstract float
getTrackTypeWeight
(int type) Defines the weight of the provided track.abstract boolean
typesOverlap
(int type1, int type2) Returnstrue
if the types overlap otherwisefalse
.
-
Field Details
-
TYPE_UNDEFINED
public static final int TYPE_UNDEFINEDDefines the unknown or not applicable track or track group type.- See Also:
-
-
Constructor Details
-
TrackTypeProvider
public TrackTypeProvider()
-
-
Method Details
-
getTrackType
public abstract int getTrackType(@NonNull com.google.android.exoplayer2.Format format) Defines the type of the track with the provided format. The type itself could be defined as one of theint
bits set.- Parameters:
format
- The track format- Returns:
- The track type or
TYPE_UNDEFINED
-
getTrackTypeWeight
public abstract float getTrackTypeWeight(int type) Defines the weight of the provided track. The value should be normalized to 0f .. 1.0f- Parameters:
type
- The track or track group type- Returns:
- The normalized to 0f .. 1.0f weight
-
getGroupType
public abstract int getGroupType(int type1, int type2) Gets the track group type by provided track or track group types. In case the track types are defined as bit-sets then the implementation here would be just logical OR of the track group and track types.- Parameters:
type1
- The track or track group type onetype2
- The track or track group type two- Returns:
- The track group type
-
typesOverlap
public abstract boolean typesOverlap(int type1, int type2) Returnstrue
if the types overlap otherwisefalse
. In case the track types are defined as bit-sets then the implementation here would be just logical AND of the track group and track types.- Parameters:
type1
- The track or track group type onetype2
- The track or track group type two- Returns:
- True if the types overlap otherwise false
-