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 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742
// 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 crate::AudioInfo; use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use std::boxed::Box as Box_; use std::mem::transmute; glib::wrapper! { /// This base class is for audio encoders turning raw audio samples into /// encoded audio data. /// /// GstAudioEncoder and subclass should cooperate as follows. /// /// ## Configuration /// /// * Initially, GstAudioEncoder calls `start` when the encoder element /// is activated, which allows subclass to perform any global setup. /// /// * GstAudioEncoder calls `set_format` to inform subclass of the format /// of input audio data that it is about to receive. Subclass should /// setup for encoding and configure various base class parameters /// appropriately, notably those directing desired input data handling. /// While unlikely, it might be called more than once, if changing input /// parameters require reconfiguration. /// /// * GstAudioEncoder calls `stop` at end of all processing. /// /// As of configuration stage, and throughout processing, GstAudioEncoder /// maintains various parameters that provide required context, /// e.g. describing the format of input audio data. /// Conversely, subclass can and should configure these context parameters /// to inform base class of its expectation w.r.t. buffer handling. /// /// ## Data processing /// /// * Base class gathers input sample data (as directed by the context's /// frame_samples and frame_max) and provides this to subclass' `handle_frame`. /// * If codec processing results in encoded data, subclass should call /// [`Self::finish_frame()`] to have encoded data pushed /// downstream. Alternatively, it might also call /// [`Self::finish_frame()`] (with a NULL buffer and some number of /// dropped samples) to indicate dropped (non-encoded) samples. /// * Just prior to actually pushing a buffer downstream, /// it is passed to `pre_push`. /// * During the parsing process GstAudioEncoderClass will handle both /// srcpad and sinkpad events. Sink events will be passed to subclass /// if `event` callback has been provided. /// /// ## Shutdown phase /// /// * GstAudioEncoder class calls `stop` to inform the subclass that data /// parsing will be stopped. /// /// Subclass is responsible for providing pad template caps for /// source and sink pads. The pads need to be named "sink" and "src". It also /// needs to set the fixed caps on srcpad, when the format is ensured. This /// is typically when base class calls subclass' `set_format` function, though /// it might be delayed until calling [`Self::finish_frame`]. /// /// In summary, above process should have subclass concentrating on /// codec data processing while leaving other matters to base class, /// such as most notably timestamp handling. While it may exert more control /// in this area (see e.g. `pre_push`), it is very much not recommended. /// /// In particular, base class will either favor tracking upstream timestamps /// (at the possible expense of jitter) or aim to arrange for a perfect stream of /// output timestamps, depending on [`crate::AudioEncoder:perfect-timestamp`]. /// However, in the latter case, the input may not be so perfect or ideal, which /// is handled as follows. An input timestamp is compared with the expected /// timestamp as dictated by input sample stream and if the deviation is less /// than [`crate::AudioEncoder:tolerance`], the deviation is discarded. /// Otherwise, it is considered a discontuinity and subsequent output timestamp /// is resynced to the new position after performing configured discontinuity /// processing. In the non-perfect-timestamp case, an upstream variation /// exceeding tolerance only leads to marking DISCONT on subsequent outgoing /// (while timestamps are adjusted to upstream regardless of variation). /// While DISCONT is also marked in the perfect-timestamp case, this one /// optionally (see [`crate::AudioEncoder:hard-resync`]) /// performs some additional steps, such as clipping of (early) input samples /// or draining all currently remaining input data, depending on the direction /// of the discontuinity. /// /// If perfect timestamps are arranged, it is also possible to request baseclass /// (usually set by subclass) to provide additional buffer metadata (in OFFSET /// and OFFSET_END) fields according to granule defined semantics currently /// needed by oggmux. Specifically, OFFSET is set to granulepos (= sample count /// including buffer) and OFFSET_END to corresponding timestamp (as determined /// by same sample count and sample rate). /// /// Things that subclass need to take care of: /// /// * Provide pad templates /// * Set source pad caps when appropriate /// * Inform base class of buffer processing needs using context's /// frame_samples and frame_bytes. /// * Set user-configurable properties to sane defaults for format and /// implementing codec at hand, e.g. those controlling timestamp behaviour /// and discontinuity processing. /// * Accept data in `handle_frame` and provide encoded results to /// [`Self::finish_frame()`]. /// /// This is an Abstract Base Class, you cannot instantiate it. /// /// # Implements /// /// [`trait@crate::prelude::AudioEncoderExt`], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::GstObjectExt`], [`trait@glib::object::ObjectExt`], [`trait@crate::prelude::AudioEncoderExtManual`] pub struct AudioEncoder(Object<ffi::GstAudioEncoder, ffi::GstAudioEncoderClass>) @extends gst::Element, gst::Object; match fn { type_ => || ffi::gst_audio_encoder_get_type(), } } unsafe impl Send for AudioEncoder {} unsafe impl Sync for AudioEncoder {} pub const NONE_AUDIO_ENCODER: Option<&AudioEncoder> = None; /// Trait containing all `AudioEncoder` methods. /// /// # Implementors /// /// [`struct@crate::AudioEncoder`] pub trait AudioEncoderExt: 'static { /// Helper function that allocates a buffer to hold an encoded audio frame /// for `self`'s current output format. /// ## `size` /// size of the buffer /// /// # Returns /// /// allocated buffer #[doc(alias = "gst_audio_encoder_allocate_output_buffer")] fn allocate_output_buffer(&self, size: usize) -> Result<gst::Buffer, glib::BoolError>; /// /// # Returns /// /// a [`crate::AudioInfo`] describing the input audio format #[doc(alias = "gst_audio_encoder_get_audio_info")] #[doc(alias = "get_audio_info")] fn audio_info(&self) -> Option<AudioInfo>; /// Queries encoder drain handling. /// /// # Returns /// /// TRUE if drainable handling is enabled. /// /// MT safe. #[doc(alias = "gst_audio_encoder_get_drainable")] #[doc(alias = "get_drainable")] fn is_drainable(&self) -> bool; /// /// # Returns /// /// currently configured maximum handled frames #[doc(alias = "gst_audio_encoder_get_frame_max")] #[doc(alias = "get_frame_max")] fn frame_max(&self) -> i32; /// /// # Returns /// /// currently maximum requested samples per frame #[doc(alias = "gst_audio_encoder_get_frame_samples_max")] #[doc(alias = "get_frame_samples_max")] fn frame_samples_max(&self) -> i32; /// /// # Returns /// /// currently minimum requested samples per frame #[doc(alias = "gst_audio_encoder_get_frame_samples_min")] #[doc(alias = "get_frame_samples_min")] fn frame_samples_min(&self) -> i32; /// Queries encoder hard minimum handling. /// /// # Returns /// /// TRUE if hard minimum handling is enabled. /// /// MT safe. #[doc(alias = "gst_audio_encoder_get_hard_min")] #[doc(alias = "get_hard_min")] fn is_hard_min(&self) -> bool; #[doc(alias = "gst_audio_encoder_get_hard_resync")] #[doc(alias = "get_hard_resync")] fn is_hard_resync(&self) -> bool; /// /// # Returns /// /// currently configured encoder lookahead #[doc(alias = "gst_audio_encoder_get_lookahead")] #[doc(alias = "get_lookahead")] fn lookahead(&self) -> i32; /// Queries if the encoder will handle granule marking. /// /// # Returns /// /// TRUE if granule marking is enabled. /// /// MT safe. #[doc(alias = "gst_audio_encoder_get_mark_granule")] #[doc(alias = "get_mark_granule")] fn is_mark_granule(&self) -> bool; /// Queries encoder perfect timestamp behaviour. /// /// # Returns /// /// TRUE if perfect timestamp setting enabled. /// /// MT safe. #[doc(alias = "gst_audio_encoder_get_perfect_timestamp")] #[doc(alias = "get_perfect_timestamp")] fn is_perfect_timestamp(&self) -> bool; /// Queries current audio jitter tolerance threshold. /// /// # Returns /// /// encoder audio jitter tolerance threshold. /// /// MT safe. #[doc(alias = "gst_audio_encoder_get_tolerance")] #[doc(alias = "get_tolerance")] fn tolerance(&self) -> gst::ClockTime; /// Sets the audio encoder tags and how they should be merged with any /// upstream stream tags. This will override any tags previously-set /// with [`Self::merge_tags()`]. /// /// Note that this is provided for convenience, and the subclass is /// not required to use this and can still do tag handling on its own. /// /// MT safe. /// ## `tags` /// a [`crate::gst::TagList`] to merge, or NULL to unset /// previously-set tags /// ## `mode` /// the [`crate::gst::TagMergeMode`] to use, usually [`crate::gst::TagMergeMode::Replace`] #[doc(alias = "gst_audio_encoder_merge_tags")] fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode); /// Returns caps that express `caps` (or sink template caps if `caps` == NULL) /// restricted to channel/rate combinations supported by downstream elements /// (e.g. muxers). /// ## `caps` /// initial caps /// ## `filter` /// filter caps /// /// # Returns /// /// a [`crate::gst::Caps`] owned by caller #[doc(alias = "gst_audio_encoder_proxy_getcaps")] fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps; /// Sets a caps in allocation query which are different from the set /// pad's caps. Use this function before calling /// [`crate::AudioEncoder::negotiate()`]. Setting to [`None`] the allocation /// query will use the caps from the pad. /// ## `allocation_caps` /// a [`crate::gst::Caps`] or [`None`] #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] #[doc(alias = "gst_audio_encoder_set_allocation_caps")] fn set_allocation_caps(&self, allocation_caps: Option<&gst::Caps>); /// Configures encoder drain handling. If drainable, subclass might /// be handed a NULL buffer to have it return any leftover encoded data. /// Otherwise, it is not considered so capable and will only ever be passed /// real data. /// /// MT safe. /// ## `enabled` /// new state #[doc(alias = "gst_audio_encoder_set_drainable")] fn set_drainable(&self, enabled: bool); /// Sets max number of frames accepted at once (assumed minimally 1). /// Requires `frame_samples_min` and `frame_samples_max` to be the equal. /// /// Note: This value will be reset to 0 every time before /// [`crate::GstAudioEncoderClass.set_format()`] is called. /// ## `num` /// number of frames #[doc(alias = "gst_audio_encoder_set_frame_max")] fn set_frame_max(&self, num: i32); /// Sets number of samples (per channel) subclass needs to be handed, /// at most or will be handed all available if 0. /// /// If an exact number of samples is required, [`Self::set_frame_samples_min()`] /// must be called with the same number. /// /// Note: This value will be reset to 0 every time before /// [`crate::GstAudioEncoderClass.set_format()`] is called. /// ## `num` /// number of samples per frame #[doc(alias = "gst_audio_encoder_set_frame_samples_max")] fn set_frame_samples_max(&self, num: i32); /// Sets number of samples (per channel) subclass needs to be handed, /// at least or will be handed all available if 0. /// /// If an exact number of samples is required, [`Self::set_frame_samples_max()`] /// must be called with the same number. /// /// Note: This value will be reset to 0 every time before /// [`crate::GstAudioEncoderClass.set_format()`] is called. /// ## `num` /// number of samples per frame #[doc(alias = "gst_audio_encoder_set_frame_samples_min")] fn set_frame_samples_min(&self, num: i32); /// Configures encoder hard minimum handling. If enabled, subclass /// will never be handed less samples than it configured, which otherwise /// might occur near end-of-data handling. Instead, the leftover samples /// will simply be discarded. /// /// MT safe. /// ## `enabled` /// new state #[doc(alias = "gst_audio_encoder_set_hard_min")] fn set_hard_min(&self, enabled: bool); #[doc(alias = "gst_audio_encoder_set_hard_resync")] fn set_hard_resync(&self, enabled: bool); /// Set the codec headers to be sent downstream whenever requested. /// ## `headers` /// a list of /// [`crate::gst::Buffer`] containing the codec header #[doc(alias = "gst_audio_encoder_set_headers")] fn set_headers(&self, headers: &[&gst::Buffer]); /// Sets encoder latency. /// ## `min` /// minimum latency /// ## `max` /// maximum latency #[doc(alias = "gst_audio_encoder_set_latency")] fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime); /// Sets encoder lookahead (in units of input rate samples) /// /// Note: This value will be reset to 0 every time before /// [`crate::GstAudioEncoderClass.set_format()`] is called. /// ## `num` /// lookahead #[doc(alias = "gst_audio_encoder_set_lookahead")] fn set_lookahead(&self, num: i32); /// Enable or disable encoder granule handling. /// /// MT safe. /// ## `enabled` /// new state #[doc(alias = "gst_audio_encoder_set_mark_granule")] fn set_mark_granule(&self, enabled: bool); /// Enable or disable encoder perfect output timestamp preference. /// /// MT safe. /// ## `enabled` /// new state #[doc(alias = "gst_audio_encoder_set_perfect_timestamp")] fn set_perfect_timestamp(&self, enabled: bool); /// Configures encoder audio jitter tolerance threshold. /// /// MT safe. /// ## `tolerance` /// new tolerance #[doc(alias = "gst_audio_encoder_set_tolerance")] fn set_tolerance(&self, tolerance: gst::ClockTime); #[doc(alias = "hard-resync")] fn connect_hard_resync_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "mark-granule")] fn connect_mark_granule_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "perfect-timestamp")] fn connect_perfect_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; #[doc(alias = "tolerance")] fn connect_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId; } impl<O: IsA<AudioEncoder>> AudioEncoderExt for O { fn allocate_output_buffer(&self, size: usize) -> Result<gst::Buffer, glib::BoolError> { unsafe { Option::<_>::from_glib_full(ffi::gst_audio_encoder_allocate_output_buffer( self.as_ref().to_glib_none().0, size, )) .ok_or_else(|| glib::bool_error!("Failed to allocate output buffer")) } } fn audio_info(&self) -> Option<AudioInfo> { unsafe { from_glib_full(ffi::gst_audio_encoder_get_audio_info( self.as_ref().to_glib_none().0, )) } } fn is_drainable(&self) -> bool { unsafe { from_glib(ffi::gst_audio_encoder_get_drainable( self.as_ref().to_glib_none().0, )) } } fn frame_max(&self) -> i32 { unsafe { ffi::gst_audio_encoder_get_frame_max(self.as_ref().to_glib_none().0) } } fn frame_samples_max(&self) -> i32 { unsafe { ffi::gst_audio_encoder_get_frame_samples_max(self.as_ref().to_glib_none().0) } } fn frame_samples_min(&self) -> i32 { unsafe { ffi::gst_audio_encoder_get_frame_samples_min(self.as_ref().to_glib_none().0) } } fn is_hard_min(&self) -> bool { unsafe { from_glib(ffi::gst_audio_encoder_get_hard_min( self.as_ref().to_glib_none().0, )) } } fn is_hard_resync(&self) -> bool { unsafe { from_glib(ffi::gst_audio_encoder_get_hard_resync( self.as_ref().to_glib_none().0, )) } } fn lookahead(&self) -> i32 { unsafe { ffi::gst_audio_encoder_get_lookahead(self.as_ref().to_glib_none().0) } } fn is_mark_granule(&self) -> bool { unsafe { from_glib(ffi::gst_audio_encoder_get_mark_granule( self.as_ref().to_glib_none().0, )) } } fn is_perfect_timestamp(&self) -> bool { unsafe { from_glib(ffi::gst_audio_encoder_get_perfect_timestamp( self.as_ref().to_glib_none().0, )) } } fn tolerance(&self) -> gst::ClockTime { unsafe { from_glib(ffi::gst_audio_encoder_get_tolerance( self.as_ref().to_glib_none().0, )) } } fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) { unsafe { ffi::gst_audio_encoder_merge_tags( self.as_ref().to_glib_none().0, tags.to_glib_none().0, mode.into_glib(), ); } } fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps { unsafe { from_glib_full(ffi::gst_audio_encoder_proxy_getcaps( self.as_ref().to_glib_none().0, caps.to_glib_none().0, filter.to_glib_none().0, )) } } #[cfg(any(feature = "v1_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))] fn set_allocation_caps(&self, allocation_caps: Option<&gst::Caps>) { unsafe { ffi::gst_audio_encoder_set_allocation_caps( self.as_ref().to_glib_none().0, allocation_caps.to_glib_none().0, ); } } fn set_drainable(&self, enabled: bool) { unsafe { ffi::gst_audio_encoder_set_drainable( self.as_ref().to_glib_none().0, enabled.into_glib(), ); } } fn set_frame_max(&self, num: i32) { unsafe { ffi::gst_audio_encoder_set_frame_max(self.as_ref().to_glib_none().0, num); } } fn set_frame_samples_max(&self, num: i32) { unsafe { ffi::gst_audio_encoder_set_frame_samples_max(self.as_ref().to_glib_none().0, num); } } fn set_frame_samples_min(&self, num: i32) { unsafe { ffi::gst_audio_encoder_set_frame_samples_min(self.as_ref().to_glib_none().0, num); } } fn set_hard_min(&self, enabled: bool) { unsafe { ffi::gst_audio_encoder_set_hard_min( self.as_ref().to_glib_none().0, enabled.into_glib(), ); } } fn set_hard_resync(&self, enabled: bool) { unsafe { ffi::gst_audio_encoder_set_hard_resync( self.as_ref().to_glib_none().0, enabled.into_glib(), ); } } fn set_headers(&self, headers: &[&gst::Buffer]) { unsafe { ffi::gst_audio_encoder_set_headers( self.as_ref().to_glib_none().0, headers.to_glib_full(), ); } } fn set_latency(&self, min: gst::ClockTime, max: gst::ClockTime) { unsafe { ffi::gst_audio_encoder_set_latency( self.as_ref().to_glib_none().0, min.into_glib(), max.into_glib(), ); } } fn set_lookahead(&self, num: i32) { unsafe { ffi::gst_audio_encoder_set_lookahead(self.as_ref().to_glib_none().0, num); } } fn set_mark_granule(&self, enabled: bool) { unsafe { ffi::gst_audio_encoder_set_mark_granule( self.as_ref().to_glib_none().0, enabled.into_glib(), ); } } fn set_perfect_timestamp(&self, enabled: bool) { unsafe { ffi::gst_audio_encoder_set_perfect_timestamp( self.as_ref().to_glib_none().0, enabled.into_glib(), ); } } fn set_tolerance(&self, tolerance: gst::ClockTime) { unsafe { ffi::gst_audio_encoder_set_tolerance( self.as_ref().to_glib_none().0, tolerance.into_glib(), ); } } #[doc(alias = "hard-resync")] fn connect_hard_resync_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_hard_resync_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( this: *mut ffi::GstAudioEncoder, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<AudioEncoder>, { let f: &F = &*(f as *const F); f(&AudioEncoder::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::hard-resync\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_hard_resync_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "mark-granule")] fn connect_mark_granule_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_mark_granule_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( this: *mut ffi::GstAudioEncoder, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<AudioEncoder>, { let f: &F = &*(f as *const F); f(&AudioEncoder::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::mark-granule\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_mark_granule_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "perfect-timestamp")] fn connect_perfect_timestamp_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_perfect_timestamp_trampoline< P, F: Fn(&P) + Send + Sync + 'static, >( this: *mut ffi::GstAudioEncoder, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<AudioEncoder>, { let f: &F = &*(f as *const F); f(&AudioEncoder::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::perfect-timestamp\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_perfect_timestamp_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } #[doc(alias = "tolerance")] fn connect_tolerance_notify<F: Fn(&Self) + Send + Sync + 'static>( &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_tolerance_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( this: *mut ffi::GstAudioEncoder, _param_spec: glib::ffi::gpointer, f: glib::ffi::gpointer, ) where P: IsA<AudioEncoder>, { let f: &F = &*(f as *const F); f(&AudioEncoder::from_glib_borrow(this).unsafe_cast_ref()) } unsafe { let f: Box_<F> = Box_::new(f); connect_raw( self.as_ptr() as *mut _, b"notify::tolerance\0".as_ptr() as *const _, Some(transmute::<_, unsafe extern "C" fn()>( notify_tolerance_trampoline::<Self, F> as *const (), )), Box_::into_raw(f), ) } } }