Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
836babd5
authored
Jun 22, 2020
by
samrobinson
Committed by
Andrew Lewis
Jun 23, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Replace usages of Charset.forName with Guava Charsets.
PiperOrigin-RevId: 317672619
parent
1836f1df
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
73 additions
and
75 deletions
library/common/src/main/java/com/google/android/exoplayer2/C.java
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableBitArray.java
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableByteArray.java
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
library/common/src/test/java/com/google/android/exoplayer2/metadata/id3/Id3DecoderTest.java
library/common/src/test/java/com/google/android/exoplayer2/util/ParsableBitArrayTest.java
library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java
library/core/src/main/java/com/google/android/exoplayer2/metadata/dvbsi/AppInfoTableDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/metadata/icy/IcyDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/tx3g/Tx3gDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/DataSchemeDataSource.java
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/DefaultContentMetadata.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParserTest.java
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/offline/DashDownloadTestData.java
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/FlacMetadataReader.java
library/hls/src/test/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloadTestData.java
library/hls/src/test/java/com/google/android/exoplayer2/source/hls/playlist/HlsMasterPlaylistParserTest.java
library/ui/build.gradle
library/ui/src/main/java/com/google/android/exoplayer2/ui/WebViewSubtitleOutput.java
library/common/src/main/java/com/google/android/exoplayer2/C.java
View file @
836babd5
...
@@ -85,23 +85,34 @@ public final class C {
...
@@ -85,23 +85,34 @@ public final class C {
public
static
final
int
BYTES_PER_FLOAT
=
4
;
public
static
final
int
BYTES_PER_FLOAT
=
4
;
/**
/**
* The name of the ASCII charset.
* @deprecated Use {@link java.nio.charset.StandardCharsets} or {@link
* com.google.common.base.Charsets} instead.
*/
*/
public
static
final
String
ASCII_NAME
=
"US-ASCII"
;
@Deprecated
public
static
final
String
ASCII_NAME
=
"US-ASCII"
;
/**
/**
* The name of the UTF-8 charset.
* @deprecated Use {@link java.nio.charset.StandardCharsets} or {@link
* com.google.common.base.Charsets} instead.
*/
*/
public
static
final
String
UTF8_NAME
=
"UTF-8"
;
@Deprecated
public
static
final
String
UTF8_NAME
=
"UTF-8"
;
/** The name of the ISO-8859-1 charset. */
/**
public
static
final
String
ISO88591_NAME
=
"ISO-8859-1"
;
* @deprecated Use {@link java.nio.charset.StandardCharsets} or {@link
* com.google.common.base.Charsets} instead.
*/
@Deprecated
public
static
final
String
ISO88591_NAME
=
"ISO-8859-1"
;
/** The name of the UTF-16 charset. */
/**
public
static
final
String
UTF16_NAME
=
"UTF-16"
;
* @deprecated Use {@link java.nio.charset.StandardCharsets} or {@link
* com.google.common.base.Charsets} instead.
*/
@Deprecated
public
static
final
String
UTF16_NAME
=
"UTF-16"
;
/** The name of the UTF-16 little-endian charset. */
/**
public
static
final
String
UTF16LE_NAME
=
"UTF-16LE"
;
* @deprecated Use {@link java.nio.charset.StandardCharsets} or {@link
* com.google.common.base.Charsets} instead.
*/
@Deprecated
public
static
final
String
UTF16LE_NAME
=
"UTF-16LE"
;
/**
/**
* The name of the serif font family.
* The name of the serif font family.
...
...
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableBitArray.java
View file @
836babd5
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
.
util
;
package
com
.
google
.
android
.
exoplayer2
.
util
;
import
com.google.
android.exoplayer2.C
;
import
com.google.
common.base.Charsets
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
/**
/**
...
@@ -288,7 +288,7 @@ public final class ParsableBitArray {
...
@@ -288,7 +288,7 @@ public final class ParsableBitArray {
* @return The string encoded by the bytes in UTF-8.
* @return The string encoded by the bytes in UTF-8.
*/
*/
public
String
readBytesAsString
(
int
length
)
{
public
String
readBytesAsString
(
int
length
)
{
return
readBytesAsString
(
length
,
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
readBytesAsString
(
length
,
Charset
s
.
UTF_8
);
}
}
/**
/**
...
...
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableByteArray.java
View file @
836babd5
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
.
util
;
package
com
.
google
.
android
.
exoplayer2
.
util
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.
android.exoplayer2.C
;
import
com.google.
common.base.Charsets
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
...
@@ -449,7 +449,7 @@ public final class ParsableByteArray {
...
@@ -449,7 +449,7 @@ public final class ParsableByteArray {
* @return The string encoded by the bytes.
* @return The string encoded by the bytes.
*/
*/
public
String
readString
(
int
length
)
{
public
String
readString
(
int
length
)
{
return
readString
(
length
,
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
readString
(
length
,
Charset
s
.
UTF_8
);
}
}
/**
/**
...
...
library/common/src/main/java/com/google/android/exoplayer2/util/Util.java
View file @
836babd5
...
@@ -54,6 +54,7 @@ import com.google.android.exoplayer2.MediaItem;
...
@@ -54,6 +54,7 @@ import com.google.android.exoplayer2.MediaItem;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.android.exoplayer2.upstream.DataSource
;
import
com.google.common.base.Ascii
;
import
com.google.common.base.Ascii
;
import
com.google.common.base.Charsets
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.Closeable
;
import
java.io.Closeable
;
import
java.io.File
;
import
java.io.File
;
...
@@ -63,7 +64,6 @@ import java.lang.reflect.Method;
...
@@ -63,7 +64,6 @@ import java.lang.reflect.Method;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.nio.ByteOrder
;
import
java.nio.charset.Charset
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -595,7 +595,7 @@ public final class Util {
...
@@ -595,7 +595,7 @@ public final class Util {
* @return The string.
* @return The string.
*/
*/
public
static
String
fromUtf8Bytes
(
byte
[]
bytes
)
{
public
static
String
fromUtf8Bytes
(
byte
[]
bytes
)
{
return
new
String
(
bytes
,
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
new
String
(
bytes
,
Charset
s
.
UTF_8
);
}
}
/**
/**
...
@@ -607,7 +607,7 @@ public final class Util {
...
@@ -607,7 +607,7 @@ public final class Util {
* @return The string.
* @return The string.
*/
*/
public
static
String
fromUtf8Bytes
(
byte
[]
bytes
,
int
offset
,
int
length
)
{
public
static
String
fromUtf8Bytes
(
byte
[]
bytes
,
int
offset
,
int
length
)
{
return
new
String
(
bytes
,
offset
,
length
,
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
new
String
(
bytes
,
offset
,
length
,
Charset
s
.
UTF_8
);
}
}
/**
/**
...
@@ -617,7 +617,7 @@ public final class Util {
...
@@ -617,7 +617,7 @@ public final class Util {
* @return The code points encoding using UTF-8.
* @return The code points encoding using UTF-8.
*/
*/
public
static
byte
[]
getUtf8Bytes
(
String
value
)
{
public
static
byte
[]
getUtf8Bytes
(
String
value
)
{
return
value
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
value
.
getBytes
(
Charset
s
.
UTF_8
);
}
}
/**
/**
...
...
library/common/src/test/java/com/google/android/exoplayer2/metadata/id3/Id3DecoderTest.java
View file @
836babd5
...
@@ -21,11 +21,10 @@ import static com.google.common.truth.Truth.assertThat;
...
@@ -21,11 +21,10 @@ import static com.google.common.truth.Truth.assertThat;
import
static
org
.
junit
.
Assert
.
assertThrows
;
import
static
org
.
junit
.
Assert
.
assertThrows
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.MetadataInputBuffer
;
import
com.google.android.exoplayer2.metadata.MetadataInputBuffer
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
java.nio.charset.Charset
;
import
com.google.common.base.Charsets
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -287,7 +286,7 @@ public final class Id3DecoderTest {
...
@@ -287,7 +286,7 @@ public final class Id3DecoderTest {
for
(
FrameSpec
frame
:
frames
)
{
for
(
FrameSpec
frame
:
frames
)
{
byte
[]
frameData
=
frame
.
frameData
;
byte
[]
frameData
=
frame
.
frameData
;
String
frameId
=
frame
.
frameId
;
String
frameId
=
frame
.
frameId
;
byte
[]
frameIdBytes
=
frameId
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
byte
[]
frameIdBytes
=
frameId
.
getBytes
(
Charset
s
.
UTF_8
);
Assertions
.
checkState
(
frameIdBytes
.
length
==
4
);
Assertions
.
checkState
(
frameIdBytes
.
length
==
4
);
// Fill in the frame header.
// Fill in the frame header.
...
...
library/common/src/test/java/com/google/android/exoplayer2/util/ParsableBitArrayTest.java
View file @
836babd5
...
@@ -19,9 +19,8 @@ import static com.google.common.truth.Truth.assertThat;
...
@@ -19,9 +19,8 @@ import static com.google.common.truth.Truth.assertThat;
import
static
org
.
junit
.
Assert
.
assertThrows
;
import
static
org
.
junit
.
Assert
.
assertThrows
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
androidx.test.ext.junit.runners.AndroidJUnit4
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
java.nio.charset.Charset
;
import
com.google.common.base.Charsets
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runner.RunWith
;
...
@@ -281,7 +280,7 @@ public final class ParsableBitArrayTest {
...
@@ -281,7 +280,7 @@ public final class ParsableBitArrayTest {
@Test
@Test
public
void
readBytesAsStringDefaultsToUtf8
()
{
public
void
readBytesAsStringDefaultsToUtf8
()
{
byte
[]
testData
=
"a non-åscii strìng"
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
byte
[]
testData
=
"a non-åscii strìng"
.
getBytes
(
Charset
s
.
UTF_8
);
ParsableBitArray
testArray
=
new
ParsableBitArray
(
testData
);
ParsableBitArray
testArray
=
new
ParsableBitArray
(
testData
);
testArray
.
skipBytes
(
2
);
testArray
.
skipBytes
(
2
);
...
@@ -290,18 +289,18 @@ public final class ParsableBitArrayTest {
...
@@ -290,18 +289,18 @@ public final class ParsableBitArrayTest {
@Test
@Test
public
void
readBytesAsStringExplicitCharset
()
{
public
void
readBytesAsStringExplicitCharset
()
{
byte
[]
testData
=
"a non-åscii strìng"
.
getBytes
(
Charset
.
forName
(
C
.
UTF16_NAME
)
);
byte
[]
testData
=
"a non-åscii strìng"
.
getBytes
(
Charset
s
.
UTF_16
);
ParsableBitArray
testArray
=
new
ParsableBitArray
(
testData
);
ParsableBitArray
testArray
=
new
ParsableBitArray
(
testData
);
testArray
.
skipBytes
(
6
);
testArray
.
skipBytes
(
6
);
assertThat
(
testArray
.
readBytesAsString
(
testData
.
length
-
6
,
Charset
.
forName
(
C
.
UTF16_NAME
)
))
assertThat
(
testArray
.
readBytesAsString
(
testData
.
length
-
6
,
Charset
s
.
UTF_16
))
.
isEqualTo
(
"non-åscii strìng"
);
.
isEqualTo
(
"non-åscii strìng"
);
}
}
@Test
@Test
public
void
readBytesNotByteAligned
()
{
public
void
readBytesNotByteAligned
()
{
String
testString
=
"test string"
;
String
testString
=
"test string"
;
byte
[]
testData
=
testString
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
byte
[]
testData
=
testString
.
getBytes
(
Charset
s
.
UTF_8
);
ParsableBitArray
testArray
=
new
ParsableBitArray
(
testData
);
ParsableBitArray
testArray
=
new
ParsableBitArray
(
testData
);
testArray
.
skipBit
();
testArray
.
skipBit
();
...
...
library/core/src/main/java/com/google/android/exoplayer2/drm/FrameworkMediaDrm.java
View file @
836babd5
...
@@ -34,9 +34,9 @@ import com.google.android.exoplayer2.util.Log;
...
@@ -34,9 +34,9 @@ import com.google.android.exoplayer2.util.Log;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.common.base.Charsets
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
import
java.nio.ByteOrder
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -438,7 +438,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
...
@@ -438,7 +438,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
return
data
;
return
data
;
}
}
int
recordLength
=
byteArray
.
readLittleEndianShort
();
int
recordLength
=
byteArray
.
readLittleEndianShort
();
String
xml
=
byteArray
.
readString
(
recordLength
,
Charset
.
forName
(
C
.
UTF16LE_NAME
)
);
String
xml
=
byteArray
.
readString
(
recordLength
,
Charset
s
.
UTF_16LE
);
if
(
xml
.
contains
(
"<LA_URL>"
))
{
if
(
xml
.
contains
(
"<LA_URL>"
))
{
// LA_URL already present. Do nothing.
// LA_URL already present. Do nothing.
return
data
;
return
data
;
...
@@ -459,7 +459,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
...
@@ -459,7 +459,7 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
newData
.
putShort
((
short
)
objectRecordCount
);
newData
.
putShort
((
short
)
objectRecordCount
);
newData
.
putShort
((
short
)
recordType
);
newData
.
putShort
((
short
)
recordType
);
newData
.
putShort
((
short
)
(
xmlWithMockLaUrl
.
length
()
*
UTF_16_BYTES_PER_CHARACTER
));
newData
.
putShort
((
short
)
(
xmlWithMockLaUrl
.
length
()
*
UTF_16_BYTES_PER_CHARACTER
));
newData
.
put
(
xmlWithMockLaUrl
.
getBytes
(
Charset
.
forName
(
C
.
UTF16LE_NAME
)
));
newData
.
put
(
xmlWithMockLaUrl
.
getBytes
(
Charset
s
.
UTF_16LE
));
return
newData
.
array
();
return
newData
.
array
();
}
}
}
}
library/core/src/main/java/com/google/android/exoplayer2/metadata/dvbsi/AppInfoTableDecoder.java
View file @
836babd5
...
@@ -16,14 +16,13 @@
...
@@ -16,14 +16,13 @@
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
dvbsi
;
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
dvbsi
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.MetadataDecoder
;
import
com.google.android.exoplayer2.metadata.MetadataDecoder
;
import
com.google.android.exoplayer2.metadata.MetadataInputBuffer
;
import
com.google.android.exoplayer2.metadata.MetadataInputBuffer
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.ParsableBitArray
;
import
com.google.android.exoplayer2.util.ParsableBitArray
;
import
com.google.common.base.Charsets
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
/**
/**
...
@@ -109,7 +108,7 @@ public final class AppInfoTableDecoder implements MetadataDecoder {
...
@@ -109,7 +108,7 @@ public final class AppInfoTableDecoder implements MetadataDecoder {
// See section 5.3.6.2.
// See section 5.3.6.2.
while
(
sectionData
.
getBytePosition
()
<
positionOfNextDescriptor
)
{
while
(
sectionData
.
getBytePosition
()
<
positionOfNextDescriptor
)
{
int
urlBaseLength
=
sectionData
.
readBits
(
8
);
int
urlBaseLength
=
sectionData
.
readBits
(
8
);
urlBase
=
sectionData
.
readBytesAsString
(
urlBaseLength
,
Charset
.
forName
(
C
.
ASCII_NAME
)
);
urlBase
=
sectionData
.
readBytesAsString
(
urlBaseLength
,
Charset
s
.
US_ASCII
);
int
extensionCount
=
sectionData
.
readBits
(
8
);
int
extensionCount
=
sectionData
.
readBits
(
8
);
for
(
int
urlExtensionIndex
=
0
;
for
(
int
urlExtensionIndex
=
0
;
...
@@ -122,8 +121,7 @@ public final class AppInfoTableDecoder implements MetadataDecoder {
...
@@ -122,8 +121,7 @@ public final class AppInfoTableDecoder implements MetadataDecoder {
}
}
}
else
if
(
descriptorTag
==
DESCRIPTOR_SIMPLE_APPLICATION_LOCATION
)
{
}
else
if
(
descriptorTag
==
DESCRIPTOR_SIMPLE_APPLICATION_LOCATION
)
{
// See section 5.3.7.
// See section 5.3.7.
urlExtension
=
urlExtension
=
sectionData
.
readBytesAsString
(
descriptorLength
,
Charsets
.
US_ASCII
);
sectionData
.
readBytesAsString
(
descriptorLength
,
Charset
.
forName
(
C
.
ASCII_NAME
));
}
}
sectionData
.
setPosition
(
positionOfNextDescriptor
*
8
);
sectionData
.
setPosition
(
positionOfNextDescriptor
*
8
);
...
...
library/core/src/main/java/com/google/android/exoplayer2/metadata/icy/IcyDecoder.java
View file @
836babd5
...
@@ -16,15 +16,14 @@
...
@@ -16,15 +16,14 @@
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
icy
;
package
com
.
google
.
android
.
exoplayer2
.
metadata
.
icy
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.MetadataDecoder
;
import
com.google.android.exoplayer2.metadata.MetadataDecoder
;
import
com.google.android.exoplayer2.metadata.MetadataInputBuffer
;
import
com.google.android.exoplayer2.metadata.MetadataInputBuffer
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Assertions
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.common.base.Charsets
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.CharacterCodingException
;
import
java.nio.charset.CharacterCodingException
;
import
java.nio.charset.Charset
;
import
java.nio.charset.CharsetDecoder
;
import
java.nio.charset.CharsetDecoder
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -40,8 +39,8 @@ public final class IcyDecoder implements MetadataDecoder {
...
@@ -40,8 +39,8 @@ public final class IcyDecoder implements MetadataDecoder {
private
final
CharsetDecoder
iso88591Decoder
;
private
final
CharsetDecoder
iso88591Decoder
;
public
IcyDecoder
()
{
public
IcyDecoder
()
{
utf8Decoder
=
Charset
.
forName
(
C
.
UTF8_NAME
)
.
newDecoder
();
utf8Decoder
=
Charset
s
.
UTF_8
.
newDecoder
();
iso88591Decoder
=
Charset
.
forName
(
C
.
ISO88591_NAME
)
.
newDecoder
();
iso88591Decoder
=
Charset
s
.
ISO_8859_1
.
newDecoder
();
}
}
@Override
@Override
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/tx3g/Tx3gDecoder.java
View file @
836babd5
...
@@ -30,7 +30,7 @@ import com.google.android.exoplayer2.text.Subtitle;
...
@@ -30,7 +30,7 @@ import com.google.android.exoplayer2.text.Subtitle;
import
com.google.android.exoplayer2.text.SubtitleDecoderException
;
import
com.google.android.exoplayer2.text.SubtitleDecoderException
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
java.nio.charset.Charset
;
import
com.google.common.base.Charsets
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -171,10 +171,10 @@ public final class Tx3gDecoder extends SimpleSubtitleDecoder {
...
@@ -171,10 +171,10 @@ public final class Tx3gDecoder extends SimpleSubtitleDecoder {
if
(
parsableByteArray
.
bytesLeft
()
>=
SIZE_BOM_UTF16
)
{
if
(
parsableByteArray
.
bytesLeft
()
>=
SIZE_BOM_UTF16
)
{
char
firstChar
=
parsableByteArray
.
peekChar
();
char
firstChar
=
parsableByteArray
.
peekChar
();
if
(
firstChar
==
BOM_UTF16_BE
||
firstChar
==
BOM_UTF16_LE
)
{
if
(
firstChar
==
BOM_UTF16_BE
||
firstChar
==
BOM_UTF16_LE
)
{
return
parsableByteArray
.
readString
(
textLength
,
Charset
.
forName
(
C
.
UTF16_NAME
)
);
return
parsableByteArray
.
readString
(
textLength
,
Charset
s
.
UTF_16
);
}
}
}
}
return
parsableByteArray
.
readString
(
textLength
,
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
parsableByteArray
.
readString
(
textLength
,
Charset
s
.
UTF_8
);
}
}
private
void
applyStyleRecord
(
ParsableByteArray
parsableByteArray
,
private
void
applyStyleRecord
(
ParsableByteArray
parsableByteArray
,
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/DataSchemeDataSource.java
View file @
836babd5
...
@@ -23,6 +23,7 @@ import androidx.annotation.Nullable;
...
@@ -23,6 +23,7 @@ import androidx.annotation.Nullable;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.common.base.Charsets
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
...
@@ -63,7 +64,7 @@ public final class DataSchemeDataSource extends BaseDataSource {
...
@@ -63,7 +64,7 @@ public final class DataSchemeDataSource extends BaseDataSource {
}
}
}
else
{
}
else
{
// TODO: Add support for other charsets.
// TODO: Add support for other charsets.
data
=
Util
.
getUtf8Bytes
(
URLDecoder
.
decode
(
dataString
,
C
.
ASCII_NAME
));
data
=
Util
.
getUtf8Bytes
(
URLDecoder
.
decode
(
dataString
,
C
harsets
.
US_ASCII
.
name
()
));
}
}
endPosition
=
endPosition
=
dataSpec
.
length
!=
C
.
LENGTH_UNSET
?
(
int
)
dataSpec
.
length
+
readPosition
:
data
.
length
;
dataSpec
.
length
!=
C
.
LENGTH_UNSET
?
(
int
)
dataSpec
.
length
+
readPosition
:
data
.
length
;
...
...
library/core/src/main/java/com/google/android/exoplayer2/upstream/cache/DefaultContentMetadata.java
View file @
836babd5
...
@@ -16,9 +16,8 @@
...
@@ -16,9 +16,8 @@
package
com
.
google
.
android
.
exoplayer2
.
upstream
.
cache
;
package
com
.
google
.
android
.
exoplayer2
.
upstream
.
cache
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.
android.exoplayer2.C
;
import
com.google.
common.base.Charsets
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.charset.Charset
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -80,7 +79,7 @@ public final class DefaultContentMetadata implements ContentMetadata {
...
@@ -80,7 +79,7 @@ public final class DefaultContentMetadata implements ContentMetadata {
public
final
String
get
(
String
name
,
@Nullable
String
defaultValue
)
{
public
final
String
get
(
String
name
,
@Nullable
String
defaultValue
)
{
@Nullable
byte
[]
bytes
=
metadata
.
get
(
name
);
@Nullable
byte
[]
bytes
=
metadata
.
get
(
name
);
if
(
bytes
!=
null
)
{
if
(
bytes
!=
null
)
{
return
new
String
(
bytes
,
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
new
String
(
bytes
,
Charset
s
.
UTF_8
);
}
else
{
}
else
{
return
defaultValue
;
return
defaultValue
;
}
}
...
@@ -162,7 +161,7 @@ public final class DefaultContentMetadata implements ContentMetadata {
...
@@ -162,7 +161,7 @@ public final class DefaultContentMetadata implements ContentMetadata {
if
(
value
instanceof
Long
)
{
if
(
value
instanceof
Long
)
{
return
ByteBuffer
.
allocate
(
8
).
putLong
((
Long
)
value
).
array
();
return
ByteBuffer
.
allocate
(
8
).
putLong
((
Long
)
value
).
array
();
}
else
if
(
value
instanceof
String
)
{
}
else
if
(
value
instanceof
String
)
{
return
((
String
)
value
).
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
return
((
String
)
value
).
getBytes
(
Charset
s
.
UTF_8
);
}
else
if
(
value
instanceof
byte
[])
{
}
else
if
(
value
instanceof
byte
[])
{
return
(
byte
[])
value
;
return
(
byte
[])
value
;
}
else
{
}
else
{
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/DashMediaSource.java
View file @
836babd5
...
@@ -63,11 +63,11 @@ import com.google.android.exoplayer2.util.Log;
...
@@ -63,11 +63,11 @@ import com.google.android.exoplayer2.util.Log;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.SntpClient
;
import
com.google.android.exoplayer2.util.SntpClient
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.common.base.Charsets
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
import
java.nio.charset.Charset
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -1451,8 +1451,7 @@ public final class DashMediaSource extends BaseMediaSource {
...
@@ -1451,8 +1451,7 @@ public final class DashMediaSource extends BaseMediaSource {
@Override
@Override
public
Long
parse
(
Uri
uri
,
InputStream
inputStream
)
throws
IOException
{
public
Long
parse
(
Uri
uri
,
InputStream
inputStream
)
throws
IOException
{
String
firstLine
=
String
firstLine
=
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
Charset
.
forName
(
C
.
UTF8_NAME
)))
new
BufferedReader
(
new
InputStreamReader
(
inputStream
,
Charsets
.
UTF_8
)).
readLine
();
.
readLine
();
try
{
try
{
Matcher
matcher
=
TIMESTAMP_WITH_TIMEZONE_PATTERN
.
matcher
(
firstLine
);
Matcher
matcher
=
TIMESTAMP_WITH_TIMEZONE_PATTERN
.
matcher
(
firstLine
);
if
(!
matcher
.
matches
())
{
if
(!
matcher
.
matches
())
{
...
...
library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParser.java
View file @
836babd5
...
@@ -39,6 +39,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
...
@@ -39,6 +39,7 @@ import com.google.android.exoplayer2.util.MimeTypes;
import
com.google.android.exoplayer2.util.UriUtil
;
import
com.google.android.exoplayer2.util.UriUtil
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.XmlPullParserUtil
;
import
com.google.android.exoplayer2.util.XmlPullParserUtil
;
import
com.google.common.base.Charsets
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
...
@@ -933,7 +934,7 @@ public class DashManifestParser extends DefaultHandler
...
@@ -933,7 +934,7 @@ public class DashManifestParser extends DefaultHandler
throws
XmlPullParserException
,
IOException
{
throws
XmlPullParserException
,
IOException
{
scratchOutputStream
.
reset
();
scratchOutputStream
.
reset
();
XmlSerializer
xmlSerializer
=
Xml
.
newSerializer
();
XmlSerializer
xmlSerializer
=
Xml
.
newSerializer
();
xmlSerializer
.
setOutput
(
scratchOutputStream
,
C
.
UTF8_NAME
);
xmlSerializer
.
setOutput
(
scratchOutputStream
,
C
harsets
.
UTF_8
.
name
()
);
// Start reading everything between <Event> and </Event>, and serialize them into an Xml
// Start reading everything between <Event> and </Event>, and serialize them into an Xml
// byte array.
// byte array.
xpp
.
nextToken
();
xpp
.
nextToken
();
...
...
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/manifest/DashManifestParserTest.java
View file @
836babd5
...
@@ -28,9 +28,9 @@ import com.google.android.exoplayer2.source.dash.manifest.SegmentBase.SegmentTim
...
@@ -28,9 +28,9 @@ import com.google.android.exoplayer2.source.dash.manifest.SegmentBase.SegmentTim
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.testutil.TestUtil
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.common.base.Charsets
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.StringReader
;
import
java.io.StringReader
;
import
java.nio.charset.Charset
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -116,11 +116,7 @@ public class DashManifestParserTest {
...
@@ -116,11 +116,7 @@ public class DashManifestParserTest {
assertThat
(
eventStream1
.
events
.
length
).
isEqualTo
(
1
);
assertThat
(
eventStream1
.
events
.
length
).
isEqualTo
(
1
);
EventMessage
expectedEvent1
=
EventMessage
expectedEvent1
=
new
EventMessage
(
new
EventMessage
(
"urn:uuid:XYZY"
,
"urn:uuid:XYZY"
,
"call"
,
10000
,
0
,
"+ 1 800 10101010"
.
getBytes
(
Charsets
.
UTF_8
));
"call"
,
10000
,
0
,
"+ 1 800 10101010"
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)));
assertThat
(
eventStream1
.
events
[
0
]).
isEqualTo
(
expectedEvent1
);
assertThat
(
eventStream1
.
events
[
0
]).
isEqualTo
(
expectedEvent1
);
assertThat
(
eventStream1
.
presentationTimesUs
[
0
]).
isEqualTo
(
0
);
assertThat
(
eventStream1
.
presentationTimesUs
[
0
]).
isEqualTo
(
0
);
...
...
library/dash/src/test/java/com/google/android/exoplayer2/source/dash/offline/DashDownloadTestData.java
View file @
836babd5
...
@@ -16,8 +16,7 @@
...
@@ -16,8 +16,7 @@
package
com
.
google
.
android
.
exoplayer2
.
source
.
dash
.
offline
;
package
com
.
google
.
android
.
exoplayer2
.
source
.
dash
.
offline
;
import
android.net.Uri
;
import
android.net.Uri
;
import
com.google.android.exoplayer2.C
;
import
com.google.common.base.Charsets
;
import
java.nio.charset.Charset
;
/** Data for DASH downloading tests. */
/** Data for DASH downloading tests. */
/* package */
interface
DashDownloadTestData
{
/* package */
interface
DashDownloadTestData
{
...
@@ -87,7 +86,7 @@ import java.nio.charset.Charset;
...
@@ -87,7 +86,7 @@ import java.nio.charset.Charset;
+
" </AdaptationSet>\n"
+
" </AdaptationSet>\n"
+
" </Period>\n"
+
" </Period>\n"
+
"</MPD>"
)
+
"</MPD>"
)
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
.
getBytes
(
Charset
s
.
UTF_8
);
byte
[]
TEST_MPD_NO_INDEX
=
byte
[]
TEST_MPD_NO_INDEX
=
(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
...
@@ -100,5 +99,5 @@ import java.nio.charset.Charset;
...
@@ -100,5 +99,5 @@ import java.nio.charset.Charset;
+
" </AdaptationSet>\n"
+
" </AdaptationSet>\n"
+
" </Period>\n"
+
" </Period>\n"
+
"</MPD>"
)
+
"</MPD>"
)
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
.
getBytes
(
Charset
s
.
UTF_8
);
}
}
library/extractor/src/main/java/com/google/android/exoplayer2/extractor/FlacMetadataReader.java
View file @
836babd5
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
package
com
.
google
.
android
.
exoplayer2
.
extractor
;
package
com
.
google
.
android
.
exoplayer2
.
extractor
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.ParserException
;
import
com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader
;
import
com.google.android.exoplayer2.extractor.VorbisUtil.CommentHeader
;
import
com.google.android.exoplayer2.metadata.Metadata
;
import
com.google.android.exoplayer2.metadata.Metadata
;
...
@@ -25,8 +24,8 @@ import com.google.android.exoplayer2.metadata.id3.Id3Decoder;
...
@@ -25,8 +24,8 @@ import com.google.android.exoplayer2.metadata.id3.Id3Decoder;
import
com.google.android.exoplayer2.util.FlacConstants
;
import
com.google.android.exoplayer2.util.FlacConstants
;
import
com.google.android.exoplayer2.util.ParsableBitArray
;
import
com.google.android.exoplayer2.util.ParsableBitArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.android.exoplayer2.util.ParsableByteArray
;
import
com.google.common.base.Charsets
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
...
@@ -275,7 +274,7 @@ public final class FlacMetadataReader {
...
@@ -275,7 +274,7 @@ public final class FlacMetadataReader {
int
pictureType
=
scratch
.
readInt
();
int
pictureType
=
scratch
.
readInt
();
int
mimeTypeLength
=
scratch
.
readInt
();
int
mimeTypeLength
=
scratch
.
readInt
();
String
mimeType
=
scratch
.
readString
(
mimeTypeLength
,
Charset
.
forName
(
C
.
ASCII_NAME
)
);
String
mimeType
=
scratch
.
readString
(
mimeTypeLength
,
Charset
s
.
US_ASCII
);
int
descriptionLength
=
scratch
.
readInt
();
int
descriptionLength
=
scratch
.
readInt
();
String
description
=
scratch
.
readString
(
descriptionLength
);
String
description
=
scratch
.
readString
(
descriptionLength
);
int
width
=
scratch
.
readInt
();
int
width
=
scratch
.
readInt
();
...
...
library/hls/src/test/java/com/google/android/exoplayer2/source/hls/offline/HlsDownloadTestData.java
View file @
836babd5
...
@@ -15,8 +15,7 @@
...
@@ -15,8 +15,7 @@
*/
*/
package
com
.
google
.
android
.
exoplayer2
.
source
.
hls
.
offline
;
package
com
.
google
.
android
.
exoplayer2
.
source
.
hls
.
offline
;
import
com.google.android.exoplayer2.C
;
import
com.google.common.base.Charsets
;
import
java.nio.charset.Charset
;
/** Data for HLS downloading tests. */
/** Data for HLS downloading tests. */
/* package */
interface
HlsDownloadTestData
{
/* package */
interface
HlsDownloadTestData
{
...
@@ -49,7 +48,7 @@ import java.nio.charset.Charset;
...
@@ -49,7 +48,7 @@ import java.nio.charset.Charset;
+
"\n"
+
"\n"
+
"#EXT-X-STREAM-INF:BANDWIDTH=41457,CODECS=\"mp4a.40.2\"\n"
+
"#EXT-X-STREAM-INF:BANDWIDTH=41457,CODECS=\"mp4a.40.2\"\n"
+
MEDIA_PLAYLIST_0_URI
)
+
MEDIA_PLAYLIST_0_URI
)
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
.
getBytes
(
Charset
s
.
UTF_8
);
byte
[]
MEDIA_PLAYLIST_DATA
=
byte
[]
MEDIA_PLAYLIST_DATA
=
(
"#EXTM3U\n"
(
"#EXTM3U\n"
...
@@ -64,7 +63,7 @@ import java.nio.charset.Charset;
...
@@ -64,7 +63,7 @@ import java.nio.charset.Charset;
+
"#EXTINF:9.97667,\n"
+
"#EXTINF:9.97667,\n"
+
"fileSequence2.ts\n"
+
"fileSequence2.ts\n"
+
"#EXT-X-ENDLIST"
)
+
"#EXT-X-ENDLIST"
)
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
.
getBytes
(
Charset
s
.
UTF_8
);
String
ENC_MEDIA_PLAYLIST_URI
=
"enc_index.m3u8"
;
String
ENC_MEDIA_PLAYLIST_URI
=
"enc_index.m3u8"
;
...
@@ -83,5 +82,5 @@ import java.nio.charset.Charset;
...
@@ -83,5 +82,5 @@ import java.nio.charset.Charset;
+
"#EXTINF:9.97667,\n"
+
"#EXTINF:9.97667,\n"
+
"fileSequence2.ts\n"
+
"fileSequence2.ts\n"
+
"#EXT-X-ENDLIST"
)
+
"#EXT-X-ENDLIST"
)
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
);
.
getBytes
(
Charset
s
.
UTF_8
);
}
}
library/hls/src/test/java/com/google/android/exoplayer2/source/hls/playlist/HlsMasterPlaylistParserTest.java
View file @
836babd5
...
@@ -27,9 +27,9 @@ import com.google.android.exoplayer2.metadata.Metadata;
...
@@ -27,9 +27,9 @@ import com.google.android.exoplayer2.metadata.Metadata;
import
com.google.android.exoplayer2.source.hls.HlsTrackMetadataEntry
;
import
com.google.android.exoplayer2.source.hls.HlsTrackMetadataEntry
;
import
com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist.Variant
;
import
com.google.android.exoplayer2.source.hls.playlist.HlsMasterPlaylist.Variant
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.android.exoplayer2.util.MimeTypes
;
import
com.google.common.base.Charsets
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.charset.Charset
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
...
@@ -461,7 +461,7 @@ public class HlsMasterPlaylistParserTest {
...
@@ -461,7 +461,7 @@ public class HlsMasterPlaylistParserTest {
throws
IOException
{
throws
IOException
{
Uri
playlistUri
=
Uri
.
parse
(
uri
);
Uri
playlistUri
=
Uri
.
parse
(
uri
);
ByteArrayInputStream
inputStream
=
ByteArrayInputStream
inputStream
=
new
ByteArrayInputStream
(
playlistString
.
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)
));
new
ByteArrayInputStream
(
playlistString
.
getBytes
(
Charset
s
.
UTF_8
));
return
(
HlsMasterPlaylist
)
new
HlsPlaylistParser
().
parse
(
playlistUri
,
inputStream
);
return
(
HlsMasterPlaylist
)
new
HlsPlaylistParser
().
parse
(
playlistUri
,
inputStream
);
}
}
}
}
library/ui/build.gradle
View file @
836babd5
...
@@ -41,6 +41,7 @@ dependencies {
...
@@ -41,6 +41,7 @@ dependencies {
api
'androidx.media:media:'
+
androidxMediaVersion
api
'androidx.media:media:'
+
androidxMediaVersion
implementation
'androidx.annotation:annotation:'
+
androidxAnnotationVersion
implementation
'androidx.annotation:annotation:'
+
androidxAnnotationVersion
implementation
'androidx.appcompat:appcompat:'
+
androidxAppCompatVersion
implementation
'androidx.appcompat:appcompat:'
+
androidxAppCompatVersion
implementation
'com.google.guava:guava:'
+
guavaVersion
compileOnly
'org.checkerframework:checker-qual:'
+
checkerframeworkVersion
compileOnly
'org.checkerframework:checker-qual:'
+
checkerframeworkVersion
compileOnly
'org.jetbrains.kotlin:kotlin-annotations-jvm:'
+
kotlinAnnotationsVersion
compileOnly
'org.jetbrains.kotlin:kotlin-annotations-jvm:'
+
kotlinAnnotationsVersion
testImplementation
project
(
modulePrefix
+
'testutils'
)
testImplementation
project
(
modulePrefix
+
'testutils'
)
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/WebViewSubtitleOutput.java
View file @
836babd5
...
@@ -29,11 +29,10 @@ import android.view.MotionEvent;
...
@@ -29,11 +29,10 @@ import android.view.MotionEvent;
import
android.webkit.WebView
;
import
android.webkit.WebView
;
import
android.widget.FrameLayout
;
import
android.widget.FrameLayout
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
com.google.android.exoplayer2.C
;
import
com.google.android.exoplayer2.text.CaptionStyleCompat
;
import
com.google.android.exoplayer2.text.CaptionStyleCompat
;
import
com.google.android.exoplayer2.text.Cue
;
import
com.google.android.exoplayer2.text.Cue
;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
java.nio.charset.Charset
;
import
com.google.common.base.Charsets
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
...
@@ -288,8 +287,7 @@ import java.util.List;
...
@@ -288,8 +287,7 @@ import java.util.List;
html
.
append
(
"</div></body></html>"
);
html
.
append
(
"</div></body></html>"
);
webView
.
loadData
(
webView
.
loadData
(
Base64
.
encodeToString
(
Base64
.
encodeToString
(
html
.
toString
().
getBytes
(
Charsets
.
UTF_8
),
Base64
.
NO_PADDING
),
html
.
toString
().
getBytes
(
Charset
.
forName
(
C
.
UTF8_NAME
)),
Base64
.
NO_PADDING
),
"text/html"
,
"text/html"
,
"base64"
);
"base64"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment