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

parse ctts atom implemented #379

Merged
merged 15 commits into from
Mar 15, 2021
Merged

parse ctts atom implemented #379

merged 15 commits into from
Mar 15, 2021

Conversation

nklhtv
Copy link
Contributor

@nklhtv nklhtv commented Mar 10, 2021

Implementation of ctts atom parsing.
@gkatsev @gesinger @joeyparrish could you review this PR? I need this atom in my project.

@joeyparrish
Copy link
Contributor

I'm not one of the maintainers of this project, so I won't be able to approve the PR. Sorry for any confusion!

@joeyparrish
Copy link
Contributor

I'm not deeply familiar with norms and preferred style in mux.js, and I haven't compared your parser to any spec for the ctts box, but the implementation looks reasonable to me, for what that's worth.

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Style-wise, it matches existing code. Also, appreciate that there are tests! Appreciate you looking at this @joeyparrish.
I'll have to defer to @gesinger or @brandonocasey to do a deeper review.

@joeyparrish
Copy link
Contributor

@gkatsev, if you are happy with the project-specific details, and it's just a question of correctness, I found docs from Apple detailing the ctts box, and the parser matches perfectly as far as I can tell:

https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap2/qtff2.html#//apple_ref/doc/uid/TP40000939-CH204-SW40

Copy link
Contributor

@joeyparrish joeyparrish left a comment

Choose a reason for hiding this comment

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

Approved by an interested outsider, for whatever that's worth. :-D

for (i = 8; entryCount; i += 8, entryCount--) {
result.compositionOffsets.push({
sampleCount: view.getUint32(i),
sampleOffset: view.getInt32(i + 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

in the spec for mp4 version 0 of this box uses an uint while version 1 uses an int. Would you mind making the change for this case?

Copy link
Contributor Author

@nklhtv nklhtv Mar 11, 2021

Choose a reason for hiding this comment

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

can you please give me a reference for ctts spec?
bento4 actually uses only uint and used to have checks for quick time support.
As far as i understand negative offsets ware used only in quicktime and they ware never part of the mp4 spec and the docs ive followed ware not mp4 compliant.

@nklhtv
Copy link
Contributor Author

nklhtv commented Mar 11, 2021

@joeyparrish Sorry, i thought you are a maintainer

@nklhtv nklhtv marked this pull request as draft March 11, 2021 10:46
@nklhtv nklhtv marked this pull request as ready for review March 11, 2021 12:49
for (i = 8; entryCount; i += 8, entryCount--) {
result.compositionOffsets.push({
sampleCount: view.getUint32(i),
sampleOffset: view.getUint32(i + 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

The spec is closed/paid for so I can't really link a reference to it. Basically you have to check the box version for this box and use view.getUint32 if it is version 0 and view.getInt32 for version 1. Should be something like this suggestion.

Suggested change
sampleOffset: view.getUint32(i + 4)
sampleOffset: view[(result.version === 0 ? 'getUint32' :'getInt32')](i + 4)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@gkatsev
Copy link
Member

gkatsev commented Mar 12, 2021

We definitely value @joeyparrish's opinion!

@joeyparrish
Copy link
Contributor

We definitely value @joeyparrish's opinion!

Then I've fooled you all!! 😈

@gkatsev
Copy link
Member

gkatsev commented Mar 12, 2021

We'll know better next time!

@brandonocasey brandonocasey merged commit b75a7a4 into videojs:main Mar 15, 2021
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.

None yet

4 participants