summaryrefslogtreecommitdiff
path: root/network
diff options
context:
space:
mode:
authorGuillaume Seguin <guillaume@segu.in>2014-10-17 14:39:30 +0200
committerGuillaume Seguin <guillaume@segu.in>2014-10-17 14:39:30 +0200
commit5a2104e89da99c845f89323e0a078a5a382f3320 (patch)
tree5e7857bae2de4661865bd12b6d8961ced4da48a7 /network
parentdcf3da3d5d98771b45c871965e07c9045d0dbdcd (diff)
network/http-launch: Add PORT command line argument
Diffstat (limited to 'network')
-rw-r--r--network/http-launch/http-launch.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/network/http-launch/http-launch.c b/network/http-launch/http-launch.c
index 4ab7a27..63c575a 100644
--- a/network/http-launch/http-launch.c
+++ b/network/http-launch/http-launch.c
@@ -352,14 +352,17 @@ main (gint argc, gchar ** argv)
gst_init (&argc, &argv);
- if (argc < 2) {
- g_print ("usage: %s <launch line>\n"
- "example: %s ( videotestsrc ! theoraenc ! oggmux name=stream )\n",
+ if (argc < 4) {
+ g_print ("usage: %s PORT <launch line>\n"
+ "example: %s 8080 ( videotestsrc ! theoraenc ! oggmux name=stream )\n",
argv[0], argv[0]);
return -1;
}
- bin = gst_parse_launchv ((const gchar **) argv + 1, &err);
+ const gchar *port_str = argv[1];
+ const int port = (int) g_ascii_strtoll(port_str, NULL, 10);
+
+ bin = gst_parse_launchv ((const gchar **) argv + 2, &err);
if (!bin) {
g_print ("invalid pipeline: %s\n", err->message);
g_clear_error (&err);
@@ -422,14 +425,14 @@ main (gint argc, gchar ** argv)
}
service = g_socket_service_new ();
- g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service), 8080, NULL,
+ g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service), port, NULL,
NULL);
g_signal_connect (service, "incoming", G_CALLBACK (on_new_connection), NULL);
g_socket_service_start (service);
- g_print ("Listening on http://127.0.0.1:8080/\n");
+ g_print ("Listening on http://127.0.0.1:%d/\n", port);
g_main_loop_run (loop);