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

[HELP] Can someone help in understanding how to parse this type of buffer? #205

Open
enricovittorini opened this issue Jun 4, 2022 · 1 comment

Comments

@enricovittorini
Copy link

Hello Guys,
can someone explain how to parse a buffer with this structure?

image

I managed to do it till here:

const patParse = new Parser()
         .uint8("table_id")
         .bit1("section_syntax_indicator")
         .bit1("zero")
         .bit2("reserved")
         .bit12("section_length")
         .uint16("transport_stream_id")
         .bit2("reserved")
         .bit5("version_number")
         .bit1("current_next_indicator")
         .uint8("section_number")
         .uint8("last_section_number")

but I do not know how to manage the "for"/"if" with unknown length.

thanks for your help!

@keichi
Copy link
Owner

keichi commented Jun 5, 2022

If you know the size of the buffer, you could calculate the number of elements (N) and pass it to the length or lengthInBytes option of the array parser.

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

No branches or pull requests

2 participants