mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
move Matroska specific code back to the Matroska extractor
This commit is contained in:
parent
d71707f220
commit
ff64d2b382
2 changed files with 12 additions and 18 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue