diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AviExtractor.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AviExtractor.java index 4163d1d2f8..8a3beaa27c 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AviExtractor.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/AviExtractor.java @@ -106,8 +106,6 @@ public class AviExtractor implements Extractor { static final int RIFF = 'R' | ('I' << 8) | ('F' << 16) | ('F' << 24); static final int AVI_ = 'A' | ('V' << 8) | ('I' << 16) | (' ' << 24); - //Stream List - static final int STRL = 's' | ('t' << 8) | ('r' << 16) | ('l' << 24); //movie data box static final int MOVI = 'm' | ('o' << 8) | ('v' << 16) | ('i' << 24); //Index @@ -191,7 +189,7 @@ public class AviExtractor implements Extractor { } @Nullable - static ListBox readHeaderList(ExtractorInput input) throws IOException { + public static ListBox readHeaderList(ExtractorInput input) throws IOException { final ByteBuffer byteBuffer = getAviBuffer(input, 20); if (byteBuffer == null) { return null; @@ -313,7 +311,7 @@ public class AviExtractor implements Extractor { int streamId = 0; for (Box box : headerList.getChildren()) { - if (box instanceof ListBox && ((ListBox) box).getListType() == STRL) { + if (box instanceof ListBox && ((ListBox) box).getListType() == ListBox.TYPE_STRL) { final ListBox streamList = (ListBox) box; aviTracks[streamId] = parseStream(streamList, streamId); streamId++; diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/ListBox.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/ListBox.java index 88af081578..952736ab39 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/ListBox.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/avi/ListBox.java @@ -15,6 +15,8 @@ public class ListBox extends Box { public static final int LIST = 'L' | ('I' << 8) | ('S' << 16) | ('T' << 24); //Header List public static final int TYPE_HDRL = 'h' | ('d' << 8) | ('r' << 16) | ('l' << 24); + //Stream List + public static final int TYPE_STRL = 's' | ('t' << 8) | ('r' << 16) | ('l' << 24); private final int listType; @@ -47,9 +49,6 @@ public class ListBox extends Box { /** * Assume the input is pointing to the list type - * @param boxFactory - * @param input - * @return * @throws IOException */ public static ListBox newInstance(final int listSize, BoxFactory boxFactory, diff --git a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorRoboTest.java b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorRoboTest.java index 694e254530..39126dfcaf 100644 --- a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorRoboTest.java +++ b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorRoboTest.java @@ -46,7 +46,7 @@ public class AviExtractorRoboTest { final AviExtractor aviExtractor = new AviExtractor(); final FakeExtractorOutput fakeExtractorOutput = new FakeExtractorOutput(); aviExtractor.init(fakeExtractorOutput); - final ListBox streamList = new ListBox(128, AviExtractor.STRL, Collections.EMPTY_LIST); + final ListBox streamList = new ListBox(128, ListBox.TYPE_STRL, Collections.EMPTY_LIST); Assert.assertNull(aviExtractor.parseStream(streamList, 0)); } @@ -55,7 +55,7 @@ public class AviExtractorRoboTest { final AviExtractor aviExtractor = new AviExtractor(); final FakeExtractorOutput fakeExtractorOutput = new FakeExtractorOutput(); aviExtractor.init(fakeExtractorOutput); - final ListBox streamList = new ListBox(128, AviExtractor.STRL, + final ListBox streamList = new ListBox(128, ListBox.TYPE_STRL, Collections.singletonList(DataHelper.getVidsStreamHeader())); Assert.assertNull(aviExtractor.parseStream(streamList, 0)); } @@ -73,7 +73,7 @@ public class AviExtractorRoboTest { byteBuffer.put(aviHeader); byteBuffer.putInt(ListBox.LIST); byteBuffer.putInt(byteBuffer.remaining() - 4); - byteBuffer.putInt(AviExtractor.STRL); + byteBuffer.putInt(ListBox.TYPE_STRL); final StreamHeaderBox streamHeaderBox = DataHelper.getVidsStreamHeader(); byteBuffer.putInt(StreamHeaderBox.STRH); diff --git a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorTest.java b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorTest.java index a93354ee7f..a6ff1487b3 100644 --- a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorTest.java +++ b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/AviExtractorTest.java @@ -319,7 +319,7 @@ public class AviExtractorTest { @Test public void readHeaderList_givenNoHeaderList() throws IOException { final ByteBuffer byteBuffer = DataHelper.getRiffHeader(88, 0x44); - byteBuffer.putInt(0x14, AviExtractor.STRL); //Overwrite header list with stream list + byteBuffer.putInt(0x14, ListBox.TYPE_STRL); //Overwrite header list with stream list final FakeExtractorInput input = new FakeExtractorInput.Builder(). setData(byteBuffer.array()).build(); Assert.assertNull(AviExtractor.readHeaderList(input)); diff --git a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/DataHelper.java b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/DataHelper.java index 268716a36b..1e944b085f 100644 --- a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/DataHelper.java +++ b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/DataHelper.java @@ -62,7 +62,7 @@ public class DataHelper { list.add(streamHeaderBox); list.add(streamFormatBox); return new ListBox((int)(streamHeaderBox.getSize() + streamFormatBox.getSize()), - AviExtractor.STRL, list); + ListBox.TYPE_STRL, list); } public static ListBox getAacStreamList() throws IOException { @@ -72,7 +72,7 @@ public class DataHelper { list.add(streamHeaderBox); list.add(streamFormatBox); return new ListBox((int)(streamHeaderBox.getSize() + streamFormatBox.getSize()), - AviExtractor.STRL, list); + ListBox.TYPE_STRL, list); } public static StreamNameBox getStreamNameBox(final String name) { diff --git a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/StreamNameBoxTest.java b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/StreamNameBoxTest.java index 5190837b60..c721df59b6 100644 --- a/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/StreamNameBoxTest.java +++ b/library/extractor/src/test/java/com/google/android/exoplayer2/extractor/avi/StreamNameBoxTest.java @@ -10,7 +10,7 @@ public class StreamNameBoxTest { @Test public void createStreamName_givenList() throws IOException { final String name = "Test"; - final ListBuilder listBuilder = new ListBuilder(AviExtractor.STRL); + final ListBuilder listBuilder = new ListBuilder(ListBox.TYPE_STRL); listBuilder.addBox(DataHelper.getStreamNameBox(name)); final ByteBuffer listBuffer = listBuilder.build(); final FakeExtractorInput fakeExtractorInput = new FakeExtractorInput.Builder().setData(listBuffer.array()).build();