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

Add MatroskaJS Chapter Codec #835

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

robUx4
Copy link
Contributor

@robUx4 robUx4 commented Aug 21, 2024

Rather than reinventing the wheel with a custom language, we can reuse and well-known one.

The goal of Matroska Script was to be similar to JavaScript/ECMAStrip/ActionScript.
But, in JavaScript, integers can only use 56 bits. So not all ChapterUID (64-bit unsigned integer) can be addressed
with the current Matroska Script stable API, if an ECMAScript interpreter was used.

Rather than adding a different GotoAndPlay() that is compatible with JavaScript (using a string), we start from
scratch with ECMAScript 6th Edition (ES6). We cannot handle the original GotoAndPlay() with that engine anyway.

The implementation of the Choice handling is almost complete in VLC by a Google Summer of Code student.

Fixes #658

Draft on top of #833

@robUx4 robUx4 added format addition spec_chapter_codec Chapter Codec Matroska spec document target labels Aug 21, 2024
Rather than reinventing the wheel with a custom language, we can reuse and well-known one.

The goal of Matroska Script was to be similar to JavaScript/ECMAStrip/ActionScript.
But, in JS, integers can only use 56 bits. So not all ChapterUID (64-bit unsigned integer) can be addressed
with the current Matroska Script stable API.

Rather than adding a different GotoAndPlay that is compatible with JavaScript (using a string), we start from
scratch with ECMAScript 6th Edition (ES6).
This API is meant for interactive movies. The author adds choices in a chapter and retrieves the user choice at the end of this chapter.

Depending on the choice, different actions can be performed.

The choice rendering and user interaction is the responsibility of the player.
@robUx4
Copy link
Contributor Author

robUx4 commented Aug 28, 2024

Not sure it should go in the "historical" Chapter Codec document, ie make the specification for what existed so far. Or if it should be a document on its own. Maybe each command will need its own IANA registry.

## MatroskaJS

This is the case when `ChapProcessCodecID` = 2. This is a script language build for
Matroska purposes. It uses the [@!ECMAScript] 6th Edition (ES6) syntax. The commands are stored as text commands, in UTF-8.
Copy link

Choose a reason for hiding this comment

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

We may want to use ES5 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would be better (less constraint) but we don't have a working solution with that.

Also there are things that could make the JS usage cleaner like let and const or static arrays and typed arrays. For example you could have a global function that gets the list of choices in an array and call the MatroskaJS engine. Then each (enter) chapter would just had the array and that call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
format addition spec_chapter_codec Chapter Codec Matroska spec document target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Interactive Movie MatroskaScript commands
2 participants