mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
example: improve example docs a little
This commit is contained in:
parent
94c9999715
commit
459bc46e31
1 changed files with 12 additions and 4 deletions
|
@ -21,7 +21,13 @@
|
|||
|
||||
#include <gst/rtsp-server/rtsp-server.h>
|
||||
|
||||
/* define this if you want the resource to only be available when using
|
||||
* user/admin as the password */
|
||||
#undef WITH_AUTH
|
||||
|
||||
/* this timeout is periodically run to clean up the expired sessions from the
|
||||
* pool. This needs to be run explicitly currently but might be done
|
||||
* automatically as part of the mainloop. */
|
||||
static gboolean
|
||||
timeout (GstRTSPServer * server, gboolean ignored)
|
||||
{
|
||||
|
@ -41,7 +47,7 @@ main (int argc, char *argv[])
|
|||
GstRTSPServer *server;
|
||||
GstRTSPMediaMapping *mapping;
|
||||
GstRTSPMediaFactory *factory;
|
||||
#if 0
|
||||
#ifdef WITH_AUTH
|
||||
GstRTSPAuth *auth;
|
||||
gchar *basic;
|
||||
#endif
|
||||
|
@ -57,8 +63,9 @@ main (int argc, char *argv[])
|
|||
* that be used to map uri mount points to media factories */
|
||||
mapping = gst_rtsp_server_get_media_mapping (server);
|
||||
|
||||
#if 0
|
||||
/* make a new authentication manager */
|
||||
#ifdef WITH_AUTH
|
||||
/* make a new authentication manager. it can be added to control access to all
|
||||
* the factories on the server or on individual factories. */
|
||||
auth = gst_rtsp_auth_new ();
|
||||
basic = gst_rtsp_auth_make_basic ("user", "admin");
|
||||
gst_rtsp_auth_set_basic (auth, basic);
|
||||
|
@ -88,9 +95,10 @@ main (int argc, char *argv[])
|
|||
if (gst_rtsp_server_attach (server, NULL) == 0)
|
||||
goto failed;
|
||||
|
||||
/* add a timeout for the session cleanup */
|
||||
g_timeout_add_seconds (2, (GSourceFunc) timeout, server);
|
||||
|
||||
/* start serving */
|
||||
/* start serving, this never stops */
|
||||
g_main_loop_run (loop);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue