Class TrackTypeProvider

  • Direct Known Subclasses:
    DefaultTrackTypeProvider

    public abstract class TrackTypeProvider
    extends Object
    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 Detail

      • TYPE_UNDEFINED

        public static final int TYPE_UNDEFINED
        Defines the unknown or not applicable track or track group type.
        See Also:
        Constant Field Values
    • Constructor Detail

      • TrackTypeProvider

        public TrackTypeProvider()
    • Method Detail

      • 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 the int 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 one
        type2 - The track or track group type two
        Returns:
        The track group type
      • typesOverlap

        public abstract boolean typesOverlap​(int type1,
                                             int type2)
        Returns true if the types overlap otherwise false. 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 one
        type2 - The track or track group type two
        Returns:
        True if the types overlap otherwise false