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
fc5eb12e
authored
Oct 01, 2018
by
Arnold Szabo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
#4306 - breaking after the first alignment tag is found
parent
876080ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
library/core/src/main/java/com/google/android/exoplayer2/text/subrip/SubripDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/subrip/SubripDecoder.java
View file @
fc5eb12e
...
...
@@ -80,7 +80,6 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
@Override
protected
SubripSubtitle
decode
(
byte
[]
bytes
,
int
length
,
boolean
reset
)
{
ArrayList
<
Cue
>
cues
=
new
ArrayList
<>();
ArrayList
<
String
>
tags
=
new
ArrayList
<>();
LongArray
cueTimesUs
=
new
LongArray
();
ParsableByteArray
subripData
=
new
ParsableByteArray
(
bytes
,
length
);
String
currentLine
;
...
...
@@ -120,6 +119,7 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
}
// Read and parse the text.
ArrayList
<
String
>
tags
=
new
ArrayList
<>();
textBuilder
.
setLength
(
0
);
while
(!
TextUtils
.
isEmpty
(
currentLine
=
subripData
.
readLine
()))
{
if
(
textBuilder
.
length
()
>
0
)
{
...
...
@@ -131,19 +131,15 @@ public final class SubripDecoder extends SimpleSubtitleDecoder {
Spanned
text
=
Html
.
fromHtml
(
textBuilder
.
toString
());
Cue
cue
=
null
;
boolean
alignTagFound
=
false
;
// At end of this loop the clue must be created with the applied tags
for
(
String
tag
:
tags
)
{
// Check if the tag is an alignment tag
if
(
tag
.
matches
(
SUBRIP_ALIGNMENT_TAG
))
{
// Based on the specs, in case of the alignment tags only the first appearance counts
if
(
alignTagFound
)
continue
;
alignTagFound
=
true
;
cue
=
buildCue
(
text
,
tag
);
// Based on the specs, in case of alignment tags only the first appearance counts, so break
break
;
}
}
...
...
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