com.google.android.exoplayer.extractor.mp4.Atom.LeafAtom

Here are the examples of the java api class com.google.android.exoplayer.extractor.mp4.Atom.LeafAtom taken from open source projects.

1. FragmentedMp4Extractor#parseTraf()

Project: ExoPlayer
File: FragmentedMp4Extractor.java
/**
   * Parses a traf atom (defined in 14496-12).
   */
private static void parseTraf(ContainerAtom traf, SparseArray<TrackBundle> trackBundleArray, int flags, byte[] extendedTypeScratch) throws ParserException {
    if (traf.getChildAtomOfTypeCount(Atom.TYPE_trun) != 1) {
        throw new ParserException("Trun count in traf != 1 (unsupported).");
    }
    LeafAtom tfhd = traf.getLeafAtomOfType(Atom.TYPE_tfhd);
    TrackBundle trackBundle = parseTfhd(tfhd.data, trackBundleArray, flags);
    if (trackBundle == null) {
        return;
    }
    TrackFragment fragment = trackBundle.fragment;
    long decodeTime = fragment.nextFragmentDecodeTime;
    trackBundle.reset();
    LeafAtom tfdtAtom = traf.getLeafAtomOfType(Atom.TYPE_tfdt);
    if (tfdtAtom != null && (flags & FLAG_WORKAROUND_IGNORE_TFDT_BOX) == 0) {
        decodeTime = parseTfdt(traf.getLeafAtomOfType(Atom.TYPE_tfdt).data);
    }
    LeafAtom trun = traf.getLeafAtomOfType(Atom.TYPE_trun);
    parseTrun(trackBundle, decodeTime, flags, trun.data);
    LeafAtom saiz = traf.getLeafAtomOfType(Atom.TYPE_saiz);
    if (saiz != null) {
        TrackEncryptionBox trackEncryptionBox = trackBundle.track.sampleDescriptionEncryptionBoxes[fragment.header.sampleDescriptionIndex];
        parseSaiz(trackEncryptionBox, saiz.data, fragment);
    }
    LeafAtom saio = traf.getLeafAtomOfType(Atom.TYPE_saio);
    if (saio != null) {
        parseSaio(saio.data, fragment);
    }
    LeafAtom senc = traf.getLeafAtomOfType(Atom.TYPE_senc);
    if (senc != null) {
        parseSenc(senc.data, fragment);
    }
    LeafAtom sbgp = traf.getLeafAtomOfType(Atom.TYPE_sbgp);
    LeafAtom sgpd = traf.getLeafAtomOfType(Atom.TYPE_sgpd);
    if (sbgp != null && sgpd != null) {
        parseSgpd(sbgp.data, sgpd.data, fragment);
    }
    int childrenSize = traf.leafChildren.size();
    for (int i = 0; i < childrenSize; i++) {
        LeafAtom atom = traf.leafChildren.get(i);
        if (atom.type == Atom.TYPE_uuid) {
            parseUuid(atom.data, fragment, extendedTypeScratch);
        }
    }
}