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
ff64d2b3
authored
Jan 13, 2017
by
Julian Cable
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
move Matroska specific code back to the Matroska extractor
parent
d71707f2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
18 deletions
library/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java
library/src/main/java/com/google/android/exoplayer2/text/ssa/SSADecoder.java
library/src/main/java/com/google/android/exoplayer2/extractor/mkv/MatroskaExtractor.java
View file @
ff64d2b3
...
...
@@ -56,6 +56,7 @@ import java.util.List;
import
java.util.Locale
;
import
java.util.UUID
;
import
static
android
.
R
.
attr
.
data
;
import
static
android
.
R
.
attr
.
format
;
import
static
android
.
R
.
attr
.
longClickable
;
import
static
android
.
R
.
attr
.
mimeType
;
...
...
@@ -1110,8 +1111,17 @@ public final class MatroskaExtractor implements Extractor {
}
private
void
writeSSASample
(
Track
track
)
{
String
s
=
SSADecoder
.
buildDialogue
(
track
.
ssaSample
,
blockDurationUs
);
ParsableByteArray
out
=
new
ParsableByteArray
(
s
.
getBytes
());
long
startUs
=
0
;
// blockTimeUs
StringBuffer
s
=
new
StringBuffer
();
s
.
append
(
"Dialogue: "
);
s
.
append
(
SSADecoder
.
formatTimeCode
(
startUs
));
s
.
append
(
","
);
long
endUs
=
startUs
+
blockDurationUs
;
s
.
append
(
SSADecoder
.
formatTimeCode
(
endUs
));
s
.
append
(
","
);
s
.
append
(
track
.
ssaSample
);
s
.
append
(
"\n"
);
ParsableByteArray
out
=
new
ParsableByteArray
(
s
.
toString
().
getBytes
());
track
.
output
.
sampleData
(
out
,
out
.
limit
());
sampleBytesWritten
+=
out
.
limit
();
}
...
...
library/src/main/java/com/google/android/exoplayer2/text/ssa/SSADecoder.java
View file @
ff64d2b3
...
...
@@ -192,22 +192,6 @@ public class SSADecoder extends SimpleSubtitleDecoder {
return
result
;
}
public
static
String
buildDialogue
(
String
data
,
long
durationUs
)
{
StringBuffer
s
=
new
StringBuffer
();
s
.
append
(
"Dialogue: "
);
s
.
append
(
SSADecoder
.
formatTimeCode
(
0
));
// blockTimeUs
s
.
append
(
","
);
long
endUs
=
durationUs
;
// + blockTimeUs
if
(
endUs
==
C
.
TIME_UNSET
)
{
endUs
=
2
*
_1e6
;
// 2 second default duration
}
s
.
append
(
SSADecoder
.
formatTimeCode
(
endUs
));
s
.
append
(
","
);
s
.
append
(
data
);
s
.
append
(
"\n"
);
return
s
.
toString
();
}
public
static
String
formatTimeCode
(
long
tc_us
)
{
long
seconds
=
tc_us
/
_1e6
;
long
us
=
tc_us
-
_1e6
*
seconds
;
...
...
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