Commit 3c123982 by andrewlewis Committed by Oliver Woodman

Rename webm.WebmExtractor to mkv.MatroskaExtractor.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=119020538
parent b977265f
Showing with 40 additions and 45 deletions
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.extractor.ExtractorInput;
import com.google.android.exoplayer.testutil.FakeExtractorInput;
......
......@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import static com.google.android.exoplayer.extractor.webm.StreamBuilder.TEST_ENCRYPTION_KEY_ID;
import static com.google.android.exoplayer.extractor.mkv.StreamBuilder.TEST_ENCRYPTION_KEY_ID;
import com.google.android.exoplayer.C;
import com.google.android.exoplayer.Format;
......@@ -23,7 +23,7 @@ import com.google.android.exoplayer.ParserException;
import com.google.android.exoplayer.drm.DrmInitData;
import com.google.android.exoplayer.drm.DrmInitData.SchemeInitData;
import com.google.android.exoplayer.extractor.ChunkIndex;
import com.google.android.exoplayer.extractor.webm.StreamBuilder.ContentEncodingSettings;
import com.google.android.exoplayer.extractor.mkv.StreamBuilder.ContentEncodingSettings;
import com.google.android.exoplayer.testutil.FakeExtractorOutput;
import com.google.android.exoplayer.testutil.FakeTrackOutput;
import com.google.android.exoplayer.testutil.TestUtil;
......@@ -39,9 +39,9 @@ import java.util.Arrays;
import java.util.UUID;
/**
* Tests for {@link WebmExtractor}.
* Tests for {@link MatroskaExtractor}.
*/
public final class WebmExtractorTest extends InstrumentationTestCase {
public final class MatroskaExtractorTest extends InstrumentationTestCase {
private static final int DEFAULT_TIMECODE_SCALE = 1000000;
private static final long TEST_DURATION_TIMECODE = 9920L;
......@@ -68,15 +68,15 @@ public final class WebmExtractorTest extends InstrumentationTestCase {
private static final UUID WIDEVINE_UUID = new UUID(0xEDEF8BA979D64ACEL, 0xA3C827DCD51D21EDL);
private static final UUID ZERO_UUID = new UUID(0, 0);
private static final String WEBM_DOC_TYPE = "webm";
private static final String MATROSKA_DOC_TYPE = "matroska";
private static final String WEBM_DOC_TYPE = "webm";
private WebmExtractor extractor;
private MatroskaExtractor extractor;
private FakeExtractorOutput extractorOutput;
@Override
public void setUp() {
extractor = new WebmExtractor();
extractor = new MatroskaExtractor();
extractorOutput = new FakeExtractorOutput();
extractor.init(extractorOutput);
}
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.testutil.TestUtil;
import com.google.android.exoplayer.util.Assertions;
......@@ -24,7 +24,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* Provides byte arrays containing WebM data for {@link WebmExtractorTest}.
* Provides byte arrays containing Matroska data for {@link MatroskaExtractorTest}.
*/
/* package */ final class StreamBuilder {
......@@ -441,7 +441,7 @@ import java.util.List;
return new EbmlElement();
}
/** Represents a WebM EBML element that can be serialized as a byte array. */
/** Represents an EBML element that can be serialized as a byte array. */
private static final class EbmlElement {
/** Returns a byte[] containing the concatenation of the data from all {@code elements}. */
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.C;
import com.google.android.exoplayer.extractor.ExtractorInput;
......
......@@ -41,8 +41,8 @@ import com.google.android.exoplayer.dash.mpd.RangedUri;
import com.google.android.exoplayer.dash.mpd.Representation;
import com.google.android.exoplayer.drm.DrmInitData;
import com.google.android.exoplayer.extractor.ChunkIndex;
import com.google.android.exoplayer.extractor.mkv.MatroskaExtractor;
import com.google.android.exoplayer.extractor.mp4.FragmentedMp4Extractor;
import com.google.android.exoplayer.extractor.webm.WebmExtractor;
import com.google.android.exoplayer.upstream.DataSource;
import com.google.android.exoplayer.upstream.DataSpec;
import com.google.android.exoplayer.util.Clock;
......@@ -695,7 +695,8 @@ public class DashChunkSource implements ChunkSource {
this.representation = representation;
String containerMimeType = representation.format.containerMimeType;
extractorWrapper = mimeTypeIsRawText(containerMimeType) ? null : new ChunkExtractorWrapper(
mimeTypeIsWebm(containerMimeType) ? new WebmExtractor() : new FragmentedMp4Extractor());
mimeTypeIsWebm(containerMimeType) ? new MatroskaExtractor()
: new FragmentedMp4Extractor());
segmentIndex = representation.getIndex();
}
......
......@@ -52,7 +52,7 @@ import java.util.List;
* <ul>
* <li>MP4, including M4A ({@link com.google.android.exoplayer.extractor.mp4.Mp4Extractor})</li>
* <li>fMP4 ({@link com.google.android.exoplayer.extractor.mp4.FragmentedMp4Extractor})</li>
* <li>Matroska and WebM ({@link com.google.android.exoplayer.extractor.webm.WebmExtractor})</li>
* <li>Matroska and WebM ({@link com.google.android.exoplayer.extractor.mkv.MatroskaExtractor})</li>
* <li>Ogg Vorbis ({@link com.google.android.exoplayer.extractor.ogg.OggVorbisExtractor}</li>
* <li>MP3 ({@link com.google.android.exoplayer.extractor.mp3.Mp3Extractor})</li>
* <li>AAC ({@link com.google.android.exoplayer.extractor.ts.AdtsExtractor})</li>
......@@ -122,7 +122,7 @@ public final class ExtractorSampleSource implements SampleSource, ExtractorOutpu
// can detect the use of reflection (see http://proguard.sourceforge.net/FAQ.html#forname).
try {
DEFAULT_EXTRACTOR_CLASSES.add(
Class.forName("com.google.android.exoplayer.extractor.webm.WebmExtractor")
Class.forName("com.google.android.exoplayer.extractor.mkv.MatroskaExtractor")
.asSubclass(Extractor.class));
} catch (ClassNotFoundException e) {
// Extractor not found.
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.C;
import com.google.android.exoplayer.ParserException;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.ParserException;
import com.google.android.exoplayer.extractor.ExtractorInput;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.ParserException;
import com.google.android.exoplayer.extractor.ExtractorInput;
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.C;
import com.google.android.exoplayer.Format;
......@@ -46,22 +46,16 @@ import java.util.List;
import java.util.Locale;
/**
* An extractor to facilitate data retrieval from the WebM container format.
* <p>
* WebM is a subset of the EBML elements defined for Matroska. More information about EBML and
* Matroska is available <a href="http://www.matroska.org/technical/specs/index.html">here</a>.
* More info about WebM is <a href="http://www.webmproject.org/code/specs/container/">here</a>.
* RFC on encrypted WebM can be found
* <a href="http://wiki.webmproject.org/encryption/webm-encryption-rfc">here</a>.
* Extracts data from a Matroska or WebM file.
*/
public final class WebmExtractor implements Extractor {
public final class MatroskaExtractor implements Extractor {
private static final int BLOCK_STATE_START = 0;
private static final int BLOCK_STATE_HEADER = 1;
private static final int BLOCK_STATE_DATA = 2;
private static final String DOC_TYPE_WEBM = "webm";
private static final String DOC_TYPE_MATROSKA = "matroska";
private static final String DOC_TYPE_WEBM = "webm";
private static final String CODEC_ID_VP8 = "V_VP8";
private static final String CODEC_ID_VP9 = "V_VP9";
private static final String CODEC_ID_MPEG2 = "V_MPEG2";
......@@ -241,11 +235,11 @@ public final class WebmExtractor implements Extractor {
// Extractor outputs.
private ExtractorOutput extractorOutput;
public WebmExtractor() {
public MatroskaExtractor() {
this(new DefaultEbmlReader());
}
/* package */ WebmExtractor(EbmlReader reader) {
/* package */ MatroskaExtractor(EbmlReader reader) {
this.reader = reader;
this.reader.init(new InnerEbmlReaderOutput());
varintReader = new VarintReader();
......@@ -911,8 +905,8 @@ public final class WebmExtractor implements Extractor {
if (CODEC_ID_VORBIS.equals(track.codecId)) {
// Vorbis decoder in android MediaCodec [1] expects the last 4 bytes of the sample to be the
// number of samples in the current page. This definition holds good only for Ogg and
// irrelevant for WebM. So we always set this to -1 (the decoder will ignore this value if we
// set it to -1). The android platform media extractor [2] does the same.
// irrelevant for Matroska. So we always set this to -1 (the decoder will ignore this value if
// we set it to -1). The android platform media extractor [2] does the same.
// [1] https://android.googlesource.com/platform/frameworks/av/+/lollipop-release/media/libstagefright/codecs/vorbis/dec/SoftVorbis.cpp#314
// [2] https://android.googlesource.com/platform/frameworks/av/+/lollipop-release/media/libstagefright/NuMediaExtractor.cpp#474
vorbisNumPageSamples.setPosition(0);
......@@ -1091,50 +1085,50 @@ public final class WebmExtractor implements Extractor {
}
/**
* Passes events through to the outer {@link WebmExtractor}.
* Passes events through to the outer {@link MatroskaExtractor}.
*/
private final class InnerEbmlReaderOutput implements EbmlReaderOutput {
@Override
public int getElementType(int id) {
return WebmExtractor.this.getElementType(id);
return MatroskaExtractor.this.getElementType(id);
}
@Override
public boolean isLevel1Element(int id) {
return WebmExtractor.this.isLevel1Element(id);
return MatroskaExtractor.this.isLevel1Element(id);
}
@Override
public void startMasterElement(int id, long contentPosition, long contentSize)
throws ParserException {
WebmExtractor.this.startMasterElement(id, contentPosition, contentSize);
MatroskaExtractor.this.startMasterElement(id, contentPosition, contentSize);
}
@Override
public void endMasterElement(int id) throws ParserException {
WebmExtractor.this.endMasterElement(id);
MatroskaExtractor.this.endMasterElement(id);
}
@Override
public void integerElement(int id, long value) throws ParserException {
WebmExtractor.this.integerElement(id, value);
MatroskaExtractor.this.integerElement(id, value);
}
@Override
public void floatElement(int id, double value) throws ParserException {
WebmExtractor.this.floatElement(id, value);
MatroskaExtractor.this.floatElement(id, value);
}
@Override
public void stringElement(int id, String value) throws ParserException {
WebmExtractor.this.stringElement(id, value);
MatroskaExtractor.this.stringElement(id, value);
}
@Override
public void binaryElement(int id, int contentsSize, ExtractorInput input)
throws IOException, InterruptedException {
WebmExtractor.this.binaryElement(id, contentsSize, input);
MatroskaExtractor.this.binaryElement(id, contentsSize, input);
}
}
......
......@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.C;
import com.google.android.exoplayer.extractor.Extractor;
......
package com.google.android.exoplayer.extractor.webm;
package com.google.android.exoplayer.extractor.mkv;
import com.google.android.exoplayer.C;
import com.google.android.exoplayer.extractor.ExtractorInput;
......
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