Support in-place adjustment of padding before audio portion of mp3 file.

#58 Merged at c030764
Repository
ijabz
Branch
master
Author
  1. Hendrik Schreiber
Reviewers
Description

It is beneficial for audio application to preserve file identity (see also https://bitbucket.org/ijabz/jaudiotagger/pull-requests/41/support-for-preserving-file-identity-inode/diff). The fix makes sure that if we need more room for ID3 tags before the audio portion of mp3 files, the required room can be created in-place, i.e. without creating a new file. The file is simply extended and the audio portion is shifted to the back.

Channel transfer operations are avoided on purpose, because of https://bugs.openjdk.java.net/browse/JDK-8140241

Comments (3)

  1. Hendrik Schreiber author

    The initial PR didn’t compute the chunkSize correctly. I have just fixed this.

  2. Hendrik Schreiber author

    When working on this, I noticed that in TagOptionSingleton we have:

        /**
         * Preserve file identity if possible
         */
        private boolean preserveFileIdentity = true;
    

    And then:

        public void setToDefault()
        {
            [...]
            preserveFileIdentity = false;
    

    That’s pretty confusing when reading the code. I’d like to suggest changing one or the other.