rtsp-stream: obtain stream position from pad
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-permissions.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_PERMISSIONS_H__
23 #define __GST_RTSP_PERMISSIONS_H__
24
25 typedef struct _GstRTSPPermissions GstRTSPPermissions;
26
27 G_BEGIN_DECLS
28
29 GST_EXPORT
30 GType gst_rtsp_permissions_get_type (void);
31
32 #define GST_TYPE_RTSP_PERMISSIONS        (gst_rtsp_permissions_get_type ())
33 #define GST_IS_RTSP_PERMISSIONS(obj)     (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_RTSP_PERMISSIONS))
34 #define GST_RTSP_PERMISSIONS_CAST(obj)   ((GstRTSPPermissions*)(obj))
35 #define GST_RTSP_PERMISSIONS(obj)        (GST_RTSP_PERMISSIONS_CAST(obj))
36
37 /**
38  * GstRTSPPermissions:
39  *
40  * The opaque permissions structure. It is used to define the permissions
41  * of objects in different roles.
42  */
43 struct _GstRTSPPermissions {
44   GstMiniObject mini_object;
45 };
46
47 /* refcounting */
48 /**
49  * gst_rtsp_permissions_ref:
50  * @permissions: The permissions to refcount
51  *
52  * Increase the refcount of this permissions.
53  *
54  * Returns: (transfer full): @permissions (for convenience when doing assignments)
55  */
56 static inline GstRTSPPermissions *
57 gst_rtsp_permissions_ref (GstRTSPPermissions * permissions)
58 {
59   return (GstRTSPPermissions *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (permissions));
60 }
61
62 /**
63  * gst_rtsp_permissions_unref:
64  * @permissions: (transfer full): the permissions to refcount
65  *
66  * Decrease the refcount of an permissions, freeing it if the refcount reaches 0.
67  */
68 static inline void
69 gst_rtsp_permissions_unref (GstRTSPPermissions * permissions)
70 {
71   gst_mini_object_unref (GST_MINI_OBJECT_CAST (permissions));
72 }
73
74
75 GST_EXPORT
76 GstRTSPPermissions *  gst_rtsp_permissions_new             (void);
77
78 GST_EXPORT
79 void                  gst_rtsp_permissions_add_role        (GstRTSPPermissions *permissions,
80                                                             const gchar *role,
81                                                             const gchar *fieldname, ...);
82
83 GST_EXPORT
84 void                  gst_rtsp_permissions_add_role_valist (GstRTSPPermissions *permissions,
85                                                             const gchar *role,
86                                                             const gchar *fieldname,
87                                                             va_list var_args);
88
89 GST_EXPORT
90 void                  gst_rtsp_permissions_remove_role     (GstRTSPPermissions *permissions,
91                                                             const gchar *role);
92
93 GST_EXPORT
94 const GstStructure *  gst_rtsp_permissions_get_role        (GstRTSPPermissions *permissions,
95                                                             const gchar *role);
96
97 GST_EXPORT
98 gboolean              gst_rtsp_permissions_is_allowed      (GstRTSPPermissions *permissions,
99                                                             const gchar *role, const gchar *permission);
100
101 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
102 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstRTSPPermissions, gst_rtsp_permissions_unref)
103 #endif
104
105 G_END_DECLS
106
107 #endif /* __GST_RTSP_PERMISSIONS_H__ */