Package net.sourceforge.jaad.mp4.boxes.impl.sampleentries.codec

Examples of net.sourceforge.jaad.mp4.boxes.impl.sampleentries.codec.H263SpecificBox


    final Box dinf = minf.getChild(BoxTypes.DATA_INFORMATION_BOX);
    final DataReferenceBox dref = (DataReferenceBox) dinf.getChild(BoxTypes.DATA_REFERENCE_BOX);
    //TODO: support URNs
    if(dref.hasChild(BoxTypes.DATA_ENTRY_URL_BOX)) {
      DataEntryUrlBox url = (DataEntryUrlBox) dref.getChild(BoxTypes.DATA_ENTRY_URL_BOX);
      inFile = url.isInFile();
      if(!inFile) {
        try {
          location = new URL(url.getLocation());
        }
        catch(MalformedURLException e) {
          Logger.getLogger("MP4 API").log(Level.WARNING, "Parsing URL-Box failed: {0}, url: {1}", new String[]{e.toString(), url.getLocation()});
          location = null;
        }
      }
    }
    /*else if(dref.containsChild(BoxTypes.DATA_ENTRY_URN_BOX)) {
View Full Code Here


    final Box mdia = trak.getChild(BoxTypes.MEDIA_BOX);
    mdhd = (MediaHeaderBox) mdia.getChild(BoxTypes.MEDIA_HEADER_BOX);
    final Box minf = mdia.getChild(BoxTypes.MEDIA_INFORMATION_BOX);

    final Box dinf = minf.getChild(BoxTypes.DATA_INFORMATION_BOX);
    final DataReferenceBox dref = (DataReferenceBox) dinf.getChild(BoxTypes.DATA_REFERENCE_BOX);
    //TODO: support URNs
    if(dref.hasChild(BoxTypes.DATA_ENTRY_URL_BOX)) {
      DataEntryUrlBox url = (DataEntryUrlBox) dref.getChild(BoxTypes.DATA_ENTRY_URL_BOX);
      inFile = url.isInFile();
      if(!inFile) {
        try {
          location = new URL(url.getLocation());
        }
View Full Code Here

    }
  }

  //TODO: support hint and meta
  private Track createTrack(Box trak) {
    final HandlerBox hdlr = (HandlerBox) trak.getChild(BoxTypes.MEDIA_BOX).getChild(BoxTypes.HANDLER_BOX);
    final Track track;
    switch((int) hdlr.getHandlerType()) {
      case HandlerBox.TYPE_VIDEO:
        track = new VideoTrack(trak, in);
        break;
      case HandlerBox.TYPE_SOUND:
        track = new AudioTrack(trak, in);
View Full Code Here

    smhd = (SoundMediaHeaderBox) minf.getChild(BoxTypes.SOUND_MEDIA_HEADER_BOX);

    final Box stbl = minf.getChild(BoxTypes.SAMPLE_TABLE_BOX);

    //sample descriptions: 'mp4a' and 'enca' have an ESDBox, all others have a CodecSpecificBox
    final SampleDescriptionBox stsd = (SampleDescriptionBox) stbl.getChild(BoxTypes.SAMPLE_DESCRIPTION_BOX);
    if(stsd.getChildren().get(0) instanceof AudioSampleEntry) {
      sampleEntry = (AudioSampleEntry) stsd.getChildren().get(0);
      final long type = sampleEntry.getType();
      if(sampleEntry.hasChild(BoxTypes.ESD_BOX)) findDecoderSpecificInfo((ESDBox) sampleEntry.getChild(BoxTypes.ESD_BOX));
      else decoderInfo = DecoderInfo.parse((CodecSpecificBox) sampleEntry.getChildren().get(0));

      if(type==BoxTypes.ENCRYPTED_AUDIO_SAMPLE_ENTRY||type==BoxTypes.DRMS_SAMPLE_ENTRY) {
View Full Code Here

    vmhd = (VideoMediaHeaderBox) minf.getChild(BoxTypes.VIDEO_MEDIA_HEADER_BOX);

    final Box stbl = minf.getChild(BoxTypes.SAMPLE_TABLE_BOX);

    //sample descriptions: 'mp4v' has an ESDBox, all others have a CodecSpecificBox
    final SampleDescriptionBox stsd = (SampleDescriptionBox) stbl.getChild(BoxTypes.SAMPLE_DESCRIPTION_BOX);
    if(stsd.getChildren().get(0) instanceof VideoSampleEntry) {
      sampleEntry = (VideoSampleEntry) stsd.getChildren().get(0);
      final long type = sampleEntry.getType();
      if(type==BoxTypes.MP4V_SAMPLE_ENTRY) findDecoderSpecificInfo((ESDBox) sampleEntry.getChild(BoxTypes.ESD_BOX));
      else if(type==BoxTypes.ENCRYPTED_VIDEO_SAMPLE_ENTRY||type==BoxTypes.DRMS_SAMPLE_ENTRY) {
        findDecoderSpecificInfo((ESDBox) sampleEntry.getChild(BoxTypes.ESD_BOX));
        protection = Protection.parse(sampleEntry.getChild(BoxTypes.PROTECTION_SCHEME_INFORMATION_BOX));
View Full Code Here

    if(stbl.hasChild(BoxTypes.CHUNK_OFFSET_BOX)) stco = (ChunkOffsetBox) stbl.getChild(BoxTypes.CHUNK_OFFSET_BOX);
    else stco = (ChunkOffsetBox) stbl.getChild(BoxTypes.CHUNK_LARGE_OFFSET_BOX);
    final long[] chunkOffsets = stco.getChunks();

    //samples to chunks
    final SampleToChunkBox stsc = ((SampleToChunkBox) stbl.getChild(BoxTypes.SAMPLE_TO_CHUNK_BOX));
    final long[] firstChunks = stsc.getFirstChunks();
    final long[] samplesPerChunk = stsc.getSamplesPerChunk();

    //sample durations/timestamps
        stts = (DecodingTimeToSampleBox) stbl.getChild(BoxTypes.DECODING_TIME_TO_SAMPLE_BOX);
    final long[] sampleCounts = stts.getSampleCounts();
    final long[] sampleDeltas = stts.getSampleDeltas();
View Full Code Here

  }

  static Protection parse(Box sinf) {
    Protection p = null;
    if(sinf.hasChild(BoxTypes.SCHEME_TYPE_BOX)) {
      final SchemeTypeBox schm = (SchemeTypeBox) sinf.getChild(BoxTypes.SCHEME_TYPE_BOX);
      final long l = schm.getSchemeType();
      if(l==Scheme.ITUNES_FAIR_PLAY.type) p = new ITunesProtection(sinf);
    }

    if(p==null) p = new UnknownProtection(sinf);
    return p;
View Full Code Here

      else if(l==BoxTypes.ARTIST_SORT_BOX) put(Field.ARTIST_SORT_TEXT, data.getText());
      else if(l==BoxTypes.TRACK_SORT_BOX) put(Field.TITLE_SORT_TEXT, data.getText());
      else if(l==BoxTypes.ALBUM_SORT_BOX) put(Field.ALBUM_SORT_TEXT, data.getText());
            else if(l==BoxTypes.CUSTOM_ITUNES_METADATA_BOX) {
                // this is special iTunes tag that stores gapless info
                FairPlayDataBox nameBox = (FairPlayDataBox) box.getChild(BoxTypes.ITUNES_METADATA_NAME_BOX);
                String name = new String(nameBox.getData()).trim();
                if (name.equals("iTunSMPB")) {
                    put(Field.GAPLESS_PLAYBACK, data.getText());
                }
            }
    }
View Full Code Here

  //parses children of 'ilst': iTunes
  private void parseITunesMetaData(Box ilst) {
    final List<Box> boxes = ilst.getChildren();
    long l;
    ITunesMetadataBox data;
    for(Box box : boxes) {
      l = box.getType();
      data = (ITunesMetadataBox) box.getChild(BoxTypes.ITUNES_METADATA_BOX);

      if(l==BoxTypes.ARTIST_NAME_BOX) put(Field.ARTIST, data.getText());
      else if(l==BoxTypes.TRACK_NAME_BOX) put(Field.TITLE, data.getText());
      else if(l==BoxTypes.ALBUM_ARTIST_NAME_BOX) put(Field.ALBUM_ARTIST, data.getText());
      else if(l==BoxTypes.ALBUM_NAME_BOX) put(Field.ALBUM, data.getText());
      else if(l==BoxTypes.TRACK_NUMBER_BOX) {
        byte[] b = data.getData();
        put(Field.TRACK_NUMBER, new Integer(b[3]));
        put(Field.TOTAL_TRACKS, new Integer(b[5]));
      }
      else if(l==BoxTypes.DISK_NUMBER_BOX) put(Field.DISK_NUMBER, data.getInteger());
      else if(l==BoxTypes.COMPOSER_NAME_BOX) put(Field.COMPOSER, data.getText());
      else if(l==BoxTypes.COMMENTS_BOX) put(Field.COMMENTS, data.getText());
      else if(l==BoxTypes.TEMPO_BOX) put(Field.TEMPO, data.getInteger());
      else if(l==BoxTypes.RELEASE_DATE_BOX) put(Field.RELEASE_DATE, data.getDate());
      else if(l==BoxTypes.GENRE_BOX||l==BoxTypes.CUSTOM_GENRE_BOX) {
        String s = null;
        if(data.getDataType()==ITunesMetadataBox.DataType.UTF8) s = data.getText();
        else {
          final int i = data.getInteger();
          if(i>0&&i<STANDARD_GENRES.length) s = STANDARD_GENRES[data.getInteger()];
        }
        if(s!=null) put(Field.GENRE, s);
      }
      else if(l==BoxTypes.ENCODER_NAME_BOX) put(Field.ENCODER_NAME, data.getText());
      else if(l==BoxTypes.ENCODER_TOOL_BOX) put(Field.ENCODER_TOOL, data.getText());
      else if(l==BoxTypes.COPYRIGHT_BOX) put(Field.COPYRIGHT, data.getText());
      else if(l==BoxTypes.COMPILATION_PART_BOX) put(Field.COMPILATION, data.getBoolean());
      else if(l==BoxTypes.COVER_BOX) {
        final Artwork aw = new Artwork(Artwork.Type.forDataType(data.getDataType()), data.getData());
        if(contents.containsKey(Field.COVER_ARTWORKS)) get(Field.COVER_ARTWORKS).add(aw);
        else {
          final List<Artwork> list = new ArrayList<Artwork>();
          list.add(aw);
          put(Field.COVER_ARTWORKS, list);
        }
      }
      else if(l==BoxTypes.GROUPING_BOX) put(Field.GROUPING, data.getText());
      else if(l==BoxTypes.LYRICS_BOX) put(Field.LYRICS, data.getText());
      else if(l==BoxTypes.RATING_BOX) put(Field.RATING, data.getInteger());
      else if(l==BoxTypes.PODCAST_BOX) put(Field.PODCAST, data.getInteger());
      else if(l==BoxTypes.PODCAST_URL_BOX) put(Field.PODCAST_URL, data.getText());
      else if(l==BoxTypes.CATEGORY_BOX) put(Field.CATEGORY, data.getText());
      else if(l==BoxTypes.KEYWORD_BOX) put(Field.KEYWORDS, data.getText());
      else if(l==BoxTypes.DESCRIPTION_BOX) put(Field.DESCRIPTION, data.getText());
      else if(l==BoxTypes.LONG_DESCRIPTION_BOX) put(Field.DESCRIPTION, data.getText());
      else if(l==BoxTypes.TV_SHOW_BOX) put(Field.TV_SHOW, data.getText());
      else if(l==BoxTypes.TV_NETWORK_NAME_BOX) put(Field.TV_NETWORK, data.getText());
      else if(l==BoxTypes.TV_EPISODE_BOX) put(Field.TV_EPISODE, data.getText());
      else if(l==BoxTypes.TV_EPISODE_NUMBER_BOX) put(Field.TV_EPISODE_NUMBER, data.getInteger());
      else if(l==BoxTypes.TV_SEASON_BOX) put(Field.TV_SEASON, data.getInteger());
      else if(l==BoxTypes.PURCHASE_DATE_BOX) put(Field.PURCHASE_DATE, data.getText());
      else if(l==BoxTypes.GAPLESS_PLAYBACK_BOX) put(Field.GAPLESS_PLAYBACK, data.getText());
      else if(l==BoxTypes.HD_VIDEO_BOX) put(Field.HD_VIDEO, data.getBoolean());
      else if(l==BoxTypes.ARTIST_SORT_BOX) put(Field.ARTIST_SORT_TEXT, data.getText());
      else if(l==BoxTypes.TRACK_SORT_BOX) put(Field.TITLE_SORT_TEXT, data.getText());
      else if(l==BoxTypes.ALBUM_SORT_BOX) put(Field.ALBUM_SORT_TEXT, data.getText());
            else if(l==BoxTypes.CUSTOM_ITUNES_METADATA_BOX) {
                // this is special iTunes tag that stores gapless info
                FairPlayDataBox nameBox = (FairPlayDataBox) box.getChild(BoxTypes.ITUNES_METADATA_NAME_BOX);
                String name = new String(nameBox.getData()).trim();
                if (name.equals("iTunSMPB")) {
                    put(Field.GAPLESS_PLAYBACK, data.getText());
                }
            }
    }
  }
View Full Code Here

  //parses specific children of 'udta': 3GPP
  //TODO: handle language codes
  private void parse3GPPData(Box udta) {
    if(udta.hasChild(BoxTypes.THREE_GPP_ALBUM_BOX)) {
      ThreeGPPAlbumBox albm = (ThreeGPPAlbumBox) udta.getChild(BoxTypes.THREE_GPP_ALBUM_BOX);
      put(Field.ALBUM, albm.getData());
      put(Field.TRACK_NUMBER, albm.getTrackNumber());
    }
    //if(udta.hasChild(BoxTypes.THREE_GPP_AUTHOR_BOX));
    //if(udta.hasChild(BoxTypes.THREE_GPP_CLASSIFICATION_BOX));
    if(udta.hasChild(BoxTypes.THREE_GPP_DESCRIPTION_BOX)) put(Field.DESCRIPTION, ((ThreeGPPMetadataBox) udta.getChild(BoxTypes.THREE_GPP_DESCRIPTION_BOX)).getData());
    if(udta.hasChild(BoxTypes.THREE_GPP_KEYWORDS_BOX)) put(Field.KEYWORDS, ((ThreeGPPMetadataBox) udta.getChild(BoxTypes.THREE_GPP_KEYWORDS_BOX)).getData());
View Full Code Here

TOP

Related Classes of net.sourceforge.jaad.mp4.boxes.impl.sampleentries.codec.H263SpecificBox

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.