<div dir="ltr"><div>Any news? Maybe I didn't comment on my patch:</div><div>This patch allows the use of the streamid option when using the SRT protocol.</div><div>For example, we can query the URL srt://localhost:9710?streamid=demo</div><div>if a stream server is listening on localhost:9710 that supports multiple streams</div><div>on the same server. Like the others already implemented, this parameter can</div><div>be overwritten in the settings of the transport.</div><div><br></div><div>In a future patch, it may be good to support the full options.</div><div>The complete list can be found here:</div><div><a href="https://github.com/Haivision/srt/blob/master/docs/APISocketOptions.md#list-of-options">https://github.com/Haivision/srt/blob/master/docs/APISocketOptions.md#list-of-options</a></div><div>A human-friendly version of this list can be found in the ffmpeg documentation:</div><div><a href="https://ffmpeg.org/ffmpeg-all.html#srt">https://ffmpeg.org/ffmpeg-all.html#srt</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mer. 28 oct. 2020 à 14:36, Yohann D'ANELLO <<a href="mailto:ynerant@crans.org">ynerant@crans.org</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Yohann D'ANELLO <<a href="mailto:yohann.danello@gmail.com" target="_blank">yohann.danello@gmail.com</a>><br>
<br>
Signed-off-by: Yohann D'ANELLO <<a href="mailto:yohann.danello@gmail.com" target="_blank">yohann.danello@gmail.com</a>><br>
---<br>
modules/access/srt.c | 18 ++++++++++++++++++<br>
modules/access/srt_common.c | 4 ++++<br>
modules/access/srt_common.h | 2 ++<br>
modules/access_output/srt.c | 18 ++++++++++++++++++<br>
4 files changed, 42 insertions(+)<br>
<br>
diff --git a/modules/access/srt.c b/modules/access/srt.c<br>
index d7ef51fccf..ae8ba2a84f 100644<br>
--- a/modules/access/srt.c<br>
+++ b/modules/access/srt.c<br>
@@ -97,6 +97,8 @@ static bool srt_schedule_reconnect(stream_t *p_stream)<br>
int stat;<br>
char *psz_passphrase = var_InheritString( p_stream, SRT_PARAM_PASSPHRASE );<br>
bool passphrase_needs_free = true;<br>
+ char *psz_streamid = var_InheritString( p_stream, SRT_PARAM_STREAMID );<br>
+ bool streamid_needs_free = true;<br>
char *url = NULL;<br>
srt_params_t params;<br>
struct addrinfo hints = {<br>
@@ -145,6 +147,11 @@ static bool srt_schedule_reconnect(stream_t *p_stream)<br>
passphrase_needs_free = false;<br>
psz_passphrase = (char *) params.passphrase;<br>
}<br>
+ if (params.streamid != NULL ) {<br>
+ free( psz_streamid );<br>
+ streamid_needs_free = false;<br>
+ psz_streamid = (char *) params.streamid;<br>
+ }<br>
}<br>
}<br>
<br>
@@ -177,6 +184,12 @@ static bool srt_schedule_reconnect(stream_t *p_stream)<br>
SRTO_PASSPHRASE, psz_passphrase, strlen(psz_passphrase) );<br>
}<br>
<br>
+ /* set stream id */<br>
+ if (psz_streamid != NULL && psz_streamid[0] != '\0') {<br>
+ srt_set_socket_option( strm_obj, SRT_PARAM_STREAMID, p_sys->sock,<br>
+ SRTO_STREAMID, psz_streamid, strlen(psz_streamid) );<br>
+ }<br>
+<br>
/* set maximum payload size */<br>
srt_set_socket_option( strm_obj, SRT_PARAM_PAYLOAD_SIZE, p_sys->sock,<br>
SRTO_PAYLOADSIZE, &i_payload_size, sizeof(i_payload_size) );<br>
@@ -211,6 +224,8 @@ out:<br>
<br>
if (passphrase_needs_free)<br>
free( psz_passphrase );<br>
+ if (streamid_needs_free)<br>
+ free( psz_streamid );<br>
freeaddrinfo( res );<br>
free( url );<br>
<br>
@@ -429,6 +444,9 @@ vlc_module_begin ()<br>
add_integer( SRT_PARAM_KEY_LENGTH, SRT_DEFAULT_KEY_LENGTH,<br>
SRT_KEY_LENGTH_TEXT, SRT_KEY_LENGTH_TEXT, false )<br>
change_integer_list( srt_key_lengths, srt_key_length_names )<br>
+ add_string(SRT_PARAM_STREAMID, "",<br>
+ N_(" SRT Stream ID"), NULL, false)<br>
+ change_safe()<br>
<br>
set_capability("access", 0)<br>
add_shortcut("srt")<br>
diff --git a/modules/access/srt_common.c b/modules/access/srt_common.c<br>
index be6a9732cb..c1b6dc3751 100644<br>
--- a/modules/access/srt_common.c<br>
+++ b/modules/access/srt_common.c<br>
@@ -107,6 +107,7 @@ bool srt_parse_url(char* url, srt_params_t* params)<br>
params->key_length = -1;<br>
params->payload_size = -1;<br>
params->bandwidth_overhead_limit = -1;<br>
+ params->streamid = NULL;<br>
<br>
/* Parse URL parameters */<br>
query = find( url, '?' );<br>
@@ -127,6 +128,9 @@ bool srt_parse_url(char* url, srt_params_t* params)<br>
} else if (strcmp( local_params[i].key, SRT_PARAM_PASSPHRASE )<br>
== 0) {<br>
params->passphrase = val;<br>
+ } else if (strcmp( local_params[i].key, SRT_PARAM_STREAMID )<br>
+ == 0) {<br>
+ params->streamid = val;<br>
} else if (strcmp( local_params[i].key, SRT_PARAM_PAYLOAD_SIZE )<br>
== 0) {<br>
int temp = atoi( val );<br>
diff --git a/modules/access/srt_common.h b/modules/access/srt_common.h<br>
index c2322d5755..5f2a11a242 100644<br>
--- a/modules/access/srt_common.h<br>
+++ b/modules/access/srt_common.h<br>
@@ -39,6 +39,7 @@<br>
#define SRT_PARAM_CHUNK_SIZE "chunk-size"<br>
#define SRT_PARAM_POLL_TIMEOUT "poll-timeout"<br>
#define SRT_PARAM_KEY_LENGTH "key-length"<br>
+#define SRT_PARAM_STREAMID "streamid"<br>
<br>
<br>
#define SRT_DEFAULT_BANDWIDTH_OVERHEAD_LIMIT 25<br>
@@ -68,6 +69,7 @@ typedef struct srt_params {<br>
int key_length;<br>
int payload_size;<br>
int bandwidth_overhead_limit;<br>
+ const char* streamid;<br>
} srt_params_t;<br>
<br>
bool srt_parse_url(char* url, srt_params_t* params);<br>
diff --git a/modules/access_output/srt.c b/modules/access_output/srt.c<br>
index 3d579eb1bd..afd11dc484 100644<br>
--- a/modules/access_output/srt.c<br>
+++ b/modules/access_output/srt.c<br>
@@ -68,6 +68,8 @@ static bool srt_schedule_reconnect(sout_access_out_t *p_access)<br>
int i_payload_size = var_InheritInteger( p_access, SRT_PARAM_PAYLOAD_SIZE );<br>
char *psz_passphrase = var_InheritString( p_access, SRT_PARAM_PASSPHRASE );<br>
bool passphrase_needs_free = true;<br>
+ char *psz_streamid = var_InheritString( p_access, SRT_PARAM_STREAMID );<br>
+ bool streamid_needs_free = true;<br>
int i_max_bandwidth_limit =<br>
var_InheritInteger( p_access, SRT_PARAM_BANDWIDTH_OVERHEAD_LIMIT );<br>
char *url = NULL;<br>
@@ -136,6 +138,11 @@ static bool srt_schedule_reconnect(sout_access_out_t *p_access)<br>
passphrase_needs_free = false;<br>
psz_passphrase = (char *) params.passphrase;<br>
}<br>
+ if (params.streamid != NULL) {<br>
+ free( psz_streamid );<br>
+ streamid_needs_free = false;<br>
+ psz_streamid = (char *) params.streamid;<br>
+ }<br>
}<br>
}<br>
<br>
@@ -168,6 +175,12 @@ static bool srt_schedule_reconnect(sout_access_out_t *p_access)<br>
SRTO_PASSPHRASE, psz_passphrase, strlen(psz_passphrase) );<br>
}<br>
<br>
+ /* set streamid */<br>
+ if (psz_streamid != NULL && psz_streamid[0] != '\0') {<br>
+ srt_set_socket_option( access_obj, SRT_PARAM_STREAMID, p_sys->sock,<br>
+ SRTO_STREAMID, psz_streamid, strlen(psz_streamid) );<br>
+ }<br>
+<br>
/* set maximumu payload size */<br>
srt_set_socket_option( access_obj, SRT_PARAM_PAYLOAD_SIZE, p_sys->sock,<br>
SRTO_PAYLOADSIZE, &i_payload_size, sizeof(i_payload_size) );<br>
@@ -204,6 +217,8 @@ out:<br>
<br>
if (passphrase_needs_free)<br>
free( psz_passphrase );<br>
+ if (streamid_needs_free)<br>
+ free( psz_streamid );<br>
free( psz_dst_addr );<br>
free( url );<br>
freeaddrinfo( res );<br>
@@ -444,6 +459,9 @@ vlc_module_begin()<br>
add_integer( SRT_PARAM_KEY_LENGTH, SRT_DEFAULT_KEY_LENGTH, SRT_KEY_LENGTH_TEXT,<br>
SRT_KEY_LENGTH_TEXT, false )<br>
change_integer_list( srt_key_lengths, srt_key_length_names )<br>
+ add_string(SRT_PARAM_STREAMID, "",<br>
+ N_(" SRT Stream ID"), NULL, false)<br>
+ change_safe()<br>
<br>
set_capability( "sout access", 0 )<br>
add_shortcut( "srt" )<br>
-- <br>
2.29.1<br>
<br>
</blockquote></div>