add a 'plugins' dir to the PLUGIN_PATH in the uninstalled script to drop random other...
[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 <glib-object.h>
27 #include "gst/gsttypes.h"
28
29 G_BEGIN_DECLS
30
31 #define GST_TYPE_MINI_OBJECT          (gst_mini_object_get_type())
32 #define GST_IS_MINI_OBJECT(obj)       (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_MINI_OBJECT))
33 #define GST_IS_MINI_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_MINI_OBJECT))
34 #define GST_MINI_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_MINI_OBJECT, GstMiniObjectClass))
35 #define GST_MINI_OBJECT(obj)          (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_MINI_OBJECT, GstMiniObject))
36 #define GST_MINI_OBJECT_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_MINI_OBJECT, GstMiniObjectClass))
37 #define GST_MINI_OBJECT_CAST(obj)     ((GstMiniObject*)(obj))
38
39 typedef struct _GstMiniObject GstMiniObject;
40 typedef struct _GstMiniObjectClass GstMiniObjectClass;
41
42 typedef GstMiniObject * (*GstMiniObjectCopyFunction) (const GstMiniObject *);
43 typedef void (*GstMiniObjectFinalizeFunction) (GstMiniObject *);
44
45 #define GST_MINI_OBJECT_FLAGS(obj)  (GST_MINI_OBJECT(obj)->flags)
46 #define GST_MINI_OBJECT_FLAG_IS_SET(obj,flag)        (GST_MINI_OBJECT_FLAGS(obj) & (flag))
47 #define GST_MINI_OBJECT_FLAG_SET(obj,flag)           (GST_MINI_OBJECT_FLAGS (obj) |= (flag))
48 #define GST_MINI_OBJECT_FLAG_UNSET(obj,flag)         (GST_MINI_OBJECT_FLAGS (obj) &= ~(flag))
49
50 #define GST_VALUE_HOLDS_MINI_OBJECT(value)  (G_VALUE_HOLDS(value, GST_TYPE_MINI_OBJECT))
51
52 typedef enum
53 {
54   GST_MINI_OBJECT_FLAG_READONLY = (1<<0),
55   GST_MINI_OBJECT_FLAG_STATIC = (1<<1),
56   GST_MINI_OBJECT_FLAG_LAST = (1<<4)
57 } GstMiniObjectFlags;
58
59 #define GST_MINI_OBJECT_REFCOUNT(obj)           ((GST_MINI_OBJECT_CAST(obj))->refcount)
60 #define GST_MINI_OBJECT_REFCOUNT_VALUE(obj)     (g_atomic_int_get (&(GST_MINI_OBJECT_CAST(obj))->refcount))
61
62 struct _GstMiniObject {
63   GTypeInstance instance;
64   gint refcount;
65   guint flags;
66
67   gpointer _gst_reserved[GST_PADDING];
68 };
69
70 struct _GstMiniObjectClass {
71   GTypeClass type_class;
72
73   GstMiniObjectCopyFunction copy;
74   GstMiniObjectFinalizeFunction finalize;
75
76   gpointer _gst_reserved[GST_PADDING];
77 };
78
79 GType gst_mini_object_get_type (void);
80
81 GstMiniObject * gst_mini_object_new (GType type);
82 GstMiniObject * gst_mini_object_copy (const GstMiniObject *mini_object);
83 gboolean gst_mini_object_is_writable (const GstMiniObject *mini_object);
84 GstMiniObject * gst_mini_object_make_writable (const GstMiniObject *mini_object);
85
86 GstMiniObject * gst_mini_object_ref (GstMiniObject *mini_object);
87 void gst_mini_object_unref (GstMiniObject *mini_object);
88
89 void gst_mini_object_replace (GstMiniObject **olddata, GstMiniObject *newdata);
90
91 GParamSpec * gst_param_spec_mini_object (const char *name, const char *nick,
92     const char *blurb, GType object_type, GParamFlags flags);
93
94 void gst_value_set_mini_object (GValue *value, GstMiniObject *mini_object);
95 void gst_value_take_mini_object (GValue *value, GstMiniObject *mini_object);
96 GstMiniObject * gst_value_get_mini_object (const GValue *value);
97
98
99 G_END_DECLS
100
101 #endif
102