Commit 1364e233 by Julian Cable

add test files for SSA.

parent 08e1d356
This diff could not be displayed because it is too large.
seekMap:
isSeekable = true
duration = 1449923000
getPosition(0) = 12068
numberOfTracks = 3
track 1:
format:
bitrate = -1
id = 1
containerMimeType = null
sampleMimeType = video/avc
maxInputSize = -1
width = 848
height = 480
frameRate = -1.0
rotationDegrees = -1
pixelWidthHeightRatio = 1.0058962
channelCount = -1
sampleRate = -1
pcmEncoding = -1
encoderDelay = -1
encoderPadding = -1
subsampleOffsetUs = 9223372036854775807
selectionFlags = 0
language = null
drmInitData = -
initializationData:
data = length 33, hash D89E426D
data = length 10, hash 7A0D0F2B
sample count = 0
track 2:
format:
bitrate = -1
id = 2
containerMimeType = null
sampleMimeType = audio/vorbis
maxInputSize = 8192
width = -1
height = -1
frameRate = -1.0
rotationDegrees = -1
pixelWidthHeightRatio = -1.0
channelCount = 2
sampleRate = 44100
pcmEncoding = -1
encoderDelay = -1
encoderPadding = -1
subsampleOffsetUs = 9223372036854775807
selectionFlags = 1
language = jpn
drmInitData = -
initializationData:
data = length 30, hash 604D0FB4
data = length 3832, hash 400807EA
sample count = 0
track 3:
format:
bitrate = -1
id = 3
containerMimeType = null
sampleMimeType = text/x-ssa
maxInputSize = -1
width = -1
height = -1
frameRate = -1.0
rotationDegrees = -1
pixelWidthHeightRatio = -1.0
channelCount = -1
sampleRate = -1
pcmEncoding = -1
encoderDelay = -1
encoderPadding = -1
subsampleOffsetUs = 9223372036854775807
selectionFlags = 1
language = eng
drmInitData = -
initializationData:
sample count = 1
sample 0:
time = 1447083000
flags = 1
data = length 108, hash 6EE53EC5
tracksEnded = true
......@@ -32,7 +32,16 @@ public final class MatroskaExtractorTest extends InstrumentationTestCase {
}
}, "mkv/sample.mkv", getInstrumentation());
}
/*
public void testMkvSSASample() throws Exception {
TestUtil.assertOutput(new TestUtil.ExtractorFactory() {
@Override
public Extractor create() {
return new MatroskaExtractor();
}
}, "mkv/ssasample.mkv", getInstrumentation());
}
*/
public void testWebmSubsampleEncryption() throws Exception {
TestUtil.assertOutput(new TestUtil.ExtractorFactory() {
@Override
......
package com.google.android.exoplayer2.text.ssa;
import android.test.InstrumentationTestCase;
import com.google.android.exoplayer2.testutil.TestUtil;
import java.io.IOException;
import java.text.SimpleDateFormat;
/**
* Created by cablej01 on 26/12/2016.
*/
public class SSATests extends InstrumentationTestCase {
private static final String TYPICAL_FILE = "ssa/typical";
private static SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
public void testDecodeTypical() throws IOException {
SSADecoder decoder = new SSADecoder();
byte[] bytes = TestUtil.getByteArray(getInstrumentation(), TYPICAL_FILE);
SSASubtitle subtitle = decoder.decode(bytes, bytes.length);
int n = subtitle.getEventTimeCount();
assertEquals(462, n);
assertTypicalCue1(subtitle, 0);
assertTypicalCue2(subtitle, 2);
assertTypicalCue3(subtitle, 4);
}
/*
Dialogue: 0,0:00:04.23,0:00:06.90,Watamote-internal/narrator,Serinuma,0000,0000,0000,,The prince should be with the princess.
Dialogue: 0,0:00:09.61,0:00:13.20,Watamote-internal/narrator,Serinuma,0000,0000,0000,,Who was the one who decided that?
Dialogue: 0,0:00:33.01,0:00:41.77,Watamote-Title,,0000,0000,0000,,{\fad(3562,1)}Kiss Him, Not Me
Dialogue: 0,0:01:48.87,0:01:54.38,Watamote-Ep_Title,,0000,0000,0000,,Can She Do It? A Real Life Oto
*/
private static void assertTypicalCue1(SSASubtitle subtitle, int eventIndex) {
assertEquals("00:00:04.230", sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex))));
assertEquals("The prince should be with the princess.",
subtitle.getCues(subtitle.getEventTime(eventIndex)).get(0).text.toString());
assertEquals("00:00:09.610", sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex+1))));
}
private static void assertTypicalCue2(SSASubtitle subtitle, int eventIndex) {
assertEquals("00:00:33.010", sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex))));
assertEquals("Kiss Him, Not Me",
subtitle.getCues(subtitle.getEventTime(eventIndex)).get(0).text.toString());
assertEquals("00:01:48.870", sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex+1))));
}
private static void assertTypicalCue3(SSASubtitle subtitle, int eventIndex) {
String s1 = sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex)));
String s2 = sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex+1)));
String s3 =
subtitle.getCues(subtitle.getEventTime(eventIndex)).get(0).text.toString();
assertEquals("00:01:59.610", sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex))));
assertEquals("Nice one, Igarashi!",
subtitle.getCues(subtitle.getEventTime(eventIndex)).get(0).text.toString());
assertEquals("00:02:01.220", sdf.format(new java.util.Date(subtitle.getEventTime(eventIndex+1))));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment