Debian Codegraph @

gstreamer/gstreamermm/structure.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/structure.h>
7 #include <gstreamermm/private/structure_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 2008-2016 The gstreamermm Development Team
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29 #include <gst/gst.h>
30 #include <gstreamermm/value.h>
31 #include <gstreamermm/miniobject.h>
32
33 namespace
34 {
35
36 static Glib::ustring quark_to_ustring(GQuark quark)
37 {
38 const gchar* pch = g_quark_to_string(quark);
39 Glib::ustring str;
40 if(pch)
41 str = pch;
42
43 return str;
44 }
45
46 extern "C"
47 {
48
49 static gboolean
50 Structure_Foreach_gstreamermm_callback(GQuark field_id, const GValue *value, void* data)
51 {
52 Gst::Structure::SlotForeach* slot = static_cast<Gst::Structure::SlotForeach*>(data);
53
54 try
55 {
56 return (*slot)(quark_to_ustring(field_id), *reinterpret_cast<const Glib::ValueBase*>(value));
57 }
58 catch(...)
59 {
60 Glib::exception_handlers_invoke();
61 }
62
63 return false;
64 }
65
66 static gboolean
67 Structure_Map_gstreamermm_callback(GQuark field_id, GValue *value, void* data)
68 {
69 Gst::Structure::SlotMap* slot = static_cast<Gst::Structure::SlotMap*>(data);
70
71 try
72 {
73 bool result = (*slot)(quark_to_ustring(field_id), *reinterpret_cast<Glib::ValueBase*>(value));
74 return result;
75 }
76 catch(...)
77 {
78 Glib::exception_handlers_invoke();
79 }
80
81 return false;
82 }
83
84 } // extern "C"
85
86 } // anonymous namespace
87
88 namespace Gst
89 {
90
91 Structure::operator const void*() const
92 {
93 return gobject_ ? GINT_TO_POINTER(1) : nullptr;
94 }
95
96 GstStructure* Structure::release() noexcept
97 {
98 GstStructure *tmp = gobj();
99 gobject_ = nullptr;
100 return tmp;
101 }
102
103 void Structure::get_field(const Glib::ustring& name, Glib::ValueBase& value) const
104 {
105 const GValue *val = gst_structure_get_value(gobj(), name.c_str());
106 value.init(val);
107 }
108
109 void Structure::set_field(const Glib::ustring& fieldname,
110 const Glib::ValueBase& value)
111 {
112 gst_structure_set_value(gobj(), fieldname.c_str(), value.gobj());
113 }
114
115 void Structure::set_field(const Glib::ustring& fieldname, GType enumtype, int value)
116 {
117 gst_structure_set(gobj(), fieldname.c_str(), enumtype, value, nullptr);
118 }
119
120 void Structure::set_field(const Glib::ustring& fieldname, const char* value)
121 {
122 set_field<std::string>(fieldname, value);
123 }
124
125 void Structure::remove_field(const Glib::ustring& fieldname)
126 {
127 gst_structure_remove_field(gobj(), fieldname.c_str());
128 }
129
130 bool Structure::get_field(const Glib::ustring& name, GType enum_type, int& value) const
131 {
132 return gst_structure_get_enum(gobj(), name.c_str(), enum_type, &value);
133 }
134
135 bool Structure::foreach(const SlotForeach& slot)
136 {
137 return gst_structure_foreach(gobj(), &Structure_Foreach_gstreamermm_callback, const_cast<SlotForeach*>(&slot));
138 }
139
140 bool Structure::map_in_place(const SlotMap& slot)
141 {
142 return gst_structure_map_in_place(gobj(), &Structure_Map_gstreamermm_callback, const_cast<SlotMap*>(&slot));
143 }
144
145 Structure Structure::create_from_string(const Glib::ustring& the_string)
146 {
147 return Structure(gst_structure_from_string(the_string.c_str(), nullptr));
148 }
149
150 bool Structure::fixate_nearest_fraction(const Glib::ustring& name, const Gst::Fraction& target)
151 {
152 return gst_structure_fixate_field_nearest_fraction(gobj(), name.c_str(), target.num, target.denom);
153 }
154
155 } //namespace Gst
156
157 namespace
158 {
159 } // anonymous namespace
160
161
162 namespace Glib
163 {
164
165 Gst::Structure wrap(GstStructure* object, bool take_copy)
166 {
167 return Gst::Structure(object, take_copy);
168 }
169
170 } // namespace Glib
171
172
173 namespace Gst
174 {
175
176
177 // static
178 GType Structure::get_type()
179 {
180 return gst_structure_get_type();
181 }
182
183 Structure::Structure()
184 :
185 gobject_ (nullptr) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
186 {}
187
188 Structure::Structure(const Structure& other)
189 :
190 gobject_ ((other.gobject_) ? gst_structure_copy(other.gobject_) : nullptr)
191 {}
192
193 Structure::Structure(Structure&& other) noexcept
194 :
195 gobject_(other.gobject_)
196 {
197 other.gobject_ = nullptr;
198 }
199
200 Structure& Structure::operator=(Structure&& other) noexcept
201 {
202 Structure temp (other);
203 swap(temp);
204 return *this;
205 }
206
207 Structure::Structure(GstStructure* gobject, bool make_a_copy)
208 :
209 // For BoxedType wrappers, make_a_copy is true by default. The static
210 // BoxedType wrappers must always take a copy, thus make_a_copy = true
211 // ensures identical behaviour if the default argument is used.
212 gobject_ ((make_a_copy && gobject) ? gst_structure_copy(gobject) : gobject)
213 {}
214
215 Structure& Structure::operator=(const Structure& other)
216 {
217 Structure temp (other);
218 swap(temp);
219 return *this;
220 }
221
222 Structure::~Structure() noexcept
223 {
224 if(gobject_)
225 gst_structure_free(gobject_);
226 }
227
228 void Structure::swap(Structure& other) noexcept
229 {
230 std::swap(gobject_, other.gobject_);
231 }
232
233 GstStructure* Structure::gobj_copy() const
234 {
235 return gst_structure_copy(gobject_);
236 }
237
238
239 Glib::ustring Structure::get_name() const
240 {
241 return Glib::convert_const_gchar_ptr_to_ustring(gst_structure_get_name(const_cast<GstStructure*>(gobj())));
242 }
243
244 bool Structure::has_name(const Glib::ustring& name) const
245 {
246 return gst_structure_has_name(const_cast<GstStructure*>(gobj()), name.c_str());
247 }
248
249 void Structure::set_name(const Glib::ustring& name)
250 {
251 gst_structure_set_name(gobj(), name.c_str());
252 }
253
254 Glib::QueryQuark Structure::get_name_id() const
255 {
256 return Glib::QueryQuark(gst_structure_get_name_id(const_cast<GstStructure*>(gobj())));
257 }
258
259 void Structure::remove_all_fields()
260 {
261 gst_structure_remove_all_fields(gobj());
262 }
263
264 GType Structure::get_field_type(const Glib::ustring& fieldname) const
265 {
266 return gst_structure_get_field_type(const_cast<GstStructure*>(gobj()), fieldname.c_str());
267 }
268
269 int Structure::size() const
270 {
271 return gst_structure_n_fields(const_cast<GstStructure*>(gobj()));
272 }
273
274 Glib::ustring Structure::get_nth_field_name(guint index) const
275 {
276 return Glib::convert_const_gchar_ptr_to_ustring(gst_structure_nth_field_name(const_cast<GstStructure*>(gobj()), index));
277 }
278
279 Glib::ustring Structure::to_string() const
280 {
281 return Glib::convert_return_gchar_ptr_to_ustring(gst_structure_to_string(const_cast<GstStructure*>(gobj())));
282 }
283
284 bool Structure::fixate_field_nearest_int(const Glib::ustring& name, int target)
285 {
286 return gst_structure_fixate_field_nearest_int(gobj(), name.c_str(), target);
287 }
288
289 bool Structure::fixate_field_nearest_double(const Glib::ustring& name, double target)
290 {
291 return gst_structure_fixate_field_nearest_double(gobj(), name.c_str(), target);
292 }
293
294 bool Structure::fixate_field_string(const Glib::ustring& name, const Glib::ustring& target)
295 {
296 return gst_structure_fixate_field_string(gobj(), name.c_str(), target.c_str());
297 }
298
299 bool Structure::fixate_field(const Glib::ustring& name)
300 {
301 return gst_structure_fixate_field(gobj(), name.c_str());
302 }
303
304 bool Structure::fixate_field_boolean(const Glib::ustring& name, bool target)
305 {
306 return gst_structure_fixate_field_boolean(gobj(), name.c_str(), static_cast<int>(target));
307 }
308
309 Gst::Structure Structure::intersect(const Gst::Structure& struct2) const
310 {
311 return Glib::wrap(gst_structure_intersect(const_cast<GstStructure*>(gobj()), struct2.gobj()));
312 }
313
314 bool Structure::is_equal(const Gst::Structure& struct2) const
315 {
316 return gst_structure_is_equal(const_cast<GstStructure*>(gobj()), struct2.gobj());
317 }
318
319 bool Structure::is_subset(const Gst::Structure& superset) const
320 {
321 return gst_structure_is_subset(const_cast<GstStructure*>(gobj()), superset.gobj());
322 }
323
324 bool Structure::can_intersect(const Gst::Structure& struct2) const
325 {
326 return gst_structure_can_intersect(const_cast<GstStructure*>(gobj()), struct2.gobj());
327 }
328
329 void Structure::fixate()
330 {
331 gst_structure_fixate(gobj());
332 }
333
334 bool Structure::get_flagset(const Glib::ustring& fieldname, guint& value_flags, guint& value_mask) const
335 {
336 return gst_structure_get_flagset(const_cast<GstStructure*>(gobj()), fieldname.c_str(), &(value_flags), &(value_mask));
337 }
338
339 bool Structure::has_field(const Glib::ustring& fieldname) const
340 {
341 return gst_structure_has_field(const_cast<GstStructure*>(gobj()), fieldname.c_str());
342 }
343
344 bool Structure::has_field(const Glib::ustring& fieldname, GType type) const
345 {
346 return gst_structure_has_field_typed(const_cast<GstStructure*>(gobj()), fieldname.c_str(), type);
347 }
348
349
350 } // namespace Gst
351
352