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
1ed048db
authored
Sep 23, 2014
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Clean up TTML timestamp parsing.
parent
7cb55e23
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java
View file @
1ed048db
...
@@ -233,22 +233,22 @@ public class TtmlParser implements SubtitleParser {
...
@@ -233,22 +233,22 @@ public class TtmlParser implements SubtitleParser {
matcher
=
OFFSET_TIME
.
matcher
(
time
);
matcher
=
OFFSET_TIME
.
matcher
(
time
);
if
(
matcher
.
matches
())
{
if
(
matcher
.
matches
())
{
String
timeValue
=
matcher
.
group
(
1
);
String
timeValue
=
matcher
.
group
(
1
);
double
value
=
Double
.
parseDouble
(
timeValue
);
double
offsetSeconds
=
Double
.
parseDouble
(
timeValue
);
String
unit
=
matcher
.
group
(
2
);
String
unit
=
matcher
.
group
(
2
);
if
(
unit
.
equals
(
"h"
))
{
if
(
unit
.
equals
(
"h"
))
{
value
*=
3600L
*
1000000L
;
offsetSeconds
*=
3600
;
}
else
if
(
unit
.
equals
(
"m"
))
{
}
else
if
(
unit
.
equals
(
"m"
))
{
value
*=
60
*
100000
0
;
offsetSeconds
*=
6
0
;
}
else
if
(
unit
.
equals
(
"s"
))
{
}
else
if
(
unit
.
equals
(
"s"
))
{
value
*=
1000000
;
// Do nothing.
}
else
if
(
unit
.
equals
(
"ms"
))
{
}
else
if
(
unit
.
equals
(
"ms"
))
{
value
*
=
1000
;
offsetSeconds
/
=
1000
;
}
else
if
(
unit
.
equals
(
"f"
))
{
}
else
if
(
unit
.
equals
(
"f"
))
{
value
=
value
/
frameRate
*
1000000
;
offsetSeconds
/=
frameRate
;
}
else
if
(
unit
.
equals
(
"t"
))
{
}
else
if
(
unit
.
equals
(
"t"
))
{
value
=
value
/
tickRate
*
1000000
;
offsetSeconds
/=
tickRate
;
}
}
return
(
long
)
value
;
return
(
long
)
(
offsetSeconds
*
1000000
)
;
}
}
throw
new
NumberFormatException
(
"Malformed time expression: "
+
time
);
throw
new
NumberFormatException
(
"Malformed time expression: "
+
time
);
}
}
...
...
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