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
5407c317
authored
Nov 01, 2019
by
ibaker
Committed by
Oliver Woodman
Nov 05, 2019
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove WebvttSubtitle from null-checking blacklist
PiperOrigin-RevId: 277916113
parent
5b80b4b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
13 deletions
library/core/src/main/java/com/google/android/exoplayer2/text/webvtt/WebvttSubtitle.java
library/core/src/main/java/com/google/android/exoplayer2/text/webvtt/WebvttSubtitle.java
View file @
5407c317
...
...
@@ -23,7 +23,6 @@ import com.google.android.exoplayer2.util.Assertions;
import
com.google.android.exoplayer2.util.Util
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
/**
...
...
@@ -73,15 +72,12 @@ import java.util.List;
@Override
public
List
<
Cue
>
getCues
(
long
timeUs
)
{
ArrayList
<
Cue
>
list
=
null
;
List
<
Cue
>
list
=
new
ArrayList
<>()
;
WebvttCue
firstNormalCue
=
null
;
SpannableStringBuilder
normalCueTextBuilder
=
null
;
for
(
int
i
=
0
;
i
<
numCues
;
i
++)
{
if
((
cueTimesUs
[
i
*
2
]
<=
timeUs
)
&&
(
timeUs
<
cueTimesUs
[
i
*
2
+
1
]))
{
if
(
list
==
null
)
{
list
=
new
ArrayList
<>();
}
WebvttCue
cue
=
cues
.
get
(
i
);
// TODO(ibaker): Replace this with a closer implementation of the WebVTT spec (keeping
// individual cues, but tweaking their `line` value):
...
...
@@ -94,9 +90,12 @@ import java.util.List;
firstNormalCue
=
cue
;
}
else
if
(
normalCueTextBuilder
==
null
)
{
normalCueTextBuilder
=
new
SpannableStringBuilder
();
normalCueTextBuilder
.
append
(
firstNormalCue
.
text
).
append
(
"\n"
).
append
(
cue
.
text
);
normalCueTextBuilder
.
append
(
Assertions
.
checkNotNull
(
firstNormalCue
.
text
))
.
append
(
"\n"
)
.
append
(
Assertions
.
checkNotNull
(
cue
.
text
));
}
else
{
normalCueTextBuilder
.
append
(
"\n"
).
append
(
cue
.
text
);
normalCueTextBuilder
.
append
(
"\n"
).
append
(
Assertions
.
checkNotNull
(
cue
.
text
)
);
}
}
else
{
list
.
add
(
cue
);
...
...
@@ -110,12 +109,7 @@ import java.util.List;
// there was only a single normal cue, so just add it to the list
list
.
add
(
firstNormalCue
);
}
if
(
list
!=
null
)
{
return
list
;
}
else
{
return
Collections
.
emptyList
();
}
return
list
;
}
}
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