fix: Add support for MP3 without ID3 header #652
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes in this pull request
MP3 files does not necessarily have ID3 header and the current version will always raise "unsupported type" error when an file is MP3 format but has no ID3 header. Getting the ID3 header in MP3 file handler only serves the purpose of skipping the size of the header, hence when the MP3 file does not have an ID3 header, we could check for the MP3 header sync word (11 bits of 1) to make sure it is a valid MP3 file instead and skip 0 bytes as there is no ID3 header to skip.
This change would enable c2pa-rs to work with MP3 files that lack ID3 headers.
Checklist
TO DO
items (or similar) have been entered as GitHub issues and the link to that issue has been included in a comment.