Skip to content

M4A: Support 64 bit atom sizes #253

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jmcintyre
Copy link

When a 64bit atom size is detected, the larger size will not be retrieved after header.

@mathiascode
Copy link
Member

Thanks! This needs a sample file in https://github.com/tinytag/tinytag/blob/master/tinytag/tests/test_all.py. You can truncate an existing file to only include the header, and add it to https://github.com/tinytag/tinytag/tree/master/tinytag/tests/samples.

In order to keep the correct atom size in the debug message, I would add a data_offset variable (or similar) that contains the position of the data after the header. Once you've logged atom_size, you can subtract data_offset from it, and possibly store the result in a new variable.

atom_size = unpack('>I', atom_header[:4])[0]
if atom_size == 1: # Indicates 64 bit size value will be packed after the header
large_size_header = fh.read(large_size_len)
atom_size = unpack('>Q', large_size_header[:8])[0] - large_size_len
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[:8] is redundant in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants