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

What are the rules for parsing a StreamID? #2047

Open
eric opened this issue Jun 25, 2021 · 7 comments
Open

What are the rules for parsing a StreamID? #2047

eric opened this issue Jun 25, 2021 · 7 comments
Labels
[docs] Area: Improvements or additions to documentation Type: Bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@eric
Copy link

eric commented Jun 25, 2021

In Access Control it says:

  • : - this marks the YAML format, the only one currently used

but the example says:

key1=value1,key2=value2...

YAML uses : to separate a key and value, not =, so it is very confusing to me what the actual syntax is for these key/value pairs.

@eric eric added the Type: Question Questions or things that require clarification label Jun 25, 2021
@maxsharabayko maxsharabayko added [docs] Area: Improvements or additions to documentation Type: Bug Indicates an unexpected problem or unintended behavior and removed Type: Question Questions or things that require clarification labels Aug 19, 2021
@maxsharabayko
Copy link
Collaborator

Hi @eric. Thanks for noticing. The reference to YAML is indeed incorrect, as : must be used there.
The provided example key1=value1,key2=value2... is the one to follow.
The Guideline document has to be fixed.

@maxsharabayko maxsharabayko added this to the v1.4.4 milestone Aug 19, 2021
@eric
Copy link
Author

eric commented Aug 20, 2021

Can you give an example with curly braces (the nesting) and an example of how to handle a value with a =, , , and in it (escaping)?

@ethouris
Copy link
Collaborator

Like:

#!:{u=john,sig={simple,ext=spliced,expires=never},m=publish}

In particular: in case of nested braces, whatever's inside the paired braces, shall not be part of the syntax. The resulting values here are:

  • u: john
  • sig: simple,ext=spliced,expires=never (to be parsed separately, not necessarily according to the overall syntax)
  • m: publish

If you specified the same thing with :: syntax:

#!::u=john,sig={simple,ext=spliced,expires=never},m=publish 

Values would be then interpreted as:

  • u: john
  • sig: {simple
  • ext: spliced
  • expires: never}
  • m: publish

Note that that's only a conceptual syntax, I don't think anyone has so far implemented it.

@eric
Copy link
Author

eric commented Aug 21, 2021

How is escaping supposed to be handled here?

Could I get an example or description of what syntax Haivision is using in their SRT solutions right now? I'd like to try to match it.

@ethouris
Copy link
Collaborator

Depends on what level of specification you mean.

On the lowest possible level you have the SRTO_STREAMID socket option, which's type is a string with specified length. This one has only one limitation: NUL characters cannot be stored directly there, that's all. Beside this, all character code values are allowed.

Above this there's the Access Control specification, which mandates this string to be UTF-8 encoded and defines the syntax. Beside key/value syntax elements and the required ability to parse it according to these rules, rest of the things are free-form. In case of braced syntax it means that when you have an open brace, until the symmetric closing brace, everything is free-form (in the frames of UTF-8 encoding). If you want to pass any kind of "binary data", including NUL character, the way how to encode and decode them is not part of this specification.

And above this there's another level, which is the URI specification in the applications, where the streamid key in the attribute part is used to set this option. This, again, should follow the overall URI specification and follow the guidelines of the URI standard, and any "escaping" takes place there (which might be necessary for some key syntax elements in the streamid specification). The default applications provided with SRT handle this, and normally applications must handle it somehow on their own.

@eric
Copy link
Author

eric commented Aug 23, 2021

During the plugfest I was shown the Haivision UI with the "Default" vs "Custom" "Stream ID Format".

The Access Control specification does not specify a format with enough detail to implement it in code. This is the reason why I have been asking for rules around escaping of values. For instance, what if the r= or h= has a , in it?

@ethouris
Copy link
Collaborator

Yes, so for that reason there exists also the braced syntax. Then I agree that the specification is too defective and requires to be completed. I think this should be simply described in a separate issue with a request to fix the specification.

maxsharabayko added a commit that referenced this issue Aug 25, 2021
as it is not used actually.
See #2047.
@maxsharabayko maxsharabayko modified the milestones: v1.4.4, v1.4.5 Oct 4, 2021
@maxsharabayko maxsharabayko modified the milestones: v1.5.0, Backlog Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[docs] Area: Improvements or additions to documentation Type: Bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants