paramspecs: Add GstParamSpecArray for GST_TYPE_ARRAY typed properties
[platform/upstream/gstreamer.git] / gst / gstparamspecs.h
1 /* GStreamer - GParamSpecs for some of our types
2  * Copyright (C) 2007 Tim-Philipp Müller  <tim centricular net>
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 #ifndef __GST_PARAMSPECS_H__
21 #define __GST_PARAMSPECS_H__
22
23 #include <gst/gstvalue.h>
24
25 G_BEGIN_DECLS
26
27 /* --- paramspec flags */
28
29 /**
30  * GST_PARAM_CONTROLLABLE:
31  *
32  * Use this flag on GObject properties to signal they can make sense to be.
33  * controlled over time. This hint is used by the GstController.
34  */
35 #define GST_PARAM_CONTROLLABLE  (1 << (G_PARAM_USER_SHIFT + 1))
36
37 /**
38  * GST_PARAM_MUTABLE_READY:
39  *
40  * Use this flag on GObject properties of GstElements to indicate that
41  * they can be changed when the element is in the READY or lower state.
42  */
43 #define GST_PARAM_MUTABLE_READY  (1 << (G_PARAM_USER_SHIFT + 2))
44
45 /**
46  * GST_PARAM_MUTABLE_PAUSED:
47  *
48  * Use this flag on GObject properties of GstElements to indicate that
49  * they can be changed when the element is in the PAUSED or lower state.
50  * This flag implies GST_PARAM_MUTABLE_READY.
51  */
52 #define GST_PARAM_MUTABLE_PAUSED  (1 << (G_PARAM_USER_SHIFT + 3))
53
54 /**
55  * GST_PARAM_MUTABLE_PLAYING:
56  *
57  * Use this flag on GObject properties of GstElements to indicate that
58  * they can be changed when the element is in the PLAYING or lower state.
59  * This flag implies GST_PARAM_MUTABLE_PAUSED.
60  */
61 #define GST_PARAM_MUTABLE_PLAYING  (1 << (G_PARAM_USER_SHIFT + 4))
62
63 /**
64  * GST_PARAM_USER_SHIFT:
65  *
66  * Bits based on GST_PARAM_USER_SHIFT can be used by 3rd party applications.
67  */
68 #define GST_PARAM_USER_SHIFT    (1 << (G_PARAM_USER_SHIFT + 8))
69
70
71 /* --- type macros --- */
72
73 #define GST_TYPE_PARAM_FRACTION           (gst_param_spec_fraction_get_type ())
74 #define GST_IS_PARAM_SPEC_FRACTION(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GST_TYPE_PARAM_FRACTION))
75 #define GST_PARAM_SPEC_FRACTION(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GST_TYPE_PARAM_FRACTION, GstParamSpecFraction))
76
77
78 #define GST_TYPE_PARAM_ARRAY_LIST           (gst_param_spec_array_get_type ())
79 #define GST_IS_PARAM_SPEC_ARRAY_LIST(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GST_TYPE_PARAM_ARRAY_LIST))
80 #define GST_PARAM_SPEC_ARRAY_LIST(pspec)    (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GST_TYPE_PARAM_ARRAY_LIST, GstParamSpecArray))
81
82
83 /* --- get_type functions --- */
84
85 GType  gst_param_spec_fraction_get_type (void);
86
87 GType  gst_param_spec_array_get_type (void);
88
89
90 /* --- typedefs & structures --- */
91
92 typedef struct _GstParamSpecFraction GstParamSpecFraction;
93 typedef struct _GstParamSpecArray GstParamSpecArray;
94
95 /**
96  * GstParamSpecFraction:
97  * @parent_instance: super class
98  * @min_num: minimal numerator
99  * @min_den: minimal denominator
100  * @max_num: maximal numerator
101  * @max_den: maximal denominator
102  * @def_num: default numerator
103  * @def_den: default denominator
104  *
105  * A GParamSpec derived structure that contains the meta data for fractional
106  * properties.
107  */
108 struct _GstParamSpecFraction {
109   GParamSpec    parent_instance;
110
111   gint          min_num, min_den;
112   gint          max_num, max_den;
113   gint          def_num, def_den;
114 };
115
116 /**
117  * GstParamSpecArray:
118  * @parent_instance: super class
119  * @value_array: the array of values
120  *
121  * A GParamSpec derived structure that contains the meta data for fractional
122  * properties.
123  */
124 struct _GstParamSpecArray {
125   GParamSpec    parent_instance;
126
127   GParamSpec * element_spec;
128 };
129
130
131 /* --- GParamSpec prototypes --- */
132
133 GParamSpec  * gst_param_spec_fraction (const gchar * name,
134                                        const gchar * nick,
135                                        const gchar * blurb,
136                                        gint min_num, gint min_denom,
137                                        gint max_num, gint max_denom,
138                                        gint default_num, gint default_denom,
139                                        GParamFlags flags) G_GNUC_MALLOC;
140
141 GParamSpec  * gst_param_spec_array    (const gchar * name,
142                                        const gchar * nick,
143                                        const gchar * blurb,
144                                        GParamSpec * element_spec,
145                                        GParamFlags flags) G_GNUC_MALLOC;
146
147 G_END_DECLS
148
149 #endif /* __GST_PARAMSPECS_H__ */
150