removed unused flags from miniobject doc fixes
[platform/upstream/gstreamer.git] / gst / gstminiobject.h
1 /* GStreamer
2  * Copyright (C) 2005 David Schleef <ds@schleef.org>
3  *
4  * gstminiobject.h: Header for GstMiniObject
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22
23 #ifndef __GST_MINI_OBJECT_H__
24 #define __GST_MINI_OBJECT_H__
25
26 #include <gst/gstconfig.h>
27
28 #include <glib-object.h>
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_MINI_OBJECT          (gst_mini_object_get_type())
33 #define GST_IS_MINI_OBJECT(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MINI_OBJECT))
34 #define GST_IS_MINI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MINI_OBJECT))
35 #define GST_MINI_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MINI_OBJECT, GstMiniObjectClass))
36 #define GST_MINI_OBJECT(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MINI_OBJECT, GstMiniObject))
37 #define GST_MINI_OBJECT_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MINI_OBJECT, GstMiniObjectClass))
38 #define GST_MINI_OBJECT_CAST(obj)     ((GstMiniObject*)(obj))
39
40 typedef struct _GstMiniObject GstMiniObject;
41 typedef struct _GstMiniObjectClass GstMiniObjectClass;
42
43 typedef GstMiniObject * (*GstMiniObjectCopyFunction) (const GstMiniObject *);
44 typedef void (*GstMiniObjectFinalizeFunction) (GstMiniObject *);
45
46 /**
47  * GST_MINI_OBJECT_FLAGS:
48  * @obj: MiniObject to return flags for.
49  *
50  * This macro returns the entire set of flags for the mini-object.
51  */
52 #define GST_MINI_OBJECT_FLAGS(obj)  (GST_MINI_OBJECT(obj)->flags)
53 /**
54  * GST_MINI_OBJECT_FLAG_IS_SET:
55  * @obj: MiniObject to check for flags.
56  * @flag: Flag to check for
57  *
58  * This macro checks to see if the given flag is set.
59  */
60 #define GST_MINI_OBJECT_FLAG_IS_SET(obj,flag)        (GST_MINI_OBJECT_FLAGS (obj) & (flag))
61 /**
62  * GST_MINI_OBJECT_FLAG_SET:
63  * @obj: MiniObject to set flag in.
64  * @flag: Flag to set, can by any number of bits in guint32.
65  *
66  * This macro sets the given bits.
67  */
68 #define GST_MINI_OBJECT_FLAG_SET(obj,flag)           (GST_MINI_OBJECT_FLAGS (obj) |= (flag))
69 /**
70  * GST_MINI_OBJECT_FLAG_UNSET:
71  * @obj: MiniObject to unset flag in.
72  * @flag: Flag to set, must be a single bit in guint32.
73  *
74  * This macro usets the given bits.
75  */
76 #define GST_MINI_OBJECT_FLAG_UNSET(obj,flag)         (GST_MINI_OBJECT_FLAGS (obj) &= ~(flag))
77
78 /**
79  * GST_VALUE_HOLDS_MINI_OBJECT:
80  * @value: the #GValue to check
81  *
82  * Checks if the given #GValue contains a #GST_TYPE_MINI_OBJECT value.
83  */
84 #define GST_VALUE_HOLDS_MINI_OBJECT(value)  (G_VALUE_HOLDS(value, GST_TYPE_MINI_OBJECT))
85
86 /**
87  * GstMiniObjectFlags:
88  * @GST_MINI_OBJECT_FLAG_READONLY: is the miniobject readonly or writable
89  * @GST_MINI_OBJECT_FLAG_LAST: first flag that can be used by subclasses.
90  *
91  * Flags for the padtemplate
92  */
93
94 typedef enum
95 {
96   GST_MINI_OBJECT_FLAG_READONLY = (1<<0),
97   /* padding */
98   GST_MINI_OBJECT_FLAG_LAST = (1<<4)
99 } GstMiniObjectFlags;
100
101 #define GST_MINI_OBJECT_REFCOUNT(obj)           ((GST_MINI_OBJECT_CAST(obj))->refcount)
102 #define GST_MINI_OBJECT_REFCOUNT_VALUE(obj)     (g_atomic_int_get (&(GST_MINI_OBJECT_CAST(obj))->refcount))
103
104 struct _GstMiniObject {
105   GTypeInstance instance;
106   gint refcount;
107   guint flags;
108
109   gpointer _gst_reserved[GST_PADDING];
110 };
111
112 struct _GstMiniObjectClass {
113   GTypeClass type_class;
114
115   GstMiniObjectCopyFunction copy;
116   GstMiniObjectFinalizeFunction finalize;
117
118   gpointer _gst_reserved[GST_PADDING];
119 };
120
121 GType gst_mini_object_get_type (void);
122
123 GstMiniObject * gst_mini_object_new (GType type);
124 GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object);
125 gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
126 GstMiniObject * gst_mini_object_make_writable (GstMiniObject *mini_object);
127
128 GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object);
129 void gst_mini_object_unref (GstMiniObject *mini_object);
130
131 void gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
132
133 GParamSpec * gst_param_spec_mini_object (const char *name, const char *nick,
134     const char *blurb, GType object_type, GParamFlags flags);
135
136 void gst_value_set_mini_object (GValue *value, GstMiniObject *mini_object);
137 void gst_value_take_mini_object (GValue *value, GstMiniObject *mini_object);
138 GstMiniObject * gst_value_get_mini_object (const GValue *value);
139
140
141 G_END_DECLS
142
143 #endif
144