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
101b7122
authored
Nov 26, 2022
by
Lev
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cleanup
parent
5e3b817b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
7 deletions
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableByteArray.java
library/extractor/src/main/java/com/google/android/exoplayer2/text/subrip/SubripDecoder.java
library/common/src/main/java/com/google/android/exoplayer2/util/ParsableByteArray.java
View file @
101b7122
...
...
@@ -234,7 +234,7 @@ public final class ParsableByteArray {
/** Peeks at the next char. */
public
char
peekLittleEndianChar
()
{
return
(
char
)
((
data
[
position
]
&
0xFF
)
|
(
data
[
position
+
1
]
&
0xFF
)
<<
8
);
return
(
char
)
((
data
[
position
]
&
0xFF
)
|
(
data
[
position
+
1
]
&
0xFF
)
<<
8
);
}
/** Reads the next byte as an unsigned value. */
...
...
@@ -554,12 +554,12 @@ public final class ParsableByteArray {
*/
@Nullable
public
String
readUtfLine
(
Charset
charset
)
{
if
(!
charset
.
equals
(
Charsets
.
UTF_8
)
if
(!
charset
.
equals
(
Charsets
.
UTF_8
)
&&
!
charset
.
equals
(
Charsets
.
UTF_16BE
)
&&
!
charset
.
equals
(
Charsets
.
UTF_16LE
))
{
throw
new
IllegalArgumentException
(
"Only UTF-8, UTF-16LE, UTF-16BE encoding supported."
);
}
if
(
charset
.
equals
(
Charsets
.
UTF_8
))
{
if
(
charset
.
equals
(
Charsets
.
UTF_8
))
{
return
readLine
();
}
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/text/subrip/SubripDecoder.java
View file @
101b7122
...
...
@@ -149,13 +149,11 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
* @return determined encoding
*/
private
Charset
detectUtfCharset
(
ParsableByteArray
data
)
{
if
(
data
.
limit
()
<
2
)
{
if
(
data
.
limit
()
<
2
)
{
return
Charsets
.
UTF_8
;
}
char
twoBytes
=
data
.
peekChar
();
switch
(
twoBytes
)
{
switch
(
data
.
peekChar
())
{
case
ParsableByteArray
.
BOM_UTF16_BE
:
return
Charsets
.
UTF_16BE
;
case
ParsableByteArray
.
BOM_UTF16_LE
:
...
...
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