mirror of
https://github.com/androidx/media.git
synced 2025-05-11 17:49:52 +08:00
parent
f03e1cd572
commit
35a9f2635c
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.google.android.exoplayer.dash.mpd;
|
package com.google.android.exoplayer.dash.mpd;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A template from which URLs can be built.
|
* A template from which URLs can be built.
|
||||||
* <p>
|
* <p>
|
||||||
@ -85,11 +87,11 @@ public final class UrlTemplate {
|
|||||||
if (identifiers[i] == REPRESENTATION_ID) {
|
if (identifiers[i] == REPRESENTATION_ID) {
|
||||||
builder.append(representationId);
|
builder.append(representationId);
|
||||||
} else if (identifiers[i] == NUMBER_ID) {
|
} else if (identifiers[i] == NUMBER_ID) {
|
||||||
builder.append(String.format(identifierFormatTags[i], segmentNumber));
|
builder.append(String.format(Locale.US, identifierFormatTags[i], segmentNumber));
|
||||||
} else if (identifiers[i] == BANDWIDTH_ID) {
|
} else if (identifiers[i] == BANDWIDTH_ID) {
|
||||||
builder.append(String.format(identifierFormatTags[i], bandwidth));
|
builder.append(String.format(Locale.US, identifierFormatTags[i], bandwidth));
|
||||||
} else if (identifiers[i] == TIME_ID) {
|
} else if (identifiers[i] == TIME_ID) {
|
||||||
builder.append(String.format(identifierFormatTags[i], time));
|
builder.append(String.format(Locale.US, identifierFormatTags[i], time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.append(urlPieces[identifierCount]);
|
builder.append(urlPieces[identifierCount]);
|
||||||
|
@ -36,7 +36,7 @@ import java.util.regex.Pattern;
|
|||||||
if (matcher.find() && matcher.groupCount() == 1) {
|
if (matcher.find() && matcher.groupCount() == 1) {
|
||||||
return matcher.group(1);
|
return matcher.group(1);
|
||||||
}
|
}
|
||||||
throw new ParserException(String.format("Couldn't match %s tag in %s", tag, line));
|
throw new ParserException("Couldn't match " + tag + " tag in " + line);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int parseIntAttr(String line, Pattern pattern, String tag)
|
public static int parseIntAttr(String line, Pattern pattern, String tag)
|
||||||
|
@ -22,6 +22,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
|
|||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +109,7 @@ public class Id3Parser implements MetadataParser<Map<String, Object>> {
|
|||||||
metadata.put(GeobMetadata.TYPE, new GeobMetadata(mimeType, filename,
|
metadata.put(GeobMetadata.TYPE, new GeobMetadata(mimeType, filename,
|
||||||
description, objectData));
|
description, objectData));
|
||||||
} else {
|
} else {
|
||||||
String type = String.format("%c%c%c%c", frameId0, frameId1, frameId2, frameId3);
|
String type = String.format(Locale.US, "%c%c%c%c", frameId0, frameId1, frameId2, frameId3);
|
||||||
byte[] frame = new byte[frameSize];
|
byte[] frame = new byte[frameSize];
|
||||||
id3Data.readBytes(frame, 0, frameSize);
|
id3Data.readBytes(frame, 0, frameSize);
|
||||||
metadata.put(type, frame);
|
metadata.put(type, frame);
|
||||||
@ -165,7 +166,7 @@ public class Id3Parser implements MetadataParser<Map<String, Object>> {
|
|||||||
int id2 = id3Buffer.readUnsignedByte();
|
int id2 = id3Buffer.readUnsignedByte();
|
||||||
int id3 = id3Buffer.readUnsignedByte();
|
int id3 = id3Buffer.readUnsignedByte();
|
||||||
if (id1 != 'I' || id2 != 'D' || id3 != '3') {
|
if (id1 != 'I' || id2 != 'D' || id3 != '3') {
|
||||||
throw new ParserException(String.format(
|
throw new ParserException(String.format(Locale.US,
|
||||||
"Unexpected ID3 file identifier, expected \"ID3\", actual \"%c%c%c\".", id1, id2, id3));
|
"Unexpected ID3 file identifier, expected \"ID3\", actual \"%c%c%c\".", id1, id2, id3));
|
||||||
}
|
}
|
||||||
id3Buffer.skipBytes(2); // Skip version.
|
id3Buffer.skipBytes(2); // Skip version.
|
||||||
|
@ -573,7 +573,7 @@ public final class Util {
|
|||||||
public static String getHexStringFromBytes(byte[] data, int beginIndex, int endIndex) {
|
public static String getHexStringFromBytes(byte[] data, int beginIndex, int endIndex) {
|
||||||
StringBuffer dataStringBuffer = new StringBuffer(endIndex - beginIndex);
|
StringBuffer dataStringBuffer = new StringBuffer(endIndex - beginIndex);
|
||||||
for (int i = beginIndex; i < endIndex; i++) {
|
for (int i = beginIndex; i < endIndex; i++) {
|
||||||
dataStringBuffer.append(String.format("%02X", data[i]));
|
dataStringBuffer.append(String.format(Locale.US, "%02X", data[i]));
|
||||||
}
|
}
|
||||||
return dataStringBuffer.toString();
|
return dataStringBuffer.toString();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user