rtsp-server: context: Add method to set the RTSPToken on some RTSPContext

Fixes #1399.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2979>
This commit is contained in:
Chris Wiggins 2022-09-05 13:28:18 +12:00 committed by Sebastian Dröge
parent e64a5b9a85
commit 5666debd5f
2 changed files with 25 additions and 0 deletions

View 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;
}

View 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