Debian Codegraph @

gstreamer/gstreamermm/pad.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/pad.h>
7 #include <gstreamermm/private/pad_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/buffer.h>
31 #include <gstreamermm/caps.h>
32 #include <gstreamermm/element.h>
33 #include <gstreamermm/event.h>
34 #include <gstreamermm/padtemplate.h>
35 #include <gstreamermm/iterator.h>
36 #include <gstreamermm/message.h>
37 #include <gstreamermm/bus.h>
38
39
40 namespace
41 {
42
43 extern "C"
44 {
45 static GstPadProbeReturn Pad_Probe_gstreamermm_callback(GstPad* pad, GstPadProbeInfo* probe_info, void* data)
46 {
47 Gst::Pad::SlotProbe* the_slot = static_cast<Gst::Pad::SlotProbe*>(data);
48 Glib::RefPtr<Gst::Pad> pad_wrapper = Glib::wrap(pad, true);
49 try
50 {
51 return static_cast<GstPadProbeReturn>((*the_slot)(pad_wrapper, Glib::wrap(probe_info, true)));
52 }
53 catch(...)
54 {
55 pad_wrapper->exception_handler();
56 }
57
58 return GST_PAD_PROBE_DROP;
59 }
60
61 static void Pad_Probe_gstreamermm_callback_disconnect(void* data)
62 {
63 Gst::Pad::SlotProbe* the_slot = static_cast<Gst::Pad::SlotProbe*>(data);
64
65 if(the_slot)
66 delete the_slot;
67 }
68
69 } // extern "C"
70
71 } // anonymous namespace
72
73 namespace Gst
74 {
75
76 Pad::Pad(PadDirection dir)
77 : // Mark this class as non-derived to allow C++ vfuncs to be skipped.
78 Glib::ObjectBase(nullptr),
79 Object(Glib::ConstructParams(pad_class_.init(), "name",nullptr,"direction",dir, nullptr))
80 {}
81
82 Pad::Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ,
83 const Glib::ustring& name)
84 : // Mark this class as non-derived to allow C++ vfuncs to be skipped.
85 Glib::ObjectBase(nullptr),
86 Object(Glib::ConstructParams(pad_class_.init(), "name",(name.empty() ? nullptr : name.c_str()),"direction",(templ ? static_cast<GstPadDirection>(templ->get_direction())
87 : GST_PAD_UNKNOWN),"template",Glib::unwrap(templ), nullptr))
88 {
89 if(!templ)
90 gstreamermm_handle_error(
91 "Gst::Pad::Pad(const Glib::RefPtr<Gst::PadTemplate>&, "
92 "const Glib::ustring&): Failed to construct pad (name = " + name + ") "
93 "from null template.");
94 }
95
96 Pad::Pad(const Glib::RefPtr<const Gst::PadTemplate>& templ)
97 : // Mark this class as non-derived to allow C++ vfuncs to be skipped.
98 Glib::ObjectBase(nullptr),
99 Object(Glib::ConstructParams(pad_class_.init(), "name",nullptr,"direction",(templ ? static_cast<GstPadDirection>(templ->get_direction())
100 : GST_PAD_UNKNOWN),"template",Glib::unwrap(templ), nullptr))
101 {
102 if(!templ)
103 gstreamermm_handle_error(
104 "Gst::Pad::Pad(const Glib::RefPtr<Gst::PadTemplate>&): Failed to "
105 "construct pad from null template.");
106 }
107
108 void Pad::exception_handler()
109 {
110 Glib::RefPtr<Element> parent = parent.cast_dynamic(get_parent());
111
112 if (!parent)
113 {
114 Glib::exception_handlers_invoke();
115 return;
116 }
117
118 Glib::RefPtr<Message> error_msg;
119
120 try
121 {
122 throw;
123 }
124 catch(const Glib::Error& error)
125 {
126 Glib::Error err = error;
127 error_msg = MessageError::create(parent, err, "glibmm exception");
128 }
129 catch(const std::exception& ex)
130 {
131 Glib::Error err(GST_CORE_ERROR, GST_CORE_ERROR_FAILED, ex.what());
132 error_msg = MessageError::create(parent, err, "standard exception");
133 }
134 catch(...)
135 {
136 Glib::Error err(GST_CORE_ERROR, GST_CORE_ERROR_FAILED, "");
137 error_msg = MessageError::create(parent, err, "unknown error type");
138 }
139
140 parent->post_message(std::move(error_msg));
141 }
142
143 gulong Pad::add_probe(PadProbeType mask, const SlotProbe& slot)
144 {
145 SlotProbe* slot_copy = new SlotProbe(slot);
146 return gst_pad_add_probe(gobj(), static_cast<GstPadProbeType>(mask), &Pad_Probe_gstreamermm_callback, slot_copy, &Pad_Probe_gstreamermm_callback_disconnect);
147 }
148
149 FlowReturn Pad::get_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer)
150 {
151 GstBuffer* c_buffer = nullptr;
152 GstFlowReturn result = gst_pad_get_range(gobj(), offset, size, &c_buffer);
153 buffer = Glib::wrap(c_buffer, false);
154 return FlowReturn(result);
155 }
156
157 FlowReturn Pad::pull_range(guint64 offset, guint size, Glib::RefPtr<Gst::Buffer>& buffer)
158 {
159 GstBuffer* c_buffer = nullptr;
160 GstFlowReturn result = gst_pad_pull_range(gobj(), offset, size, &c_buffer);
161 buffer = Glib::wrap(c_buffer, false);
162 return FlowReturn(result);
163 }
164
165 bool Pad::query_position(Format& format) const
166 {
167 return gst_pad_query_position(const_cast<GstPad*>(gobj()), (GstFormat)format, nullptr);
168 }
169
170 bool Pad::query_duration(Format& format) const
171 {
172 return gst_pad_query_duration(const_cast<GstPad*>(gobj()), (GstFormat)format, nullptr);
173 }
174
175 GstFlowReturn Pad::Pad_Chain_gstreamermm_callback(GstPad* pad, GstObject*, GstBuffer *buffer)
176 {
177 //FIXME: It's made like vfunc wrappers, but why there is no reffing of pad?
178 Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
179 (static_cast<Glib::ObjectBase*>(
180 Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
181 )
182 );
183 g_assert(pad);
184
185 try
186 {
187 Glib::RefPtr<Buffer> buffer_wrapped = Glib::wrap(buffer, false); //manage object
188
189 return static_cast<GstFlowReturn>(
190 pad_wrapper->slot_chain(Glib::wrap(pad, true), //take copy
191 buffer_wrapped
192 ));
193 }
194 catch(...)
195 {
196 pad_wrapper->exception_handler();
197 }
198
199 return GST_FLOW_ERROR;
200 }
201
202 gboolean Pad::Pad_Query_gstreamermm_callback(GstPad* pad, GstObject*, GstQuery* query)
203 {
204 Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
205 (static_cast<Glib::ObjectBase*>(
206 Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
207 )
208 );
209 g_assert(pad);
210
211 try
212 {
213 //We cannot make copy of query, since some elements fail to answer the query if it's refcount>1 (is not writtable)
214 Glib::RefPtr<Query> query_wrapped = Glib::wrap(query, false);
215
216 gboolean res = pad_wrapper->slot_query(Glib::wrap(pad, true), query_wrapped);
217
218 //we have to increase refcount, since freeing RefPtr will decrease it which would be inaccurate here, since the
219 //caller is responsible for managing the object (see "transfer none" on this parameter)
220 query_wrapped->reference();
221 return res;
222 }
223 catch(...)
224 {
225 pad_wrapper->exception_handler();
226 }
227
228 return false;
229 }
230
231 gboolean Pad::Pad_Event_gstreamermm_callback(GstPad* pad, GstObject*, GstEvent* event)
232 {
233 Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
234 (static_cast<Glib::ObjectBase*>(
235 Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
236 )
237 );
238 g_assert(pad);
239
240 try
241 {
242 //we don't make copy, since ownership is transfered to the callee ("transfer full")
243 Glib::RefPtr<Event> event_wrapped = Glib::wrap(event, false);
244
245 return pad_wrapper->slot_event(Glib::wrap(pad, true), event_wrapped);
246 }
247 catch(...)
248 {
249 pad_wrapper->exception_handler();
250 }
251
252 return false;
253 }
254
255 gboolean Pad::Pad_Activate_gstreamermm_callback(GstPad* pad, GstObject*)
256 {
257 Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
258 (static_cast<Glib::ObjectBase*>(
259 Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
260 )
261 );
262 g_assert(pad);
263
264 try
265 {
266 return pad_wrapper->slot_activate(Glib::wrap(pad, true));
267 }
268 catch(...)
269 {
270 pad_wrapper->exception_handler();
271 }
272
273 return false;
274 }
275
276 gboolean Pad::Pad_Activatemode_gstreamermm_callback(GstPad* pad, GstObject*, GstPadMode mode, gboolean active)
277 {
278 Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
279 (static_cast<Glib::ObjectBase*>(
280 Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
281 )
282 );
283 g_assert(pad);
284
285 try
286 {
287 return pad_wrapper->slot_activatemode(Glib::wrap(pad, true), static_cast<PadMode>(mode), active);
288 }
289 catch(...)
290 {
291 pad_wrapper->exception_handler();
292 }
293
294 return false;
295 }
296
297 GstFlowReturn Pad::Pad_Getrange_gstreamermm_callback(GstPad* pad, GstObject*, guint64 offset, guint length, GstBuffer **buffer)
298 {
299 Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
300 (static_cast<Glib::ObjectBase*>(
301 Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
302 )
303 );
304 g_assert(pad);
305 Glib::RefPtr<Buffer> buf = Glib::wrap(*buffer, false);
306 try
307 {
308 return static_cast<GstFlowReturn>(
309 pad_wrapper->slot_getrange(Glib::wrap(pad, true), offset, length, buf)
310 );
311 }
312 catch(...)
313 {
314 pad_wrapper->exception_handler();
315 }
316
317 return GST_FLOW_ERROR;
318 }
319
320 void Pad::set_chain_function(const SlotChain& slot)
321 {
322 slot_chain = slot;
323 gst_pad_set_chain_function(GST_PAD(gobj()), &Pad_Chain_gstreamermm_callback);
324 }
325
326 void Pad::set_query_function(const SlotQuery& slot)
327 {
328 slot_query = slot;
329 gst_pad_set_query_function(GST_PAD(gobj()), &Pad_Query_gstreamermm_callback);
330 }
331
332 void Pad::set_event_function(const SlotEvent& slot)
333 {
334 slot_event = slot;
335 gst_pad_set_event_function(GST_PAD(gobj()), &Pad_Event_gstreamermm_callback);
336 }
337
338 bool Pad::push_event(const Glib::RefPtr<Gst::Event>& event)
339 {
340 event->reference();
341 return gst_pad_push_event(gobj(), event->gobj());
342 }
343
344 void Pad::set_activate_function(const SlotActivate& slot)
345 {
346 slot_activate = slot;
347 gst_pad_set_activate_function(GST_PAD(gobj()), &Pad_Activate_gstreamermm_callback);
348 }
349
350 void Pad::set_activatemode_function(const SlotActivatemode& slot)
351 {
352 slot_activatemode= slot;
353 gst_pad_set_activatemode_function(GST_PAD(gobj()), &Pad_Activatemode_gstreamermm_callback);
354 }
355
356 void Pad::set_getrange_function(const SlotGetrange& slot)
357 {
358 slot_getrange = slot;
359 gst_pad_set_getrange_function(GST_PAD(gobj()), &Pad_Getrange_gstreamermm_callback);
360 }
361
362 bool Pad::is_ghost_pad() const
363 {
364 return GST_IS_GHOST_PAD(gobj());
365 }
366
367 bool Pad::is_proxy_pad() const
368 {
369 return GST_IS_PROXY_PAD(gobj());
370 }
371
372 bool Pad::send_event(const Glib::RefPtr<Gst::Event>& event)
373 {
374 event->reference();
375 return gst_pad_send_event(gobj(), event->gobj());
376 }
377
378
379 PadProbeInfo::PadProbeInfo()
380 : gobj_(g_try_new(GstPadProbeInfo, 1)),
381 take_ownership(true)
382 {
383 // Handle possible memory allocation failure.
384 if(!gobj_)
385 {
386 gstreamermm_handle_error(
387 "Failed to allocate a new Gst::PadProbeInfo.");
388 }
389 }
390
391 PadProbeInfo::PadProbeInfo(GstPadProbeInfo& castitem, bool take_ownership)
392 : gobj_(&castitem),
393 take_ownership(take_ownership)
394 {
395 }
396
397 PadProbeInfo::PadProbeInfo(GstPadProbeInfo* castitem, bool take_copy)
398 : take_ownership(take_copy)
399 {
400 if(take_copy)
401 {
402 gobj_ = (g_try_new(GstPadProbeInfo, 1));
403
404 if(!gobj_)
405 {
406 gstreamermm_handle_error(
407 "Failed to allocate a new Gst::PadProbeInfo.");
408 return;
409 }
410
411 if(castitem)
412 *gobj_ = *castitem;
413 }
414 else
415 {
416 gobj_ = castitem;
417 }
418 }
419
420 PadProbeInfo::PadProbeInfo(const PadProbeInfo& other)
421 : gobj_(g_try_new(GstPadProbeInfo, 1)),
422 take_ownership(true)
423 {
424 if(!gobj_)
425 {
426 gstreamermm_handle_error("Failed to allocate a new Gst::PadProbeInfo.");
427 return;
428 }
429
430 // I can do it, because there is no dynamic allocated memory in pad
431 *gobj_ = *other.gobj_;
432 }
433
434 PadProbeInfo::~PadProbeInfo()
435 {
436 if(take_ownership)
437 g_free(gobj_);
438 }
439
440 PadProbeType PadProbeInfo::get_type() const
441 {
442 return static_cast<PadProbeType>(GST_PAD_PROBE_INFO_TYPE(gobj()));
443 }
444
445 } //namespace Gst
446
447 namespace Glib
448 {
449 Gst::PadProbeInfo wrap(GstPadProbeInfo* probe_info, bool take_copy)
450 {
451 return Gst::PadProbeInfo(probe_info, take_copy);
452 }
453 }
454
455 namespace
456 {
457
458
459 static void Pad_signal_linked_callback(GstPad* self, GstPad* p0,void* data)
460 {
461 using namespace Gst;
462 using SlotType = sigc::slot< void,const Glib::RefPtr<Gst::Pad>& >;
463
464 auto obj = dynamic_cast<Pad*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
465 // Do not try to call a signal on a disassociated wrapper.
466 if(obj)
467 {
468 try
469 {
470 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
471 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
472 );
473 }
474 catch(...)
475 {
476 Glib::exception_handlers_invoke();
477 }
478 }
479 }
480
481 static const Glib::SignalProxyInfo Pad_signal_linked_info =
482 {
483 "linked",
484 (GCallback) &Pad_signal_linked_callback,
485 (GCallback) &Pad_signal_linked_callback
486 };
487
488
489 static void Pad_signal_unlinked_callback(GstPad* self, GstPad* p0,void* data)
490 {
491 using namespace Gst;
492 using SlotType = sigc::slot< void,const Glib::RefPtr<Gst::Pad>& >;
493
494 auto obj = dynamic_cast<Pad*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
495 // Do not try to call a signal on a disassociated wrapper.
496 if(obj)
497 {
498 try
499 {
500 if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
501 (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
502 );
503 }
504 catch(...)
505 {
506 Glib::exception_handlers_invoke();
507 }
508 }
509 }
510
511 static const Glib::SignalProxyInfo Pad_signal_unlinked_info =
512 {
513 "unlinked",
514 (GCallback) &Pad_signal_unlinked_callback,
515 (GCallback) &Pad_signal_unlinked_callback
516 };
517
518
519 } // anonymous namespace
520
521 // static
522 GType Glib::Value<Gst::PadMode>::value_type()
523 {
524 return gst_pad_mode_get_type();
525 }
526
527 // static
528 GType Glib::Value<Gst::FlowReturn>::value_type()
529 {
530 return gst_flow_return_get_type();
531 }
532
533 // static
534 GType Glib::Value<Gst::PadDirection>::value_type()
535 {
536 return gst_pad_direction_get_type();
537 }
538
539 // static
540 GType Glib::Value<Gst::PadFlags>::value_type()
541 {
542 return gst_pad_flags_get_type();
543 }
544
545 // static
546 GType Glib::Value<Gst::PadLinkReturn>::value_type()
547 {
548 return gst_pad_link_return_get_type();
549 }
550
551 // static
552 GType Glib::Value<Gst::PadLinkCheck>::value_type()
553 {
554 return gst_pad_link_check_get_type();
555 }
556
557 // static
558 GType Glib::Value<Gst::PadProbeType>::value_type()
559 {
560 return gst_pad_probe_type_get_type();
561 }
562
563 // static
564 GType Glib::Value<Gst::PadProbeReturn>::value_type()
565 {
566 return gst_pad_probe_return_get_type();
567 }
568
569
570 namespace Glib
571 {
572
573 Glib::RefPtr<Gst::Pad> wrap(GstPad* object, bool take_copy)
574 {
575 return Glib::RefPtr<Gst::Pad>( dynamic_cast<Gst::Pad*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
576 //We use dynamic_cast<> in case of multiple inheritance.
577 }
578
579 } /* namespace Glib */
580
581
582 namespace Gst
583 {
584
585
586 /* The *_Class implementation: */
587
588 const Glib::Class& Pad_Class::init()
589 {
590 if(!gtype_) // create the GType if necessary
591 {
592 // Glib::Class has to know the class init function to clone custom types.
593 class_init_func_ = &Pad_Class::class_init_function;
594
595 // This is actually just optimized away, apparently with no harm.
596 // Make sure that the parent type has been created.
597 //CppClassParent::CppObjectType::get_type();
598
599 // Create the wrapper type, with the same class/instance size as the base type.
600 register_derived_type(gst_pad_get_type());
601
602 // Add derived versions of interfaces, if the C type implements any interfaces:
603
604 }
605
606 return *this;
607 }
608
609
610 void Pad_Class::class_init_function(void* g_class, void* class_data)
611 {
612 const auto klass = static_cast<BaseClassType*>(g_class);
613 CppClassParent::class_init_function(klass, class_data);
614
615
616 klass->linked = &linked_callback;
617 klass->unlinked = &unlinked_callback;
618 }
619
620
621 void Pad_Class::linked_callback(GstPad* self, GstPad* p0)
622 {
623 const auto obj_base = static_cast<Glib::ObjectBase*>(
624 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
625
626 // Non-gtkmmproc-generated custom classes implicitly call the default
627 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
628 // generated classes can use this optimisation, which avoids the unnecessary
629 // parameter conversions if there is no possibility of the virtual function
630 // being overridden:
631 if(obj_base && obj_base->is_derived_())
632 {
633 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
634 if(obj) // This can be NULL during destruction.
635 {
636 try // Trap C++ exceptions which would normally be lost because this is a C callback.
637 {
638 // Call the virtual member method, which derived classes might override.
639 obj->on_linked(Glib::wrap(p0, true)
640 );
641 return;
642 }
643 catch(...)
644 {
645 Glib::exception_handlers_invoke();
646 }
647 }
648 }
649
650 const auto base = static_cast<BaseClassType*>(
651 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
652 );
653
654 // Call the original underlying C function:
655 if(base && base->linked)
656 (*base->linked)(self, p0);
657 }
658 void Pad_Class::unlinked_callback(GstPad* self, GstPad* p0)
659 {
660 const auto obj_base = static_cast<Glib::ObjectBase*>(
661 Glib::ObjectBase::_get_current_wrapper((GObject*)self));
662
663 // Non-gtkmmproc-generated custom classes implicitly call the default
664 // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
665 // generated classes can use this optimisation, which avoids the unnecessary
666 // parameter conversions if there is no possibility of the virtual function
667 // being overridden:
668 if(obj_base && obj_base->is_derived_())
669 {
670 const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
671 if(obj) // This can be NULL during destruction.
672 {
673 try // Trap C++ exceptions which would normally be lost because this is a C callback.
674 {
675 // Call the virtual member method, which derived classes might override.
676 obj->on_unlinked(Glib::wrap(p0, true)
677 );
678 return;
679 }
680 catch(...)
681 {
682 Glib::exception_handlers_invoke();
683 }
684 }
685 }
686
687 const auto base = static_cast<BaseClassType*>(
688 g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
689 );
690
691 // Call the original underlying C function:
692 if(base && base->unlinked)
693 (*base->unlinked)(self, p0);
694 }
695
696
697 Glib::ObjectBase* Pad_Class::wrap_new(GObject* object)
698 {
699 return new Pad((GstPad*)object);
700 }
701
702
703 /* The implementation: */
704
705 GstPad* Pad::gobj_copy()
706 {
707 reference();
708 return gobj();
709 }
710
711 Pad::Pad(const Glib::ConstructParams& construct_params)
712 :
713 Object(construct_params)
714 {
715
716 }
717
718 Pad::Pad(GstPad* castitem)
719 :
720 Object((GstObject*)(castitem))
721 {}
722
723
724 Pad::Pad(Pad&& src) noexcept
725 : Object(std::move(src))
726 {}
727
728 Pad& Pad::operator=(Pad&& src) noexcept
729 {
730 Object::operator=(std::move(src));
731 return *this;
732 }
733
734
735 Pad::~Pad() noexcept
736 {}
737
738
739 Pad::CppClassType Pad::pad_class_; // initialize static member
740
741 GType Pad::get_type()
742 {
743 return pad_class_.init().get_type();
744 }
745
746
747 GType Pad::get_base_type()
748 {
749 return gst_pad_get_type();
750 }
751
752
753 Pad::Pad(const Glib::ustring& name, PadDirection direction)
754 :
755 // Mark this class as non-derived to allow C++ vfuncs to be skipped.
756 Glib::ObjectBase(nullptr),
757 Object(Glib::ConstructParams(pad_class_.init(), "name", name.c_str(), "direction", ((GstPadDirection)(direction)), nullptr))
758 {
759
760
761 }
762
763 Glib::RefPtr<Pad> Pad::create(const Glib::ustring& name, PadDirection dir)
764 {
765 return Glib::RefPtr<Pad>( new Pad(name, dir) );
766 }
767
768 Glib::RefPtr<Pad> Pad::create(PadDirection dir)
769 {
770 return Glib::RefPtr<Pad>( new Pad(dir) );
771 }
772
773 Glib::RefPtr<Pad> Pad::create(const Glib::RefPtr<const Gst::PadTemplate>& pad_template)
774 {
775 return Glib::RefPtr<Pad>( new Pad(pad_template) );
776 }
777
778 Glib::RefPtr<Pad> Pad::create(const Glib::RefPtr<const Gst::PadTemplate>& pad_template, const Glib::ustring& name)
779 {
780 return Glib::RefPtr<Pad>( new Pad(pad_template, name) );
781 }
782
783 Gst::PadMode Pad::get_mode() const
784 {
785 return ((Gst::PadMode)(gobj()->mode));
786 }
787
788 Glib::RefPtr<Gst::Caps> Pad::query_caps(Glib::RefPtr<Gst::Caps> caps)
789 {
790 return Glib::wrap(gst_pad_query_caps(gobj(), Glib::unwrap(caps)));
791 }
792
793 Glib::RefPtr<const Gst::Caps> Pad::query_caps(Glib::RefPtr<Gst::Caps> caps) const
794 {
795 return const_cast<Pad*>(this)->query_caps(caps);
796 }
797
798 PadDirection Pad::get_direction() const
799 {
800 return ((PadDirection)(gst_pad_get_direction(const_cast<GstPad*>(gobj()))));
801 }
802
803 Glib::RefPtr<Gst::Element> Pad::get_parent_element()
804 {
805 return Glib::wrap(gst_pad_get_parent_element(gobj()));
806 }
807
808 Glib::RefPtr<const Gst::Element> Pad::get_parent_element() const
809 {
810 return const_cast<Pad*>(this)->get_parent_element();
811 }
812
813 Glib::RefPtr<Gst::PadTemplate> Pad::get_pad_template()
814 {
815 return Glib::wrap(gst_pad_get_pad_template(gobj()));
816 }
817
818 Glib::RefPtr<const Gst::PadTemplate> Pad::get_pad_template() const
819 {
820 return const_cast<Pad*>(this)->get_pad_template();
821 }
822
823 PadLinkReturn Pad::link(const Glib::RefPtr<Gst::Pad>& sink_pad)
824 {
825 return ((PadLinkReturn)(gst_pad_link(gobj(), Glib::unwrap(sink_pad))));
826 }
827
828 bool Pad::unlink(const Glib::RefPtr<Gst::Pad>& sink_pad)
829 {
830 return gst_pad_unlink(gobj(), Glib::unwrap(sink_pad));
831 }
832
833 bool Pad::is_linked() const
834 {
835 return gst_pad_is_linked(const_cast<GstPad*>(gobj()));
836 }
837
838 bool Pad::can_link(const Glib::RefPtr<const Gst::Pad>& other_pad) const
839 {
840 return gst_pad_can_link(const_cast<GstPad*>(gobj()), const_cast<GstPad*>(Glib::unwrap(other_pad)));
841 }
842
843 Glib::RefPtr<Gst::Caps> Pad::get_allowed_caps()
844 {
845 return Glib::wrap(gst_pad_get_allowed_caps(gobj()));
846 }
847
848 Glib::RefPtr<const Gst::Caps> Pad::get_allowed_caps() const
849 {
850 return const_cast<Pad*>(this)->get_allowed_caps();
851 }
852
853 Glib::RefPtr<Gst::Caps> Pad::get_pad_template_caps()
854 {
855 return Glib::wrap(gst_pad_get_pad_template_caps(gobj()));
856 }
857
858 Glib::RefPtr<const Gst::Caps> Pad::get_pad_template_caps() const
859 {
860 return const_cast<Pad*>(this)->get_pad_template_caps();
861 }
862
863 void Pad::remove_probe(gulong id)
864 {
865 gst_pad_remove_probe(gobj(), id);
866 }
867
868 Glib::RefPtr<Gst::Pad> Pad::get_peer()
869 {
870 return Glib::wrap(gst_pad_get_peer(gobj()));
871 }
872
873 Glib::RefPtr<const Gst::Pad> Pad::get_peer() const
874 {
875 return const_cast<Pad*>(this)->get_peer();
876 }
877
878 void Pad::use_fixed_caps()
879 {
880 gst_pad_use_fixed_caps(gobj());
881 }
882
883 bool Pad::is_active() const
884 {
885 return gst_pad_is_active(const_cast<GstPad*>(gobj()));
886 }
887
888 bool Pad::is_blocked() const
889 {
890 return gst_pad_is_blocked(const_cast<GstPad*>(gobj()));
891 }
892
893 bool Pad::is_blocking() const
894 {
895 return gst_pad_is_blocking(const_cast<GstPad*>(gobj()));
896 }
897
898 void Pad::mark_reconfigure()
899 {
900 gst_pad_mark_reconfigure(gobj());
901 }
902
903 bool Pad::needs_reconfigure() const
904 {
905 return gst_pad_needs_reconfigure(const_cast<GstPad*>(gobj()));
906 }
907
908 bool Pad::check_reconfigure()
909 {
910 return gst_pad_check_reconfigure(gobj());
911 }
912
913 bool Pad::has_current_caps() const
914 {
915 return gst_pad_has_current_caps(const_cast<GstPad*>(gobj()));
916 }
917
918 Glib::ustring Pad::create_stream_id(const Glib::RefPtr<Gst::Element>& parent, const Glib::ustring& stream_id)
919 {
920 return Glib::convert_return_gchar_ptr_to_ustring(gst_pad_create_stream_id(gobj(), Glib::unwrap(parent), stream_id.c_str()));
921 }
922
923 Glib::ustring Pad::get_stream_id() const
924 {
925 return Glib::convert_return_gchar_ptr_to_ustring(gst_pad_get_stream_id(const_cast<GstPad*>(gobj())));
926 }
927
928 void Pad::set_offset(gint64 offset)
929 {
930 gst_pad_set_offset(gobj(), offset);
931 }
932
933 gint64 Pad::get_offset() const
934 {
935 return gst_pad_get_offset(const_cast<GstPad*>(gobj()));
936 }
937
938 void Pad::set_element_private(gpointer priv)
939 {
940 gst_pad_set_element_private(gobj(), priv);
941 }
942
943 gpointer Pad::get_element_private()
944 {
945 return gst_pad_get_element_private(gobj());
946 }
947
948 bool Pad::query_accept_caps(const Glib::RefPtr<const Gst::Caps>& caps) const
949 {
950 return gst_pad_query_accept_caps(const_cast<GstPad*>(gobj()), const_cast<GstCaps*>(Glib::unwrap(caps)));
951 }
952
953 bool Pad::proxy_query_caps(const Glib::RefPtr<Gst::Query>& query) const
954 {
955 return gst_pad_proxy_query_caps(const_cast<GstPad*>(gobj()), Glib::unwrap(query));
956 }
957
958 bool Pad::proxy_query_accept_caps(const Glib::RefPtr<Gst::Query>& query) const
959 {
960 return gst_pad_proxy_query_accept_caps(const_cast<GstPad*>(gobj()), Glib::unwrap(query));
961 }
962
963 bool Pad::peer_query_accept_caps(const Glib::RefPtr<const Gst::Caps>& caps) const
964 {
965 return gst_pad_peer_query_accept_caps(const_cast<GstPad*>(gobj()), const_cast<GstCaps*>(Glib::unwrap(caps)));
966 }
967
968 bool Pad::peer_query_position(Gst::Format format, gint64& cur) const
969 {
970 return gst_pad_peer_query_position(const_cast<GstPad*>(gobj()), ((GstFormat)(format)), &(cur));
971 }
972
973 bool Pad::peer_query_duration(Gst::Format format, gint64& duration) const
974 {
975 return gst_pad_peer_query_duration(const_cast<GstPad*>(gobj()), ((GstFormat)(format)), &(duration));
976 }
977
978 FlowReturn Pad::push(Glib::RefPtr<Gst::Buffer>&& buffer)
979 {
980 return ((FlowReturn)(gst_pad_push(gobj(), (buffer) ? buffer.release()->gobj() : nullptr)));
981 }
982
983 bool Pad::push_event(Glib::RefPtr<Gst::Event>&& event)
984 {
985 return gst_pad_push_event(gobj(), (event) ? event.release()->gobj() : nullptr);
986 }
987
988 bool Pad::send_event(Glib::RefPtr<Gst::Event>&& event)
989 {
990 return gst_pad_send_event(gobj(), (event) ? event.release()->gobj() : nullptr);
991 }
992
993 bool Pad::activate_mode(Gst::PadMode mode, bool active)
994 {
995 return gst_pad_activate_mode(gobj(), ((GstPadMode)(mode)), static_cast<int>(active));
996 }
997
998 bool Pad::event_default(const Glib::RefPtr<Gst::Object>& parent, Glib::RefPtr<Gst::Event>&& event)
999 {
1000 return gst_pad_event_default(gobj(), Glib::unwrap(parent), (event) ? event.release()->gobj() : nullptr);
1001 }
1002
1003 bool Pad::event_default(Glib::RefPtr<Gst::Event>&& event)
1004 {
1005 return gst_pad_event_default(gobj(), nullptr, (event) ? event.release()->gobj() : nullptr);
1006 }
1007
1008 bool Pad::query(const Glib::RefPtr<Gst::Query>& query) const
1009 {
1010 return gst_pad_query(const_cast<GstPad*>(gobj()), Glib::unwrap(query));
1011 }
1012
1013 bool Pad::peer_query(const Glib::RefPtr<Gst::Query>& query) const
1014 {
1015 return gst_pad_peer_query(const_cast<GstPad*>(gobj()), Glib::unwrap(query));
1016 }
1017
1018 Glib::RefPtr<Gst::Caps> Pad::peer_query_caps(const Glib::RefPtr<Gst::Caps>& filter) const
1019 {
1020 return Glib::wrap(gst_pad_peer_query_caps(const_cast<GstPad*>(gobj()), Glib::unwrap(filter)));
1021 }
1022
1023 bool Pad::query_default(const Glib::RefPtr<Gst::Object>& parent, const Glib::RefPtr<Gst::Query>& query) const
1024 {
1025 return gst_pad_query_default(const_cast<GstPad*>(gobj()), Glib::unwrap(parent), Glib::unwrap(query));
1026 }
1027
1028 bool Pad::query_default(const Glib::RefPtr<Gst::Query>& query) const
1029 {
1030 return gst_pad_query_default(const_cast<GstPad*>(gobj()), nullptr, Glib::unwrap(query));
1031 }
1032
1033 bool Pad::query_position(Format format, gint64& position) const
1034 {
1035 return gst_pad_query_position(const_cast<GstPad*>(gobj()), ((GstFormat)(format)), &(position));
1036 }
1037
1038 bool Pad::query_duration(Format format, gint64& duration) const
1039 {
1040 return gst_pad_query_duration(const_cast<GstPad*>(gobj()), ((GstFormat)(format)), &(duration));
1041 }
1042
1043 bool Pad::query_convert(Format src_format, gint64 src_value, Format dst_format, gint64& dst_value) const
1044 {
1045 return gst_pad_query_convert(const_cast<GstPad*>(gobj()), ((GstFormat)(src_format)), src_value, ((GstFormat)(dst_format)), &(dst_value));
1046 }
1047
1048 bool Pad::peer_query_convert(Format src_format, gint64 src_value, Format dst_format, gint64& dst_value) const
1049 {
1050 return gst_pad_peer_query_convert(const_cast<GstPad*>(gobj()), ((GstFormat)(src_format)), src_value, ((GstFormat)(dst_format)), &(dst_value));
1051 }
1052
1053 Gst::Iterator<Gst::Pad> Pad::iterate_internal_links()
1054 {
1055 return Gst::Iterator<Gst::Pad>(gst_pad_iterate_internal_links(gobj()));
1056 }
1057
1058 Gst::Iterator<const Gst::Pad> Pad::iterate_internal_links() const
1059 {
1060 return Gst::Iterator<const Gst::Pad>(gst_pad_iterate_internal_links(const_cast<GstPad*>(gobj())));
1061 }
1062
1063 Gst::Iterator<Gst::Pad> Pad::iterate_internal_links_default(const Glib::RefPtr<Gst::Object>& parent)
1064 {
1065 return Gst::Iterator<Gst::Pad>(gst_pad_iterate_internal_links_default(gobj(), Glib::unwrap(parent)));
1066 }
1067
1068 Gst::Iterator<Gst::Pad> Pad::iterate_internal_links_default()
1069 {
1070 return Gst::Iterator<Gst::Pad>(gst_pad_iterate_internal_links_default(gobj(), nullptr));
1071 }
1072
1073 Gst::Iterator<const Gst::Pad> Pad::iterate_internal_links_default(const Glib::RefPtr<Gst::Object>& parent) const
1074 {
1075 return Gst::Iterator<const Gst::Pad>(gst_pad_iterate_internal_links_default(const_cast<GstPad*>(gobj()), Glib::unwrap(parent)));
1076 }
1077
1078 Gst::Iterator<const Gst::Pad> Pad::iterate_internal_links_default() const
1079 {
1080 return Gst::Iterator<const Gst::Pad>(gst_pad_iterate_internal_links_default(const_cast<GstPad*>(gobj()), nullptr));
1081 }
1082
1083 Gst::FlowReturn Pad::chain(Glib::RefPtr<Gst::Buffer>&& buffer)
1084 {
1085 return ((Gst::FlowReturn)(gst_pad_chain(gobj(), (buffer) ? buffer.release()->gobj() : nullptr)));
1086 }
1087
1088 Glib::RefPtr<Gst::Caps> Pad::get_current_caps()
1089 {
1090 return Glib::wrap(gst_pad_get_current_caps(gobj()));
1091 }
1092
1093 bool Pad::pause_task()
1094 {
1095 return gst_pad_pause_task(gobj());
1096 }
1097
1098 bool Pad::stop_task()
1099 {
1100 return gst_pad_stop_task(gobj());
1101 }
1102
1103 bool Pad::set_active(bool active)
1104 {
1105 return gst_pad_set_active(gobj(), static_cast<int>(active));
1106 }
1107
1108 Gst::FlowReturn Pad::get_last_flow_return() const
1109 {
1110 return ((Gst::FlowReturn)(gst_pad_get_last_flow_return(const_cast<GstPad*>(gobj()))));
1111 }
1112
1113 Glib::RefPtr<Gst::Event> Pad::get_sticky_event(Gst::EventType event_type, guint idx) const
1114 {
1115 return Glib::wrap(gst_pad_get_sticky_event(const_cast<GstPad*>(gobj()), ((GstEventType)(event_type)), idx));
1116 }
1117
1118
1119 Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& > Pad::signal_linked()
1120 {
1121 return Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& >(this, &Pad_signal_linked_info);
1122 }
1123
1124
1125 Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& > Pad::signal_unlinked()
1126 {
1127 return Glib::SignalProxy< void,const Glib::RefPtr<Gst::Pad>& >(this, &Pad_signal_unlinked_info);
1128 }
1129
1130
1131 Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Caps> > Pad::property_caps() const
1132 {
1133 return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Caps> >(this, "caps");
1134 }
1135
1136 Glib::PropertyProxy_ReadOnly< PadDirection > Pad::property_direction() const
1137 {
1138 return Glib::PropertyProxy_ReadOnly< PadDirection >(this, "direction");
1139 }
1140
1141 Glib::PropertyProxy< PadTemplate > Pad::property_template()
1142 {
1143 return Glib::PropertyProxy< PadTemplate >(this, "template");
1144 }
1145
1146 Glib::PropertyProxy_ReadOnly< PadTemplate > Pad::property_template() const
1147 {
1148 return Glib::PropertyProxy_ReadOnly< PadTemplate >(this, "template");
1149 }
1150
1151 Glib::PropertyProxy< gint64 > Pad::property_offset()
1152 {
1153 return Glib::PropertyProxy< gint64 >(this, "offset");
1154 }
1155
1156 Glib::PropertyProxy_ReadOnly< gint64 > Pad::property_offset() const
1157 {
1158 return Glib::PropertyProxy_ReadOnly< gint64 >(this, "offset");
1159 }
1160
1161
1162 void Gst::Pad::on_linked(const Glib::RefPtr<Gst::Pad>& peer_pad)
1163 {
1164 const auto base = static_cast<BaseClassType*>(
1165 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1166 );
1167
1168 if(base && base->linked)
1169 (*base->linked)(gobj(),Glib::unwrap(peer_pad));
1170 }
1171 void Gst::Pad::on_unlinked(const Glib::RefPtr<Gst::Pad>& peer_pad)
1172 {
1173 const auto base = static_cast<BaseClassType*>(
1174 g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
1175 );
1176
1177 if(base && base->unlinked)
1178 (*base->unlinked)(gobj(),Glib::unwrap(peer_pad));
1179 }
1180
1181
1182 } // namespace Gst
1183
1184
1185 namespace Gst
1186 {
1187
1188
1189 gulong PadProbeInfo::get_id() const
1190 {
1191 return gobj()->id;
1192 }
1193
1194 Glib::RefPtr<Gst::Event> PadProbeInfo::get_event()
1195 {
1196 Glib::RefPtr<Gst::Event> retvalue = Glib::wrap(gst_pad_probe_info_get_event(gobj()));
1197 if(retvalue)
1198 retvalue->reference(); //The function does not do a ref for us.
1199 return retvalue;
1200 }
1201
1202 const Glib::RefPtr<Gst::Event> PadProbeInfo::get_event() const
1203 {
1204 return const_cast<PadProbeInfo*>(this)->get_event();
1205 }
1206
1207 Glib::RefPtr<Gst::Query> PadProbeInfo::get_query()
1208 {
1209 return Glib::wrap(gst_pad_probe_info_get_query(gobj()));
1210 }
1211
1212 const Glib::RefPtr<Gst::Query> PadProbeInfo::get_query() const
1213 {
1214 return const_cast<PadProbeInfo*>(this)->get_query();
1215 }
1216
1217 Glib::RefPtr<Gst::Buffer> PadProbeInfo::get_buffer()
1218 {
1219 Glib::RefPtr<Gst::Buffer> retvalue = Glib::wrap(gst_pad_probe_info_get_buffer(gobj()));
1220 if(retvalue)
1221 retvalue->reference(); //The function does not do a ref for us.
1222 return retvalue;
1223 }
1224
1225 const Glib::RefPtr<Gst::Buffer> PadProbeInfo::get_buffer() const
1226 {
1227 return const_cast<PadProbeInfo*>(this)->get_buffer();
1228 }
1229
1230 Glib::RefPtr<Gst::BufferList> PadProbeInfo::get_buffer_list()
1231 {
1232 return Glib::wrap(gst_pad_probe_info_get_buffer_list(gobj()));
1233 }
1234
1235 const Glib::RefPtr<Gst::BufferList> PadProbeInfo::get_buffer_list() const
1236 {
1237 return const_cast<PadProbeInfo*>(this)->get_buffer_list();
1238 }
1239
1240
1241 } // namespace Gst
1242
1243