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 G_DEFINE_POINTER_TYPE (GstRTSPContext, gst_rtsp_context);
31 static GPrivate current_context;
34 * gst_rtsp_context_get_current:
36 * Get the current #GstRTSPContext. This object is retrieved from the
37 * current thread that is handling the request for a client.
39 * Returns: a #GstRTSPContext
42 gst_rtsp_context_get_current (void)
46 l = g_private_get (¤t_context);
50 return (GstRTSPContext *) (l->data);
55 * gst_rtsp_context_push_current:
56 * @ctx: a ##GstRTSPContext
58 * Pushes @ctx onto the context stack. The current
59 * context can then be received using gst_rtsp_context_get_current().
62 gst_rtsp_context_push_current (GstRTSPContext * ctx)
66 g_return_if_fail (ctx != NULL);
68 l = g_private_get (¤t_context);
69 l = g_slist_prepend (l, ctx);
70 g_private_set (¤t_context, l);
74 * gst_rtsp_context_pop_current:
75 * @ctx: a #GstRTSPContext
77 * Pops @ctx off the context stack (verifying that @ctx
78 * is on the top of the stack).
81 gst_rtsp_context_pop_current (GstRTSPContext * ctx)
85 l = g_private_get (¤t_context);
87 g_return_if_fail (l != NULL);
88 g_return_if_fail (l->data == ctx);
90 l = g_slist_delete_link (l, l);
91 g_private_set (¤t_context, l);