rtsp-stream: obtain stream position from pad
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-token.h
1 /* GStreamer
2  * Copyright (C) 2010 Wim Taymans <wim.taymans at gmail.com>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include <gst/gst.h>
21
22 #ifndef __GST_RTSP_TOKEN_H__
23 #define __GST_RTSP_TOKEN_H__
24
25 typedef struct _GstRTSPToken GstRTSPToken;
26
27 #include "rtsp-auth.h"
28
29 G_BEGIN_DECLS
30
31 GST_EXPORT
32 GType gst_rtsp_token_get_type(void);
33
34 #define GST_TYPE_RTSP_TOKEN        (gst_rtsp_token_get_type())
35 #define GST_IS_RTSP_TOKEN(obj)     (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_RTSP_TOKEN))
36 #define GST_RTSP_TOKEN_CAST(obj)   ((GstRTSPToken*)(obj))
37 #define GST_RTSP_TOKEN(obj)        (GST_RTSP_TOKEN_CAST(obj))
38
39 /**
40  * GstRTSPToken:
41  *
42  * An opaque object used for checking authorisations.
43  * It is generated after successful authentication.
44  */
45 struct _GstRTSPToken {
46   GstMiniObject mini_object;
47 };
48
49 /* refcounting */
50 /**
51  * gst_rtsp_token_ref:
52  * @token: The token to refcount
53  *
54  * Increase the refcount of this token.
55  *
56  * Returns: (transfer full): @token (for convenience when doing assignments)
57  */
58 static inline GstRTSPToken *
59 gst_rtsp_token_ref (GstRTSPToken * token)
60 {
61   return (GstRTSPToken *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (token));
62 }
63
64 /**
65  * gst_rtsp_token_unref:
66  * @token: (transfer full): the token to refcount
67  *
68  * Decrease the refcount of an token, freeing it if the refcount reaches 0.
69  */
70 static inline void
71 gst_rtsp_token_unref (GstRTSPToken * token)
72 {
73   gst_mini_object_unref (GST_MINI_OBJECT_CAST (token));
74 }
75
76
77 GST_EXPORT
78 GstRTSPToken *       gst_rtsp_token_new_empty          (void);
79
80 GST_EXPORT
81 GstRTSPToken *       gst_rtsp_token_new                (const gchar * firstfield, ...);
82
83 GST_EXPORT
84 GstRTSPToken *       gst_rtsp_token_new_valist         (const gchar * firstfield, va_list var_args);
85
86 GST_EXPORT
87 const GstStructure * gst_rtsp_token_get_structure      (GstRTSPToken *token);
88
89 GST_EXPORT
90 GstStructure *       gst_rtsp_token_writable_structure (GstRTSPToken *token);
91
92 GST_EXPORT
93 const gchar *        gst_rtsp_token_get_string         (GstRTSPToken *token,
94                                                         const gchar *field);
95
96 GST_EXPORT
97 gboolean             gst_rtsp_token_is_allowed         (GstRTSPToken *token,
98                                                         const gchar *field);
99 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
100 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPToken, gst_rtsp_token_unref)
101 #endif
102
103 G_END_DECLS
104
105 #endif /* __GST_RTSP_TOKEN_H__ */