AtomParsers { 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; String schemeType = null; Integer dataFormat = null; while (childPosition - position < size) { parent.setPosition(childPosition); int childAtomSize = parent.readInt(); int childAtomType = parent.readInt(); if (childAtomType == Atom.TYPE_frma) { dataFormat = parent.readInt(); } else if (childAtomType == Atom.TYPE_schm) { parent.skipBytes(4); schemeType = parent.readString(4); } else if (childAtomType == Atom.TYPE_schi) { schemeInformationBoxPosition = childPosition; schemeInformationBoxSize = childAtomSize; } childPosition += childAtomSize; } 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"); TrackEncryptionBox encryptionBox = parseSchiFromParent(parent, schemeInformationBoxPosition, schemeInformationBoxSize, schemeType); Assertions.checkArgument(encryptionBox != null, "tenc atom is mandatory"); return Pair.create(dataFormat, encryptionBox); } else { return null; } } private  AtomParsers(); static Track parseTrak(Atom.ContainerAtom trak, Atom.LeafAtom mvhd, long duration,
      DrmInitData drmInitData, boolean ignoreEditLists, boolean isQuickTime); static TrackSampleTable parseStbl(
      Track track, Atom.ContainerAtom stblAtom, GaplessInfoHolder gaplessInfoHolder); @Nullable static Metadata parseUdta(Atom.LeafAtom udtaAtom, boolean isQuickTime); @Nullable static Metadata parseMdtaFromMeta(Atom.ContainerAtom meta);  }
@Test public void testParseCommonEncryptionSinfFromParentIgnoresUnknownSchemeType() { byte[] cencSinf = new byte[] { 0, 0, 0, 24, 115, 105, 110, 102, 0, 0, 0, 16, 115, 99, 104, 109, 0, 0, 0, 0, 88, 88, 88, 88}; assertThat(AtomParsers.parseCommonEncryptionSinfFromParent( new ParsableByteArray(cencSinf), 0, cencSinf.length)).isNull(); }