Java Code Examples for com.google.android.exoplayer2.Format#createContainerFormat()
The following examples show how to use
com.google.android.exoplayer2.Format#createContainerFormat() .
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: HlsMasterPlaylist.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Creates a variant for a given media playlist url. * * @param url The media playlist url. * @return The variant instance. */ public static Variant createMediaPlaylistVariantUrl(Uri url) { Format format = Format.createContainerFormat( "0", /* label= */ null, MimeTypes.APPLICATION_M3U8, /* sampleMimeType= */ null, /* codecs= */ null, /* bitrate= */ Format.NO_VALUE, /* selectionFlags= */ 0, /* roleFlags= */ 0, /* language= */ null); return new Variant( url, format, /* videoGroupId= */ null, /* audioGroupId= */ null, /* subtitleGroupId= */ null, /* captionGroupId= */ null); }
Example 2
Source File: HlsMasterPlaylist.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Creates a variant for a given media playlist url. * * @param url The media playlist url. * @return The variant instance. */ public static Variant createMediaPlaylistVariantUrl(Uri url) { Format format = Format.createContainerFormat( "0", /* label= */ null, MimeTypes.APPLICATION_M3U8, /* sampleMimeType= */ null, /* codecs= */ null, /* bitrate= */ Format.NO_VALUE, /* selectionFlags= */ 0, /* roleFlags= */ 0, /* language= */ null); return new Variant( url, format, /* videoGroupId= */ null, /* audioGroupId= */ null, /* subtitleGroupId= */ null, /* captionGroupId= */ null); }
Example 3
Source File: HlsMasterPlaylist.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Creates a variant for a given media playlist url. * * @param url The media playlist url. * @return The variant instance. */ public static Variant createMediaPlaylistVariantUrl(Uri url) { Format format = Format.createContainerFormat( "0", /* label= */ null, MimeTypes.APPLICATION_M3U8, /* sampleMimeType= */ null, /* codecs= */ null, /* bitrate= */ Format.NO_VALUE, /* selectionFlags= */ 0, /* roleFlags= */ 0, /* language= */ null); return new Variant( url, format, /* videoGroupId= */ null, /* audioGroupId= */ null, /* subtitleGroupId= */ null, /* captionGroupId= */ null); }
Example 4
Source File: HlsMasterPlaylist.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Creates an HLS url from a given http url. * * @param url The url. * @return An HLS url. */ public static HlsUrl createMediaPlaylistHlsUrl(String url) { Format format = Format.createContainerFormat( "0", /* label= */ null, MimeTypes.APPLICATION_M3U8, /* sampleMimeType= */ null, /* codecs= */ null, /* bitrate= */ Format.NO_VALUE, /* selectionFlags= */ 0, /* language= */ null); return new HlsUrl(url, format); }
Example 5
Source File: HlsMasterPlaylist.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Creates an HLS url from a given http url. * * @param url The url. * @return An HLS url. */ public static HlsUrl createMediaPlaylistHlsUrl(String url) { Format format = Format.createContainerFormat( "0", /* label= */ null, MimeTypes.APPLICATION_M3U8, /* sampleMimeType= */ null, /* codecs= */ null, /* bitrate= */ Format.NO_VALUE, /* selectionFlags= */ 0, /* language= */ null); return new HlsUrl(url, format); }
Example 6
Source File: DashManifestParser.java From K-Sonic with MIT License | 5 votes |
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 |
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 |
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 |
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: HlsMasterPlaylist.java From K-Sonic with MIT License | 4 votes |
public static HlsUrl createMediaPlaylistHlsUrl(String baseUri) { Format format = Format.createContainerFormat("0", MimeTypes.APPLICATION_M3U8, null, null, Format.NO_VALUE, 0, null); return new HlsUrl(baseUri, format); }
Example 11
Source File: DashManifestParser.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
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 12
Source File: DashManifestParser.java From Telegram with GNU General Public License v2.0 | 4 votes |
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); }