Interface DashSegmentIndex

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int INDEX_UNBOUNDED  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      long getAvailableSegmentCount​(long periodDurationUs, long nowUnixTimeUs)
      Returns the number of available segments in the index.
      long getDurationUs​(long segmentNum, long periodDurationUs)
      Returns the duration of a segment.
      long getFirstAvailableSegmentNum​(long periodDurationUs, long nowUnixTimeUs)
      Returns the segment number of the first available segment in the index.
      long getFirstSegmentNum()
      Returns the segment number of the first defined segment in the index.
      long getNextSegmentAvailableTimeUs​(long periodDurationUs, long nowUnixTimeUs)
      Returns the time, in microseconds, at which a new segment becomes available, or C.TIME_UNSET if not applicable.
      long getSegmentCount​(long periodDurationUs)
      Returns the number of segments defined in the index, or INDEX_UNBOUNDED.
      long getSegmentNum​(long timeUs, long periodDurationUs)
      Returns getFirstSegmentNum() if the index has no segments or if the given media time is earlier than the start of the first segment.
      RangedUri getSegmentUrl​(long segmentNum)
      Returns a RangedUri defining the location of a segment.
      long getTimeUs​(long segmentNum)
      Returns the start time of a segment.
      boolean isExplicit()
      Returns true if segments are defined explicitly by the index.
    • Method Detail

      • getSegmentNum

        long getSegmentNum​(long timeUs,
                           long periodDurationUs)
        Returns getFirstSegmentNum() if the index has no segments or if the given media time is earlier than the start of the first segment. Returns getFirstSegmentNum() + getSegmentCount() - 1 if the given media time is later than the end of the last segment. Otherwise, returns the segment number of the segment containing the given media time.
        Parameters:
        timeUs - The time in microseconds.
        periodDurationUs - The duration of the enclosing period in microseconds, or C.TIME_UNSET if the period's duration is not yet known.
        Returns:
        The segment number of the corresponding segment.
      • getTimeUs

        long getTimeUs​(long segmentNum)
        Returns the start time of a segment.
        Parameters:
        segmentNum - The segment number.
        Returns:
        The corresponding start time in microseconds.
      • getDurationUs

        long getDurationUs​(long segmentNum,
                           long periodDurationUs)
        Returns the duration of a segment.
        Parameters:
        segmentNum - The segment number.
        periodDurationUs - The duration of the enclosing period in microseconds, or C.TIME_UNSET if the period's duration is not yet known.
        Returns:
        The duration of the segment, in microseconds.
      • getSegmentUrl

        RangedUri getSegmentUrl​(long segmentNum)
        Returns a RangedUri defining the location of a segment.
        Parameters:
        segmentNum - The segment number.
        Returns:
        The RangedUri defining the location of the data.
      • getFirstSegmentNum

        long getFirstSegmentNum()
        Returns the segment number of the first defined segment in the index.
      • getFirstAvailableSegmentNum

        long getFirstAvailableSegmentNum​(long periodDurationUs,
                                         long nowUnixTimeUs)
        Returns the segment number of the first available segment in the index.
        Parameters:
        periodDurationUs - The duration of the enclosing period in microseconds, or C.TIME_UNSET if the period's duration is not yet known.
        nowUnixTimeUs - The current time in milliseconds since the Unix epoch.
        Returns:
        The number of the first available segment.
      • getSegmentCount

        long getSegmentCount​(long periodDurationUs)
        Returns the number of segments defined in the index, or INDEX_UNBOUNDED.

        An unbounded index occurs if a dynamic manifest uses SegmentTemplate elements without a SegmentTimeline element, and if the period duration is not yet known. In this case the caller can query the available segment using getFirstAvailableSegmentNum(long, long) and getAvailableSegmentCount(long, long).

        Parameters:
        periodDurationUs - The duration of the enclosing period in microseconds, or C.TIME_UNSET if the period's duration is not yet known.
        Returns:
        The number of segments in the index, or INDEX_UNBOUNDED.
      • getAvailableSegmentCount

        long getAvailableSegmentCount​(long periodDurationUs,
                                      long nowUnixTimeUs)
        Returns the number of available segments in the index.
        Parameters:
        periodDurationUs - The duration of the enclosing period in microseconds, or C.TIME_UNSET if the period's duration is not yet known.
        nowUnixTimeUs - The current time in milliseconds since the Unix epoch.
        Returns:
        The number of available segments in the index.
      • getNextSegmentAvailableTimeUs

        long getNextSegmentAvailableTimeUs​(long periodDurationUs,
                                           long nowUnixTimeUs)
        Returns the time, in microseconds, at which a new segment becomes available, or C.TIME_UNSET if not applicable.
        Parameters:
        periodDurationUs - The duration of the enclosing period in microseconds, or C.TIME_UNSET if the period's duration is not yet known.
        nowUnixTimeUs - The current time in milliseconds since the Unix epoch.
        Returns:
        The time, in microseconds, at which a new segment becomes available, or C.TIME_UNSET if not applicable.
      • isExplicit

        boolean isExplicit()
        Returns true if segments are defined explicitly by the index.

        If true is returned, each segment is defined explicitly by the index data, and all of the listed segments are guaranteed to be available at the time when the index was obtained.

        If false is returned then segment information was derived from properties such as a fixed segment duration. If the presentation is dynamic, it's possible that only a subset of the segments are available.

        Returns:
        Whether segments are defined explicitly by the index.