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
f9f3b82d
authored
Nov 26, 2014
by
ojw28
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge pull request #172 from google/dev
dev -> dev-hls
parents
f034ee7d
ab00a4da
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
3 deletions
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java
library/src/main/java/com/google/android/exoplayer/chunk/ChunkSampleSource.java
View file @
f9f3b82d
...
...
@@ -134,14 +134,17 @@ public class ChunkSampleSource implements SampleSource, Loader.Callback {
}
/**
* The default minimum number of times to retry loading data prior to failing.
*/
public
static
final
int
DEFAULT_MIN_LOADABLE_RETRY_COUNT
=
1
;
private
static
final
int
STATE_UNPREPARED
=
0
;
private
static
final
int
STATE_PREPARED
=
1
;
private
static
final
int
STATE_ENABLED
=
2
;
private
static
final
int
NO_RESET_PENDING
=
-
1
;
private
static
final
int
DEFAULT_MIN_LOADABLE_RETRY_COUNT
=
1
;
private
final
int
eventSourceId
;
private
final
LoadControl
loadControl
;
private
final
ChunkSource
chunkSource
;
...
...
library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java
View file @
f9f3b82d
...
...
@@ -63,6 +63,16 @@ public class WebvttParser implements SubtitleParser {
private
static
final
Pattern
MEDIA_TIMESTAMP_OFFSET
=
Pattern
.
compile
(
OFFSET
+
"\\d+"
);
private
static
final
Pattern
MEDIA_TIMESTAMP
=
Pattern
.
compile
(
"MPEGTS:\\d+"
);
private
final
boolean
strictParsing
;
public
WebvttParser
()
{
this
(
true
);
}
public
WebvttParser
(
boolean
strictParsing
)
{
this
.
strictParsing
=
strictParsing
;
}
@Override
public
WebvttSubtitle
parse
(
InputStream
inputStream
,
String
inputEncoding
,
long
startTimeUs
)
throws
IOException
{
...
...
@@ -108,7 +118,7 @@ public class WebvttParser implements SubtitleParser {
Matcher
matcher
=
WEBVTT_METADATA_HEADER
.
matcher
(
line
);
if
(!
matcher
.
find
())
{
throw
new
ParserException
(
"Expected webvtt metadata header; got: "
+
line
);
handleNoncompliantLine
(
line
);
}
if
(
line
.
startsWith
(
"X-TIMESTAMP-MAP"
))
{
...
...
@@ -182,6 +192,12 @@ public class WebvttParser implements SubtitleParser {
return
startTimeUs
;
}
protected
void
handleNoncompliantLine
(
String
line
)
throws
ParserException
{
if
(
strictParsing
)
{
throw
new
ParserException
(
"Unexpected line: "
+
line
);
}
}
private
static
long
parseTimestampUs
(
String
s
)
throws
NumberFormatException
{
if
(!
s
.
matches
(
WEBVTT_TIMESTAMP_STRING
))
{
throw
new
NumberFormatException
(
"has invalid format"
);
...
...
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