Java Code Examples for com.google.android.exoplayer2.util.Util#normalizeLanguageCode()

The following examples show how to use com.google.android.exoplayer2.util.Util#normalizeLanguageCode() . 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: 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 2
Source File: DefaultTrackSelector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
Parameters(
    SparseArray<Map<TrackGroupArray, SelectionOverride>> selectionOverrides,
    SparseBooleanArray rendererDisabledFlags,
    @Nullable String preferredAudioLanguage,
    @Nullable String preferredTextLanguage,
    boolean selectUndeterminedTextLanguage,
    int disabledTextTrackSelectionFlags,
    boolean forceLowestBitrate,
    boolean allowMixedMimeAdaptiveness,
    boolean allowNonSeamlessAdaptiveness,
    int maxVideoWidth,
    int maxVideoHeight,
    int maxVideoBitrate,
    boolean exceedVideoConstraintsIfNecessary,
    boolean exceedRendererCapabilitiesIfNecessary,
    int viewportWidth,
    int viewportHeight,
    boolean viewportOrientationMayChange,
    int tunnelingAudioSessionId) {
  this.selectionOverrides = selectionOverrides;
  this.rendererDisabledFlags = rendererDisabledFlags;
  this.preferredAudioLanguage = Util.normalizeLanguageCode(preferredAudioLanguage);
  this.preferredTextLanguage = Util.normalizeLanguageCode(preferredTextLanguage);
  this.selectUndeterminedTextLanguage = selectUndeterminedTextLanguage;
  this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
  this.forceLowestBitrate = forceLowestBitrate;
  this.allowMixedMimeAdaptiveness = allowMixedMimeAdaptiveness;
  this.allowNonSeamlessAdaptiveness = allowNonSeamlessAdaptiveness;
  this.maxVideoWidth = maxVideoWidth;
  this.maxVideoHeight = maxVideoHeight;
  this.maxVideoBitrate = maxVideoBitrate;
  this.exceedVideoConstraintsIfNecessary = exceedVideoConstraintsIfNecessary;
  this.exceedRendererCapabilitiesIfNecessary = exceedRendererCapabilitiesIfNecessary;
  this.viewportWidth = viewportWidth;
  this.viewportHeight = viewportHeight;
  this.viewportOrientationMayChange = viewportOrientationMayChange;
  this.tunnelingAudioSessionId = tunnelingAudioSessionId;
}
 
Example 3
Source File: DefaultTrackSelector.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
Parameters(
    SparseArray<Map<TrackGroupArray, SelectionOverride>> selectionOverrides,
    SparseBooleanArray rendererDisabledFlags,
    @Nullable String preferredAudioLanguage,
    @Nullable String preferredTextLanguage,
    boolean selectUndeterminedTextLanguage,
    int disabledTextTrackSelectionFlags,
    boolean forceLowestBitrate,
    boolean allowMixedMimeAdaptiveness,
    boolean allowNonSeamlessAdaptiveness,
    int maxVideoWidth,
    int maxVideoHeight,
    int maxVideoBitrate,
    boolean exceedVideoConstraintsIfNecessary,
    boolean exceedRendererCapabilitiesIfNecessary,
    int viewportWidth,
    int viewportHeight,
    boolean viewportOrientationMayChange,
    int tunnelingAudioSessionId) {
  this.selectionOverrides = selectionOverrides;
  this.rendererDisabledFlags = rendererDisabledFlags;
  this.preferredAudioLanguage = Util.normalizeLanguageCode(preferredAudioLanguage);
  this.preferredTextLanguage = Util.normalizeLanguageCode(preferredTextLanguage);
  this.selectUndeterminedTextLanguage = selectUndeterminedTextLanguage;
  this.disabledTextTrackSelectionFlags = disabledTextTrackSelectionFlags;
  this.forceLowestBitrate = forceLowestBitrate;
  this.allowMixedMimeAdaptiveness = allowMixedMimeAdaptiveness;
  this.allowNonSeamlessAdaptiveness = allowNonSeamlessAdaptiveness;
  this.maxVideoWidth = maxVideoWidth;
  this.maxVideoHeight = maxVideoHeight;
  this.maxVideoBitrate = maxVideoBitrate;
  this.exceedVideoConstraintsIfNecessary = exceedVideoConstraintsIfNecessary;
  this.exceedRendererCapabilitiesIfNecessary = exceedRendererCapabilitiesIfNecessary;
  this.viewportWidth = viewportWidth;
  this.viewportHeight = viewportHeight;
  this.viewportOrientationMayChange = viewportOrientationMayChange;
  this.tunnelingAudioSessionId = tunnelingAudioSessionId;
}
 
Example 4
Source File: DefaultTrackSelector.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * Returns a {@link Parameters} instance with the provided preferred language for audio and
 * forced text tracks.
 *
 * @param preferredAudioLanguage The preferred language as defined by RFC 5646. {@code null} to
 *     select the default track, or first track if there's no default.
 * @return A {@link Parameters} instance with the provided preferred language for audio and
 *     forced text tracks.
 */
public Parameters withPreferredAudioLanguage(String preferredAudioLanguage) {
  preferredAudioLanguage = Util.normalizeLanguageCode(preferredAudioLanguage);
  if (TextUtils.equals(preferredAudioLanguage, this.preferredAudioLanguage)) {
    return this;
  }
  return new Parameters(preferredAudioLanguage, preferredTextLanguage,
      allowMixedMimeAdaptiveness, allowNonSeamlessAdaptiveness, maxVideoWidth, maxVideoHeight,
      maxVideoBitrate, exceedVideoConstraintsIfNecessary, exceedRendererCapabilitiesIfNecessary,
      viewportWidth, viewportHeight, orientationMayChange);
}
 
Example 5
Source File: DefaultTrackSelector.java    From K-Sonic with MIT License 5 votes vote down vote up
/**
 * Returns a {@link Parameters} instance with the provided preferred language for text tracks.
 *
 * @param preferredTextLanguage The preferred language as defined by RFC 5646. {@code null} to
 *     select the default track, or no track if there's no default.
 * @return A {@link Parameters} instance with the provided preferred language for text tracks.
 */
public Parameters withPreferredTextLanguage(String preferredTextLanguage) {
  preferredTextLanguage = Util.normalizeLanguageCode(preferredTextLanguage);
  if (TextUtils.equals(preferredTextLanguage, this.preferredTextLanguage)) {
    return this;
  }
  return new Parameters(preferredAudioLanguage, preferredTextLanguage,
      allowMixedMimeAdaptiveness, allowNonSeamlessAdaptiveness, maxVideoWidth, maxVideoHeight,
      maxVideoBitrate, exceedVideoConstraintsIfNecessary, exceedRendererCapabilitiesIfNecessary,
      viewportWidth, viewportHeight, orientationMayChange);
}
 
Example 6
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 7
Source File: TrackSelectionParameters.java    From Telegram 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 8
Source File: Format.java    From MediaSDK with Apache License 2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @C.SelectionFlags int selectionFlags,
    @C.RoleFlags int roleFlags,
    int bitrate,
    @Nullable String codecs,
    @Nullable Metadata metadata,
    // Container specific.
    @Nullable String containerMimeType,
    // Elementary stream specific.
    @Nullable String sampleMimeType,
    int maxInputSize,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    long subsampleOffsetUs,
    // Video specific.
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    // Audio specific.
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    // Audio and text specific.
    @Nullable String language,
    int accessibilityChannel,
    // Provided by source.
    @Nullable Class<? extends ExoMediaCrypto> exoMediaCryptoType) {
  this.id = id;
  this.label = label;
  this.selectionFlags = selectionFlags;
  this.roleFlags = roleFlags;
  this.bitrate = bitrate;
  this.codecs = codecs;
  this.metadata = metadata;
  // Container specific.
  this.containerMimeType = containerMimeType;
  // Elementary stream specific.
  this.sampleMimeType = sampleMimeType;
  this.maxInputSize = maxInputSize;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.subsampleOffsetUs = subsampleOffsetUs;
  // Video specific.
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  // Audio specific.
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  // Audio and text specific.
  this.language = Util.normalizeLanguageCode(language);
  this.accessibilityChannel = accessibilityChannel;
  // Provided by source.
  this.exoMediaCryptoType = exoMediaCryptoType;
}
 
Example 9
Source File: Format.java    From Telegram-FOSS with GNU General Public License v2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @C.SelectionFlags int selectionFlags,
    @C.RoleFlags int roleFlags,
    int bitrate,
    @Nullable String codecs,
    @Nullable Metadata metadata,
    // Container specific.
    @Nullable String containerMimeType,
    // Elementary stream specific.
    @Nullable String sampleMimeType,
    int maxInputSize,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    long subsampleOffsetUs,
    // Video specific.
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    // Audio specific.
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    // Audio and text specific.
    @Nullable String language,
    int accessibilityChannel) {
  this.id = id;
  this.label = label;
  this.selectionFlags = selectionFlags;
  this.roleFlags = roleFlags;
  this.bitrate = bitrate;
  this.codecs = codecs;
  this.metadata = metadata;
  // Container specific.
  this.containerMimeType = containerMimeType;
  // Elementary stream specific.
  this.sampleMimeType = sampleMimeType;
  this.maxInputSize = maxInputSize;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.subsampleOffsetUs = subsampleOffsetUs;
  // Video specific.
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  // Audio specific.
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  // Audio and text specific.
  this.language = Util.normalizeLanguageCode(language);
  this.accessibilityChannel = accessibilityChannel;
}
 
Example 10
Source File: Format.java    From Telegram with GNU General Public License v2.0 4 votes vote down vote up
Format(
    @Nullable String id,
    @Nullable String label,
    @C.SelectionFlags int selectionFlags,
    @C.RoleFlags int roleFlags,
    int bitrate,
    @Nullable String codecs,
    @Nullable Metadata metadata,
    // Container specific.
    @Nullable String containerMimeType,
    // Elementary stream specific.
    @Nullable String sampleMimeType,
    int maxInputSize,
    @Nullable List<byte[]> initializationData,
    @Nullable DrmInitData drmInitData,
    long subsampleOffsetUs,
    // Video specific.
    int width,
    int height,
    float frameRate,
    int rotationDegrees,
    float pixelWidthHeightRatio,
    @Nullable byte[] projectionData,
    @C.StereoMode int stereoMode,
    @Nullable ColorInfo colorInfo,
    // Audio specific.
    int channelCount,
    int sampleRate,
    @C.PcmEncoding int pcmEncoding,
    int encoderDelay,
    int encoderPadding,
    // Audio and text specific.
    @Nullable String language,
    int accessibilityChannel) {
  this.id = id;
  this.label = label;
  this.selectionFlags = selectionFlags;
  this.roleFlags = roleFlags;
  this.bitrate = bitrate;
  this.codecs = codecs;
  this.metadata = metadata;
  // Container specific.
  this.containerMimeType = containerMimeType;
  // Elementary stream specific.
  this.sampleMimeType = sampleMimeType;
  this.maxInputSize = maxInputSize;
  this.initializationData =
      initializationData == null ? Collections.emptyList() : initializationData;
  this.drmInitData = drmInitData;
  this.subsampleOffsetUs = subsampleOffsetUs;
  // Video specific.
  this.width = width;
  this.height = height;
  this.frameRate = frameRate;
  this.rotationDegrees = rotationDegrees == Format.NO_VALUE ? 0 : rotationDegrees;
  this.pixelWidthHeightRatio =
      pixelWidthHeightRatio == Format.NO_VALUE ? 1 : pixelWidthHeightRatio;
  this.projectionData = projectionData;
  this.stereoMode = stereoMode;
  this.colorInfo = colorInfo;
  // Audio specific.
  this.channelCount = channelCount;
  this.sampleRate = sampleRate;
  this.pcmEncoding = pcmEncoding;
  this.encoderDelay = encoderDelay == Format.NO_VALUE ? 0 : encoderDelay;
  this.encoderPadding = encoderPadding == Format.NO_VALUE ? 0 : encoderPadding;
  // Audio and text specific.
  this.language = Util.normalizeLanguageCode(language);
  this.accessibilityChannel = accessibilityChannel;
}