Commit 9c3ac92a by andrewlewis Committed by Andrew Lewis

Allow extension of MatroskaExtractor

Subclasses can handle arbitrary elements.

PiperOrigin-RevId: 233057241
parent 36da5fb5
...@@ -52,7 +52,7 @@ import java.util.ArrayDeque; ...@@ -52,7 +52,7 @@ import java.util.ArrayDeque;
private final ArrayDeque<MasterElement> masterElementsStack; private final ArrayDeque<MasterElement> masterElementsStack;
private final VarintReader varintReader; private final VarintReader varintReader;
private EbmlReaderOutput output; private EbmlProcessor processor;
private @ElementState int elementState; private @ElementState int elementState;
private int elementId; private int elementId;
private long elementContentSize; private long elementContentSize;
...@@ -64,8 +64,8 @@ import java.util.ArrayDeque; ...@@ -64,8 +64,8 @@ import java.util.ArrayDeque;
} }
@Override @Override
public void init(EbmlReaderOutput eventHandler) { public void init(EbmlProcessor processor) {
this.output = eventHandler; this.processor = processor;
} }
@Override @Override
...@@ -77,11 +77,11 @@ import java.util.ArrayDeque; ...@@ -77,11 +77,11 @@ import java.util.ArrayDeque;
@Override @Override
public boolean read(ExtractorInput input) throws IOException, InterruptedException { public boolean read(ExtractorInput input) throws IOException, InterruptedException {
Assertions.checkState(output != null); Assertions.checkNotNull(processor);
while (true) { while (true) {
if (!masterElementsStack.isEmpty() if (!masterElementsStack.isEmpty()
&& input.getPosition() >= masterElementsStack.peek().elementEndPosition) { && input.getPosition() >= masterElementsStack.peek().elementEndPosition) {
output.endMasterElement(masterElementsStack.pop().elementId); processor.endMasterElement(masterElementsStack.pop().elementId);
return true; return true;
} }
...@@ -103,42 +103,42 @@ import java.util.ArrayDeque; ...@@ -103,42 +103,42 @@ import java.util.ArrayDeque;
elementState = ELEMENT_STATE_READ_CONTENT; elementState = ELEMENT_STATE_READ_CONTENT;
} }
@EbmlReaderOutput.ElementType int type = output.getElementType(elementId); @EbmlProcessor.ElementType int type = processor.getElementType(elementId);
switch (type) { switch (type) {
case EbmlReaderOutput.TYPE_MASTER: case EbmlProcessor.ELEMENT_TYPE_MASTER:
long elementContentPosition = input.getPosition(); long elementContentPosition = input.getPosition();
long elementEndPosition = elementContentPosition + elementContentSize; long elementEndPosition = elementContentPosition + elementContentSize;
masterElementsStack.push(new MasterElement(elementId, elementEndPosition)); masterElementsStack.push(new MasterElement(elementId, elementEndPosition));
output.startMasterElement(elementId, elementContentPosition, elementContentSize); processor.startMasterElement(elementId, elementContentPosition, elementContentSize);
elementState = ELEMENT_STATE_READ_ID; elementState = ELEMENT_STATE_READ_ID;
return true; return true;
case EbmlReaderOutput.TYPE_UNSIGNED_INT: case EbmlProcessor.ELEMENT_TYPE_UNSIGNED_INT:
if (elementContentSize > MAX_INTEGER_ELEMENT_SIZE_BYTES) { if (elementContentSize > MAX_INTEGER_ELEMENT_SIZE_BYTES) {
throw new ParserException("Invalid integer size: " + elementContentSize); throw new ParserException("Invalid integer size: " + elementContentSize);
} }
output.integerElement(elementId, readInteger(input, (int) elementContentSize)); processor.integerElement(elementId, readInteger(input, (int) elementContentSize));
elementState = ELEMENT_STATE_READ_ID; elementState = ELEMENT_STATE_READ_ID;
return true; return true;
case EbmlReaderOutput.TYPE_FLOAT: case EbmlProcessor.ELEMENT_TYPE_FLOAT:
if (elementContentSize != VALID_FLOAT32_ELEMENT_SIZE_BYTES if (elementContentSize != VALID_FLOAT32_ELEMENT_SIZE_BYTES
&& elementContentSize != VALID_FLOAT64_ELEMENT_SIZE_BYTES) { && elementContentSize != VALID_FLOAT64_ELEMENT_SIZE_BYTES) {
throw new ParserException("Invalid float size: " + elementContentSize); throw new ParserException("Invalid float size: " + elementContentSize);
} }
output.floatElement(elementId, readFloat(input, (int) elementContentSize)); processor.floatElement(elementId, readFloat(input, (int) elementContentSize));
elementState = ELEMENT_STATE_READ_ID; elementState = ELEMENT_STATE_READ_ID;
return true; return true;
case EbmlReaderOutput.TYPE_STRING: case EbmlProcessor.ELEMENT_TYPE_STRING:
if (elementContentSize > Integer.MAX_VALUE) { if (elementContentSize > Integer.MAX_VALUE) {
throw new ParserException("String element size: " + elementContentSize); throw new ParserException("String element size: " + elementContentSize);
} }
output.stringElement(elementId, readString(input, (int) elementContentSize)); processor.stringElement(elementId, readString(input, (int) elementContentSize));
elementState = ELEMENT_STATE_READ_ID; elementState = ELEMENT_STATE_READ_ID;
return true; return true;
case EbmlReaderOutput.TYPE_BINARY: case EbmlProcessor.ELEMENT_TYPE_BINARY:
output.binaryElement(elementId, (int) elementContentSize, input); processor.binaryElement(elementId, (int) elementContentSize, input);
elementState = ELEMENT_STATE_READ_ID; elementState = ELEMENT_STATE_READ_ID;
return true; return true;
case EbmlReaderOutput.TYPE_UNKNOWN: case EbmlProcessor.ELEMENT_TYPE_UNKNOWN:
input.skipFully((int) elementContentSize); input.skipFully((int) elementContentSize);
elementState = ELEMENT_STATE_READ_ID; elementState = ELEMENT_STATE_READ_ID;
break; break;
...@@ -167,7 +167,7 @@ import java.util.ArrayDeque; ...@@ -167,7 +167,7 @@ import java.util.ArrayDeque;
int varintLength = VarintReader.parseUnsignedVarintLength(scratch[0]); int varintLength = VarintReader.parseUnsignedVarintLength(scratch[0]);
if (varintLength != C.LENGTH_UNSET && varintLength <= MAX_ID_BYTES) { if (varintLength != C.LENGTH_UNSET && varintLength <= MAX_ID_BYTES) {
int potentialId = (int) VarintReader.assembleVarint(scratch, varintLength, false); int potentialId = (int) VarintReader.assembleVarint(scratch, varintLength, false);
if (output.isLevel1Element(potentialId)) { if (processor.isLevel1Element(potentialId)) {
input.skipFully(varintLength); input.skipFully(varintLength);
return potentialId; return potentialId;
} }
...@@ -243,7 +243,7 @@ import java.util.ArrayDeque; ...@@ -243,7 +243,7 @@ import java.util.ArrayDeque;
/** /**
* Used in {@link #masterElementsStack} to track when the current master element ends, so that * Used in {@link #masterElementsStack} to track when the current master element ends, so that
* {@link EbmlReaderOutput#endMasterElement(int)} can be called. * {@link EbmlProcessor#endMasterElement(int)} can be called.
*/ */
private static final class MasterElement { private static final class MasterElement {
......
/* /*
* Copyright (C) 2016 The Android Open Source Project * Copyright (C) 2019 The Android Open Source Project
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -23,41 +23,48 @@ import java.lang.annotation.Documented; ...@@ -23,41 +23,48 @@ import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
/** /** Defines EBML element IDs/types and processes events. */
* Defines EBML element IDs/types and reacts to events. public interface EbmlProcessor {
*/
/* package */ interface EbmlReaderOutput {
/** /**
* EBML element types. One of {@link #TYPE_UNKNOWN}, {@link #TYPE_MASTER}, {@link * EBML element types. One of {@link #ELEMENT_TYPE_UNKNOWN}, {@link #ELEMENT_TYPE_MASTER}, {@link
* #TYPE_UNSIGNED_INT}, {@link #TYPE_STRING}, {@link #TYPE_BINARY} or {@link #TYPE_FLOAT}. * #ELEMENT_TYPE_UNSIGNED_INT}, {@link #ELEMENT_TYPE_STRING}, {@link #ELEMENT_TYPE_BINARY} or
* {@link #ELEMENT_TYPE_FLOAT}.
*/ */
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({TYPE_UNKNOWN, TYPE_MASTER, TYPE_UNSIGNED_INT, TYPE_STRING, TYPE_BINARY, TYPE_FLOAT}) @IntDef({
ELEMENT_TYPE_UNKNOWN,
ELEMENT_TYPE_MASTER,
ELEMENT_TYPE_UNSIGNED_INT,
ELEMENT_TYPE_STRING,
ELEMENT_TYPE_BINARY,
ELEMENT_TYPE_FLOAT
})
@interface ElementType {} @interface ElementType {}
/** Type for unknown elements. */ /** Type for unknown elements. */
int TYPE_UNKNOWN = 0; int ELEMENT_TYPE_UNKNOWN = 0;
/** Type for elements that contain child elements. */ /** Type for elements that contain child elements. */
int TYPE_MASTER = 1; int ELEMENT_TYPE_MASTER = 1;
/** Type for integer value elements of up to 8 bytes. */ /** Type for integer value elements of up to 8 bytes. */
int TYPE_UNSIGNED_INT = 2; int ELEMENT_TYPE_UNSIGNED_INT = 2;
/** Type for string elements. */ /** Type for string elements. */
int TYPE_STRING = 3; int ELEMENT_TYPE_STRING = 3;
/** Type for binary elements. */ /** Type for binary elements. */
int TYPE_BINARY = 4; int ELEMENT_TYPE_BINARY = 4;
/** Type for IEEE floating point value elements of either 4 or 8 bytes. */ /** Type for IEEE floating point value elements of either 4 or 8 bytes. */
int TYPE_FLOAT = 5; int ELEMENT_TYPE_FLOAT = 5;
/** /**
* Maps an element ID to a corresponding type. * Maps an element ID to a corresponding type.
* *
* <p>If {@link #TYPE_UNKNOWN} is returned then the element is skipped. Note that all children of * <p>If {@link #ELEMENT_TYPE_UNKNOWN} is returned then the element is skipped. Note that all
* a skipped element are also skipped. * children of a skipped element are also skipped.
* *
* @param id The element ID to map. * @param id The element ID to map.
* @return One of {@link #TYPE_UNKNOWN}, {@link #TYPE_MASTER}, {@link #TYPE_UNSIGNED_INT}, {@link * @return One of {@link #ELEMENT_TYPE_UNKNOWN}, {@link #ELEMENT_TYPE_MASTER}, {@link
* #TYPE_STRING}, {@link #TYPE_BINARY} and {@link #TYPE_FLOAT}. * #ELEMENT_TYPE_UNSIGNED_INT}, {@link #ELEMENT_TYPE_STRING}, {@link #ELEMENT_TYPE_BINARY} and
* {@link #ELEMENT_TYPE_FLOAT}.
*/ */
@ElementType @ElementType
int getElementType(int id); int getElementType(int id);
......
...@@ -20,20 +20,20 @@ import com.google.android.exoplayer2.extractor.ExtractorInput; ...@@ -20,20 +20,20 @@ import com.google.android.exoplayer2.extractor.ExtractorInput;
import java.io.IOException; import java.io.IOException;
/** /**
* Event-driven EBML reader that delivers events to an {@link EbmlReaderOutput}. * Event-driven EBML reader that delivers events to an {@link EbmlProcessor}.
* <p> *
* EBML can be summarized as a binary XML format somewhat similar to Protocol Buffers. It was * <p>EBML can be summarized as a binary XML format somewhat similar to Protocol Buffers. It was
* originally designed for the Matroska container format. More information about EBML and * originally designed for the Matroska container format. More information about EBML and Matroska
* Matroska is available <a href="http://www.matroska.org/technical/specs/index.html">here</a>. * is available <a href="http://www.matroska.org/technical/specs/index.html">here</a>.
*/ */
/* package */ interface EbmlReader { /* package */ interface EbmlReader {
/** /**
* Initializes the extractor with an {@link EbmlReaderOutput}. * Initializes the extractor with an {@link EbmlProcessor}.
* *
* @param output An {@link EbmlReaderOutput} to receive events. * @param processor An {@link EbmlProcessor} to process events.
*/ */
void init(EbmlReaderOutput output); void init(EbmlProcessor processor);
/** /**
* Resets the state of the reader. * Resets the state of the reader.
......
...@@ -37,19 +37,19 @@ public class DefaultEbmlReaderTest { ...@@ -37,19 +37,19 @@ public class DefaultEbmlReaderTest {
@Test @Test
public void testMasterElement() throws IOException, InterruptedException { public void testMasterElement() throws IOException, InterruptedException {
ExtractorInput input = createTestInput(0x1A, 0x45, 0xDF, 0xA3, 0x84, 0x42, 0x85, 0x81, 0x01); ExtractorInput input = createTestInput(0x1A, 0x45, 0xDF, 0xA3, 0x84, 0x42, 0x85, 0x81, 0x01);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.startMasterElement(TestOutput.ID_EBML, 5, 4); expected.startMasterElement(TestProcessor.ID_EBML, 5, 4);
expected.integerElement(TestOutput.ID_DOC_TYPE_READ_VERSION, 1); expected.integerElement(TestProcessor.ID_DOC_TYPE_READ_VERSION, 1);
expected.endMasterElement(TestOutput.ID_EBML); expected.endMasterElement(TestProcessor.ID_EBML);
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
@Test @Test
public void testMasterElementEmpty() throws IOException, InterruptedException { public void testMasterElementEmpty() throws IOException, InterruptedException {
ExtractorInput input = createTestInput(0x18, 0x53, 0x80, 0x67, 0x80); ExtractorInput input = createTestInput(0x18, 0x53, 0x80, 0x67, 0x80);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.startMasterElement(TestOutput.ID_SEGMENT, 5, 0); expected.startMasterElement(TestProcessor.ID_SEGMENT, 5, 0);
expected.endMasterElement(TestOutput.ID_SEGMENT); expected.endMasterElement(TestProcessor.ID_SEGMENT);
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
...@@ -57,8 +57,8 @@ public class DefaultEbmlReaderTest { ...@@ -57,8 +57,8 @@ public class DefaultEbmlReaderTest {
public void testUnsignedIntegerElement() throws IOException, InterruptedException { public void testUnsignedIntegerElement() throws IOException, InterruptedException {
// 0xFE is chosen because for signed integers it should be interpreted as -2 // 0xFE is chosen because for signed integers it should be interpreted as -2
ExtractorInput input = createTestInput(0x42, 0xF7, 0x81, 0xFE); ExtractorInput input = createTestInput(0x42, 0xF7, 0x81, 0xFE);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.integerElement(TestOutput.ID_EBML_READ_VERSION, 254); expected.integerElement(TestProcessor.ID_EBML_READ_VERSION, 254);
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
...@@ -66,8 +66,8 @@ public class DefaultEbmlReaderTest { ...@@ -66,8 +66,8 @@ public class DefaultEbmlReaderTest {
public void testUnsignedIntegerElementLarge() throws IOException, InterruptedException { public void testUnsignedIntegerElementLarge() throws IOException, InterruptedException {
ExtractorInput input = ExtractorInput input =
createTestInput(0x42, 0xF7, 0x88, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); createTestInput(0x42, 0xF7, 0x88, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.integerElement(TestOutput.ID_EBML_READ_VERSION, Long.MAX_VALUE); expected.integerElement(TestProcessor.ID_EBML_READ_VERSION, Long.MAX_VALUE);
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
...@@ -76,32 +76,32 @@ public class DefaultEbmlReaderTest { ...@@ -76,32 +76,32 @@ public class DefaultEbmlReaderTest {
throws IOException, InterruptedException { throws IOException, InterruptedException {
ExtractorInput input = ExtractorInput input =
createTestInput(0x42, 0xF7, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); createTestInput(0x42, 0xF7, 0x88, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.integerElement(TestOutput.ID_EBML_READ_VERSION, -1); expected.integerElement(TestProcessor.ID_EBML_READ_VERSION, -1);
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
@Test @Test
public void testStringElement() throws IOException, InterruptedException { public void testStringElement() throws IOException, InterruptedException {
ExtractorInput input = createTestInput(0x42, 0x82, 0x86, 0x41, 0x62, 0x63, 0x31, 0x32, 0x33); ExtractorInput input = createTestInput(0x42, 0x82, 0x86, 0x41, 0x62, 0x63, 0x31, 0x32, 0x33);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.stringElement(TestOutput.ID_DOC_TYPE, "Abc123"); expected.stringElement(TestProcessor.ID_DOC_TYPE, "Abc123");
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
@Test @Test
public void testStringElementWithZeroPadding() throws IOException, InterruptedException { public void testStringElementWithZeroPadding() throws IOException, InterruptedException {
ExtractorInput input = createTestInput(0x42, 0x82, 0x86, 0x41, 0x62, 0x63, 0x00, 0x00, 0x00); ExtractorInput input = createTestInput(0x42, 0x82, 0x86, 0x41, 0x62, 0x63, 0x00, 0x00, 0x00);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.stringElement(TestOutput.ID_DOC_TYPE, "Abc"); expected.stringElement(TestProcessor.ID_DOC_TYPE, "Abc");
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
@Test @Test
public void testStringElementEmpty() throws IOException, InterruptedException { public void testStringElementEmpty() throws IOException, InterruptedException {
ExtractorInput input = createTestInput(0x42, 0x82, 0x80); ExtractorInput input = createTestInput(0x42, 0x82, 0x80);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.stringElement(TestOutput.ID_DOC_TYPE, ""); expected.stringElement(TestProcessor.ID_DOC_TYPE, "");
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
...@@ -109,8 +109,8 @@ public class DefaultEbmlReaderTest { ...@@ -109,8 +109,8 @@ public class DefaultEbmlReaderTest {
public void testFloatElementFourBytes() throws IOException, InterruptedException { public void testFloatElementFourBytes() throws IOException, InterruptedException {
ExtractorInput input = ExtractorInput input =
createTestInput(0x44, 0x89, 0x84, 0x3F, 0x80, 0x00, 0x00); createTestInput(0x44, 0x89, 0x84, 0x3F, 0x80, 0x00, 0x00);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.floatElement(TestOutput.ID_DURATION, 1.0); expected.floatElement(TestProcessor.ID_DURATION, 1.0);
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
...@@ -118,8 +118,8 @@ public class DefaultEbmlReaderTest { ...@@ -118,8 +118,8 @@ public class DefaultEbmlReaderTest {
public void testFloatElementEightBytes() throws IOException, InterruptedException { public void testFloatElementEightBytes() throws IOException, InterruptedException {
ExtractorInput input = ExtractorInput input =
createTestInput(0x44, 0x89, 0x88, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); createTestInput(0x44, 0x89, 0x88, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.floatElement(TestOutput.ID_DURATION, -2.0); expected.floatElement(TestProcessor.ID_DURATION, -2.0);
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
...@@ -127,8 +127,10 @@ public class DefaultEbmlReaderTest { ...@@ -127,8 +127,10 @@ public class DefaultEbmlReaderTest {
public void testBinaryElement() throws IOException, InterruptedException { public void testBinaryElement() throws IOException, InterruptedException {
ExtractorInput input = ExtractorInput input =
createTestInput(0xA3, 0x88, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08); createTestInput(0xA3, 0x88, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08);
TestOutput expected = new TestOutput(); TestProcessor expected = new TestProcessor();
expected.binaryElement(TestOutput.ID_SIMPLE_BLOCK, 8, expected.binaryElement(
TestProcessor.ID_SIMPLE_BLOCK,
8,
createTestInput(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08)); createTestInput(0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08));
assertEvents(input, expected.events); assertEvents(input, expected.events);
} }
...@@ -136,7 +138,7 @@ public class DefaultEbmlReaderTest { ...@@ -136,7 +138,7 @@ public class DefaultEbmlReaderTest {
private static void assertEvents(ExtractorInput input, List<String> expectedEvents) private static void assertEvents(ExtractorInput input, List<String> expectedEvents)
throws IOException, InterruptedException { throws IOException, InterruptedException {
DefaultEbmlReader reader = new DefaultEbmlReader(); DefaultEbmlReader reader = new DefaultEbmlReader();
TestOutput output = new TestOutput(); TestProcessor output = new TestProcessor();
reader.init(output); reader.init(output);
// We expect the number of successful reads to equal the number of expected events. // We expect the number of successful reads to equal the number of expected events.
...@@ -164,10 +166,8 @@ public class DefaultEbmlReaderTest { ...@@ -164,10 +166,8 @@ public class DefaultEbmlReaderTest {
.build(); .build();
} }
/** /** An {@link EbmlProcessor} that records each event callback. */
* An {@link EbmlReaderOutput} that records each event callback. private static final class TestProcessor implements EbmlProcessor {
*/
private static final class TestOutput implements EbmlReaderOutput {
// Element IDs // Element IDs
private static final int ID_EBML = 0x1A45DFA3; private static final int ID_EBML = 0x1A45DFA3;
...@@ -182,22 +182,23 @@ public class DefaultEbmlReaderTest { ...@@ -182,22 +182,23 @@ public class DefaultEbmlReaderTest {
private final List<String> events = new ArrayList<>(); private final List<String> events = new ArrayList<>();
@Override @Override
public @ElementType int getElementType(int id) { @EbmlProcessor.ElementType
public int getElementType(int id) {
switch (id) { switch (id) {
case ID_EBML: case ID_EBML:
case ID_SEGMENT: case ID_SEGMENT:
return TYPE_MASTER; return EbmlProcessor.ELEMENT_TYPE_MASTER;
case ID_EBML_READ_VERSION: case ID_EBML_READ_VERSION:
case ID_DOC_TYPE_READ_VERSION: case ID_DOC_TYPE_READ_VERSION:
return TYPE_UNSIGNED_INT; return EbmlProcessor.ELEMENT_TYPE_UNSIGNED_INT;
case ID_DOC_TYPE: case ID_DOC_TYPE:
return TYPE_STRING; return EbmlProcessor.ELEMENT_TYPE_STRING;
case ID_SIMPLE_BLOCK: case ID_SIMPLE_BLOCK:
return TYPE_BINARY; return EbmlProcessor.ELEMENT_TYPE_BINARY;
case ID_DURATION: case ID_DURATION:
return TYPE_FLOAT; return EbmlProcessor.ELEMENT_TYPE_FLOAT;
default: default:
return TYPE_UNKNOWN; return EbmlProcessor.ELEMENT_TYPE_UNKNOWN;
} }
} }
...@@ -219,12 +220,12 @@ public class DefaultEbmlReaderTest { ...@@ -219,12 +220,12 @@ public class DefaultEbmlReaderTest {
@Override @Override
public void integerElement(int id, long value) { public void integerElement(int id, long value) {
events.add(formatEvent(id, "integer=" + String.valueOf(value))); events.add(formatEvent(id, "integer=" + value));
} }
@Override @Override
public void floatElement(int id, double value) { public void floatElement(int id, double value) {
events.add(formatEvent(id, "float=" + String.valueOf(value))); events.add(formatEvent(id, "float=" + value));
} }
@Override @Override
......
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