1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::StaticType; use glib::ToValue; use std::boxed::Box as Box_; use std::mem::transmute; glib::wrapper! { /// This is a generic base class for source elements. The following /// types of sources are supported: /// /// * random access sources like files /// * seekable sources /// * live sources /// /// The source can be configured to operate in any [`crate::gst::Format`] with the /// [`crate::prelude::BaseSrcExt::set_format()`] method. The currently set format determines /// the format of the internal [`crate::gst::Segment`] and any [`crate::gst::EventType::Segment`] /// events. The default format for [`crate::BaseSrc`] is [`crate::gst::Format::Bytes`]. /// /// [`crate::BaseSrc`] always supports push mode scheduling. If the following /// conditions are met, it also supports pull mode scheduling: /// /// * The format is set to [`crate::gst::Format::Bytes`] (default). /// * [`crate::GstBaseSrcClass.is_seekable()`] returns [`true`]. /// /// If all the conditions are met for operating in pull mode, [`crate::BaseSrc`] is /// automatically seekable in push mode as well. The following conditions must /// be met to make the element seekable in push mode when the format is not /// [`crate::gst::Format::Bytes`]: /// /// * [`crate::GstBaseSrcClass.is_seekable()`] returns [`true`]. /// * [`crate::GstBaseSrcClass.query()`] can convert all supported seek formats to the /// internal format as set with [`crate::prelude::BaseSrcExt::set_format()`]. /// * [`crate::GstBaseSrcClass.do_seek()`] is implemented, performs the seek and returns /// [`true`]. /// /// When the element does not meet the requirements to operate in pull mode, the /// offset and length in the [`crate::GstBaseSrcClass.create()`] method should be ignored. /// It is recommended to subclass [`crate::PushSrc`] instead, in this situation. If the /// element can operate in pull mode but only with specific offsets and /// lengths, it is allowed to generate an error when the wrong values are passed /// to the [`crate::GstBaseSrcClass.create()`] function. /// /// [`crate::BaseSrc`] has support for live sources. Live sources are sources that when /// paused discard data, such as audio or video capture devices. A typical live /// source also produces data at a fixed rate and thus provides a clock to publish /// this rate. /// Use [`crate::prelude::BaseSrcExt::set_live()`] to activate the live source mode. /// /// A live source does not produce data in the PAUSED state. This means that the /// [`crate::GstBaseSrcClass.create()`] method will not be called in PAUSED but only in /// PLAYING. To signal the pipeline that the element will not produce data, the /// return value from the READY to PAUSED state will be /// [`crate::gst::StateChangeReturn::NoPreroll`]. /// /// A typical live source will timestamp the buffers it creates with the /// current running time of the pipeline. This is one reason why a live source /// can only produce data in the PLAYING state, when the clock is actually /// distributed and running. /// /// Live sources that synchronize and block on the clock (an audio source, for /// example) can use [`crate::prelude::BaseSrcExt::wait_playing()`] when the /// [`crate::GstBaseSrcClass.create()`] function was interrupted by a state change to /// PAUSED. /// /// The [`crate::GstBaseSrcClass.get_times()`] method can be used to implement pseudo-live /// sources. It only makes sense to implement the [`crate::GstBaseSrcClass.get_times()`] /// function if the source is a live source. The [`crate::GstBaseSrcClass.get_times()`] /// function should return timestamps starting from 0, as if it were a non-live /// source. The base class will make sure that the timestamps are transformed /// into the current running_time. The base source will then wait for the /// calculated running_time before pushing out the buffer. /// /// For live sources, the base class will by default report a latency of 0. /// For pseudo live sources, the base class will by default measure the difference /// between the first buffer timestamp and the start time of get_times and will /// report this value as the latency. /// Subclasses should override the query function when this behaviour is not /// acceptable. /// /// There is only support in [`crate::BaseSrc`] for exactly one source pad, which /// should be named "src". A source implementation (subclass of [`crate::BaseSrc`]) /// should install a pad template in its class_init function, like so: /// /// ```C /// static void /// my_element_class_init (GstMyElementClass *klass) /// { /// GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); /// // srctemplate should be a #GstStaticPadTemplate with direction /// // %GST_PAD_SRC and name "src" /// gst_element_class_add_static_pad_template (gstelement_class, &srctemplate); /// /// gst_element_class_set_static_metadata (gstelement_class, /// "Source name", /// "Source", /// "My Source element", /// "The author <my.sink@my.email>"); /// } /// ``` /// /// ## Controlled shutdown of live sources in applications /// /// Applications that record from a live source may want to stop recording /// in a controlled way, so that the recording is stopped, but the data /// already in the pipeline is processed to the end (remember that many live /// sources would go on recording forever otherwise). For that to happen the /// application needs to make the source stop recording and send an EOS /// event down the pipeline. The application would then wait for an /// EOS message posted on the pipeline's bus to know when all data has /// been processed and the pipeline can safely be stopped. /// /// An application may send an EOS event to a source element to make it /// perform the EOS logic (send EOS event downstream or post a /// [`crate::gst::MessageType::SegmentDone`] on the bus). This can typically be done /// with the [`crate::gst::prelude::ElementExt::send_event()`] function on the element or its parent bin. /// /// After the EOS has been sent to the element, the application should wait for /// an EOS message to be posted on the pipeline's bus. Once this EOS message is /// received, it may safely shut down the entire pipeline. /// /// This is an Abstract Base Class, you cannot instantiate it. /// /// # Implements /// /// [`trait@crate::prelude::BaseSrcExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::ObjectExt`], [`trait@glib::object::ObjectExt`], [`trait@crate::prelude::BaseSrcExtManual`] pub struct BaseSrc(Object<ffi::GstBaseSrc, ffi::GstBaseSrcClass>) @extends gst::Element, gst::Object; match fn { type_ => || ffi::gst_base_src_get_type(), } } unsafe impl Send for BaseSrc {} unsafe impl Sync for BaseSrc {} pub const NONE_BASE_SRC: Option<&BaseSrc> = None; /// Trait containing all `BaseSrc` methods. /// /// # Implementors /// /// [`struct@crate::BaseSrc`], [`struct@crate::PushSrc`] pub trait BaseSrcExt: 'static { //#[doc(alias = "gst_base_src_get_allocator")] //#[doc(alias = "get_allocator")] //fn allocator(&self, allocator: /*Ignored*/Option<gst::Allocator>, params: /*Ignored*/gst::AllocationParams); /// Get the number of bytes that `self` will push out with each buffer. /// /// # Returns /// /// the number of bytes pushed with each buffer. #[doc(alias = "gst_base_src_get_blocksize")] #[doc(alias = "get_blocksize")] fn blocksize(&self) -> u32; /// /// # Returns /// /// the instance of the [`crate::gst::BufferPool`] used /// by the src; unref it after usage. #[doc(alias = "gst_base_src_get_buffer_pool")] #[doc(alias = "get_buffer_pool")] fn buffer_pool(&self) -> Option<gst::BufferPool>; /// Query if `self` timestamps outgoing buffers based on the current running_time. /// /// # Returns /// /// [`true`] if the base class will automatically timestamp outgoing buffers. #[doc(alias = "gst_base_src_get_do_timestamp")] #[doc(alias = "get_do_timestamp")] fn does_timestamp(&self) -> bool; /// Get the current async behaviour of `self`. See also [`Self::set_async()`]. /// /// # Returns /// /// [`true`] if `self` is operating in async mode. #[doc(alias = "gst_base_src_is_async")] fn is_async(&self) -> bool; /// Check if an element is in live mode. /// /// # Returns /// /// [`true`] if element is in live mode. #[doc(alias = "gst_base_src_is_live")] fn is_live(&self) -> bool; /// Negotiates src pad caps with downstream elements. /// Unmarks GST_PAD_FLAG_NEED_RECONFIGURE in any case. But marks it again /// if [`crate::GstBaseSrcClass.negotiate()`] fails. /// /// Do not call this in the [`crate::GstBaseSrcClass.fill()`] vmethod. Call this in /// [`crate::GstBaseSrcClass.create()`] or in [`crate::GstBaseSrcClass.alloc()`], _before_ any /// buffer is allocated. /// /// # Returns /// /// [`true`] if the negotiation succeeded, else [`false`]. #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] #[doc(alias = "gst_base_src_negotiate")] fn negotiate(&self) -> bool; /// Prepare a new seamless segment for emission downstream. This function must /// only be called by derived sub-classes, and only from the [`crate::BaseSrcClass::create`] function, /// as the stream-lock needs to be held. /// /// The format for the new segment will be the current format of the source, as /// configured with [`Self::set_format()`] /// /// # Deprecated since 1.18 /// /// Use [`crate::BaseSrc::new_segment()`] /// ## `start` /// The new start value for the segment /// ## `stop` /// Stop value for the new segment /// ## `time` /// The new time value for the start of the new segment /// /// # Returns /// /// [`true`] if preparation of the seamless segment succeeded. #[cfg_attr(feature = "v1_18", deprecated = "Since 1.18")] #[doc(alias = "gst_base_src_new_seamless_segment")] fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool; /// Configure async behaviour in `self`, no state change will block. The open, /// close, start, stop, play and pause virtual methods will be executed in a /// different thread and are thus allowed to perform blocking operations. Any /// blocking operation should be unblocked with the unlock vmethod. /// ## `async_` /// new async mode #[doc(alias = "gst_base_src_set_async")] fn set_async(&self, async_: bool); /// If `automatic_eos` is [`true`], `self` will automatically go EOS if a buffer /// after the total size is returned. By default this is [`true`] but sources /// that can't return an authoritative size and only know that they're EOS /// when trying to read more should set this to [`false`]. /// /// When `self` operates in [`crate::gst::Format::Time`], [`crate::BaseSrc`] will send an EOS /// when a buffer outside of the currently configured segment is pushed if /// `automatic_eos` is [`true`]. Since 1.16, if `automatic_eos` is [`false`] an /// EOS will be pushed only when the [`crate::GstBaseSrcClass.create()`] implementation /// returns [`crate::gst::FlowReturn::Eos`]. /// ## `automatic_eos` /// automatic eos #[doc(alias = "gst_base_src_set_automatic_eos")] fn set_automatic_eos(&self, automatic_eos: bool); /// Set the number of bytes that `self` will push out with each buffer. When /// `blocksize` is set to -1, a default length will be used. /// ## `blocksize` /// the new blocksize in bytes #[doc(alias = "gst_base_src_set_blocksize")] fn set_blocksize(&self, blocksize: u32); /// Set new caps on the basesrc source pad. /// ## `caps` /// a [`crate::gst::Caps`] /// /// # Returns /// /// [`true`] if the caps could be set #[doc(alias = "gst_base_src_set_caps")] fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError>; /// Configure `self` to automatically timestamp outgoing buffers based on the /// current running_time of the pipeline. This property is mostly useful for live /// sources. /// ## `timestamp` /// enable or disable timestamping #[doc(alias = "gst_base_src_set_do_timestamp")] fn set_do_timestamp(&self, timestamp: bool); /// If not `dynamic`, size is only updated when needed, such as when trying to /// read past current tracked size. Otherwise, size is checked for upon each /// read. /// ## `dynamic` /// new dynamic size mode #[doc(alias = "gst_base_src_set_dynamic_size")] fn set_dynamic_size(&self, dynamic: bool); /// Sets the default format of the source. This will be the format used /// for sending SEGMENT events and for performing seeks. /// /// If a format of GST_FORMAT_BYTES is set, the element will be able to /// operate in pull mode if the [`crate::GstBaseSrcClass.is_seekable()`] returns [`true`]. /// /// This function must only be called in states < [`crate::gst::State::Paused`]. /// ## `format` /// the format to use #[doc(alias = "gst_base_src_set_format")] fn set_format(&self, format: gst::Format); /// If the element listens to a live source, `live` should /// be set to [`true`]. /// /// A live source will not produce data in the PAUSED state and /// will therefore not be able to participate in the PREROLL phase /// of a pipeline. To signal this fact to the application and the /// pipeline, the state change return value of the live source will /// be GST_STATE_CHANGE_NO_PREROLL. /// ## `live` /// new live-mode #[doc(alias = "gst_base_src_set_live")] fn set_live(&self, live: bool); /// Complete an asynchronous start operation. When the subclass overrides the /// start method, it should call [`Self::start_complete()`] when the start /// operation completes either from the same thread or from an asynchronous /// helper thread. /// ## `ret` /// a [`crate::gst::FlowReturn`] #[doc(alias = "gst_base_src_start_complete")] fn start_complete(&self, ret: impl Into<gst::FlowReturn>); #[doc(alias = "gst_base_src_start_wait")] fn start_wait(&self) -> Result<gst::FlowSuccess, gst::FlowError>; #[doc(alias = "gst_base_src_wait_playing")] fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError>; #[doc(alias = "num-buffers")] fn num_buffers(&self) -> i32; #[doc(alias = "num-buffers")] fn set_num_buffers(&self, num_buffers: i32); fn is_typefind(&self) -> bool; fn set_typefind(&self, typefind: bool); #[doc(alias = "blocksize")] fn connect_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "do-timestamp")] fn connect_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "num-buffers")] fn connect_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "typefind")] fn connect_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; } impl<O: IsA<BaseSrc>> BaseSrcExt for O { //fn allocator(&self, allocator: /*Ignored*/Option<gst::Allocator>, params: /*Ignored*/gst::AllocationParams) { // unsafe { TODO: call ffi:gst_base_src_get_allocator() } //} fn blocksize(&self) -> u32 { unsafe { ffi::gst_base_src_get_blocksize(self.as_ref().to_glib_none().0) } } fn buffer_pool(&self) -> Option<gst::BufferPool> { unsafe { from_glib_full(ffi::gst_base_src_get_buffer_pool( self.as_ref().to_glib_none().0, )) } } fn does_timestamp(&self) -> bool { unsafe { from_glib(ffi::gst_base_src_get_do_timestamp( self.as_ref().to_glib_none().0, )) } } fn is_async(&self) -> bool { unsafe { from_glib(ffi::gst_base_src_is_async(self.as_ref().to_glib_none().0)) } } fn is_live(&self) -> bool { unsafe { from_glib(ffi::gst_base_src_is_live(self.as_ref().to_glib_none().0)) } } #[cfg(any(feature = "v1_18", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))] fn negotiate(&self) -> bool { unsafe { from_glib(ffi::gst_base_src_negotiate(self.as_ref().to_glib_none().0)) } } fn new_seamless_segment(&self, start: i64, stop: i64, time: i64) -> bool { unsafe { from_glib(ffi::gst_base_src_new_seamless_segment( self.as_ref().to_glib_none().0, start, stop, time, )) } } fn set_async(&self, async_: bool) { unsafe { ffi::gst_base_src_set_async(self.as_ref().to_glib_none().0, async_.into_glib()); } } fn set_automatic_eos(&self, automatic_eos: bool) { unsafe { ffi::gst_base_src_set_automatic_eos( self.as_ref().to_glib_none().0, automatic_eos.into_glib(), ); } } fn set_blocksize(&self, blocksize: u32) { unsafe { ffi::gst_base_src_set_blocksize(self.as_ref().to_glib_none().0, blocksize); } } fn set_caps(&self, caps: &gst::Caps) -> Result<(), glib::error::BoolError> { unsafe { glib::result_from_gboolean!( ffi::gst_base_src_set_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0), "Failed to set caps" ) } } fn set_do_timestamp(&self, timestamp: bool) { unsafe { ffi::gst_base_src_set_do_timestamp( self.as_ref().to_glib_none().0, timestamp.into_glib(), ); } } fn set_dynamic_size(&self, dynamic: bool) { unsafe { ffi::gst_base_src_set_dynamic_size(self.as_ref().to_glib_none().0, dynamic.into_glib()); } } fn set_format(&self, format: gst::Format) { unsafe { ffi::gst_base_src_set_format(self.as_ref().to_glib_none().0, format.into_glib()); } } fn set_live(&self, live: bool) { unsafe { ffi::gst_base_src_set_live(self.as_ref().to_glib_none().0, live.into_glib()); } } fn start_complete(&self, ret: impl Into<gst::FlowReturn>) { unsafe { ffi::gst_base_src_start_complete( self.as_ref().to_glib_none().0, ret.into().into_glib(), ); } } fn start_wait(&self) -> Result<gst::FlowSuccess, gst::FlowError> { unsafe { gst::FlowSuccess::try_from_glib(ffi::gst_base_src_start_wait( self.as_ref().to_glib_none().0, )) } } fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError> { unsafe { gst::FlowSuccess::try_from_glib(ffi::gst_base_src_wait_playing( self.as_ref().to_glib_none().0, )) } } fn num_buffers(&self) -> i32 { unsafe { let mut value = glib::Value::from_type(<i32 as StaticType>::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"num-buffers\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `num-buffers` getter") } } fn set_num_buffers(&self, num_buffers: i32) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"num-buffers\0".as_ptr() as *const _, num_buffers.to_value().to_glib_none().0, ); } } fn is_typefind(&self) -> bool { unsafe { let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); glib::gobject_ffi::g_object_get_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"typefind\0".as_ptr() as *const _, value.to_glib_none_mut().0, ); value .get() .expect("Return Value for property `typefind` getter") } } fn set_typefind(&self, typefind: bool) { unsafe { glib::gobject_ffi::g_object_set_property( self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, b"typefind\0".as_ptr() as *const _, typefind.to_value().to_glib_none().0, ); } } #[doc(alias = "blocksize")] fn connect_blocksize_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_blocksize_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( this: *mut ffi::GstBaseSrc, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<BaseSrc>, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::blocksize\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_blocksize_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "do-timestamp")] fn connect_do_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_do_timestamp_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( this: *mut ffi::GstBaseSrc, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<BaseSrc>, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::do-timestamp\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_do_timestamp_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "num-buffers")] fn connect_num_buffers_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_num_buffers_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( this: *mut ffi::GstBaseSrc, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<BaseSrc>, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::num-buffers\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_num_buffers_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "typefind")] fn connect_typefind_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_typefind_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( this: *mut ffi::GstBaseSrc, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<BaseSrc>, { let f: &F = &*(f as *const F); f(&BaseSrc::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::typefind\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_typefind_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } }