Commit 14adfec5 authored by Jakub Adam's avatar Jakub Adam
Browse files

Allow specifying addresses for RIST output

parent 188485ec
......@@ -7,13 +7,16 @@
#include <gst/webrtc/rtcsessiondescription.h>
#define DEFAULT_SRT_URI "srt://127.0.0.1:7001?mode=listener"
#define DEFAULT_RIST_ADDRESSES "127.0.0.1:5004"
static gchar *srt_uri = NULL;
static gchar *rist_addresses = NULL;
static GOptionEntry options[] = {
{ "srt-uri", 'u', 0, G_OPTION_ARG_STRING, &srt_uri,
"SRT stream URI. Default: " DEFAULT_SRT_URI ".", "srt://address:port"
},
"SRT stream URI. Default: " DEFAULT_SRT_URI ".", "srt://address:port" },
{ "rist-addresses", 'r', 0, G_OPTION_ARG_STRING, &rist_addresses,
"Comma-separated list of addresses to send RIST packets to. Default: " DEFAULT_RIST_ADDRESSES ".", "address:port,address:port" },
{ NULL }
};
......@@ -215,18 +218,22 @@ int main (int argc, char *argv[])
if (!srt_uri) {
srt_uri = g_strdup(DEFAULT_SRT_URI);
}
if (!rist_addresses) {
rist_addresses = g_strdup (DEFAULT_RIST_ADDRESSES);
}
http_server = mss_http_server_new ();
pipeline_str = g_strdup_printf ("srtsrc uri=%s ! tsparse ! tee name=t ! "
"queue ! decodebin ! videoconvert ! autovideosink "
"t. ! queue leaky=downstream ! tsdemux ! mpegtsmux ! hlssink location=%s/segment%%05d.ts playlist-location=%s/playlist.m3u8 target-duration=5 playlist-length=3 "
"t. ! queue leaky=downstream max-size-buffers=400 ! rtpmp2tpay ! ristsink "
"t. ! queue leaky=downstream max-size-buffers=400 ! rtpmp2tpay ! ristsink bonding-addresses=%s "
"t. ! queue leaky=downstream ! tsdemux ! h264parse ! rtph264pay ! application/x-rtp,payload=96 ! tee name=webrtctee allow-not-linked=true"
,
srt_uri,
mss_http_server_get_hls_dir (http_server),
mss_http_server_get_hls_dir (http_server));
mss_http_server_get_hls_dir (http_server),
rist_addresses);
gst_init (&argc, &argv);
pipeline = gst_parse_launch (pipeline_str, &error);
......@@ -252,9 +259,10 @@ int main (int argc, char *argv[])
g_print ("Input SRT URI is %s.\n"
"\nOutput streams:\n"
"\tHLS: http://localhost:8080\n"
"\tRIST: localhost:5004\n",
srt_uri);
"\tHLS & WebRTC web player: http://localhost:8080\n"
"\tRIST: %s\n",
srt_uri,
rist_addresses);
g_main_loop_run (loop);
g_main_loop_unref (loop);
......@@ -263,5 +271,6 @@ int main (int argc, char *argv[])
gst_clear_object (&pipeline);
g_clear_object (&http_server);
g_clear_pointer(&srt_uri, g_free);
g_clear_pointer (&srt_uri, g_free);
g_clear_pointer (&rist_addresses, g_free);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment