Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make use of padding when writing #445

Open
2 of 8 tasks
Serial-ATA opened this issue Aug 25, 2024 · 0 comments
Open
2 of 8 tasks

Make use of padding when writing #445

Serial-ATA opened this issue Aug 25, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Serial-ATA
Copy link
Owner

Serial-ATA commented Aug 25, 2024

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant