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

Update MpegTsDemuxer to implement the Transform API #7

Closed
slifty opened this issue May 8, 2021 · 2 comments · Fixed by #10
Closed

Update MpegTsDemuxer to implement the Transform API #7

slifty opened this issue May 8, 2021 · 2 comments · Fixed by #10

Comments

@slifty
Copy link
Member

slifty commented May 8, 2021

Task

Description

As discussed in #6 (comment), the MpegTsDemuxer is acting as a Transform stream without actually implementing the Transform stream API.

If we implement it as a Transform then everybody can benefit from node pipelines and stream management in general.

@slifty
Copy link
Member Author

slifty commented May 8, 2021

Note that Node doesn't seem to support typed streams which is unfortunate.

@slifty
Copy link
Member Author

slifty commented May 8, 2021

There's a handy guide for implementing a Transform Stream which I'm not sure always existed.

slifty added a commit that referenced this issue May 8, 2021
The original TSDemuxer API used a callback parameter to emit extracted
Packets.  This replaces that with NodeJS's built in Transform Stream
API.

https://nodejs.org/api/stream.html#stream_class_stream_transform

Really what's happening is that:

1) We hijacked `cb` to insteadp invoke `push`
2) `process` is now private and only invoked from _transform
3) `finalize` is now private and only invoked from _flush

Issue #7
@slifty slifty closed this as completed in #10 May 8, 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 a pull request may close this issue.

1 participant