rtsp-server: test-launch: added the argument mount/m to specify the mountpoint

Default is the previous hardcoded "/test"

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3942>
This commit is contained in:
Jan Vermaete 2023-02-11 19:55:41 +01:00
parent 4e7a5ebb11
commit c99db9a42b

View file

@ -22,14 +22,18 @@
#include <gst/rtsp-server/rtsp-server.h>
#define DEFAULT_RTSP_PORT "8554"
#define DEFAULT_MOUNT "/test"
#define DEFAULT_DISABLE_RTCP FALSE
static char *port = (char *) DEFAULT_RTSP_PORT;
static char *mount = (char *) DEFAULT_MOUNT;
static gboolean disable_rtcp = DEFAULT_DISABLE_RTCP;
static GOptionEntry entries[] = {
{"port", 'p', 0, G_OPTION_ARG_STRING, &port,
"Port to listen on (default: " DEFAULT_RTSP_PORT ")", "PORT"},
{"mount", 'm', 0, G_OPTION_ARG_STRING, &mount,
"Mountpoint (default: " DEFAULT_MOUNT ")", "MOUNT"},
{"disable-rtcp", '\0', 0, G_OPTION_ARG_NONE, &disable_rtcp,
"Whether RTCP should be disabled (default false)", NULL},
{NULL}
@ -76,8 +80,8 @@ main (int argc, char *argv[])
gst_rtsp_media_factory_set_shared (factory, TRUE);
gst_rtsp_media_factory_set_enable_rtcp (factory, !disable_rtcp);
/* attach the test factory to the /test url */
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
/* attach the test factory to the mount url */
gst_rtsp_mount_points_add_factory (mounts, mount, factory);
/* don't need the ref to the mapper anymore */
g_object_unref (mounts);
@ -86,7 +90,7 @@ main (int argc, char *argv[])
gst_rtsp_server_attach (server, NULL);
/* start serving */
g_print ("stream ready at rtsp://127.0.0.1:%s/test\n", port);
g_print ("stream ready at rtsp://127.0.0.1:%s%s\n", port, mount);
g_main_loop_run (loop);
return 0;