Package entagged.audioformats.mp4

Examples of entagged.audioformats.mp4.Mp4Tag


    @Override
    public void write(Track track) throws TagWriteException {
        try {
            org.jaudiotagger.audio.AudioFile af1 = AudioFileIO.read(track.getTrackData().getFile());
            Tag abstractTag = af1.getTag();
            copyTagFields(abstractTag, new Mp4Tag(), track);
      // workaround since track/tracktotal and disc/disctotal share same field
            handleTrackDiscFields(abstractTag, track);
      // workaround since genre and genre custom field types used
            handleGenreFields(abstractTag, track);
            AudioFileIO.write(af1);
View Full Code Here


    }

    private void handleGenreFields(Tag tag, Track track) throws FieldDataInvalidException, KeyNotFoundException {
      FieldValues genres = track.getTrackData().getGenres();
      if (genres != null && !genres.isEmpty()) {
        Mp4Tag mp4Tag = (Mp4Tag) tag;
       
        mp4Tag.deleteField(Mp4FieldKey.GENRE);
        mp4Tag.deleteField(Mp4FieldKey.GENRE_CUSTOM);
       
      for (int i = 0; i < genres.size(); i++) {
        String genre = genres.get(i);
          if (!Util.isEmpty(genre)) {
            mp4Tag.addField(FieldKey.GENRE, genre);
          }
        }
      }
    }
View Full Code Here

     *
     * There are gaps between these boxes

     */
    public Mp4Tag read(RandomAccessFile raf) throws CannotReadException, IOException {
        Mp4Tag tag = new Mp4Tag();

        //Get to the facts everything we are interested in is within the moov box, so just load data from file
        //once so no more file I/O needed
        Mp4BoxHeader moovHeader = Mp4BoxHeader.seekWithinLevel(raf, Mp4NotMetaFieldKey.MOOV.getFieldName());
        if (moovHeader == null) {
View Full Code Here

        if (SupportedFileFormat.FLAC.getFilesuffix().equals(file.getName().substring(file.getName().lastIndexOf('.')))) {
            return new FlacTag(VorbisCommentTag.createNewTag(), new ArrayList<MetadataBlockDataPicture>());
        } else if (SupportedFileFormat.OGG.getFilesuffix().equals(file.getName().substring(file.getName().lastIndexOf('.')))) {
            return VorbisCommentTag.createNewTag();
        } else if (SupportedFileFormat.MP4.getFilesuffix().equals(file.getName().substring(file.getName().lastIndexOf('.')))) {
            return new Mp4Tag();
        } else if (SupportedFileFormat.M4A.getFilesuffix().equals(file.getName().substring(file.getName().lastIndexOf('.')))) {
            return new Mp4Tag();
        } else if (SupportedFileFormat.M4P.getFilesuffix().equals(file.getName().substring(file.getName().lastIndexOf('.')))) {
            return new Mp4Tag();
        } else if (SupportedFileFormat.WAV.getFilesuffix().equals(file.getName().substring(file.getName().lastIndexOf('.')))) {
            return new WavTag();
        } else {
            throw new RuntimeException("Unable to create default tag for this file format");
        }
View Full Code Here

     * @param raf
     * @param rafTemp
     * @throws IOException
     */
    public void delete(RandomAccessFile raf, RandomAccessFile rafTemp) throws IOException {
        Mp4Tag tag = new Mp4Tag();

        try {
            write(tag, raf, rafTemp);
        } catch (CannotWriteException cwe) {
            throw new IOException(cwe.getMessage());
View Full Code Here

TOP

Related Classes of entagged.audioformats.mp4.Mp4Tag

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.