Serial-ATA / Serial-ATA/lofty-rs

Make use of padding when writing

Open
#445 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
359
Forks
76
Avg merge
12h 54m
Merged PRs (30d)
11

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the MP4, FLAC, and ID3v2 tag-writing paths; the issue does not name specific files or tests. Done means supported padding is reused without rewriting the entire file where the checklist permits, including the stated remaining-padding behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
audio-video-rtc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.