com.google.android.exoplayer2.source.dash.manifest.SegmentBase.SingleSegmentBase Java Examples

The following examples show how to use com.google.android.exoplayer2.source.dash.manifest.SegmentBase.SingleSegmentBase. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Representation.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase The segment base underlying the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public SingleSegmentRepresentation(
    long revisionId,
    Format format,
    String baseUrl,
    SingleSegmentBase segmentBase,
    List<Descriptor> inbandEventStreams,
    String cacheKey,
    long contentLength) {
  super(revisionId, format, baseUrl, segmentBase, inbandEventStreams);
  this.uri = Uri.parse(baseUrl);
  this.indexUri = segmentBase.getIndex();
  this.cacheKey = cacheKey;
  this.contentLength = contentLength;
  // If we have an index uri then the index is defined externally, and we shouldn't return one
  // directly. If we don't, then we can't do better than an index defining a single segment.
  segmentIndex = indexUri != null ? null
      : new SingleSegmentIndex(new RangedUri(null, 0, contentLength));
}
 
Example #2
Source File: Representation.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a new instance.
 *
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase A segment base element for the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null. This
 *     parameter is ignored if {@code segmentBase} consists of multiple segments.
 * @return The constructed instance.
 */
public static Representation newInstance(
    long revisionId,
    Format format,
    String baseUrl,
    SegmentBase segmentBase,
    List<Descriptor> inbandEventStreams,
    String cacheKey) {
  if (segmentBase instanceof SingleSegmentBase) {
    return new SingleSegmentRepresentation(
        revisionId,
        format,
        baseUrl,
        (SingleSegmentBase) segmentBase,
        inbandEventStreams,
        cacheKey,
        C.LENGTH_UNSET);
  } else if (segmentBase instanceof MultiSegmentBase) {
    return new MultiSegmentRepresentation(
        revisionId, format, baseUrl, (MultiSegmentBase) segmentBase, inbandEventStreams);
  } else {
    throw new IllegalArgumentException("segmentBase must be of type SingleSegmentBase or "
        + "MultiSegmentBase");
  }
}
 
Example #3
Source File: Representation.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param uri The uri of the media.
 * @param initializationStart The offset of the first byte of initialization data.
 * @param initializationEnd The offset of the last byte of initialization data.
 * @param indexStart The offset of the first byte of index data.
 * @param indexEnd The offset of the last byte of index data.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public static SingleSegmentRepresentation newInstance(
    long revisionId,
    Format format,
    String uri,
    long initializationStart,
    long initializationEnd,
    long indexStart,
    long indexEnd,
    List<Descriptor> inbandEventStreams,
    String cacheKey,
    long contentLength) {
  RangedUri rangedUri = new RangedUri(null, initializationStart,
      initializationEnd - initializationStart + 1);
  SingleSegmentBase segmentBase = new SingleSegmentBase(rangedUri, 1, 0, indexStart,
      indexEnd - indexStart + 1);
  return new SingleSegmentRepresentation(
      revisionId, format, uri, segmentBase, inbandEventStreams, cacheKey, contentLength);
}
 
Example #4
Source File: Representation.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase The segment base underlying the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public SingleSegmentRepresentation(
    long revisionId,
    Format format,
    String baseUrl,
    SingleSegmentBase segmentBase,
    List<Descriptor> inbandEventStreams,
    String cacheKey,
    long contentLength) {
  super(revisionId, format, baseUrl, segmentBase, inbandEventStreams);
  this.uri = Uri.parse(baseUrl);
  this.indexUri = segmentBase.getIndex();
  this.cacheKey = cacheKey;
  this.contentLength = contentLength;
  // If we have an index uri then the index is defined externally, and we shouldn't return one
  // directly. If we don't, then we can't do better than an index defining a single segment.
  segmentIndex = indexUri != null ? null
      : new SingleSegmentIndex(new RangedUri(null, 0, contentLength));
}
 
Example #5
Source File: Representation.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Constructs a new instance.
 *
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase A segment base element for the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null. This
 *     parameter is ignored if {@code segmentBase} consists of multiple segments.
 * @return The constructed instance.
 */
public static Representation newInstance(
    long revisionId,
    Format format,
    String baseUrl,
    SegmentBase segmentBase,
    List<Descriptor> inbandEventStreams,
    String cacheKey) {
  if (segmentBase instanceof SingleSegmentBase) {
    return new SingleSegmentRepresentation(
        revisionId,
        format,
        baseUrl,
        (SingleSegmentBase) segmentBase,
        inbandEventStreams,
        cacheKey,
        C.LENGTH_UNSET);
  } else if (segmentBase instanceof MultiSegmentBase) {
    return new MultiSegmentRepresentation(
        revisionId, format, baseUrl, (MultiSegmentBase) segmentBase, inbandEventStreams);
  } else {
    throw new IllegalArgumentException("segmentBase must be of type SingleSegmentBase or "
        + "MultiSegmentBase");
  }
}
 
Example #6
Source File: Representation.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase The segment base underlying the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public SingleSegmentRepresentation(
    long revisionId,
    Format format,
    String baseUrl,
    SingleSegmentBase segmentBase,
    @Nullable List<Descriptor> inbandEventStreams,
    @Nullable String cacheKey,
    long contentLength) {
  super(revisionId, format, baseUrl, segmentBase, inbandEventStreams);
  this.uri = Uri.parse(baseUrl);
  this.indexUri = segmentBase.getIndex();
  this.cacheKey = cacheKey;
  this.contentLength = contentLength;
  // If we have an index uri then the index is defined externally, and we shouldn't return one
  // directly. If we don't, then we can't do better than an index defining a single segment.
  segmentIndex = indexUri != null ? null
      : new SingleSegmentIndex(new RangedUri(null, 0, contentLength));
}
 
Example #7
Source File: Representation.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param uri The uri of the media.
 * @param initializationStart The offset of the first byte of initialization data.
 * @param initializationEnd The offset of the last byte of initialization data.
 * @param indexStart The offset of the first byte of index data.
 * @param indexEnd The offset of the last byte of index data.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public static SingleSegmentRepresentation newInstance(
    long revisionId,
    Format format,
    String uri,
    long initializationStart,
    long initializationEnd,
    long indexStart,
    long indexEnd,
    List<Descriptor> inbandEventStreams,
    @Nullable String cacheKey,
    long contentLength) {
  RangedUri rangedUri = new RangedUri(null, initializationStart,
      initializationEnd - initializationStart + 1);
  SingleSegmentBase segmentBase = new SingleSegmentBase(rangedUri, 1, 0, indexStart,
      indexEnd - indexStart + 1);
  return new SingleSegmentRepresentation(
      revisionId, format, uri, segmentBase, inbandEventStreams, cacheKey, contentLength);
}
 
Example #8
Source File: Representation.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a new instance.
 *
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase A segment base element for the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null. This
 *     parameter is ignored if {@code segmentBase} consists of multiple segments.
 * @return The constructed instance.
 */
public static Representation newInstance(
    long revisionId,
    Format format,
    String baseUrl,
    SegmentBase segmentBase,
    @Nullable List<Descriptor> inbandEventStreams,
    @Nullable String cacheKey) {
  if (segmentBase instanceof SingleSegmentBase) {
    return new SingleSegmentRepresentation(
        revisionId,
        format,
        baseUrl,
        (SingleSegmentBase) segmentBase,
        inbandEventStreams,
        cacheKey,
        C.LENGTH_UNSET);
  } else if (segmentBase instanceof MultiSegmentBase) {
    return new MultiSegmentRepresentation(
        revisionId, format, baseUrl, (MultiSegmentBase) segmentBase, inbandEventStreams);
  } else {
    throw new IllegalArgumentException("segmentBase must be of type SingleSegmentBase or "
        + "MultiSegmentBase");
  }
}
 
Example #9
Source File: Representation.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param uri The uri of the media.
 * @param initializationStart The offset of the first byte of initialization data.
 * @param initializationEnd The offset of the last byte of initialization data.
 * @param indexStart The offset of the first byte of index data.
 * @param indexEnd The offset of the last byte of index data.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param cacheKey An optional key to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public static SingleSegmentRepresentation newInstance(
    long revisionId,
    Format format,
    String uri,
    long initializationStart,
    long initializationEnd,
    long indexStart,
    long indexEnd,
    List<Descriptor> inbandEventStreams,
    String cacheKey,
    long contentLength) {
  RangedUri rangedUri = new RangedUri(null, initializationStart,
      initializationEnd - initializationStart + 1);
  SingleSegmentBase segmentBase = new SingleSegmentBase(rangedUri, 1, 0, indexStart,
      indexEnd - indexStart + 1);
  return new SingleSegmentRepresentation(
      revisionId, format, uri, segmentBase, inbandEventStreams, cacheKey, contentLength);
}
 
Example #10
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
protected SingleSegmentBase parseSegmentBase(XmlPullParser xpp, SingleSegmentBase parent)
    throws XmlPullParserException, IOException {

  long timescale = parseLong(xpp, "timescale", parent != null ? parent.timescale : 1);
  long presentationTimeOffset = parseLong(xpp, "presentationTimeOffset",
      parent != null ? parent.presentationTimeOffset : 0);

  long indexStart = parent != null ? parent.indexStart : 0;
  long indexLength = parent != null ? parent.indexLength : 0;
  String indexRangeText = xpp.getAttributeValue(null, "indexRange");
  if (indexRangeText != null) {
    String[] indexRange = indexRangeText.split("-");
    indexStart = Long.parseLong(indexRange[0]);
    indexLength = Long.parseLong(indexRange[1]) - indexStart + 1;
  }

  RangedUri initialization = parent != null ? parent.initialization : null;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "Initialization")) {
      initialization = parseInitialization(xpp);
    } else {
      maybeSkipTag(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "SegmentBase"));

  return buildSingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #11
Source File: DashManifestParser.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
protected SingleSegmentBase parseSegmentBase(
    XmlPullParser xpp, @Nullable SingleSegmentBase parent)
    throws XmlPullParserException, IOException {

  long timescale = parseLong(xpp, "timescale", parent != null ? parent.timescale : 1);
  long presentationTimeOffset = parseLong(xpp, "presentationTimeOffset",
      parent != null ? parent.presentationTimeOffset : 0);

  long indexStart = parent != null ? parent.indexStart : 0;
  long indexLength = parent != null ? parent.indexLength : 0;
  String indexRangeText = xpp.getAttributeValue(null, "indexRange");
  if (indexRangeText != null) {
    String[] indexRange = indexRangeText.split("-");
    indexStart = Long.parseLong(indexRange[0]);
    indexLength = Long.parseLong(indexRange[1]) - indexStart + 1;
  }

  RangedUri initialization = parent != null ? parent.initialization : null;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "Initialization")) {
      initialization = parseInitialization(xpp);
    } else {
      maybeSkipTag(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "SegmentBase"));

  return buildSingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #12
Source File: DashManifestParser.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
protected SingleSegmentBase parseSegmentBase(XmlPullParser xpp, SingleSegmentBase parent)
    throws XmlPullParserException, IOException {

  long timescale = parseLong(xpp, "timescale", parent != null ? parent.timescale : 1);
  long presentationTimeOffset = parseLong(xpp, "presentationTimeOffset",
      parent != null ? parent.presentationTimeOffset : 0);

  long indexStart = parent != null ? parent.indexStart : 0;
  long indexLength = parent != null ? parent.indexLength : 0;
  String indexRangeText = xpp.getAttributeValue(null, "indexRange");
  if (indexRangeText != null) {
    String[] indexRange = indexRangeText.split("-");
    indexStart = Long.parseLong(indexRange[0]);
    indexLength = Long.parseLong(indexRange[1]) - indexStart + 1;
  }

  RangedUri initialization = parent != null ? parent.initialization : null;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "Initialization")) {
      initialization = parseInitialization(xpp);
    } else {
      maybeSkipTag(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "SegmentBase"));

  return buildSingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #13
Source File: Representation.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * @param contentId Identifies the piece of content to which this representation belongs.
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase The segment base underlying the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public SingleSegmentRepresentation(String contentId, long revisionId, Format format,
    String baseUrl, SingleSegmentBase segmentBase, List<SchemeValuePair> inbandEventStreams,
    String customCacheKey, long contentLength) {
  super(contentId, revisionId, format, baseUrl, segmentBase, inbandEventStreams);
  this.uri = Uri.parse(baseUrl);
  this.indexUri = segmentBase.getIndex();
  this.cacheKey = customCacheKey != null ? customCacheKey
      : contentId != null ? contentId + "." + format.id + "." + revisionId : null;
  this.contentLength = contentLength;
  // If we have an index uri then the index is defined externally, and we shouldn't return one
  // directly. If we don't, then we can't do better than an index defining a single segment.
  segmentIndex = indexUri != null ? null
      : new SingleSegmentIndex(new RangedUri(null, 0, contentLength));
}
 
Example #14
Source File: Representation.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * Constructs a new instance.
 *
 * @param contentId Identifies the piece of content to which this representation belongs.
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase A segment base element for the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null. This
 *     parameter is ignored if {@code segmentBase} consists of multiple segments.
 * @return The constructed instance.
 */
public static Representation newInstance(String contentId, long revisionId, Format format,
    String baseUrl, SegmentBase segmentBase, List<SchemeValuePair> inbandEventStreams,
    String customCacheKey) {
  if (segmentBase instanceof SingleSegmentBase) {
    return new SingleSegmentRepresentation(contentId, revisionId, format, baseUrl,
        (SingleSegmentBase) segmentBase, inbandEventStreams, customCacheKey, C.LENGTH_UNSET);
  } else if (segmentBase instanceof MultiSegmentBase) {
    return new MultiSegmentRepresentation(contentId, revisionId, format, baseUrl,
        (MultiSegmentBase) segmentBase, inbandEventStreams);
  } else {
    throw new IllegalArgumentException("segmentBase must be of type SingleSegmentBase or "
        + "MultiSegmentBase");
  }
}
 
Example #15
Source File: DashManifestParser.java    From K-Sonic with MIT License 5 votes vote down vote up
protected SingleSegmentBase parseSegmentBase(XmlPullParser xpp, SingleSegmentBase parent)
    throws XmlPullParserException, IOException {

  long timescale = parseLong(xpp, "timescale", parent != null ? parent.timescale : 1);
  long presentationTimeOffset = parseLong(xpp, "presentationTimeOffset",
      parent != null ? parent.presentationTimeOffset : 0);

  long indexStart = parent != null ? parent.indexStart : 0;
  long indexLength = parent != null ? parent.indexLength : 0;
  String indexRangeText = xpp.getAttributeValue(null, "indexRange");
  if (indexRangeText != null) {
    String[] indexRange = indexRangeText.split("-");
    indexStart = Long.parseLong(indexRange[0]);
    indexLength = Long.parseLong(indexRange[1]) - indexStart + 1;
  }

  RangedUri initialization = parent != null ? parent.initialization : null;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "Initialization")) {
      initialization = parseInitialization(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "SegmentBase"));

  return buildSingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #16
Source File: Representation.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param contentId Identifies the piece of content to which this representation belongs.
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase The segment base underlying the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public SingleSegmentRepresentation(String contentId, long revisionId, Format format,
    String baseUrl, SingleSegmentBase segmentBase, List<Descriptor> inbandEventStreams,
    String customCacheKey, long contentLength) {
  super(contentId, revisionId, format, baseUrl, segmentBase, inbandEventStreams);
  this.uri = Uri.parse(baseUrl);
  this.indexUri = segmentBase.getIndex();
  this.cacheKey = customCacheKey != null ? customCacheKey
      : contentId != null ? contentId + "." + format.id + "." + revisionId : null;
  this.contentLength = contentLength;
  // If we have an index uri then the index is defined externally, and we shouldn't return one
  // directly. If we don't, then we can't do better than an index defining a single segment.
  segmentIndex = indexUri != null ? null
      : new SingleSegmentIndex(new RangedUri(null, 0, contentLength));
}
 
Example #17
Source File: Representation.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new instance.
 *
 * @param contentId Identifies the piece of content to which this representation belongs.
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase A segment base element for the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null. This
 *     parameter is ignored if {@code segmentBase} consists of multiple segments.
 * @return The constructed instance.
 */
public static Representation newInstance(String contentId, long revisionId, Format format,
    String baseUrl, SegmentBase segmentBase, List<Descriptor> inbandEventStreams,
    String customCacheKey) {
  if (segmentBase instanceof SingleSegmentBase) {
    return new SingleSegmentRepresentation(contentId, revisionId, format, baseUrl,
        (SingleSegmentBase) segmentBase, inbandEventStreams, customCacheKey, C.LENGTH_UNSET);
  } else if (segmentBase instanceof MultiSegmentBase) {
    return new MultiSegmentRepresentation(contentId, revisionId, format, baseUrl,
        (MultiSegmentBase) segmentBase, inbandEventStreams);
  } else {
    throw new IllegalArgumentException("segmentBase must be of type SingleSegmentBase or "
        + "MultiSegmentBase");
  }
}
 
Example #18
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
protected SingleSegmentBase parseSegmentBase(XmlPullParser xpp, SingleSegmentBase parent)
    throws XmlPullParserException, IOException {

  long timescale = parseLong(xpp, "timescale", parent != null ? parent.timescale : 1);
  long presentationTimeOffset = parseLong(xpp, "presentationTimeOffset",
      parent != null ? parent.presentationTimeOffset : 0);

  long indexStart = parent != null ? parent.indexStart : 0;
  long indexLength = parent != null ? parent.indexLength : 0;
  String indexRangeText = xpp.getAttributeValue(null, "indexRange");
  if (indexRangeText != null) {
    String[] indexRange = indexRangeText.split("-");
    indexStart = Long.parseLong(indexRange[0]);
    indexLength = Long.parseLong(indexRange[1]) - indexStart + 1;
  }

  RangedUri initialization = parent != null ? parent.initialization : null;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "Initialization")) {
      initialization = parseInitialization(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "SegmentBase"));

  return buildSingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #19
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
protected SingleSegmentBase parseSegmentBase(XmlPullParser xpp, SingleSegmentBase parent)
    throws XmlPullParserException, IOException {

  long timescale = parseLong(xpp, "timescale", parent != null ? parent.timescale : 1);
  long presentationTimeOffset = parseLong(xpp, "presentationTimeOffset",
      parent != null ? parent.presentationTimeOffset : 0);

  long indexStart = parent != null ? parent.indexStart : 0;
  long indexLength = parent != null ? parent.indexLength : 0;
  String indexRangeText = xpp.getAttributeValue(null, "indexRange");
  if (indexRangeText != null) {
    String[] indexRange = indexRangeText.split("-");
    indexStart = Long.parseLong(indexRange[0]);
    indexLength = Long.parseLong(indexRange[1]) - indexStart + 1;
  }

  RangedUri initialization = parent != null ? parent.initialization : null;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "Initialization")) {
      initialization = parseInitialization(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "SegmentBase"));

  return buildSingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #20
Source File: Representation.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param contentId Identifies the piece of content to which this representation belongs.
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase The segment base underlying the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null.
 * @param contentLength The content length, or {@link C#LENGTH_UNSET} if unknown.
 */
public SingleSegmentRepresentation(String contentId, long revisionId, Format format,
    String baseUrl, SingleSegmentBase segmentBase, List<Descriptor> inbandEventStreams,
    String customCacheKey, long contentLength) {
  super(contentId, revisionId, format, baseUrl, segmentBase, inbandEventStreams);
  this.uri = Uri.parse(baseUrl);
  this.indexUri = segmentBase.getIndex();
  this.cacheKey = customCacheKey != null ? customCacheKey
      : contentId != null ? contentId + "." + format.id + "." + revisionId : null;
  this.contentLength = contentLength;
  // If we have an index uri then the index is defined externally, and we shouldn't return one
  // directly. If we don't, then we can't do better than an index defining a single segment.
  segmentIndex = indexUri != null ? null
      : new SingleSegmentIndex(new RangedUri(null, 0, contentLength));
}
 
Example #21
Source File: Representation.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new instance.
 *
 * @param contentId Identifies the piece of content to which this representation belongs.
 * @param revisionId Identifies the revision of the content.
 * @param format The format of the representation.
 * @param baseUrl The base URL of the representation.
 * @param segmentBase A segment base element for the representation.
 * @param inbandEventStreams The in-band event streams in the representation. May be null.
 * @param customCacheKey A custom value to be returned from {@link #getCacheKey()}, or null. This
 *     parameter is ignored if {@code segmentBase} consists of multiple segments.
 * @return The constructed instance.
 */
public static Representation newInstance(String contentId, long revisionId, Format format,
    String baseUrl, SegmentBase segmentBase, List<Descriptor> inbandEventStreams,
    String customCacheKey) {
  if (segmentBase instanceof SingleSegmentBase) {
    return new SingleSegmentRepresentation(contentId, revisionId, format, baseUrl,
        (SingleSegmentBase) segmentBase, inbandEventStreams, customCacheKey, C.LENGTH_UNSET);
  } else if (segmentBase instanceof MultiSegmentBase) {
    return new MultiSegmentRepresentation(contentId, revisionId, format, baseUrl,
        (MultiSegmentBase) segmentBase, inbandEventStreams);
  } else {
    throw new IllegalArgumentException("segmentBase must be of type SingleSegmentBase or "
        + "MultiSegmentBase");
  }
}
 
Example #22
Source File: DashManifestParser.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
protected RepresentationInfo parseRepresentation(
    XmlPullParser xpp,
    String baseUrl,
    String adaptationSetMimeType,
    String adaptationSetCodecs,
    int adaptationSetWidth,
    int adaptationSetHeight,
    float adaptationSetFrameRate,
    int adaptationSetAudioChannels,
    int adaptationSetAudioSamplingRate,
    String adaptationSetLanguage,
    List<Descriptor> adaptationSetRoleDescriptors,
    List<Descriptor> adaptationSetAccessibilityDescriptors,
    List<Descriptor> adaptationSetSupplementalProperties,
    SegmentBase segmentBase)
    throws XmlPullParserException, IOException {
  String id = xpp.getAttributeValue(null, "id");
  int bandwidth = parseInt(xpp, "bandwidth", Format.NO_VALUE);

  String mimeType = parseString(xpp, "mimeType", adaptationSetMimeType);
  String codecs = parseString(xpp, "codecs", adaptationSetCodecs);
  int width = parseInt(xpp, "width", adaptationSetWidth);
  int height = parseInt(xpp, "height", adaptationSetHeight);
  float frameRate = parseFrameRate(xpp, adaptationSetFrameRate);
  int audioChannels = adaptationSetAudioChannels;
  int audioSamplingRate = parseInt(xpp, "audioSamplingRate", adaptationSetAudioSamplingRate);
  String drmSchemeType = null;
  ArrayList<SchemeData> drmSchemeDatas = new ArrayList<>();
  ArrayList<Descriptor> inbandEventStreams = new ArrayList<>();
  ArrayList<Descriptor> supplementalProperties = new ArrayList<>();

  boolean seenFirstBaseUrl = false;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "BaseURL")) {
      if (!seenFirstBaseUrl) {
        baseUrl = parseBaseUrl(xpp, baseUrl);
        seenFirstBaseUrl = true;
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) {
      audioChannels = parseAudioChannelConfiguration(xpp);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentBase")) {
      segmentBase = parseSegmentBase(xpp, (SingleSegmentBase) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentList")) {
      segmentBase = parseSegmentList(xpp, (SegmentList) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) {
      segmentBase =
          parseSegmentTemplate(
              xpp, (SegmentTemplate) segmentBase, adaptationSetSupplementalProperties);
    } else if (XmlPullParserUtil.isStartTag(xpp, "ContentProtection")) {
      Pair<String, SchemeData> contentProtection = parseContentProtection(xpp);
      if (contentProtection.first != null) {
        drmSchemeType = contentProtection.first;
      }
      if (contentProtection.second != null) {
        drmSchemeDatas.add(contentProtection.second);
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "InbandEventStream")) {
      inbandEventStreams.add(parseDescriptor(xpp, "InbandEventStream"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "SupplementalProperty")) {
      supplementalProperties.add(parseDescriptor(xpp, "SupplementalProperty"));
    } else {
      maybeSkipTag(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "Representation"));

  Format format =
      buildFormat(
          id,
          mimeType,
          width,
          height,
          frameRate,
          audioChannels,
          audioSamplingRate,
          bandwidth,
          adaptationSetLanguage,
          adaptationSetRoleDescriptors,
          adaptationSetAccessibilityDescriptors,
          codecs,
          supplementalProperties);
  segmentBase = segmentBase != null ? segmentBase : new SingleSegmentBase();

  return new RepresentationInfo(format, baseUrl, segmentBase, drmSchemeType, drmSchemeDatas,
      inbandEventStreams, Representation.REVISION_ID_DEFAULT);
}
 
Example #23
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
protected AdaptationSet parseAdaptationSet(XmlPullParser xpp, String baseUrl,
    SegmentBase segmentBase) throws XmlPullParserException, IOException {
  int id = parseInt(xpp, "id", AdaptationSet.ID_UNSET);
  int contentType = parseContentType(xpp);

  String mimeType = xpp.getAttributeValue(null, "mimeType");
  String codecs = xpp.getAttributeValue(null, "codecs");
  int width = parseInt(xpp, "width", Format.NO_VALUE);
  int height = parseInt(xpp, "height", Format.NO_VALUE);
  float frameRate = parseFrameRate(xpp, Format.NO_VALUE);
  int audioChannels = Format.NO_VALUE;
  int audioSamplingRate = parseInt(xpp, "audioSamplingRate", Format.NO_VALUE);
  String language = xpp.getAttributeValue(null, "lang");
  String label = xpp.getAttributeValue(null, "label");
  String drmSchemeType = null;
  ArrayList<SchemeData> drmSchemeDatas = new ArrayList<>();
  ArrayList<Descriptor> inbandEventStreams = new ArrayList<>();
  ArrayList<Descriptor> accessibilityDescriptors = new ArrayList<>();
  ArrayList<Descriptor> supplementalProperties = new ArrayList<>();
  List<RepresentationInfo> representationInfos = new ArrayList<>();
  @C.SelectionFlags int selectionFlags = 0;

  boolean seenFirstBaseUrl = false;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "BaseURL")) {
      if (!seenFirstBaseUrl) {
        baseUrl = parseBaseUrl(xpp, baseUrl);
        seenFirstBaseUrl = true;
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "ContentProtection")) {
      Pair<String, SchemeData> contentProtection = parseContentProtection(xpp);
      if (contentProtection.first != null) {
        drmSchemeType = contentProtection.first;
      }
      if (contentProtection.second != null) {
        drmSchemeDatas.add(contentProtection.second);
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "ContentComponent")) {
      language = checkLanguageConsistency(language, xpp.getAttributeValue(null, "lang"));
      contentType = checkContentTypeConsistency(contentType, parseContentType(xpp));
    } else if (XmlPullParserUtil.isStartTag(xpp, "Role")) {
      selectionFlags |= parseRole(xpp);
    } else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) {
      audioChannels = parseAudioChannelConfiguration(xpp);
    } else if (XmlPullParserUtil.isStartTag(xpp, "Accessibility")) {
      accessibilityDescriptors.add(parseDescriptor(xpp, "Accessibility"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "SupplementalProperty")) {
      supplementalProperties.add(parseDescriptor(xpp, "SupplementalProperty"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "Representation")) {
      RepresentationInfo representationInfo =
          parseRepresentation(
              xpp,
              baseUrl,
              label,
              mimeType,
              codecs,
              width,
              height,
              frameRate,
              audioChannels,
              audioSamplingRate,
              language,
              selectionFlags,
              accessibilityDescriptors,
              segmentBase);
      contentType = checkContentTypeConsistency(contentType,
          getContentType(representationInfo.format));
      representationInfos.add(representationInfo);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentBase")) {
      segmentBase = parseSegmentBase(xpp, (SingleSegmentBase) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentList")) {
      segmentBase = parseSegmentList(xpp, (SegmentList) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) {
      segmentBase = parseSegmentTemplate(xpp, (SegmentTemplate) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "InbandEventStream")) {
      inbandEventStreams.add(parseDescriptor(xpp, "InbandEventStream"));
    } else if (XmlPullParserUtil.isStartTag(xpp)) {
      parseAdaptationSetChild(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "AdaptationSet"));

  // Build the representations.
  List<Representation> representations = new ArrayList<>(representationInfos.size());
  for (int i = 0; i < representationInfos.size(); i++) {
    representations.add(buildRepresentation(representationInfos.get(i), contentId,
        drmSchemeType, drmSchemeDatas, inbandEventStreams));
  }

  return buildAdaptationSet(id, contentType, representations, accessibilityDescriptors,
      supplementalProperties);
}
 
Example #24
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
protected SingleSegmentBase buildSingleSegmentBase(RangedUri initialization, long timescale,
    long presentationTimeOffset, long indexStart, long indexLength) {
  return new SingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #25
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
protected RepresentationInfo parseRepresentation(
    XmlPullParser xpp,
    String baseUrl,
    String label,
    String adaptationSetMimeType,
    String adaptationSetCodecs,
    int adaptationSetWidth,
    int adaptationSetHeight,
    float adaptationSetFrameRate,
    int adaptationSetAudioChannels,
    int adaptationSetAudioSamplingRate,
    String adaptationSetLanguage,
    @C.SelectionFlags int adaptationSetSelectionFlags,
    List<Descriptor> adaptationSetAccessibilityDescriptors,
    SegmentBase segmentBase)
    throws XmlPullParserException, IOException {
  String id = xpp.getAttributeValue(null, "id");
  int bandwidth = parseInt(xpp, "bandwidth", Format.NO_VALUE);

  String mimeType = parseString(xpp, "mimeType", adaptationSetMimeType);
  String codecs = parseString(xpp, "codecs", adaptationSetCodecs);
  int width = parseInt(xpp, "width", adaptationSetWidth);
  int height = parseInt(xpp, "height", adaptationSetHeight);
  float frameRate = parseFrameRate(xpp, adaptationSetFrameRate);
  int audioChannels = adaptationSetAudioChannels;
  int audioSamplingRate = parseInt(xpp, "audioSamplingRate", adaptationSetAudioSamplingRate);
  String drmSchemeType = null;
  ArrayList<SchemeData> drmSchemeDatas = new ArrayList<>();
  ArrayList<Descriptor> inbandEventStreams = new ArrayList<>();
  ArrayList<Descriptor> supplementalProperties = new ArrayList<>();

  boolean seenFirstBaseUrl = false;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "BaseURL")) {
      if (!seenFirstBaseUrl) {
        baseUrl = parseBaseUrl(xpp, baseUrl);
        seenFirstBaseUrl = true;
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) {
      audioChannels = parseAudioChannelConfiguration(xpp);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentBase")) {
      segmentBase = parseSegmentBase(xpp, (SingleSegmentBase) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentList")) {
      segmentBase = parseSegmentList(xpp, (SegmentList) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) {
      segmentBase = parseSegmentTemplate(xpp, (SegmentTemplate) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "ContentProtection")) {
      Pair<String, SchemeData> contentProtection = parseContentProtection(xpp);
      if (contentProtection.first != null) {
        drmSchemeType = contentProtection.first;
      }
      if (contentProtection.second != null) {
        drmSchemeDatas.add(contentProtection.second);
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "InbandEventStream")) {
      inbandEventStreams.add(parseDescriptor(xpp, "InbandEventStream"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "SupplementalProperty")) {
      supplementalProperties.add(parseDescriptor(xpp, "SupplementalProperty"));
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "Representation"));

  Format format =
      buildFormat(
          id,
          label,
          mimeType,
          width,
          height,
          frameRate,
          audioChannels,
          audioSamplingRate,
          bandwidth,
          adaptationSetLanguage,
          adaptationSetSelectionFlags,
          adaptationSetAccessibilityDescriptors,
          codecs,
          supplementalProperties);
  segmentBase = segmentBase != null ? segmentBase : new SingleSegmentBase();

  return new RepresentationInfo(format, baseUrl, segmentBase, drmSchemeType, drmSchemeDatas,
      inbandEventStreams, Representation.REVISION_ID_DEFAULT);
}
 
Example #26
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
protected RepresentationInfo parseRepresentation(
    XmlPullParser xpp,
    String baseUrl,
    String adaptationSetMimeType,
    String adaptationSetCodecs,
    int adaptationSetWidth,
    int adaptationSetHeight,
    float adaptationSetFrameRate,
    int adaptationSetAudioChannels,
    int adaptationSetAudioSamplingRate,
    String adaptationSetLanguage,
    List<Descriptor> adaptationSetRoleDescriptors,
    List<Descriptor> adaptationSetAccessibilityDescriptors,
    List<Descriptor> adaptationSetSupplementalProperties,
    SegmentBase segmentBase)
    throws XmlPullParserException, IOException {
  String id = xpp.getAttributeValue(null, "id");
  int bandwidth = parseInt(xpp, "bandwidth", Format.NO_VALUE);

  String mimeType = parseString(xpp, "mimeType", adaptationSetMimeType);
  String codecs = parseString(xpp, "codecs", adaptationSetCodecs);
  int width = parseInt(xpp, "width", adaptationSetWidth);
  int height = parseInt(xpp, "height", adaptationSetHeight);
  float frameRate = parseFrameRate(xpp, adaptationSetFrameRate);
  int audioChannels = adaptationSetAudioChannels;
  int audioSamplingRate = parseInt(xpp, "audioSamplingRate", adaptationSetAudioSamplingRate);
  String drmSchemeType = null;
  ArrayList<SchemeData> drmSchemeDatas = new ArrayList<>();
  ArrayList<Descriptor> inbandEventStreams = new ArrayList<>();
  ArrayList<Descriptor> supplementalProperties = new ArrayList<>();

  boolean seenFirstBaseUrl = false;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "BaseURL")) {
      if (!seenFirstBaseUrl) {
        baseUrl = parseBaseUrl(xpp, baseUrl);
        seenFirstBaseUrl = true;
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) {
      audioChannels = parseAudioChannelConfiguration(xpp);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentBase")) {
      segmentBase = parseSegmentBase(xpp, (SingleSegmentBase) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentList")) {
      segmentBase = parseSegmentList(xpp, (SegmentList) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) {
      segmentBase =
          parseSegmentTemplate(
              xpp, (SegmentTemplate) segmentBase, adaptationSetSupplementalProperties);
    } else if (XmlPullParserUtil.isStartTag(xpp, "ContentProtection")) {
      Pair<String, SchemeData> contentProtection = parseContentProtection(xpp);
      if (contentProtection.first != null) {
        drmSchemeType = contentProtection.first;
      }
      if (contentProtection.second != null) {
        drmSchemeDatas.add(contentProtection.second);
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "InbandEventStream")) {
      inbandEventStreams.add(parseDescriptor(xpp, "InbandEventStream"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "SupplementalProperty")) {
      supplementalProperties.add(parseDescriptor(xpp, "SupplementalProperty"));
    } else {
      maybeSkipTag(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "Representation"));

  Format format =
      buildFormat(
          id,
          mimeType,
          width,
          height,
          frameRate,
          audioChannels,
          audioSamplingRate,
          bandwidth,
          adaptationSetLanguage,
          adaptationSetRoleDescriptors,
          adaptationSetAccessibilityDescriptors,
          codecs,
          supplementalProperties);
  segmentBase = segmentBase != null ? segmentBase : new SingleSegmentBase();

  return new RepresentationInfo(format, baseUrl, segmentBase, drmSchemeType, drmSchemeDatas,
      inbandEventStreams, Representation.REVISION_ID_DEFAULT);
}
 
Example #27
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
protected AdaptationSet parseAdaptationSet(XmlPullParser xpp, String baseUrl,
    SegmentBase segmentBase) throws XmlPullParserException, IOException {
  int id = parseInt(xpp, "id", AdaptationSet.ID_UNSET);
  int contentType = parseContentType(xpp);

  String mimeType = xpp.getAttributeValue(null, "mimeType");
  String codecs = xpp.getAttributeValue(null, "codecs");
  int width = parseInt(xpp, "width", Format.NO_VALUE);
  int height = parseInt(xpp, "height", Format.NO_VALUE);
  float frameRate = parseFrameRate(xpp, Format.NO_VALUE);
  int audioChannels = Format.NO_VALUE;
  int audioSamplingRate = parseInt(xpp, "audioSamplingRate", Format.NO_VALUE);
  String language = xpp.getAttributeValue(null, "lang");
  String label = xpp.getAttributeValue(null, "label");
  String drmSchemeType = null;
  ArrayList<SchemeData> drmSchemeDatas = new ArrayList<>();
  ArrayList<Descriptor> inbandEventStreams = new ArrayList<>();
  ArrayList<Descriptor> accessibilityDescriptors = new ArrayList<>();
  ArrayList<Descriptor> roleDescriptors = new ArrayList<>();
  ArrayList<Descriptor> supplementalProperties = new ArrayList<>();
  List<RepresentationInfo> representationInfos = new ArrayList<>();

  boolean seenFirstBaseUrl = false;
  do {
    xpp.next();
    if (XmlPullParserUtil.isStartTag(xpp, "BaseURL")) {
      if (!seenFirstBaseUrl) {
        baseUrl = parseBaseUrl(xpp, baseUrl);
        seenFirstBaseUrl = true;
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "ContentProtection")) {
      Pair<String, SchemeData> contentProtection = parseContentProtection(xpp);
      if (contentProtection.first != null) {
        drmSchemeType = contentProtection.first;
      }
      if (contentProtection.second != null) {
        drmSchemeDatas.add(contentProtection.second);
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "ContentComponent")) {
      language = checkLanguageConsistency(language, xpp.getAttributeValue(null, "lang"));
      contentType = checkContentTypeConsistency(contentType, parseContentType(xpp));
    } else if (XmlPullParserUtil.isStartTag(xpp, "Role")) {
      roleDescriptors.add(parseDescriptor(xpp, "Role"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "AudioChannelConfiguration")) {
      audioChannels = parseAudioChannelConfiguration(xpp);
    } else if (XmlPullParserUtil.isStartTag(xpp, "Accessibility")) {
      accessibilityDescriptors.add(parseDescriptor(xpp, "Accessibility"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "SupplementalProperty")) {
      supplementalProperties.add(parseDescriptor(xpp, "SupplementalProperty"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "Representation")) {
      RepresentationInfo representationInfo =
          parseRepresentation(
              xpp,
              baseUrl,
              mimeType,
              codecs,
              width,
              height,
              frameRate,
              audioChannels,
              audioSamplingRate,
              language,
              roleDescriptors,
              accessibilityDescriptors,
              supplementalProperties,
              segmentBase);
      contentType = checkContentTypeConsistency(contentType,
          getContentType(representationInfo.format));
      representationInfos.add(representationInfo);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentBase")) {
      segmentBase = parseSegmentBase(xpp, (SingleSegmentBase) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentList")) {
      segmentBase = parseSegmentList(xpp, (SegmentList) segmentBase);
    } else if (XmlPullParserUtil.isStartTag(xpp, "SegmentTemplate")) {
      segmentBase =
          parseSegmentTemplate(xpp, (SegmentTemplate) segmentBase, supplementalProperties);
    } else if (XmlPullParserUtil.isStartTag(xpp, "InbandEventStream")) {
      inbandEventStreams.add(parseDescriptor(xpp, "InbandEventStream"));
    } else if (XmlPullParserUtil.isStartTag(xpp, "Label")) {
      label = parseLabel(xpp);
    } else if (XmlPullParserUtil.isStartTag(xpp)) {
      parseAdaptationSetChild(xpp);
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "AdaptationSet"));

  // Build the representations.
  List<Representation> representations = new ArrayList<>(representationInfos.size());
  for (int i = 0; i < representationInfos.size(); i++) {
    representations.add(
        buildRepresentation(
            representationInfos.get(i),
            label,
            drmSchemeType,
            drmSchemeDatas,
            inbandEventStreams));
  }

  return buildAdaptationSet(id, contentType, representations, accessibilityDescriptors,
      supplementalProperties);
}
 
Example #28
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
protected SingleSegmentBase buildSingleSegmentBase(RangedUri initialization, long timescale,
    long presentationTimeOffset, long indexStart, long indexLength) {
  return new SingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #29
Source File: DashManifestParser.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
protected SingleSegmentBase buildSingleSegmentBase(RangedUri initialization, long timescale,
    long presentationTimeOffset, long indexStart, long indexLength) {
  return new SingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}
 
Example #30
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
protected SingleSegmentBase buildSingleSegmentBase(RangedUri initialization, long timescale,
    long presentationTimeOffset, long indexStart, long indexLength) {
  return new SingleSegmentBase(initialization, timescale, presentationTimeOffset, indexStart,
      indexLength);
}