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
5e3b817b
authored
Nov 26, 2022
by
Lev
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cleanup
parent
184761f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
24 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 @
5e3b817b
...
@@ -157,11 +157,6 @@ public final class ParsableByteArray {
...
@@ -157,11 +157,6 @@ public final class ParsableByteArray {
this
.
position
=
position
;
this
.
position
=
position
;
}
}
/** Resets the current byte offset. */
public
void
resetPosition
()
{
this
.
position
=
0
;
}
/**
/**
* Returns the underlying array.
* Returns the underlying array.
*
*
...
@@ -572,8 +567,7 @@ public final class ParsableByteArray {
...
@@ -572,8 +567,7 @@ public final class ParsableByteArray {
return
null
;
return
null
;
}
}
boolean
isLittleEndian
=
charset
.
equals
(
Charsets
.
UTF_16LE
);
int
lineLimit
=
calculateLineLimitForUtf16
(
charset
.
equals
(
Charsets
.
UTF_16LE
));
int
lineLimit
=
calculateLineLimitForUtf16
(
isLittleEndian
);
if
(
lineLimit
-
position
>=
2
&&
isUtf16BOM
(
peekChar
()))
{
if
(
lineLimit
-
position
>=
2
&&
isUtf16BOM
(
peekChar
()))
{
// There's a UTF-16 byte order mark at the start of the line. Discard it.
// There's a UTF-16 byte order mark at the start of the line. Discard it.
...
@@ -586,27 +580,14 @@ public final class ParsableByteArray {
...
@@ -586,27 +580,14 @@ public final class ParsableByteArray {
return
line
;
return
line
;
}
}
char
currentChar
;
if
(
peekLittleEndianChar
()
==
'\r'
||
peekChar
()
==
'\r'
)
{
if
(
isLittleEndian
)
{
currentChar
=
peekLittleEndianChar
();
}
else
{
currentChar
=
peekChar
();
}
if
(
currentChar
==
'\r'
)
{
position
+=
2
;
position
+=
2
;
if
(
position
==
limit
)
{
if
(
position
==
limit
)
{
return
line
;
return
line
;
}
}
}
}
if
(
isLittleEndian
)
{
if
(
peekLittleEndianChar
()
==
'\n'
||
peekChar
()
==
'\n'
)
{
currentChar
=
peekLittleEndianChar
();
}
else
{
currentChar
=
peekChar
();
}
if
(
currentChar
==
'\n'
)
{
position
+=
2
;
position
+=
2
;
}
}
return
line
;
return
line
;
...
...
library/extractor/src/main/java/com/google/android/exoplayer2/text/subrip/SubripDecoder.java
View file @
5e3b817b
...
@@ -144,10 +144,9 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
...
@@ -144,10 +144,9 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
/**
/**
* Determine UTF encoding of the byte array. It can be UTF-16LE/UTF-16BE
* Determine UTF encoding of the byte array. It can be UTF-16LE/UTF-16BE
* if the byte array contains BOM, or UTF-8 otherwise as the default behavior.
* if the byte array contains BOM, or UTF-8 otherwise as the default behavior.
* After it resets the offset in ParsableByteArray
*
*
* @param data byte array to determinate UTF encoding.
* @param data byte array to determinate UTF encoding.
* @return
D
etermined encoding
* @return
d
etermined encoding
*/
*/
private
Charset
detectUtfCharset
(
ParsableByteArray
data
)
{
private
Charset
detectUtfCharset
(
ParsableByteArray
data
)
{
if
(
data
.
limit
()
<
2
)
{
if
(
data
.
limit
()
<
2
)
{
...
...
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