2 * Copyright (C) 2013 Wim Taymans <wim.taymans at gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 * SECTION:rtsp-context
21 * @short_description: A client request context
22 * @see_also: #GstRTSPServer, #GstRTSPClient
24 * Last reviewed on 2013-07-11 (1.0.0)
27 #include "rtsp-context.h"
29 static GPrivate current_context;
32 * gst_rtsp_context_get_current:
34 * Get the current #GstRTSPContext. This object is retrieved from the
35 * current thread that is handling the request for a client.
37 * Returns: a #GstRTSPContext
40 gst_rtsp_context_get_current (void)
44 l = g_private_get (¤t_context);
48 return (GstRTSPContext *) (l->data);
53 * gst_rtsp_context_push_current:
54 * @ctx: a ##GstRTSPContext
56 * Pushes @ctx onto the context stack. The current
57 * context can then be received using gst_rtsp_context_get_current().
60 gst_rtsp_context_push_current (GstRTSPContext * ctx)
64 g_return_if_fail (ctx != NULL);
66 l = g_private_get (¤t_context);
67 l = g_slist_prepend (l, ctx);
68 g_private_set (¤t_context, l);
72 * gst_rtsp_context_pop_current:
73 * @ctx: a #GstRTSPContext
75 * Pops @ctx off the context stack (verifying that @ctx
76 * is on the top of the stack).
79 gst_rtsp_context_pop_current (GstRTSPContext * ctx)
83 l = g_private_get (¤t_context);
85 g_return_if_fail (l != NULL);
86 g_return_if_fail (l->data == ctx);
88 l = g_slist_delete_link (l, l);
89 g_private_set (¤t_context, l);