private static StsdData parseStsd(ParsableByteArray stsd,int trackId,long durationUs,int rotationDegrees,String language,boolean isQuickTime){
  stsd.setPosition(Atom.FULL_HEADER_SIZE);
  int numberOfEntries=stsd.readInt();
  StsdData out=new StsdData(numberOfEntries);
  for (int i=0; i < numberOfEntries; i++) {
    int childStartPosition=stsd.getPosition();
    int childAtomSize=stsd.readInt();
    Assertions.checkArgument(childAtomSize > 0,"childAtomSize should be positive");
    int childAtomType=stsd.readInt();
    if (childAtomType == Atom.TYPE_avc1 || childAtomType == Atom.TYPE_avc3 || childAtomType == Atom.TYPE_encv || childAtomType == Atom.TYPE_mp4v || childAtomType == Atom.TYPE_hvc1 || childAtomType == Atom.TYPE_hev1 || childAtomType == Atom.TYPE_s263 || childAtomType == Atom.TYPE_vp08 || childAtomType == Atom.TYPE_vp09) {
      parseVideoSampleEntry(stsd,childAtomType,childStartPosition,childAtomSize,trackId,durationUs,rotationDegrees,out,i);
    }
 else     if (childAtomType == Atom.TYPE_mp4a || childAtomType == Atom.TYPE_enca || childAtomType == Atom.TYPE_ac_3 || childAtomType == Atom.TYPE_ec_3 || childAtomType == Atom.TYPE_dtsc || childAtomType == Atom.TYPE_dtse || childAtomType == Atom.TYPE_dtsh || childAtomType == Atom.TYPE_dtsl || childAtomType == Atom.TYPE_samr || childAtomType == Atom.TYPE_sawb || childAtomType == Atom.TYPE_lpcm || childAtomType == Atom.TYPE_sowt) {
      parseAudioSampleEntry(stsd,childAtomType,childStartPosition,childAtomSize,trackId,durationUs,language,isQuickTime,out,i);
    }
 else     if (childAtomType == Atom.TYPE_TTML) {
      out.mediaFormat=MediaFormat.createTextFormat(Integer.toString(trackId),MimeTypes.APPLICATION_TTML,MediaFormat.NO_VALUE,durationUs,language);
    }
 else     if (childAtomType == Atom.TYPE_tx3g) {
      out.mediaFormat=MediaFormat.createTextFormat(Integer.toString(trackId),MimeTypes.APPLICATION_TX3G,MediaFormat.NO_VALUE,durationUs,language);
    }
 else     if (childAtomType == Atom.TYPE_wvtt) {
      out.mediaFormat=MediaFormat.createTextFormat(Integer.toString(trackId),MimeTypes.APPLICATION_MP4VTT,MediaFormat.NO_VALUE,durationUs,language);
    }
 else     if (childAtomType == Atom.TYPE_stpp) {
      out.mediaFormat=MediaFormat.createTextFormat(Integer.toString(trackId),MimeTypes.APPLICATION_TTML,MediaFormat.NO_VALUE,durationUs,language,0);
    }
    stsd.setPosition(childStartPosition + childAtomSize);
  }
  return out;
}

private static StsdData parseStsd ( ParsableByteArray stsd , int trackId , long durationUs , int rotationDegrees , String language , boolean isQuickTime ) { stsd . setPosition ( Atom . FULL_HEADER_SIZE ) ; int numberOfEntries = stsd . readInt ( ) ; StsdData out = new StsdData ( numberOfEntries ) ; for ( int i = 0 ; i < numberOfEntries ; i ++ ) { int childStartPosition = stsd . getPosition ( ) ; int childAtomSize = stsd . readInt ( ) ; Assertions . checkArgument ( childAtomSize > 0 , "childAtomSize should be positive" ) ; int childAtomType = stsd . readInt ( ) ; if ( childAtomType == Atom . TYPE_avc1 || childAtomType == Atom . TYPE_avc3 || childAtomType == Atom . TYPE_encv || childAtomType == Atom . TYPE_mp4v || childAtomType == Atom . TYPE_hvc1 || childAtomType == Atom . TYPE_hev1 || childAtomType == Atom . TYPE_s263 || childAtomType == Atom . TYPE_vp08 || childAtomType == Atom . TYPE_vp09 ) { parseVideoSampleEntry ( stsd , childAtomType , childStartPosition , childAtomSize , trackId , durationUs , rotationDegrees , out , i ) ; } else if ( childAtomType == Atom . TYPE_mp4a || childAtomType == Atom . TYPE_enca || childAtomType == Atom . TYPE_ac_3 || childAtomType == Atom . TYPE_ec_3 || childAtomType == Atom . TYPE_dtsc || childAtomType == Atom . TYPE_dtse || childAtomType == Atom . TYPE_dtsh || childAtomType == Atom . TYPE_dtsl || childAtomType == Atom . TYPE_samr || childAtomType == Atom . TYPE_sawb || childAtomType == Atom . TYPE_lpcm || childAtomType == Atom . TYPE_sowt ) { parseAudioSampleEntry ( stsd , childAtomType , childStartPosition , childAtomSize , trackId , durationUs , language , isQuickTime , out , i ) ; } else if ( childAtomType == Atom . TYPE_TTML ) { out . mediaFormat = MediaFormat . createTextFormat ( Integer . toString ( trackId ) , MimeTypes . APPLICATION_TTML , MediaFormat . NO_VALUE , durationUs , language ) ; } else if ( childAtomType == Atom . TYPE_tx3g ) { out . mediaFormat = MediaFormat . createTextFormat ( Integer . toString ( trackId ) , MimeTypes . APPLICATION_TX3G , MediaFormat . NO_VALUE , durationUs , language ) ; } else if ( childAtomType == Atom . TYPE_wvtt ) { out . mediaFormat = MediaFormat . createTextFormat ( Integer . toString ( trackId ) , MimeTypes . APPLICATION_MP4VTT , MediaFormat . NO_VALUE , durationUs , language ) ; } else if ( childAtomType == Atom . TYPE_stpp ) { out . mediaFormat = MediaFormat . createTextFormat ( Integer . toString ( trackId ) , MimeTypes . APPLICATION_TTML , MediaFormat . NO_VALUE , durationUs , language , 0 ) ; } stsd . setPosition ( childStartPosition + childAtomSize ) ; } return out ; }
parses a stsd atom ( defined in 14496 - 12 ) .
