From 5666debd5f4c76dc5d0fb1ab90ece963a68f3492 Mon Sep 17 00:00:00 2001 From: Chris Wiggins Date: Mon, 5 Sep 2022 13:28:18 +1200 Subject: [PATCH] rtsp-server: context: Add method to set the RTSPToken on some RTSPContext Fixes #1399. Part-of: --- .../gst-rtsp-server/gst/rtsp-server/rtsp-context.c | 23 ++++++++++++++++++++++ .../gst-rtsp-server/gst/rtsp-server/rtsp-context.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.c b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.c index 7c88153..0e21479 100644 --- a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.c +++ b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.c @@ -93,3 +93,26 @@ gst_rtsp_context_pop_current (GstRTSPContext * ctx) l = g_slist_delete_link (l, l); g_private_set (¤t_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; +} diff --git a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.h b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.h index c4567f9..fbfe411 100644 --- a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.h +++ b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-context.h @@ -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 -- 2.7.4