Skip to content

Make use of padding when writing #445

Open

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)

Activity

  1. added
    enhancement
    on Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions