static parseSegmentInfo(context, callback) {
    goog.asserts.assert(
        callback(context.representation),
        'There must be at least one element of the given type.');
    const MpdUtils = shaka.dash.MpdUtils;
    const TXml = shaka.util.TXml;

    const timescaleStr =
        MpdUtils.inheritAttribute(context, callback, 'timescale');
    let timescale = 1;
    if (timescaleStr) {
      timescale = TXml.parsePositiveInt(timescaleStr) || 1;
    }

    const durationStr =
        MpdUtils.inheritAttribute(context, callback, 'duration');
    const unscaledSegmentDuration = TXml.parsePositiveInt(durationStr || '');
    const segmentDuration = unscaledSegmentDuration ?
        unscaledSegmentDuration / timescale : null;

    const startNumberStr =
        MpdUtils.inheritAttribute(context, callback, 'startNumber');
    const unscaledPresentationTimeOffset =
        Number(MpdUtils.inheritAttribute(context, callback,
            'presentationTimeOffset')) || 0;
    let startNumber = TXml.parseNonNegativeInt(startNumberStr || '');
    if (startNumberStr == null || startNumber == null) {
      startNumber = 1;
    }

    /** @type {Array<shaka.media.PresentationTimeline.TimeRange>} */
    let timeline = null;
    const timelineNode =
        MpdUtils.inheritChild(context, callback, 'SegmentTimeline');
    if (timelineNode) {
      const timePoints = TXml.findChildren(timelineNode, 'S');
      timeline = MpdUtils.createTimeline(
          timePoints, timescale, unscaledPresentationTimeOffset,
          context.periodInfo.duration || Infinity, startNumber);
    }

    const scaledPresentationTimeOffset =
        (unscaledPresentationTimeOffset / timescale) || 0;
    return {
      timescale: timescale,
      unscaledSegmentDuration: unscaledSegmentDuration,
      segmentDuration: segmentDuration,
      startNumber: startNumber,
      scaledPresentationTimeOffset: scaledPresentationTimeOffset,
      unscaledPresentationTimeOffset: unscaledPresentationTimeOffset,
      timeline: timeline,
    };
  }
Parses common segment info for SegmentList and SegmentTemplate.

@param {shaka.dash.DashParser.Context} context
@param {function(?shaka.dash.DashParser.InheritanceFrame):
  ?shaka.extern.xml.Node} callback
  Gets the element that contains the segment info.
@return {shaka.dash.MpdUtils.SegmentInfo}