Skip to content

Make use of padding when writing #445

Open
@Serial-ATA

Description

@Serial-ATA

Right now we just retain existing padding and add some if it's missing.

  • MP4: Utilize free atoms surrounding ilst atoms
    • Calculate space available before writing
      • When writing, all available space is taken into consideration. This includes all free atoms before AND after the ilst, as well as the ilst itself. Any remaining space is converted back to padding.
        • This means if you save a 500 byte tag to the following file:
          • free (250 bytes)
          • ilst (250 bytes)
          • free (250 bytes)
        • The result will be:
          • ilst (500 bytes)
          • free (250 bytes)
    • Do not rewrite the entire file
      • We should be able to update the tag as above and its offsets without having to rewrite the entire file.
  • FLAC: Utilize PADDING blocks
    • We should be able to handle the cases:
      • No padding, write as normal and append to the end
      • Padding exists at the end, do not rewrite the file if it's enough
        • Still rewrite if the remaining padding is less than the preferred_padding
      • Padding exists between blocks, such as after VORBIS_COMMENTS and before a PICTURE
        • We should be able to grow the VORBIS_COMMENTS and leave PICTURE alone if possible. (?)
  • ID3v2: Simply overwrite tags
    • ID3v2 supports padding, so if tag_to_write.len() <= existing_tag.len(), we can simply write tag_to_write at the beginning of the file and replace any remaining size with padding.
    • This only applies to formats where ID3v2 can be written to the beginning of the file (not IFF formats)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions