Debian Codegraph @

gstreamer/gstreamermm/audiocdsrc.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/audiocdsrc.h>
7 #include <gstreamermm/private/audiocdsrc_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 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 <gstreamermm/buffer.h>
30
31
32 namespace Gst
33 {
34
35 bool AudioCdSrc::add_track(guint num, guint start, guint end, bool is_audio,
36 const Gst::TagList& tags)
37 {
38 GstAudioCdSrcTrack track;
39
40 track.num = num;
41 track.start = start;
42 track.end = end;
43 track.is_audio = is_audio;
44
45 if (tags)
46 track.tags = tags.gobj_copy();
47
48 return gst_audio_cd_src_add_track(gobj(), &track);
49 }
50
51 } // namespace Gst
52
53 namespace
54 {
55 } // anonymous namespace
56
57 // static
58 GType Glib::Value<Gst::AudioCdSrcMode>::value_type()
59 {
60 return gst_audio_cd_src_mode_get_type();
61 }
62
63
64 namespace Glib
65 {
66
67 Glib::RefPtr<Gst::AudioCdSrc> wrap(GstAudioCdSrc* object, bool take_copy)
68 {
69 return Glib::RefPtr<Gst::AudioCdSrc>( dynamic_cast<Gst::AudioCdSrc*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
70 //We use dynamic_cast<> in case of multiple inheritance.
71 }
72
73 } /* namespace Glib */
74
75
76 namespace Gst
77 {
78
79
80 /* The *_Class implementation: */
81
82 const Glib::Class& AudioCdSrc_Class::init()
83 {
84 if(!gtype_) // create the GType if necessary
85 {
86 // Glib::Class has to know the class init function to clone custom types.
87 class_init_func_ = &AudioCdSrc_Class::class_init_function;
88
89 // This is actually just optimized away, apparently with no harm.
90 // Make sure that the parent type has been created.
91 //CppClassParent::CppObjectType::get_type();
92
93 // Create the wrapper type, with the same class/instance size as the base type.
94 register_derived_type(gst_audio_cd_src_get_type());
95
96 // Add derived versions of interfaces, if the C type implements any interfaces:
97
98 }
99
100 return *this;
101 }
102
103
104 void AudioCdSrc_Class::class_init_function(void* g_class, void* class_data)
105 {
106 const auto klass = static_cast<BaseClassType*>(g_class);
107 CppClassParent::class_init_function(klass, class_data);
108
109 klass->open = &open_vfunc_callback;
110 klass->close = &close_vfunc_callback;
111 klass->read_sector = &read_sector_vfunc_callback;
112
113 }
114
115 gboolean AudioCdSrc_Class::open_vfunc_callback(GstAudioCdSrc* self, const gchar* device)
116 {
117 const auto obj_base = static_cast<Glib::ObjectBase*>(
118 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
119
120 // Non-gtkmmproc-generated custom classes implicitly call the default
121 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
122 // generated classes can use this optimisation, which avoids the unnecessary
123 // parameter conversions if there is no possibility of the virtual function
124 // being overridden:
125 if(obj_base && obj_base->is_derived_())
126 {
127 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
128 if(obj) // This can be NULL during destruction.
129 {
130 try // Trap C++ exceptions which would normally be lost because this is a C callback.
131 {
132 // Call the virtual member method, which derived classes might override.
133 return static_cast<int>(obj->open_vfunc(Glib::convert_const_gchar_ptr_to_stdstring(device)
134 ));
135 }
136 catch(...)
137 {
138 Glib::exception_handlers_invoke();
139 }
140 }
141 }
142
143 BaseClassType *const base = static_cast<BaseClassType*>(
144 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
145 );
146
147 // Call the original underlying C function:
148 if(base && base->open)
149 return (*base->open)(self, device);
150
151 using RType = gboolean;
152 return RType();
153 }
154 void AudioCdSrc_Class::close_vfunc_callback(GstAudioCdSrc* self)
155 {
156 const auto obj_base = static_cast<Glib::ObjectBase*>(
157 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
158
159 // Non-gtkmmproc-generated custom classes implicitly call the default
160 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
161 // generated classes can use this optimisation, which avoids the unnecessary
162 // parameter conversions if there is no possibility of the virtual function
163 // being overridden:
164 if(obj_base && obj_base->is_derived_())
165 {
166 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
167 if(obj) // This can be NULL during destruction.
168 {
169 try // Trap C++ exceptions which would normally be lost because this is a C callback.
170 {
171 // Call the virtual member method, which derived classes might override.
172 obj->close_vfunc();
173 return;
174 }
175 catch(...)
176 {
177 Glib::exception_handlers_invoke();
178 }
179 }
180 }
181
182 BaseClassType *const base = static_cast<BaseClassType*>(
183 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
184 );
185
186 // Call the original underlying C function:
187 if(base && base->close)
188 (*base->close)(self);
189 }
190 GstBuffer* AudioCdSrc_Class::read_sector_vfunc_callback(GstAudioCdSrc* self, gint sector)
191 {
192 const auto obj_base = static_cast<Glib::ObjectBase*>(
193 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
194
195 // Non-gtkmmproc-generated custom classes implicitly call the default
196 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
197 // generated classes can use this optimisation, which avoids the unnecessary
198 // parameter conversions if there is no possibility of the virtual function
199 // being overridden:
200 if(obj_base && obj_base->is_derived_())
201 {
202 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
203 if(obj) // This can be NULL during destruction.
204 {
205 try // Trap C++ exceptions which would normally be lost because this is a C callback.
206 {
207 // Call the virtual member method, which derived classes might override.
208 return Glib::unwrap(obj->read_sector_vfunc(sector));
209 }
210 catch(...)
211 {
212 Glib::exception_handlers_invoke();
213 }
214 }
215 }
216
217 BaseClassType *const base = static_cast<BaseClassType*>(
218 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
219 );
220
221 // Call the original underlying C function:
222 if(base && base->read_sector)
223 return (*base->read_sector)(self, sector);
224
225 using RType = GstBuffer*;
226 return RType();
227 }
228
229
230 Glib::ObjectBase* AudioCdSrc_Class::wrap_new(GObject* object)
231 {
232 return new AudioCdSrc((GstAudioCdSrc*)object);
233 }
234
235
236 /* The implementation: */
237
238 GstAudioCdSrc* AudioCdSrc::gobj_copy()
239 {
240 reference();
241 return gobj();
242 }
243
244 AudioCdSrc::AudioCdSrc(const Glib::ConstructParams& construct_params)
245 :
246 Gst::PushSrc(construct_params)
247 {
248
249 }
250
251 AudioCdSrc::AudioCdSrc(GstAudioCdSrc* castitem)
252 :
253 Gst::PushSrc((GstPushSrc*)(castitem))
254 {}
255
256
257 AudioCdSrc::AudioCdSrc(AudioCdSrc&& src) noexcept
258 : Gst::PushSrc(std::move(src))
259 {}
260
261 AudioCdSrc& AudioCdSrc::operator=(AudioCdSrc&& src) noexcept
262 {
263 Gst::PushSrc::operator=(std::move(src));
264 return *this;
265 }
266
267
268 AudioCdSrc::~AudioCdSrc() noexcept
269 {}
270
271
272 AudioCdSrc::CppClassType AudioCdSrc::audiocdsrc_class_; // initialize static member
273
274 GType AudioCdSrc::get_type()
275 {
276 return audiocdsrc_class_.init().get_type();
277 }
278
279
280 GType AudioCdSrc::get_base_type()
281 {
282 return gst_audio_cd_src_get_type();
283 }
284
285
286 Glib::PropertyProxy< std::string > AudioCdSrc::property_device()
287 {
288 return Glib::PropertyProxy< std::string >(this, "device");
289 }
290
291 Glib::PropertyProxy_ReadOnly< std::string > AudioCdSrc::property_device() const
292 {
293 return Glib::PropertyProxy_ReadOnly< std::string >(this, "device");
294 }
295
296 Glib::PropertyProxy< AudioCdSrcMode > AudioCdSrc::property_mode()
297 {
298 return Glib::PropertyProxy< AudioCdSrcMode >(this, "mode");
299 }
300
301 Glib::PropertyProxy_ReadOnly< AudioCdSrcMode > AudioCdSrc::property_mode() const
302 {
303 return Glib::PropertyProxy_ReadOnly< AudioCdSrcMode >(this, "mode");
304 }
305
306 Glib::PropertyProxy< guint > AudioCdSrc::property_track()
307 {
308 return Glib::PropertyProxy< guint >(this, "track");
309 }
310
311 Glib::PropertyProxy_ReadOnly< guint > AudioCdSrc::property_track() const
312 {
313 return Glib::PropertyProxy_ReadOnly< guint >(this, "track");
314 }
315
316
317 bool Gst::AudioCdSrc::open_vfunc(const std::string& device)
318 {
319 const auto base = static_cast<BaseClassType*>(
320 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
321 );
322
323 if(base && base->open)
324 {
325 bool retval((*base->open)(gobj(),device.c_str()));
326 return retval;
327 }
328
329 using RType = bool;
330 return RType();
331 }
332 void Gst::AudioCdSrc::close_vfunc()
333 {
334 const auto base = static_cast<BaseClassType*>(
335 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
336 );
337
338 if(base && base->close)
339 {
340 (*base->close)(gobj());
341 }
342 }
343 Glib::RefPtr<Gst::Buffer> Gst::AudioCdSrc::read_sector_vfunc(gint sector)
344 {
345 const auto base = static_cast<BaseClassType*>(
346 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
347 );
348
349 if(base && base->read_sector)
350 {
351 Glib::RefPtr<Gst::Buffer> retval(Glib::wrap((*base->read_sector)(gobj(),sector)));
352 return retval;
353 }
354
355 using RType = Glib::RefPtr<Gst::Buffer>;
356 return RType();
357 }
358
359
360 } // namespace Gst
361
362