summaryrefslogtreecommitdiff
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
commit37ba90a83b95822a78eb9863eac94325dbe7f3c5 (patch)
tree5c6de399cef14e1dab52d294d7b97bb16a59a7d9
parentce4ccc175c40e47dec590ce4fdeb0f68df6677bc (diff)
Add PORT command line argument
-rw-r--r--http-launch/src/http-launch.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/http-launch/src/http-launch.c b/http-launch/src/http-launch.c
index 4ab7a27..63c575a 100644
--- a/http-launch/src/http-launch.c
+++ b/http-launch/src/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);