Java Code Examples for com.google.android.exoplayer2.C#RoleFlags
The following examples show how to use
com.google.android.exoplayer2.C#RoleFlags .
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: DashManifestParser.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@C.RoleFlags protected int parseTvaAudioPurposeCsValue(String value) { if (value == null) { return 0; } switch (value) { case "1": // Audio description for the visually impaired. return C.ROLE_FLAG_DESCRIBES_VIDEO; case "2": // Audio description for the hard of hearing. return C.ROLE_FLAG_ENHANCED_DIALOG_INTELLIGIBILITY; case "3": // Supplemental commentary. return C.ROLE_FLAG_SUPPLEMENTARY; case "4": // Director's commentary. return C.ROLE_FLAG_COMMENTARY; case "6": // Main programme audio. return C.ROLE_FLAG_MAIN; default: return 0; } }
Example 2
Source File: HlsPlaylistParser.java From MediaSDK with Apache License 2.0 | 6 votes |
@C.RoleFlags private static int parseRoleFlags(String line, Map<String, String> variableDefinitions) { String concatenatedCharacteristics = parseOptionalStringAttr(line, REGEX_CHARACTERISTICS, variableDefinitions); if (TextUtils.isEmpty(concatenatedCharacteristics)) { return 0; } String[] characteristics = Util.split(concatenatedCharacteristics, ","); @C.RoleFlags int roleFlags = 0; if (Util.contains(characteristics, "public.accessibility.describes-video")) { roleFlags |= C.ROLE_FLAG_DESCRIBES_VIDEO; } if (Util.contains(characteristics, "public.accessibility.transcribes-spoken-dialog")) { roleFlags |= C.ROLE_FLAG_TRANSCRIBES_DIALOG; } if (Util.contains(characteristics, "public.accessibility.describes-music-and-sound")) { roleFlags |= C.ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND; } if (Util.contains(characteristics, "public.easy-to-read")) { roleFlags |= C.ROLE_FLAG_EASY_TO_READ; } return roleFlags; }
Example 3
Source File: DashManifestParser.java From Telegram with GNU General Public License v2.0 | 6 votes |
@C.RoleFlags protected int parseTvaAudioPurposeCsValue(String value) { if (value == null) { return 0; } switch (value) { case "1": // Audio description for the visually impaired. return C.ROLE_FLAG_DESCRIBES_VIDEO; case "2": // Audio description for the hard of hearing. return C.ROLE_FLAG_ENHANCED_DIALOG_INTELLIGIBILITY; case "3": // Supplemental commentary. return C.ROLE_FLAG_SUPPLEMENTARY; case "4": // Director's commentary. return C.ROLE_FLAG_COMMENTARY; case "6": // Main programme audio. return C.ROLE_FLAG_MAIN; default: return 0; } }
Example 4
Source File: DashManifestParser.java From MediaSDK with Apache License 2.0 | 6 votes |
@C.RoleFlags protected int parseTvaAudioPurposeCsValue(@Nullable String value) { if (value == null) { return 0; } switch (value) { case "1": // Audio description for the visually impaired. return C.ROLE_FLAG_DESCRIBES_VIDEO; case "2": // Audio description for the hard of hearing. return C.ROLE_FLAG_ENHANCED_DIALOG_INTELLIGIBILITY; case "3": // Supplemental commentary. return C.ROLE_FLAG_SUPPLEMENTARY; case "4": // Director's commentary. return C.ROLE_FLAG_COMMENTARY; case "6": // Main programme audio. return C.ROLE_FLAG_MAIN; default: return 0; } }
Example 5
Source File: TrackSelectionParameters.java From MediaSDK with Apache License 2.0 | 5 votes |
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 6
Source File: DashManifestParser.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@C.RoleFlags protected int parseRoleFlagsFromAccessibilityDescriptors( List<Descriptor> accessibilityDescriptors) { @C.RoleFlags int result = 0; for (int i = 0; i < accessibilityDescriptors.size(); i++) { Descriptor descriptor = accessibilityDescriptors.get(i); if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(descriptor.schemeIdUri)) { result |= parseDashRoleSchemeValue(descriptor.value); } else if ("urn:tva:metadata:cs:AudioPurposeCS:2007" .equalsIgnoreCase(descriptor.schemeIdUri)) { result |= parseTvaAudioPurposeCsValue(descriptor.value); } } return result; }
Example 7
Source File: DashManifestParser.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@C.RoleFlags protected int parseRoleFlagsFromRoleDescriptors(List<Descriptor> roleDescriptors) { @C.RoleFlags int result = 0; for (int i = 0; i < roleDescriptors.size(); i++) { Descriptor descriptor = roleDescriptors.get(i); if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(descriptor.schemeIdUri)) { result |= parseDashRoleSchemeValue(descriptor.value); } } return result; }
Example 8
Source File: DashManifestParser.java From Telegram with GNU General Public License v2.0 | 5 votes |
@C.RoleFlags protected int parseRoleFlagsFromAccessibilityDescriptors( List<Descriptor> accessibilityDescriptors) { @C.RoleFlags int result = 0; for (int i = 0; i < accessibilityDescriptors.size(); i++) { Descriptor descriptor = accessibilityDescriptors.get(i); if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(descriptor.schemeIdUri)) { result |= parseDashRoleSchemeValue(descriptor.value); } else if ("urn:tva:metadata:cs:AudioPurposeCS:2007" .equalsIgnoreCase(descriptor.schemeIdUri)) { result |= parseTvaAudioPurposeCsValue(descriptor.value); } } return result; }
Example 9
Source File: DashManifestParser.java From Telegram with GNU General Public License v2.0 | 5 votes |
@C.RoleFlags protected int parseDashRoleSchemeValue(String value) { if (value == null) { return 0; } switch (value) { case "main": return C.ROLE_FLAG_MAIN; case "alternate": return C.ROLE_FLAG_ALTERNATE; case "supplementary": return C.ROLE_FLAG_SUPPLEMENTARY; case "commentary": return C.ROLE_FLAG_COMMENTARY; case "dub": return C.ROLE_FLAG_DUB; case "emergency": return C.ROLE_FLAG_EMERGENCY; case "caption": return C.ROLE_FLAG_CAPTION; case "subtitle": return C.ROLE_FLAG_SUBTITLE; case "sign": return C.ROLE_FLAG_SIGN; case "description": return C.ROLE_FLAG_DESCRIBES_VIDEO; case "enhanced-audio-intelligibility": return C.ROLE_FLAG_ENHANCED_DIALOG_INTELLIGIBILITY; default: return 0; } }
Example 10
Source File: TrackSelectionParameters.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
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 11
Source File: DashManifestParser.java From Telegram with GNU General Public License v2.0 | 5 votes |
@C.RoleFlags protected int parseRoleFlagsFromRoleDescriptors(List<Descriptor> roleDescriptors) { @C.RoleFlags int result = 0; for (int i = 0; i < roleDescriptors.size(); i++) { Descriptor descriptor = roleDescriptors.get(i); if ("urn:mpeg:dash:role:2011".equalsIgnoreCase(descriptor.schemeIdUri)) { result |= parseDashRoleSchemeValue(descriptor.value); } } return result; }
Example 12
Source File: DefaultTrackSelector.java From Telegram with GNU General Public License v2.0 | 4 votes |
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 13
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); }
Example 14
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 15
Source File: DefaultTrackSelector.java From MediaSDK with Apache License 2.0 | 4 votes |
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 16
Source File: DefaultTrackSelector.java From MediaSDK with Apache License 2.0 | 4 votes |
@Override public ParametersBuilder setPreferredTextRoleFlags(@C.RoleFlags int preferredTextRoleFlags) { super.setPreferredTextRoleFlags(preferredTextRoleFlags); return this; }
Example 17
Source File: DefaultTrackSelector.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public ParametersBuilder setPreferredTextRoleFlags(@C.RoleFlags int preferredTextRoleFlags) { super.setPreferredTextRoleFlags(preferredTextRoleFlags); return this; }
Example 18
Source File: TrackSelectionParameters.java From Telegram-FOSS with GNU General Public License v2.0 | 2 votes |
/** * Sets the preferred {@link C.RoleFlags} for text tracks. * * @param preferredTextRoleFlags Preferred text role flags. * @return This builder. */ public Builder setPreferredTextRoleFlags(@C.RoleFlags int preferredTextRoleFlags) { this.preferredTextRoleFlags = preferredTextRoleFlags; return this; }
Example 19
Source File: TrackSelectionParameters.java From Telegram with GNU General Public License v2.0 | 2 votes |
/** * Sets the preferred {@link C.RoleFlags} for text tracks. * * @param preferredTextRoleFlags Preferred text role flags. * @return This builder. */ public Builder setPreferredTextRoleFlags(@C.RoleFlags int preferredTextRoleFlags) { this.preferredTextRoleFlags = preferredTextRoleFlags; return this; }
Example 20
Source File: TrackSelectionParameters.java From MediaSDK with Apache License 2.0 | 2 votes |
/** * Sets the preferred {@link C.RoleFlags} for text tracks. * * @param preferredTextRoleFlags Preferred text role flags. * @return This builder. */ public Builder setPreferredTextRoleFlags(@C.RoleFlags int preferredTextRoleFlags) { this.preferredTextRoleFlags = preferredTextRoleFlags; return this; }