Java Code Examples for com.google.android.exoplayer2.drm.DrmInitData#createSessionCreationData()

The following examples show how to use com.google.android.exoplayer2.drm.DrmInitData#createSessionCreationData() . 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: Format.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("ReferenceEquality")
public Format copyWithManifestFormatInfo(Format manifestFormat) {
  if (this == manifestFormat) {
    // No need to copy from ourselves.
    return this;
  }

  int trackType = MimeTypes.getTrackType(sampleMimeType);

  // Use manifest value only.
  String id = manifestFormat.id;

  // Prefer manifest values, but fill in from sample format if missing.
  String label = manifestFormat.label != null ? manifestFormat.label : this.label;
  String language = this.language;
  if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO)
      && manifestFormat.language != null) {
    language = manifestFormat.language;
  }

  // Prefer sample format values, but fill in from manifest if missing.
  int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
  String codecs = this.codecs;
  if (codecs == null) {
    // The manifest format may be muxed, so filter only codecs of this format's type. If we still
    // have more than one codec then we're unable to uniquely identify which codec to fill in.
    String codecsOfType = Util.getCodecsOfType(manifestFormat.codecs, trackType);
    if (Util.splitCodecs(codecsOfType).length == 1) {
      codecs = codecsOfType;
    }
  }

  Metadata metadata =
      this.metadata == null
          ? manifestFormat.metadata
          : this.metadata.copyWithAppendedEntriesFrom(manifestFormat.metadata);

  float frameRate = this.frameRate;
  if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
    frameRate = manifestFormat.frameRate;
  }

  // Merge manifest and sample format values.
  @C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
  @C.RoleFlags int roleFlags = this.roleFlags | manifestFormat.roleFlags;
  DrmInitData drmInitData =
      DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData);

  return new Format(
      id,
      label,
      selectionFlags,
      roleFlags,
      bitrate,
      codecs,
      metadata,
      containerMimeType,
      sampleMimeType,
      maxInputSize,
      initializationData,
      drmInitData,
      subsampleOffsetUs,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      channelCount,
      sampleRate,
      pcmEncoding,
      encoderDelay,
      encoderPadding,
      language,
      accessibilityChannel,
      exoMediaCryptoType);
}
 
Example 2
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("ReferenceEquality")
public Format copyWithManifestFormatInfo(Format manifestFormat) {
  if (this == manifestFormat) {
    // No need to copy from ourselves.
    return this;
  }

  int trackType = MimeTypes.getTrackType(sampleMimeType);

  // Use manifest value only.
  String id = manifestFormat.id;

  // Prefer manifest values, but fill in from sample format if missing.
  String label = manifestFormat.label != null ? manifestFormat.label : this.label;
  String language = this.language;
  if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO)
      && manifestFormat.language != null) {
    language = manifestFormat.language;
  }

  // Prefer sample format values, but fill in from manifest if missing.
  int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
  String codecs = this.codecs;
  if (codecs == null) {
    // The manifest format may be muxed, so filter only codecs of this format's type. If we still
    // have more than one codec then we're unable to uniquely identify which codec to fill in.
    String codecsOfType = Util.getCodecsOfType(manifestFormat.codecs, trackType);
    if (Util.splitCodecs(codecsOfType).length == 1) {
      codecs = codecsOfType;
    }
  }
  float frameRate = this.frameRate;
  if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
    frameRate = manifestFormat.frameRate;
  }

  // Merge manifest and sample format values.
  @C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
  DrmInitData drmInitData =
      DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData);

  return new Format(
      id,
      label,
      containerMimeType,
      sampleMimeType,
      codecs,
      bitrate,
      maxInputSize,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      channelCount,
      sampleRate,
      pcmEncoding,
      encoderDelay,
      encoderPadding,
      selectionFlags,
      language,
      accessibilityChannel,
      subsampleOffsetUs,
      initializationData,
      drmInitData,
      metadata);
}
 
Example 3
Source File: Format.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("ReferenceEquality")
public Format copyWithManifestFormatInfo(Format manifestFormat) {
  if (this == manifestFormat) {
    // No need to copy from ourselves.
    return this;
  }

  int trackType = MimeTypes.getTrackType(sampleMimeType);

  // Use manifest value only.
  String id = manifestFormat.id;

  // Prefer manifest values, but fill in from sample format if missing.
  String label = manifestFormat.label != null ? manifestFormat.label : this.label;
  String language = this.language;
  if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO)
      && manifestFormat.language != null) {
    language = manifestFormat.language;
  }

  // Prefer sample format values, but fill in from manifest if missing.
  int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
  String codecs = this.codecs;
  if (codecs == null) {
    // The manifest format may be muxed, so filter only codecs of this format's type. If we still
    // have more than one codec then we're unable to uniquely identify which codec to fill in.
    String codecsOfType = Util.getCodecsOfType(manifestFormat.codecs, trackType);
    if (Util.splitCodecs(codecsOfType).length == 1) {
      codecs = codecsOfType;
    }
  }
  float frameRate = this.frameRate;
  if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
    frameRate = manifestFormat.frameRate;
  }

  // Merge manifest and sample format values.
  @C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
  DrmInitData drmInitData =
      DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData);

  return new Format(
      id,
      label,
      containerMimeType,
      sampleMimeType,
      codecs,
      bitrate,
      maxInputSize,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      channelCount,
      sampleRate,
      pcmEncoding,
      encoderDelay,
      encoderPadding,
      selectionFlags,
      language,
      accessibilityChannel,
      subsampleOffsetUs,
      initializationData,
      drmInitData,
      metadata);
}
 
Example 4
Source File: Format.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("ReferenceEquality")
public Format copyWithManifestFormatInfo(Format manifestFormat) {
  if (this == manifestFormat) {
    // No need to copy from ourselves.
    return this;
  }

  int trackType = MimeTypes.getTrackType(sampleMimeType);

  // Use manifest value only.
  String id = manifestFormat.id;

  // Prefer manifest values, but fill in from sample format if missing.
  String label = manifestFormat.label != null ? manifestFormat.label : this.label;
  String language = this.language;
  if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO)
      && manifestFormat.language != null) {
    language = manifestFormat.language;
  }

  // Prefer sample format values, but fill in from manifest if missing.
  int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
  String codecs = this.codecs;
  if (codecs == null) {
    // The manifest format may be muxed, so filter only codecs of this format's type. If we still
    // have more than one codec then we're unable to uniquely identify which codec to fill in.
    String codecsOfType = Util.getCodecsOfType(manifestFormat.codecs, trackType);
    if (Util.splitCodecs(codecsOfType).length == 1) {
      codecs = codecsOfType;
    }
  }

  Metadata metadata =
      this.metadata == null
          ? manifestFormat.metadata
          : this.metadata.copyWithAppendedEntriesFrom(manifestFormat.metadata);

  float frameRate = this.frameRate;
  if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
    frameRate = manifestFormat.frameRate;
  }

  // Merge manifest and sample format values.
  @C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
  @C.RoleFlags int roleFlags = this.roleFlags | manifestFormat.roleFlags;
  DrmInitData drmInitData =
      DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData);

  return new Format(
      id,
      label,
      selectionFlags,
      roleFlags,
      bitrate,
      codecs,
      metadata,
      containerMimeType,
      sampleMimeType,
      maxInputSize,
      initializationData,
      drmInitData,
      subsampleOffsetUs,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      channelCount,
      sampleRate,
      pcmEncoding,
      encoderDelay,
      encoderPadding,
      language,
      accessibilityChannel);
}
 
Example 5
Source File: Format.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("ReferenceEquality")
public Format copyWithManifestFormatInfo(Format manifestFormat) {
  if (this == manifestFormat) {
    // No need to copy from ourselves.
    return this;
  }

  int trackType = MimeTypes.getTrackType(sampleMimeType);

  // Use manifest value only.
  String id = manifestFormat.id;

  // Prefer manifest values, but fill in from sample format if missing.
  String label = manifestFormat.label != null ? manifestFormat.label : this.label;
  String language = this.language;
  if ((trackType == C.TRACK_TYPE_TEXT || trackType == C.TRACK_TYPE_AUDIO)
      && manifestFormat.language != null) {
    language = manifestFormat.language;
  }

  // Prefer sample format values, but fill in from manifest if missing.
  int bitrate = this.bitrate == NO_VALUE ? manifestFormat.bitrate : this.bitrate;
  String codecs = this.codecs;
  if (codecs == null) {
    // The manifest format may be muxed, so filter only codecs of this format's type. If we still
    // have more than one codec then we're unable to uniquely identify which codec to fill in.
    String codecsOfType = Util.getCodecsOfType(manifestFormat.codecs, trackType);
    if (Util.splitCodecs(codecsOfType).length == 1) {
      codecs = codecsOfType;
    }
  }

  Metadata metadata =
      this.metadata == null
          ? manifestFormat.metadata
          : this.metadata.copyWithAppendedEntriesFrom(manifestFormat.metadata);

  float frameRate = this.frameRate;
  if (frameRate == NO_VALUE && trackType == C.TRACK_TYPE_VIDEO) {
    frameRate = manifestFormat.frameRate;
  }

  // Merge manifest and sample format values.
  @C.SelectionFlags int selectionFlags = this.selectionFlags | manifestFormat.selectionFlags;
  @C.RoleFlags int roleFlags = this.roleFlags | manifestFormat.roleFlags;
  DrmInitData drmInitData =
      DrmInitData.createSessionCreationData(manifestFormat.drmInitData, this.drmInitData);

  return new Format(
      id,
      label,
      selectionFlags,
      roleFlags,
      bitrate,
      codecs,
      metadata,
      containerMimeType,
      sampleMimeType,
      maxInputSize,
      initializationData,
      drmInitData,
      subsampleOffsetUs,
      width,
      height,
      frameRate,
      rotationDegrees,
      pixelWidthHeightRatio,
      projectionData,
      stereoMode,
      colorInfo,
      channelCount,
      sampleRate,
      pcmEncoding,
      encoderDelay,
      encoderPadding,
      language,
      accessibilityChannel);
}