Skip to content

Evi/typings #458

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

Closed
wants to merge 7 commits into from
Closed

Evi/typings #458

wants to merge 7 commits into from

Conversation

erwanvivien
Copy link
Contributor

@erwanvivien erwanvivien commented May 26, 2025

Description

Fixes a few bugs in the lib along typings please start reviewing after feat: fix onReady, onMoovStart and onSidx callbacks typing

I can't update the base of my PRs, unsure why

@erwanvivien
Copy link
Contributor Author

erwanvivien commented May 26, 2025

Putting this PR in draft as it's blocked by #455

Resolved

@erwanvivien erwanvivien marked this pull request as draft May 26, 2025 20:00
@erwanvivien erwanvivien marked this pull request as ready for review May 28, 2025 08:20
@erwanvivien
Copy link
Contributor Author

This PR conflicts with #462 (ff3529d)

@erwanvivien
Copy link
Contributor Author

cc @bigmistqke if you want to review

@@ -25,8 +25,8 @@ function decimalToHex(d: number | string, padding?: number | null) {
}

class avcCSampleEntryBase extends VisualSampleEntry {
declare avcC: avcCBox;
declare avcCs: Array<avcCBox>;
avcC: avcCBox | undefined;
Copy link
Contributor Author

@erwanvivien erwanvivien May 28, 2025

Choose a reason for hiding this comment

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

Unsure about this change, my reasoning is that the avcC is at some point undefined (same for most other boxes)

We seem to be checking if (this.avcC) meaning the type can actually be undefined, so I'd say we should do this update, though I'm missing quite a lot of those in the commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed in 078e7c5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure why no | undefined typings are working?

image
Screenshot 2025-05-28 at 11 09 00

On the first screen Typescript doesn't even pick the undefined in the second screen Typescript allows to use .length on an optional type
I'm clueless 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking of dropping the latest commit and current work (unmerged) to merge this PR and resolve issues, then come back to it

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure why no | undefined typings are working?

This is probably due to strict: false in the tsconfig. Maybe not a bad idea to set it to true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, only Found 1118 errors in 154 files. haha

I might have time to work on that, I'll break this PR in more PRs so we can merge few things at least

Copy link
Contributor

@bigmistqke bigmistqke left a comment

Choose a reason for hiding this comment

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

this commit has some memory implications: instead of having a shared method on the prototype, this will create a function for each box' instance.

@DenizUgur
Copy link
Member

Why do we need this change: bdf5e29

@erwanvivien
Copy link
Contributor Author

@DenizUgur
Copy link
Member

This seems to run. Am I missing something?

function _getDescription(descriptionBox: Box) {
  const stream = new DataStream(undefined, 0, DataStream.BIG_ENDIAN);
  descriptionBox.write(stream);
  return new Uint8Array(stream.buffer, 8); // Remove the box header.
}

const avcc = new avcCBox();
avcc.SPS = [];
avcc.PPS = [];
console.log(_getDescription(avcc));

@DenizUgur
Copy link
Member

I've fixed most of the issues you've highlighted in this PR locally. I'll be closing this PR and the other ones you've opened. Once I've pushed my fixes, feel free to open again if the issues continue.

@DenizUgur DenizUgur closed this May 30, 2025
@erwanvivien
Copy link
Contributor Author

I've fixed most of the issues you've highlighted in this PR locally. I'll be closing this PR and the other ones you've opened. Once I've pushed my fixes, feel free to open again if the issues continue.

Ahah ok 🫡

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.

3 participants