Only parse common-encryption sinf boxes
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=172124807
This commit is contained in:
parent
feceabadeb
commit
dbdae4ca25
@ -34,18 +34,18 @@ public final class AtomParsersTest extends TestCase {
|
||||
+ SAMPLE_COUNT + "0001000200030004");
|
||||
|
||||
public void testStz2Parsing4BitFieldSize() {
|
||||
verifyParsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(FOUR_BIT_STZ2)));
|
||||
verifyStz2Parsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(FOUR_BIT_STZ2)));
|
||||
}
|
||||
|
||||
public void testStz2Parsing8BitFieldSize() {
|
||||
verifyParsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(EIGHT_BIT_STZ2)));
|
||||
verifyStz2Parsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(EIGHT_BIT_STZ2)));
|
||||
}
|
||||
|
||||
public void testStz2Parsing16BitFieldSize() {
|
||||
verifyParsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(SIXTEEN_BIT_STZ2)));
|
||||
verifyStz2Parsing(new Atom.LeafAtom(Atom.TYPE_stsz, new ParsableByteArray(SIXTEEN_BIT_STZ2)));
|
||||
}
|
||||
|
||||
private void verifyParsing(Atom.LeafAtom stz2Atom) {
|
||||
private static void verifyStz2Parsing(Atom.LeafAtom stz2Atom) {
|
||||
AtomParsers.Stz2SampleSizeBox box = new AtomParsers.Stz2SampleSizeBox(stz2Atom);
|
||||
assertEquals(4, box.getSampleCount());
|
||||
assertFalse(box.isFixedSampleSize());
|
||||
|
@ -1060,8 +1060,8 @@ import java.util.List;
|
||||
Assertions.checkArgument(childAtomSize > 0, "childAtomSize should be positive");
|
||||
int childAtomType = parent.readInt();
|
||||
if (childAtomType == Atom.TYPE_sinf) {
|
||||
Pair<Integer, TrackEncryptionBox> result = parseSinfFromParent(parent, childPosition,
|
||||
childAtomSize);
|
||||
Pair<Integer, TrackEncryptionBox> result = parseCommonEncryptionSinfFromParent(parent,
|
||||
childPosition, childAtomSize);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
@ -1071,8 +1071,8 @@ import java.util.List;
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Pair<Integer, TrackEncryptionBox> parseSinfFromParent(ParsableByteArray parent,
|
||||
int position, int size) {
|
||||
/* package */ static Pair<Integer, TrackEncryptionBox> parseCommonEncryptionSinfFromParent(
|
||||
ParsableByteArray parent, int position, int size) {
|
||||
int childPosition = position + Atom.HEADER_SIZE;
|
||||
int schemeInformationBoxPosition = C.POSITION_UNSET;
|
||||
int schemeInformationBoxSize = 0;
|
||||
@ -1086,7 +1086,7 @@ import java.util.List;
|
||||
dataFormat = parent.readInt();
|
||||
} else if (childAtomType == Atom.TYPE_schm) {
|
||||
parent.skipBytes(4);
|
||||
// scheme_type field. Defined in ISO/IEC 23001-7:2016, section 4.1.
|
||||
// Common encryption scheme_type values are defined in ISO/IEC 23001-7:2016, section 4.1.
|
||||
schemeType = parent.readString(4);
|
||||
} else if (childAtomType == Atom.TYPE_schi) {
|
||||
schemeInformationBoxPosition = childPosition;
|
||||
@ -1095,7 +1095,8 @@ import java.util.List;
|
||||
childPosition += childAtomSize;
|
||||
}
|
||||
|
||||
if (schemeType != null) {
|
||||
if (C.CENC_TYPE_cenc.equals(schemeType) || C.CENC_TYPE_cbc1.equals(schemeType)
|
||||
|| C.CENC_TYPE_cens.equals(schemeType) || C.CENC_TYPE_cbcs.equals(schemeType)) {
|
||||
Assertions.checkArgument(dataFormat != null, "frma atom is mandatory");
|
||||
Assertions.checkArgument(schemeInformationBoxPosition != C.POSITION_UNSET,
|
||||
"schi atom is mandatory");
|
||||
|
Loading…
x
Reference in New Issue
Block a user