Java Code Examples for com.google.android.exoplayer2.C#SelectionFlags

The following examples show how to use com.google.android.exoplayer2.C#SelectionFlags . 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: HlsPlaylistParser.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@C.SelectionFlags
private static int parseSelectionFlags(String line) {
  int flags = 0;
  if (parseOptionalBooleanAttribute(line, REGEX_DEFAULT, false)) {
    flags |= C.SELECTION_FLAG_DEFAULT;
  }
  if (parseOptionalBooleanAttribute(line, REGEX_FORCED, false)) {
    flags |= C.SELECTION_FLAG_FORCED;
  }
  if (parseOptionalBooleanAttribute(line, REGEX_AUTOSELECT, false)) {
    flags |= C.SELECTION_FLAG_AUTOSELECT;
  }
  return flags;
}
 
Example 2
Source File: TrackSelectionParameters.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
TrackSelectionParameters(
    @Nullable String preferredAudioLanguage,
    @Nullable String preferredTextLanguage,
    @C.RoleFlags int preferredTextRoleFlags,
    boolean selectUndeterminedTextLanguage,
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  // Audio
  this.preferredAudioLanguage = Util.normalizeLanguageCode(preferredAudioLanguage);
  // Text
  this.preferredTextLanguage = Util.normalizeLanguageCode(preferredTextLanguage);
  this.preferredTextRoleFlags = preferredTextRoleFlags;
  this.selectUndeterminedTextLanguage = selectUndeterminedTextLanguage;
  this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
}
 
Example 3
Source File: DashManifestParser.java    From K-Sonic with MIT License 5 votes vote down vote up
protected Format buildFormat(String id, String containerMimeType, int width, int height,
    float frameRate, int audioChannels, int audioSamplingRate, int bitrate, String language,
    @C.SelectionFlags int selectionFlags, List<SchemeValuePair> accessibilityDescriptors,
    String codecs) {
  String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
  if (sampleMimeType != null) {
    if (MimeTypes.isVideo(sampleMimeType)) {
      return Format.createVideoContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, width, height, frameRate, null, selectionFlags);
    } else if (MimeTypes.isAudio(sampleMimeType)) {
      return Format.createAudioContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, audioChannels, audioSamplingRate, null, selectionFlags, language);
    } else if (mimeTypeIsRawText(sampleMimeType)) {
      int accessibilityChannel;
      if (MimeTypes.APPLICATION_CEA608.equals(sampleMimeType)) {
        accessibilityChannel = parseCea608AccessibilityChannel(accessibilityDescriptors);
      } else if (MimeTypes.APPLICATION_CEA708.equals(sampleMimeType)) {
        accessibilityChannel = parseCea708AccessibilityChannel(accessibilityDescriptors);
      } else {
        accessibilityChannel = Format.NO_VALUE;
      }
      return Format.createTextContainerFormat(id, containerMimeType, sampleMimeType, codecs,
          bitrate, selectionFlags, language, accessibilityChannel);
    }
  }
  return Format.createContainerFormat(id, containerMimeType, sampleMimeType, codecs, bitrate,
      selectionFlags, language);
}
 
Example 4
Source File: HlsPlaylistParser.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@C.SelectionFlags
private static int parseSelectionFlags(String line) {
  int flags = 0;
  if (parseOptionalBooleanAttribute(line, REGEX_DEFAULT, false)) {
    flags |= C.SELECTION_FLAG_DEFAULT;
  }
  if (parseOptionalBooleanAttribute(line, REGEX_FORCED, false)) {
    flags |= C.SELECTION_FLAG_FORCED;
  }
  if (parseOptionalBooleanAttribute(line, REGEX_AUTOSELECT, false)) {
    flags |= C.SELECTION_FLAG_AUTOSELECT;
  }
  return flags;
}
 
Example 5
Source File: HlsPlaylistParser.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@C.SelectionFlags
private static int parseSelectionFlags(String line) {
  int flags = 0;
  if (parseOptionalBooleanAttribute(line, REGEX_DEFAULT, false)) {
    flags |= C.SELECTION_FLAG_DEFAULT;
  }
  if (parseOptionalBooleanAttribute(line, REGEX_FORCED, false)) {
    flags |= C.SELECTION_FLAG_FORCED;
  }
  if (parseOptionalBooleanAttribute(line, REGEX_AUTOSELECT, false)) {
    flags |= C.SELECTION_FLAG_AUTOSELECT;
  }
  return flags;
}
 
Example 6
Source File: TrackSelectionParameters.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
TrackSelectionParameters(
    @Nullable String preferredAudioLanguage,
    @Nullable String preferredTextLanguage,
    @C.RoleFlags int preferredTextRoleFlags,
    boolean selectUndeterminedTextLanguage,
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  // Audio
  this.preferredAudioLanguage = Util.normalizeLanguageCode(preferredAudioLanguage);
  // Text
  this.preferredTextLanguage = Util.normalizeLanguageCode(preferredTextLanguage);
  this.preferredTextRoleFlags = preferredTextRoleFlags;
  this.selectUndeterminedTextLanguage = selectUndeterminedTextLanguage;
  this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
}
 
Example 7
Source File: DefaultTrackSelector.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
Parameters(
    // Video
    int maxVideoWidth,
    int maxVideoHeight,
    int maxVideoFrameRate,
    int maxVideoBitrate,
    boolean exceedVideoConstraintsIfNecessary,
    boolean allowVideoMixedMimeTypeAdaptiveness,
    boolean allowVideoNonSeamlessAdaptiveness,
    int viewportWidth,
    int viewportHeight,
    boolean viewportOrientationMayChange,
    // Audio
    @Nullable String preferredAudioLanguage,
    int maxAudioChannelCount,
    int maxAudioBitrate,
    boolean exceedAudioConstraintsIfNecessary,
    boolean allowAudioMixedMimeTypeAdaptiveness,
    boolean allowAudioMixedSampleRateAdaptiveness,
    boolean allowAudioMixedChannelCountAdaptiveness,
    // Text
    @Nullable String preferredTextLanguage,
    @C.RoleFlags int preferredTextRoleFlags,
    boolean selectUndeterminedTextLanguage,
    @C.SelectionFlags int disabledTextTrackSelectionFlags,
    // General
    boolean forceLowestBitrate,
    boolean forceHighestSupportedBitrate,
    boolean exceedRendererCapabilitiesIfNecessary,
    int tunnelingAudioSessionId,
    // Overrides
    SparseArray<Map<TrackGroupArray, SelectionOverride>> selectionOverrides,
    SparseBooleanArray rendererDisabledFlags) {
  super(
      preferredAudioLanguage,
      preferredTextLanguage,
      preferredTextRoleFlags,
      selectUndeterminedTextLanguage,
      disabledTextTrackSelectionFlags);
  // Video
  this.maxVideoWidth = maxVideoWidth;
  this.maxVideoHeight = maxVideoHeight;
  this.maxVideoFrameRate = maxVideoFrameRate;
  this.maxVideoBitrate = maxVideoBitrate;
  this.exceedVideoConstraintsIfNecessary = exceedVideoConstraintsIfNecessary;
  this.allowVideoMixedMimeTypeAdaptiveness = allowVideoMixedMimeTypeAdaptiveness;
  this.allowVideoNonSeamlessAdaptiveness = allowVideoNonSeamlessAdaptiveness;
  this.viewportWidth = viewportWidth;
  this.viewportHeight = viewportHeight;
  this.viewportOrientationMayChange = viewportOrientationMayChange;
  // Audio
  this.maxAudioChannelCount = maxAudioChannelCount;
  this.maxAudioBitrate = maxAudioBitrate;
  this.exceedAudioConstraintsIfNecessary = exceedAudioConstraintsIfNecessary;
  this.allowAudioMixedMimeTypeAdaptiveness = allowAudioMixedMimeTypeAdaptiveness;
  this.allowAudioMixedSampleRateAdaptiveness = allowAudioMixedSampleRateAdaptiveness;
  this.allowAudioMixedChannelCountAdaptiveness = allowAudioMixedChannelCountAdaptiveness;
  // General
  this.forceLowestBitrate = forceLowestBitrate;
  this.forceHighestSupportedBitrate = forceHighestSupportedBitrate;
  this.exceedRendererCapabilitiesIfNecessary = exceedRendererCapabilitiesIfNecessary;
  this.tunnelingAudioSessionId = tunnelingAudioSessionId;
  // Deprecated fields.
  this.allowMixedMimeAdaptiveness = allowVideoMixedMimeTypeAdaptiveness;
  this.allowNonSeamlessAdaptiveness = allowVideoNonSeamlessAdaptiveness;
  // Overrides
  this.selectionOverrides = selectionOverrides;
  this.rendererDisabledFlags = rendererDisabledFlags;
}
 
Example 8
Source File: DashManifestParser.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
protected Format buildFormat(
    String id,
    String containerMimeType,
    int width,
    int height,
    float frameRate,
    int audioChannels,
    int audioSamplingRate,
    int bitrate,
    String language,
    List<Descriptor> roleDescriptors,
    List<Descriptor> accessibilityDescriptors,
    String codecs,
    List<Descriptor> supplementalProperties) {
  String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
  @C.SelectionFlags int selectionFlags = parseSelectionFlagsFromRoleDescriptors(roleDescriptors);
  @C.RoleFlags int roleFlags = parseRoleFlagsFromRoleDescriptors(roleDescriptors);
  roleFlags |= parseRoleFlagsFromAccessibilityDescriptors(accessibilityDescriptors);
  if (sampleMimeType != null) {
    if (MimeTypes.AUDIO_E_AC3.equals(sampleMimeType)) {
      sampleMimeType = parseEac3SupplementalProperties(supplementalProperties);
    }
    if (MimeTypes.isVideo(sampleMimeType)) {
      return Format.createVideoContainerFormat(
          id,
          /* label= */ null,
          containerMimeType,
          sampleMimeType,
          codecs,
          /* metadata= */ null,
          bitrate,
          width,
          height,
          frameRate,
          /* initializationData= */ null,
          selectionFlags,
          roleFlags);
    } else if (MimeTypes.isAudio(sampleMimeType)) {
      return Format.createAudioContainerFormat(
          id,
          /* label= */ null,
          containerMimeType,
          sampleMimeType,
          codecs,
          /* metadata= */ null,
          bitrate,
          audioChannels,
          audioSamplingRate,
          /* initializationData= */ null,
          selectionFlags,
          roleFlags,
          language);
    } else if (mimeTypeIsRawText(sampleMimeType)) {
      int accessibilityChannel;
      if (MimeTypes.APPLICATION_CEA608.equals(sampleMimeType)) {
        accessibilityChannel = parseCea608AccessibilityChannel(accessibilityDescriptors);
      } else if (MimeTypes.APPLICATION_CEA708.equals(sampleMimeType)) {
        accessibilityChannel = parseCea708AccessibilityChannel(accessibilityDescriptors);
      } else {
        accessibilityChannel = Format.NO_VALUE;
      }
      return Format.createTextContainerFormat(
          id,
          /* label= */ null,
          containerMimeType,
          sampleMimeType,
          codecs,
          bitrate,
          selectionFlags,
          roleFlags,
          language,
          accessibilityChannel);
    }
  }
  return Format.createContainerFormat(
      id,
      /* label= */ null,
      containerMimeType,
      sampleMimeType,
      codecs,
      bitrate,
      selectionFlags,
      roleFlags,
      language);
}
 
Example 9
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 10
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 11
Source File: DashManifestParser.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
protected Format buildFormat(
    String id,
    String label,
    String containerMimeType,
    int width,
    int height,
    float frameRate,
    int audioChannels,
    int audioSamplingRate,
    int bitrate,
    String language,
    @C.SelectionFlags int selectionFlags,
    List<Descriptor> accessibilityDescriptors,
    String codecs,
    List<Descriptor> supplementalProperties) {
  String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
  if (sampleMimeType != null) {
    if (MimeTypes.AUDIO_E_AC3.equals(sampleMimeType)) {
      sampleMimeType = parseEac3SupplementalProperties(supplementalProperties);
    }
    if (MimeTypes.isVideo(sampleMimeType)) {
      return Format.createVideoContainerFormat(
          id,
          label,
          containerMimeType,
          sampleMimeType,
          codecs,
          bitrate,
          width,
          height,
          frameRate,
          /* initializationData= */ null,
          selectionFlags);
    } else if (MimeTypes.isAudio(sampleMimeType)) {
      return Format.createAudioContainerFormat(
          id,
          label,
          containerMimeType,
          sampleMimeType,
          codecs,
          bitrate,
          audioChannels,
          audioSamplingRate,
          /* initializationData= */ null,
          selectionFlags,
          language);
    } else if (mimeTypeIsRawText(sampleMimeType)) {
      int accessibilityChannel;
      if (MimeTypes.APPLICATION_CEA608.equals(sampleMimeType)) {
        accessibilityChannel = parseCea608AccessibilityChannel(accessibilityDescriptors);
      } else if (MimeTypes.APPLICATION_CEA708.equals(sampleMimeType)) {
        accessibilityChannel = parseCea708AccessibilityChannel(accessibilityDescriptors);
      } else {
        accessibilityChannel = Format.NO_VALUE;
      }
      return Format.createTextContainerFormat(
          id,
          label,
          containerMimeType,
          sampleMimeType,
          codecs,
          bitrate,
          selectionFlags,
          language,
          accessibilityChannel);
    }
  }
  return Format.createContainerFormat(
      id, label, containerMimeType, sampleMimeType, codecs, bitrate, selectionFlags, language);
}
 
Example 12
Source File: DefaultTrackSelector.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ParametersBuilder setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  super.setDisabledTextTrackSelectionFlags(disabledTextTrackSelectionFlags);
  return this;
}
 
Example 13
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 14
Source File: DefaultTrackSelector.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
Parameters(
    // Video
    int maxVideoWidth,
    int maxVideoHeight,
    int maxVideoFrameRate,
    int maxVideoBitrate,
    boolean exceedVideoConstraintsIfNecessary,
    boolean allowVideoMixedMimeTypeAdaptiveness,
    boolean allowVideoNonSeamlessAdaptiveness,
    int viewportWidth,
    int viewportHeight,
    boolean viewportOrientationMayChange,
    // Audio
    @Nullable String preferredAudioLanguage,
    int maxAudioChannelCount,
    int maxAudioBitrate,
    boolean exceedAudioConstraintsIfNecessary,
    boolean allowAudioMixedMimeTypeAdaptiveness,
    boolean allowAudioMixedSampleRateAdaptiveness,
    boolean allowAudioMixedChannelCountAdaptiveness,
    // Text
    @Nullable String preferredTextLanguage,
    @C.RoleFlags int preferredTextRoleFlags,
    boolean selectUndeterminedTextLanguage,
    @C.SelectionFlags int disabledTextTrackSelectionFlags,
    // General
    boolean forceLowestBitrate,
    boolean forceHighestSupportedBitrate,
    boolean exceedRendererCapabilitiesIfNecessary,
    int tunnelingAudioSessionId,
    // Overrides
    SparseArray<Map<TrackGroupArray, @NullableType SelectionOverride>> selectionOverrides,
    SparseBooleanArray rendererDisabledFlags) {
  super(
      preferredAudioLanguage,
      preferredTextLanguage,
      preferredTextRoleFlags,
      selectUndeterminedTextLanguage,
      disabledTextTrackSelectionFlags);
  // Video
  this.maxVideoWidth = maxVideoWidth;
  this.maxVideoHeight = maxVideoHeight;
  this.maxVideoFrameRate = maxVideoFrameRate;
  this.maxVideoBitrate = maxVideoBitrate;
  this.exceedVideoConstraintsIfNecessary = exceedVideoConstraintsIfNecessary;
  this.allowVideoMixedMimeTypeAdaptiveness = allowVideoMixedMimeTypeAdaptiveness;
  this.allowVideoNonSeamlessAdaptiveness = allowVideoNonSeamlessAdaptiveness;
  this.viewportWidth = viewportWidth;
  this.viewportHeight = viewportHeight;
  this.viewportOrientationMayChange = viewportOrientationMayChange;
  // Audio
  this.maxAudioChannelCount = maxAudioChannelCount;
  this.maxAudioBitrate = maxAudioBitrate;
  this.exceedAudioConstraintsIfNecessary = exceedAudioConstraintsIfNecessary;
  this.allowAudioMixedMimeTypeAdaptiveness = allowAudioMixedMimeTypeAdaptiveness;
  this.allowAudioMixedSampleRateAdaptiveness = allowAudioMixedSampleRateAdaptiveness;
  this.allowAudioMixedChannelCountAdaptiveness = allowAudioMixedChannelCountAdaptiveness;
  // General
  this.forceLowestBitrate = forceLowestBitrate;
  this.forceHighestSupportedBitrate = forceHighestSupportedBitrate;
  this.exceedRendererCapabilitiesIfNecessary = exceedRendererCapabilitiesIfNecessary;
  this.tunnelingAudioSessionId = tunnelingAudioSessionId;
  // Deprecated fields.
  this.allowMixedMimeAdaptiveness = allowVideoMixedMimeTypeAdaptiveness;
  this.allowNonSeamlessAdaptiveness = allowVideoNonSeamlessAdaptiveness;
  // Overrides
  this.selectionOverrides = selectionOverrides;
  this.rendererDisabledFlags = rendererDisabledFlags;
}
 
Example 15
Source File: DefaultTrackSelector.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@Override
public ParametersBuilder setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  super.setDisabledTextTrackSelectionFlags(disabledTextTrackSelectionFlags);
  return this;
}
 
Example 16
Source File: DashManifestParser.java    From K-Sonic with MIT License 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,
    @C.SelectionFlags int adaptationSetSelectionFlags,
    List<SchemeValuePair> 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);
  ArrayList<SchemeData> drmSchemeDatas = new ArrayList<>();
  ArrayList<SchemeValuePair> inbandEventStreams = 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")) {
      SchemeData contentProtection = parseContentProtection(xpp);
      if (contentProtection != null) {
        drmSchemeDatas.add(contentProtection);
      }
    } else if (XmlPullParserUtil.isStartTag(xpp, "InbandEventStream")) {
      inbandEventStreams.add(parseInbandEventStream(xpp));
    }
  } while (!XmlPullParserUtil.isEndTag(xpp, "Representation"));

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

  return new RepresentationInfo(format, baseUrl, segmentBase, drmSchemeDatas, inbandEventStreams);
}
 
Example 17
Source File: DefaultTrackSelector.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@Override
public ParametersBuilder setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  super.setDisabledTextTrackSelectionFlags(disabledTextTrackSelectionFlags);
  return this;
}
 
Example 18
Source File: TrackSelectionParameters.java    From MediaSDK with Apache License 2.0 2 votes vote down vote up
/**
 * Sets a bitmask of selection flags that are disabled for text track selections.
 *
 * @param disabledTextTrackSelectionFlags A bitmask of {@link C.SelectionFlags} that are
 *     disabled for text track selections.
 * @return This builder.
 */
public Builder setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
  return this;
}
 
Example 19
Source File: TrackSelectionParameters.java    From Telegram with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets a bitmask of selection flags that are disabled for text track selections.
 *
 * @param disabledTextTrackSelectionFlags A bitmask of {@link C.SelectionFlags} that are
 *     disabled for text track selections.
 * @return This builder.
 */
public Builder setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
  return this;
}
 
Example 20
Source File: TrackSelectionParameters.java    From Telegram-FOSS with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets a bitmask of selection flags that are disabled for text track selections.
 *
 * @param disabledTextTrackSelectionFlags A bitmask of {@link C.SelectionFlags} that are
 *     disabled for text track selections.
 * @return This builder.
 */
public Builder setDisabledTextTrackSelectionFlags(
    @C.SelectionFlags int disabledTextTrackSelectionFlags) {
  this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
  return this;
}