From: Wim Taymans Date: Tue, 20 Nov 2012 12:34:46 +0000 (+0100) Subject: test-auth: add example of how to remove sessions X-Git-Tag: 1.6.0~653 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca11abd193012f99b33412a0f7eaca8a8ea02a5d;p=platform%2Fupstream%2Fgst-rtsp-server.git test-auth: add example of how to remove sessions Add an example of the session filter api. --- diff --git a/examples/test-auth.c b/examples/test-auth.c index eeb61fd..2375bc0 100644 --- a/examples/test-auth.c +++ b/examples/test-auth.c @@ -21,9 +21,29 @@ #include +static gboolean +remove_func (GstRTSPSessionPool * pool, GstRTSPSession * session, + GstRTSPServer * server) +{ + return GST_RTSP_FILTER_REMOVE; +} + +static gboolean +remove_sessions (GstRTSPServer * server) +{ + GstRTSPSessionPool *pool; + + g_print ("removing all sessions\n"); + pool = gst_rtsp_server_get_session_pool (server); + gst_rtsp_session_pool_filter (pool, (GstRTSPSessionFilterFunc) remove_func, + server); + g_object_unref (pool); + + return FALSE; +} static gboolean -timeout (GstRTSPServer * server, gboolean ignored) +timeout (GstRTSPServer * server) { GstRTSPSessionPool *pool; @@ -100,8 +120,11 @@ main (int argc, char *argv[]) goto failed; g_timeout_add_seconds (2, (GSourceFunc) timeout, server); + g_timeout_add_seconds (10, (GSourceFunc) remove_sessions, server); /* start serving */ + g_print ("stream with user:admin ready at rtsp://127.0.0.1:8554/test\n"); + g_print ("stream with user2:admin2 ready at rtsp://127.0.0.1:8554/test2\n"); g_main_loop_run (loop); return 0;