avformat/sctp: use ff_parse_opts_from_query_string() to set URL parameters

Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
Marton Balint
2025-08-25 02:09:26 +02:00
parent 49c6e6cc44
commit f231439ee7
2 changed files with 12 additions and 6 deletions

View File

@@ -1535,7 +1535,15 @@ The accepted URL syntax is:
sctp://@var{host}:@var{port}[?@var{options}] sctp://@var{host}:@var{port}[?@var{options}]
@end example @end example
The protocol accepts the following options: @var{options} contains a list of &-separated options of the form
@var{key}=@var{val}. Standard percent-encoding (and using the plus sign for
space) can be used to escape keys and values.
Options can also can be specified via command line options (or in code via
@code{AVOption}s).
The list of supported options follows.
@table @option @table @option
@item listen @item listen
If set to any value, listen for an incoming connection. Outgoing connection is done by default. If set to any value, listen for an incoming connection. Outgoing connection is done by default.

View File

@@ -185,7 +185,6 @@ static int sctp_open(URLContext *h, const char *uri, int flags)
int fd = -1; int fd = -1;
SCTPContext *s = h->priv_data; SCTPContext *s = h->priv_data;
const char *p; const char *p;
char buf[256];
int ret; int ret;
char hostname[1024], proto[1024], path[1024]; char hostname[1024], proto[1024], path[1024];
char portstr[10]; char portstr[10];
@@ -201,10 +200,9 @@ static int sctp_open(URLContext *h, const char *uri, int flags)
p = strchr(uri, '?'); p = strchr(uri, '?');
if (p) { if (p) {
if (av_find_info_tag(buf, sizeof(buf), "listen", p)) ret = ff_parse_opts_from_query_string(s, p, 0);
s->listen = 1; if (ret < 0)
if (av_find_info_tag(buf, sizeof(buf), "max_streams", p)) return ret;
s->max_streams = strtol(buf, NULL, 10);
} }
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;