Java Code Examples for com.google.android.exoplayer2.Format#createVideoContainerFormat()

The following examples show how to use com.google.android.exoplayer2.Format#createVideoContainerFormat() . 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: HlsMediaPeriod.java    From MediaSDK with Apache License 2.0 6 votes vote down vote up
private static Format deriveVideoFormat(Format variantFormat) {
  String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO);
  String sampleMimeType = MimeTypes.getMediaMimeType(codecs);
  return Format.createVideoContainerFormat(
      variantFormat.id,
      variantFormat.label,
      variantFormat.containerMimeType,
      sampleMimeType,
      codecs,
      variantFormat.metadata,
      variantFormat.bitrate,
      variantFormat.width,
      variantFormat.height,
      variantFormat.frameRate,
      /* initializationData= */ null,
      variantFormat.selectionFlags,
      variantFormat.roleFlags);
}
 
Example 2
Source File: HlsMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static Format deriveVideoFormat(Format variantFormat) {
  String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO);
  String sampleMimeType = MimeTypes.getMediaMimeType(codecs);
  return Format.createVideoContainerFormat(
      variantFormat.id,
      variantFormat.label,
      variantFormat.containerMimeType,
      sampleMimeType,
      codecs,
      variantFormat.bitrate,
      variantFormat.width,
      variantFormat.height,
      variantFormat.frameRate,
      /* initializationData= */ null,
      variantFormat.selectionFlags);
}
 
Example 3
Source File: HlsMediaPeriod.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
private static Format deriveVideoFormat(Format variantFormat) {
  String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO);
  String sampleMimeType = MimeTypes.getMediaMimeType(codecs);
  return Format.createVideoContainerFormat(
      variantFormat.id,
      variantFormat.label,
      variantFormat.containerMimeType,
      sampleMimeType,
      codecs,
      variantFormat.bitrate,
      variantFormat.width,
      variantFormat.height,
      variantFormat.frameRate,
      /* initializationData= */ null,
      variantFormat.selectionFlags);
}
 
Example 4
Source File: HlsMediaPeriod.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private static Format deriveVideoFormat(Format variantFormat) {
  String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO);
  String sampleMimeType = MimeTypes.getMediaMimeType(codecs);
  return Format.createVideoContainerFormat(
      variantFormat.id,
      variantFormat.label,
      variantFormat.containerMimeType,
      sampleMimeType,
      codecs,
      variantFormat.metadata,
      variantFormat.bitrate,
      variantFormat.width,
      variantFormat.height,
      variantFormat.frameRate,
      /* initializationData= */ null,
      variantFormat.selectionFlags,
      variantFormat.roleFlags);
}
 
Example 5
Source File: HlsMediaPeriod.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private static Format deriveVideoFormat(Format variantFormat) {
  String codecs = Util.getCodecsOfType(variantFormat.codecs, C.TRACK_TYPE_VIDEO);
  String sampleMimeType = MimeTypes.getMediaMimeType(codecs);
  return Format.createVideoContainerFormat(
      variantFormat.id,
      variantFormat.label,
      variantFormat.containerMimeType,
      sampleMimeType,
      codecs,
      variantFormat.metadata,
      variantFormat.bitrate,
      variantFormat.width,
      variantFormat.height,
      variantFormat.frameRate,
      /* initializationData= */ null,
      variantFormat.selectionFlags,
      variantFormat.roleFlags);
}
 
Example 6
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 7
Source File: DashManifestParser.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
protected Format buildFormat(
    @Nullable String id,
    @Nullable String containerMimeType,
    int width,
    int height,
    float frameRate,
    int audioChannels,
    int audioSamplingRate,
    int bitrate,
    @Nullable String language,
    List<Descriptor> roleDescriptors,
    List<Descriptor> accessibilityDescriptors,
    @Nullable 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 8
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 9
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 10
Source File: DashManifestParser.java    From Telegram-FOSS 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 11
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);
}