com.google.android.exoplayer2.util.Util.toLowerInvariant()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(368)

本文整理了Java中com.google.android.exoplayer2.util.Util.toLowerInvariant()方法的一些代码示例,展示了Util.toLowerInvariant()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.toLowerInvariant()方法的具体详情如下:
包路径:com.google.android.exoplayer2.util.Util
类名称:Util
方法名:toLowerInvariant

Util.toLowerInvariant介绍

[英]Converts text to lower case using Locale#US.
[中]使用Locale#US将文本转换为小写。

代码示例

代码示例来源:origin: google/ExoPlayer

  1. public WebvttCssStyle setFontFamily(String fontFamily) {
  2. this.fontFamily = Util.toLowerInvariant(fontFamily);
  3. return this;
  4. }

代码示例来源:origin: google/ExoPlayer

  1. /**
  2. * Parses the number of channels from the value attribute of an AudioElementConfiguration with
  3. * schemeIdUri "tag:dolby.com,2014:dash:audio_channel_configuration:2011", as defined by table E.5
  4. * in ETSI TS 102 366.
  5. *
  6. * @param xpp The parser from which to read.
  7. * @return The parsed number of channels, or {@link Format#NO_VALUE} if the channel count could
  8. * not be parsed.
  9. */
  10. protected static int parseDolbyChannelConfiguration(XmlPullParser xpp) {
  11. String value = Util.toLowerInvariant(xpp.getAttributeValue(null, "value"));
  12. if (value == null) {
  13. return Format.NO_VALUE;
  14. }
  15. switch (value) {
  16. case "4000":
  17. return 1;
  18. case "a000":
  19. return 2;
  20. case "f801":
  21. return 6;
  22. case "fa01":
  23. return 8;
  24. default:
  25. return Format.NO_VALUE;
  26. }
  27. }

代码示例来源:origin: google/ExoPlayer

  1. /**
  2. * Derives a DRM {@link UUID} from {@code drmScheme}.
  3. *
  4. * @param drmScheme A UUID string, or {@code "widevine"}, {@code "playready"} or {@code
  5. * "clearkey"}.
  6. * @return The derived {@link UUID}, or {@code null} if one could not be derived.
  7. */
  8. public static @Nullable UUID getDrmUuid(String drmScheme) {
  9. switch (Util.toLowerInvariant(drmScheme)) {
  10. case "widevine":
  11. return C.WIDEVINE_UUID;
  12. case "playready":
  13. return C.PLAYREADY_UUID;
  14. case "clearkey":
  15. return C.CLEARKEY_UUID;
  16. default:
  17. try {
  18. return UUID.fromString(drmScheme);
  19. } catch (RuntimeException e) {
  20. return null;
  21. }
  22. }
  23. }

代码示例来源:origin: google/ExoPlayer

  1. /** Returns a fixed SmoothStreaming client manifest {@link Uri}. */
  2. public static Uri fixManifestUri(Uri manifestUri) {
  3. if (Util.toLowerInvariant(manifestUri.getLastPathSegment()).matches("manifest(\\(.+\\))?")) {
  4. return manifestUri;
  5. }
  6. return Uri.withAppendedPath(manifestUri, "Manifest");
  7. }

代码示例来源:origin: google/ExoPlayer

  1. /**
  2. * Makes a best guess to infer the type from a file name.
  3. *
  4. * @param fileName Name of the file. It can include the path of the file.
  5. * @return The content type.
  6. */
  7. @C.ContentType
  8. public static int inferContentType(String fileName) {
  9. fileName = Util.toLowerInvariant(fileName);
  10. if (fileName.endsWith(".mpd")) {
  11. return C.TYPE_DASH;
  12. } else if (fileName.endsWith(".m3u8")) {
  13. return C.TYPE_HLS;
  14. } else if (fileName.matches(".*\\.ism(l)?(/manifest(\\(.+\\))?)?")) {
  15. return C.TYPE_SS;
  16. } else {
  17. return C.TYPE_OTHER;
  18. }
  19. }

代码示例来源:origin: google/ExoPlayer

  1. private void setEncryptionData(Uri keyUri, String iv, byte[] secretKey) {
  2. String trimmedIv;
  3. if (Util.toLowerInvariant(iv).startsWith("0x")) {
  4. trimmedIv = iv.substring(2);
  5. } else {
  6. trimmedIv = iv;
  7. }
  8. byte[] ivData = new BigInteger(trimmedIv, 16).toByteArray();
  9. byte[] ivDataWithPadding = new byte[16];
  10. int offset = ivData.length > 16 ? ivData.length - 16 : 0;
  11. System.arraycopy(ivData, offset, ivDataWithPadding, ivDataWithPadding.length - ivData.length
  12. + offset, ivData.length - offset);
  13. encryptionKeyUri = keyUri;
  14. encryptionKey = secretKey;
  15. encryptionIvString = iv;
  16. encryptionIv = ivDataWithPadding;
  17. }

代码示例来源:origin: CarGuo/GSYVideoPlayer

  1. @SuppressLint("WrongConstant")
  2. @C.ContentType
  3. public static int inferContentType(String fileName, @Nullable String overrideExtension) {
  4. fileName = Util.toLowerInvariant(fileName);
  5. if (fileName.startsWith("rtmp:")) {
  6. return TYPE_RTMP;
  7. } else {
  8. return inferContentType(Uri.parse(fileName), overrideExtension);
  9. }
  10. }

代码示例来源:origin: google/ExoPlayer

  1. /**
  2. * Returns a normalized RFC 639-2/T code for {@code language}.
  3. *
  4. * @param language A case-insensitive ISO 639 alpha-2 or alpha-3 language code.
  5. * @return The all-lowercase normalized code, or null if the input was null, or {@code
  6. * language.toLowerCase()} if the language could not be normalized.
  7. */
  8. public static @Nullable String normalizeLanguageCode(@Nullable String language) {
  9. try {
  10. return language == null ? null : new Locale(language).getISO3Language();
  11. } catch (MissingResourceException e) {
  12. return toLowerInvariant(language);
  13. }
  14. }

代码示例来源:origin: google/ExoPlayer

  1. formatTextIndex = C.INDEX_UNSET;
  2. for (int i = 0; i < formatKeyCount; i++) {
  3. String key = Util.toLowerInvariant(values[i].trim());
  4. switch (key) {
  5. case "start":

代码示例来源:origin: google/ExoPlayer

  1. Integer color = COLOR_MAP.get(Util.toLowerInvariant(colorExpression));
  2. if (color != null) {
  3. return color;

代码示例来源:origin: google/ExoPlayer

  1. return null;
  2. codec = Util.toLowerInvariant(codec.trim());
  3. if (codec.startsWith("avc1") || codec.startsWith("avc3")) {
  4. return MimeTypes.VIDEO_H264;

代码示例来源:origin: google/ExoPlayer

  1. return new Point(3840, 2160);
  2. } else if (("NVIDIA".equals(Util.MANUFACTURER) && Util.MODEL.contains("SHIELD"))
  3. || ("philips".equals(Util.toLowerInvariant(Util.MANUFACTURER))
  4. && (Util.MODEL.startsWith("QM1")
  5. || Util.MODEL.equals("QV151E")

代码示例来源:origin: google/ExoPlayer

  1. private static ApicFrame decodeApicFrame(ParsableByteArray id3Data, int frameSize,
  2. int majorVersion) throws UnsupportedEncodingException {
  3. int encoding = id3Data.readUnsignedByte();
  4. String charset = getCharsetName(encoding);
  5. byte[] data = new byte[frameSize - 1];
  6. id3Data.readBytes(data, 0, frameSize - 1);
  7. String mimeType;
  8. int mimeTypeEndIndex;
  9. if (majorVersion == 2) {
  10. mimeTypeEndIndex = 2;
  11. mimeType = "image/" + Util.toLowerInvariant(new String(data, 0, 3, "ISO-8859-1"));
  12. if ("image/jpg".equals(mimeType)) {
  13. mimeType = "image/jpeg";
  14. }
  15. } else {
  16. mimeTypeEndIndex = indexOfZeroByte(data, 0);
  17. mimeType = Util.toLowerInvariant(new String(data, 0, mimeTypeEndIndex, "ISO-8859-1"));
  18. if (mimeType.indexOf('/') == -1) {
  19. mimeType = "image/" + mimeType;
  20. }
  21. }
  22. int pictureType = data[mimeTypeEndIndex + 1] & 0xFF;
  23. int descriptionStartIndex = mimeTypeEndIndex + 2;
  24. int descriptionEndIndex = indexOfEos(data, descriptionStartIndex, encoding);
  25. String description = new String(data, descriptionStartIndex,
  26. descriptionEndIndex - descriptionStartIndex, charset);
  27. int pictureDataStartIndex = descriptionEndIndex + delimiterLength(encoding);
  28. byte[] pictureData = copyOfRangeIfValid(data, pictureDataStartIndex, data.length);
  29. return new ApicFrame(mimeType, description, pictureType, pictureData);
  30. }

代码示例来源:origin: google/ExoPlayer

  1. TtmlNode.ATTR_TTS_DISPLAY_ALIGN);
  2. if (displayAlign != null) {
  3. switch (Util.toLowerInvariant(displayAlign)) {
  4. case "center":
  5. lineAnchor = Cue.ANCHOR_TYPE_MIDDLE;

代码示例来源:origin: google/ExoPlayer

  1. switch (Util.toLowerInvariant(schemeIdUri)) {
  2. case "urn:mpeg:dash:mp4protection:2011":
  3. schemeType = xpp.getAttributeValue(null, "value");

代码示例来源:origin: google/ExoPlayer

  1. break;
  2. case TtmlNode.ATTR_TTS_TEXT_ALIGN:
  3. switch (Util.toLowerInvariant(attributeValue)) {
  4. case TtmlNode.LEFT:
  5. style = createIfNull(style).setTextAlign(Layout.Alignment.ALIGN_NORMAL);
  6. switch (Util.toLowerInvariant(attributeValue)) {
  7. case TtmlNode.LINETHROUGH:
  8. style = createIfNull(style).setLinethrough(true);

代码示例来源:origin: maiwenchang/ArtPlayer

  1. public static int inferContentType(String fileName) {
  2. fileName = Util.toLowerInvariant(fileName);
  3. if (fileName.endsWith(".mpd")) {
  4. return C.TYPE_DASH;
  5. } else if (fileName.endsWith(".m3u8")) {
  6. return C.TYPE_HLS;
  7. } else if (fileName.endsWith(".ism") || fileName.endsWith(".isml")
  8. || fileName.endsWith(".ism/manifest") || fileName.endsWith(".isml/manifest")) {
  9. return C.TYPE_SS;
  10. } else if (fileName.startsWith("rtmp:")) {
  11. return TYPE_RTMP;
  12. } else {
  13. return C.TYPE_OTHER;
  14. }
  15. }

代码示例来源:origin: novoda/no-player

  1. Integer color = COLOR_MAP.get(Util.toLowerInvariant(colorExpression));
  2. if (color != null) {
  3. return color;

相关文章