rtsp-server: context: Add method to set the RTSPToken on some RTSPContext
authorChris Wiggins <chris@chriswiggins.co.nz>
Mon, 5 Sep 2022 01:28:18 +0000 (13:28 +1200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 13 Sep 2022 07:42:52 +0000 (10:42 +0300)
Fixes #1399.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2979>

subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.c
subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.h

index 7c88153..0e21479 100644 (file)
@@ -93,3 +93,26 @@ gst_rtsp_context_pop_current (GstRTSPContext * ctx)
   l = g_slist_delete_link (l, l);
   g_private_set (&current_context, l);
 }
+
+/**
+ * gst_rtsp_context_set_token:
+ * @ctx: a #GstRTSPContext
+ * @token: a #GstRTSPToken
+ *
+ * Set the token for @ctx.
+ *
+ * Since: 1.22
+ **/
+void
+gst_rtsp_context_set_token (GstRTSPContext * ctx, GstRTSPToken * token)
+{
+  g_return_if_fail (ctx != NULL);
+  g_return_if_fail (ctx == gst_rtsp_context_get_current ());
+  g_return_if_fail (GST_IS_RTSP_TOKEN (token));
+
+  if (ctx->token != NULL)
+    gst_rtsp_token_unref (ctx->token);
+
+  gst_rtsp_token_ref (token);
+  ctx->token = token;
+}
index c4567f9..fbfe411 100644 (file)
@@ -91,6 +91,8 @@ void                 gst_rtsp_context_push_current  (GstRTSPContext * ctx);
 GST_RTSP_SERVER_API
 void                 gst_rtsp_context_pop_current   (GstRTSPContext * ctx);
 
+GST_RTSP_SERVER_API
+void                 gst_rtsp_context_set_token     (GstRTSPContext * ctx, GstRTSPToken * token);
 
 G_END_DECLS