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 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785
// 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::{ffi, AudioInfo};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// This base class is for audio decoders turning encoded data into
/// raw audio samples.
///
/// GstAudioDecoder and subclass should cooperate as follows.
///
/// ## Configuration
///
/// * Initially, GstAudioDecoder calls `start` when the decoder element
/// is activated, which allows subclass to perform any global setup.
/// Base class (context) parameters can already be set according to subclass
/// capabilities (or possibly upon receive more information in subsequent
/// `set_format`).
/// * GstAudioDecoder calls `set_format` to inform subclass of the format
/// of input audio data that it is about to receive.
/// While unlikely, it might be called more than once, if changing input
/// parameters require reconfiguration.
/// * GstAudioDecoder calls `stop` at end of all processing.
///
/// As of configuration stage, and throughout processing, GstAudioDecoder
/// provides various (context) parameters, e.g. describing the format of
/// output audio data (valid when output caps have been set) or current parsing state.
/// Conversely, subclass can and should configure context to inform
/// base class of its expectation w.r.t. buffer handling.
///
/// ## Data processing
/// * Base class gathers input data, and optionally allows subclass
/// to parse this into subsequently manageable (as defined by subclass)
/// chunks. Such chunks are subsequently referred to as 'frames',
/// though they may or may not correspond to 1 (or more) audio format frame.
/// * Input frame is provided to subclass' `handle_frame`.
/// * If codec processing results in decoded data, subclass should call
/// [`AudioDecoderExt::finish_frame()`][crate::prelude::AudioDecoderExt::finish_frame()] to have decoded data pushed
/// downstream.
/// * Just prior to actually pushing a buffer downstream,
/// it is passed to `pre_push`. Subclass should either use this callback
/// to arrange for additional downstream pushing or otherwise ensure such
/// custom pushing occurs after at least a method call has finished since
/// setting src pad caps.
/// * During the parsing process GstAudioDecoderClass will handle both
/// srcpad and sinkpad events. Sink events will be passed to subclass
/// if `event` callback has been provided.
///
/// ## Shutdown phase
///
/// * GstAudioDecoder 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 [`AudioDecoderExt::finish_frame()`][crate::prelude::AudioDecoderExt::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 try to arrange for perfect output timestamps
/// as much as possible while tracking upstream timestamps.
/// To this end, if deviation between the next ideal expected perfect timestamp
/// and upstream exceeds [`tolerance`][struct@crate::AudioDecoder#tolerance], then resync to upstream
/// occurs (which would happen always if the tolerance mechanism is disabled).
///
/// In non-live pipelines, baseclass can also (configurably) arrange for
/// output buffer aggregation which may help to redue large(r) numbers of
/// small(er) buffers being pushed and processed downstream. Note that this
/// feature is only available if the buffer layout is interleaved. For planar
/// buffers, the decoder implementation is fully responsible for the output
/// buffer size.
///
/// On the other hand, it should be noted that baseclass only provides limited
/// seeking support (upon explicit subclass request), as full-fledged support
/// should rather be left to upstream demuxer, parser or alike. This simple
/// approach caters for seeking and duration reporting using estimated input
/// bitrates.
///
/// Things that subclass need to take care of:
///
/// * Provide pad templates
/// * Set source pad caps when appropriate
/// * Set user-configurable properties to sane defaults for format and
/// implementing codec at hand, and convey some subclass capabilities and
/// expectations in context.
///
/// * Accept data in `handle_frame` and provide encoded results to
/// [`AudioDecoderExt::finish_frame()`][crate::prelude::AudioDecoderExt::finish_frame()]. If it is prepared to perform
/// PLC, it should also accept NULL data in `handle_frame` and provide for
/// data for indicated duration.
///
/// This is an Abstract Base Class, you cannot instantiate it.
///
/// ## Properties
///
///
/// #### `max-errors`
/// Maximum number of tolerated consecutive decode errors. See
/// [`AudioDecoderExt::set_max_errors()`][crate::prelude::AudioDecoderExt::set_max_errors()] for more details.
///
/// Readable | Writeable
///
///
/// #### `min-latency`
/// Readable | Writeable
///
///
/// #### `plc`
/// Readable | Writeable
///
///
/// #### `tolerance`
/// Readable | Writeable
/// <details><summary><h4>Object</h4></summary>
///
///
/// #### `name`
/// Readable | Writeable | Construct
///
///
/// #### `parent`
/// The parent of the object. Please note, that when changing the 'parent'
/// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
/// signals due to locking issues. In some cases one can use
/// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
/// achieve a similar effect.
///
/// Readable | Writeable
/// </details>
///
/// # Implements
///
/// [`AudioDecoderExt`][trait@crate::prelude::AudioDecoderExt], [`trait@gst::prelude::ElementExt`], [`trait@gst::prelude::GstObjectExt`], [`trait@glib::ObjectExt`], [`AudioDecoderExtManual`][trait@crate::prelude::AudioDecoderExtManual]
#[doc(alias = "GstAudioDecoder")]
pub struct AudioDecoder(Object<ffi::GstAudioDecoder, ffi::GstAudioDecoderClass>) @extends gst::Element, gst::Object;
match fn {
type_ => || ffi::gst_audio_decoder_get_type(),
}
}
impl AudioDecoder {
pub const NONE: Option<&'static AudioDecoder> = None;
}
unsafe impl Send for AudioDecoder {}
unsafe impl Sync for AudioDecoder {}
mod sealed {
pub trait Sealed {}
impl<T: super::IsA<super::AudioDecoder>> Sealed for T {}
}
/// Trait containing all [`struct@AudioDecoder`] methods.
///
/// # Implementors
///
/// [`AudioDecoder`][struct@crate::AudioDecoder]
pub trait AudioDecoderExt: IsA<AudioDecoder> + sealed::Sealed + 'static {
/// Helper function that allocates a buffer to hold an audio frame
/// for `self`'s current output format.
/// ## `size`
/// size of the buffer
///
/// # Returns
///
/// allocated buffer
#[doc(alias = "gst_audio_decoder_allocate_output_buffer")]
fn allocate_output_buffer(&self, size: usize) -> gst::Buffer {
unsafe {
from_glib_full(ffi::gst_audio_decoder_allocate_output_buffer(
self.as_ref().to_glib_none().0,
size,
))
}
}
/// Collects decoded data and pushes it downstream.
///
/// `buf` may be NULL in which case the indicated number of frames
/// are discarded and considered to have produced no output
/// (e.g. lead-in or setup frames).
/// Otherwise, source pad caps must be set when it is called with valid
/// data in `buf`.
///
/// Note that a frame received in `GstAudioDecoderClass.handle_frame()` may be
/// invalidated by a call to this function.
/// ## `buf`
/// decoded data
/// ## `frames`
/// number of decoded frames represented by decoded data
///
/// # Returns
///
/// a [`gst::FlowReturn`][crate::gst::FlowReturn] that should be escalated to caller (of caller)
#[doc(alias = "gst_audio_decoder_finish_frame")]
fn finish_frame(
&self,
buf: Option<gst::Buffer>,
frames: i32,
) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
try_from_glib(ffi::gst_audio_decoder_finish_frame(
self.as_ref().to_glib_none().0,
buf.into_glib_ptr(),
frames,
))
}
}
/// Collects decoded data and pushes it downstream. This function may be called
/// multiple times for a given input frame.
///
/// `buf` may be NULL in which case it is assumed that the current input frame is
/// finished. This is equivalent to calling [`finish_subframe()`][Self::finish_subframe()]
/// with a NULL buffer and frames=1 after having pushed out all decoded audio
/// subframes using this function.
///
/// When called with valid data in `buf` the source pad caps must have been set
/// already.
///
/// Note that a frame received in `GstAudioDecoderClass.handle_frame()` may be
/// invalidated by a call to this function.
/// ## `buf`
/// decoded data
///
/// # Returns
///
/// a [`gst::FlowReturn`][crate::gst::FlowReturn] that should be escalated to caller (of caller)
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
#[doc(alias = "gst_audio_decoder_finish_subframe")]
fn finish_subframe(
&self,
buf: Option<gst::Buffer>,
) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe {
try_from_glib(ffi::gst_audio_decoder_finish_subframe(
self.as_ref().to_glib_none().0,
buf.into_glib_ptr(),
))
}
}
///
/// # Returns
///
/// a [`AudioInfo`][crate::AudioInfo] describing the input audio format
#[doc(alias = "gst_audio_decoder_get_audio_info")]
#[doc(alias = "get_audio_info")]
fn audio_info(&self) -> AudioInfo {
unsafe {
from_glib_none(ffi::gst_audio_decoder_get_audio_info(
self.as_ref().to_glib_none().0,
))
}
}
///
/// # Returns
///
/// currently configured decoder delay
#[doc(alias = "gst_audio_decoder_get_delay")]
#[doc(alias = "get_delay")]
fn delay(&self) -> i32 {
unsafe { ffi::gst_audio_decoder_get_delay(self.as_ref().to_glib_none().0) }
}
/// Queries decoder drain handling.
///
/// # Returns
///
/// TRUE if drainable handling is enabled.
///
/// MT safe.
#[doc(alias = "gst_audio_decoder_get_drainable")]
#[doc(alias = "get_drainable")]
fn is_drainable(&self) -> bool {
unsafe {
from_glib(ffi::gst_audio_decoder_get_drainable(
self.as_ref().to_glib_none().0,
))
}
}
///
/// # Returns
///
/// currently configured byte to time conversion setting
#[doc(alias = "gst_audio_decoder_get_estimate_rate")]
#[doc(alias = "get_estimate_rate")]
fn estimate_rate(&self) -> i32 {
unsafe { ffi::gst_audio_decoder_get_estimate_rate(self.as_ref().to_glib_none().0) }
}
/// Sets the variables pointed to by `min` and `max` to the currently configured
/// latency.
///
/// # Returns
///
///
/// ## `min`
/// a pointer to storage to hold minimum latency
///
/// ## `max`
/// a pointer to storage to hold maximum latency
#[doc(alias = "gst_audio_decoder_get_latency")]
#[doc(alias = "get_latency")]
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>) {
unsafe {
let mut min = std::mem::MaybeUninit::uninit();
let mut max = std::mem::MaybeUninit::uninit();
ffi::gst_audio_decoder_get_latency(
self.as_ref().to_glib_none().0,
min.as_mut_ptr(),
max.as_mut_ptr(),
);
(
try_from_glib(min.assume_init()).expect("mandatory glib value is None"),
from_glib(max.assume_init()),
)
}
}
///
/// # Returns
///
/// currently configured decoder tolerated error count.
#[doc(alias = "gst_audio_decoder_get_max_errors")]
#[doc(alias = "get_max_errors")]
#[doc(alias = "max-errors")]
fn max_errors(&self) -> i32 {
unsafe { ffi::gst_audio_decoder_get_max_errors(self.as_ref().to_glib_none().0) }
}
/// Queries decoder's latency aggregation.
///
/// # Returns
///
/// aggregation latency.
///
/// MT safe.
#[doc(alias = "gst_audio_decoder_get_min_latency")]
#[doc(alias = "get_min_latency")]
#[doc(alias = "min-latency")]
fn min_latency(&self) -> gst::ClockTime {
unsafe {
try_from_glib(ffi::gst_audio_decoder_get_min_latency(
self.as_ref().to_glib_none().0,
))
.expect("mandatory glib value is None")
}
}
/// Queries decoder required format handling.
///
/// # Returns
///
/// TRUE if required format handling is enabled.
///
/// MT safe.
#[doc(alias = "gst_audio_decoder_get_needs_format")]
#[doc(alias = "get_needs_format")]
fn needs_format(&self) -> bool {
unsafe {
from_glib(ffi::gst_audio_decoder_get_needs_format(
self.as_ref().to_glib_none().0,
))
}
}
/// Return current parsing (sync and eos) state.
///
/// # Returns
///
///
/// ## `sync`
/// a pointer to a variable to hold the current sync state
///
/// ## `eos`
/// a pointer to a variable to hold the current eos state
#[doc(alias = "gst_audio_decoder_get_parse_state")]
#[doc(alias = "get_parse_state")]
fn parse_state(&self) -> (bool, bool) {
unsafe {
let mut sync = std::mem::MaybeUninit::uninit();
let mut eos = std::mem::MaybeUninit::uninit();
ffi::gst_audio_decoder_get_parse_state(
self.as_ref().to_glib_none().0,
sync.as_mut_ptr(),
eos.as_mut_ptr(),
);
(from_glib(sync.assume_init()), from_glib(eos.assume_init()))
}
}
/// Queries decoder packet loss concealment handling.
///
/// # Returns
///
/// TRUE if packet loss concealment is enabled.
///
/// MT safe.
#[doc(alias = "gst_audio_decoder_get_plc")]
#[doc(alias = "get_plc")]
#[doc(alias = "plc")]
fn is_plc(&self) -> bool {
unsafe {
from_glib(ffi::gst_audio_decoder_get_plc(
self.as_ref().to_glib_none().0,
))
}
}
///
/// # Returns
///
/// currently configured plc handling
#[doc(alias = "gst_audio_decoder_get_plc_aware")]
#[doc(alias = "get_plc_aware")]
fn plc_aware(&self) -> i32 {
unsafe { ffi::gst_audio_decoder_get_plc_aware(self.as_ref().to_glib_none().0) }
}
/// Queries current audio jitter tolerance threshold.
///
/// # Returns
///
/// decoder audio jitter tolerance threshold.
///
/// MT safe.
#[doc(alias = "gst_audio_decoder_get_tolerance")]
#[doc(alias = "get_tolerance")]
fn tolerance(&self) -> gst::ClockTime {
unsafe {
try_from_glib(ffi::gst_audio_decoder_get_tolerance(
self.as_ref().to_glib_none().0,
))
.expect("mandatory glib value is None")
}
}
/// Sets the audio decoder tags and how they should be merged with any
/// upstream stream tags. This will override any tags previously-set
/// with [`merge_tags()`][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.
/// ## `tags`
/// a [`gst::TagList`][crate::gst::TagList] to merge, or NULL
/// ## `mode`
/// the [`gst::TagMergeMode`][crate::gst::TagMergeMode] to use, usually [`gst::TagMergeMode::Replace`][crate::gst::TagMergeMode::Replace]
#[doc(alias = "gst_audio_decoder_merge_tags")]
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) {
unsafe {
ffi::gst_audio_decoder_merge_tags(
self.as_ref().to_glib_none().0,
tags.to_glib_none().0,
mode.into_glib(),
);
}
}
/// Returns caps that express `caps` (or sink template caps if `caps` == NULL)
/// restricted to rate/channels/... combinations supported by downstream
/// elements.
/// ## `caps`
/// initial caps
/// ## `filter`
/// filter caps
///
/// # Returns
///
/// a [`gst::Caps`][crate::gst::Caps] owned by caller
#[doc(alias = "gst_audio_decoder_proxy_getcaps")]
fn proxy_getcaps(&self, caps: Option<&gst::Caps>, filter: Option<&gst::Caps>) -> gst::Caps {
unsafe {
from_glib_full(ffi::gst_audio_decoder_proxy_getcaps(
self.as_ref().to_glib_none().0,
caps.to_glib_none().0,
filter.to_glib_none().0,
))
}
}
/// Sets a caps in allocation query which are different from the set
/// pad's caps. Use this function before calling
/// [`AudioDecoderExtManual::negotiate()`][crate::prelude::AudioDecoderExtManual::negotiate()]. Setting to [`None`] the allocation
/// query will use the caps from the pad.
/// ## `allocation_caps`
/// a [`gst::Caps`][crate::gst::Caps] or [`None`]
#[doc(alias = "gst_audio_decoder_set_allocation_caps")]
fn set_allocation_caps(&self, allocation_caps: Option<&gst::Caps>) {
unsafe {
ffi::gst_audio_decoder_set_allocation_caps(
self.as_ref().to_glib_none().0,
allocation_caps.to_glib_none().0,
);
}
}
/// Configures decoder drain handling. If drainable, subclass might
/// be handed a NULL buffer to have it return any leftover decoded 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_decoder_set_drainable")]
fn set_drainable(&self, enabled: bool) {
unsafe {
ffi::gst_audio_decoder_set_drainable(
self.as_ref().to_glib_none().0,
enabled.into_glib(),
);
}
}
/// Allows baseclass to perform byte to time estimated conversion.
/// ## `enabled`
/// whether to enable byte to time conversion
#[doc(alias = "gst_audio_decoder_set_estimate_rate")]
fn set_estimate_rate(&self, enabled: bool) {
unsafe {
ffi::gst_audio_decoder_set_estimate_rate(
self.as_ref().to_glib_none().0,
enabled.into_glib(),
);
}
}
/// Sets decoder latency. If the provided values changed from
/// previously provided ones, this will also post a LATENCY message on the bus
/// so the pipeline can reconfigure its global latency.
/// ## `min`
/// minimum latency
/// ## `max`
/// maximum latency
#[doc(alias = "gst_audio_decoder_set_latency")]
fn set_latency(&self, min: gst::ClockTime, max: impl Into<Option<gst::ClockTime>>) {
unsafe {
ffi::gst_audio_decoder_set_latency(
self.as_ref().to_glib_none().0,
min.into_glib(),
max.into().into_glib(),
);
}
}
/// Sets numbers of tolerated decoder errors, where a tolerated one is then only
/// warned about, but more than tolerated will lead to fatal error. You can set
/// -1 for never returning fatal errors. Default is set to
/// GST_AUDIO_DECODER_MAX_ERRORS.
/// ## `num`
/// max tolerated errors
#[doc(alias = "gst_audio_decoder_set_max_errors")]
#[doc(alias = "max-errors")]
fn set_max_errors(&self, num: i32) {
unsafe {
ffi::gst_audio_decoder_set_max_errors(self.as_ref().to_glib_none().0, num);
}
}
/// Sets decoder minimum aggregation latency.
///
/// MT safe.
/// ## `num`
/// new minimum latency
#[doc(alias = "gst_audio_decoder_set_min_latency")]
#[doc(alias = "min-latency")]
fn set_min_latency(&self, num: gst::ClockTime) {
unsafe {
ffi::gst_audio_decoder_set_min_latency(self.as_ref().to_glib_none().0, num.into_glib());
}
}
/// Configures decoder format needs. If enabled, subclass needs to be
/// negotiated with format caps before it can process any data. It will then
/// never be handed any data before it has been configured.
/// Otherwise, it might be handed data without having been configured and
/// is then expected being able to do so either by default
/// or based on the input data.
///
/// MT safe.
/// ## `enabled`
/// new state
#[doc(alias = "gst_audio_decoder_set_needs_format")]
fn set_needs_format(&self, enabled: bool) {
unsafe {
ffi::gst_audio_decoder_set_needs_format(
self.as_ref().to_glib_none().0,
enabled.into_glib(),
);
}
}
/// Enable or disable decoder packet loss concealment, provided subclass
/// and codec are capable and allow handling plc.
///
/// MT safe.
/// ## `enabled`
/// new state
#[doc(alias = "gst_audio_decoder_set_plc")]
#[doc(alias = "plc")]
fn set_plc(&self, enabled: bool) {
unsafe {
ffi::gst_audio_decoder_set_plc(self.as_ref().to_glib_none().0, enabled.into_glib());
}
}
/// Indicates whether or not subclass handles packet loss concealment (plc).
/// ## `plc`
/// new plc state
#[doc(alias = "gst_audio_decoder_set_plc_aware")]
fn set_plc_aware(&self, plc: bool) {
unsafe {
ffi::gst_audio_decoder_set_plc_aware(self.as_ref().to_glib_none().0, plc.into_glib());
}
}
/// Configures decoder audio jitter tolerance threshold.
///
/// MT safe.
/// ## `tolerance`
/// new tolerance
#[doc(alias = "gst_audio_decoder_set_tolerance")]
#[doc(alias = "tolerance")]
fn set_tolerance(&self, tolerance: gst::ClockTime) {
unsafe {
ffi::gst_audio_decoder_set_tolerance(
self.as_ref().to_glib_none().0,
tolerance.into_glib(),
);
}
}
/// Lets [`AudioDecoder`][crate::AudioDecoder] sub-classes decide if they want the sink pad
/// to use the default pad query handler to reply to accept-caps queries.
///
/// By setting this to true it is possible to further customize the default
/// handler with `GST_PAD_SET_ACCEPT_INTERSECT` and
/// `GST_PAD_SET_ACCEPT_TEMPLATE`
/// ## `use_`
/// if the default pad accept-caps query handling should be used
#[doc(alias = "gst_audio_decoder_set_use_default_pad_acceptcaps")]
fn set_use_default_pad_acceptcaps(&self, use_: bool) {
unsafe {
ffi::gst_audio_decoder_set_use_default_pad_acceptcaps(
self.as_ref().to_glib_none().0,
use_.into_glib(),
);
}
}
#[cfg(feature = "v1_18")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_18")))]
#[doc(alias = "max-errors")]
fn connect_max_errors_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_max_errors_trampoline<
P: IsA<AudioDecoder>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstAudioDecoder,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(AudioDecoder::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::max-errors\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_max_errors_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "min-latency")]
fn connect_min_latency_notify<F: Fn(&Self) + Send + Sync + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn notify_min_latency_trampoline<
P: IsA<AudioDecoder>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstAudioDecoder,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(AudioDecoder::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::min-latency\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_min_latency_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "plc")]
fn connect_plc_notify<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_plc_trampoline<
P: IsA<AudioDecoder>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstAudioDecoder,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(AudioDecoder::from_glib_borrow(this).unsafe_cast_ref())
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::plc\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_plc_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: IsA<AudioDecoder>,
F: Fn(&P) + Send + Sync + 'static,
>(
this: *mut ffi::GstAudioDecoder,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(AudioDecoder::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(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_tolerance_trampoline::<Self, F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl<O: IsA<AudioDecoder>> AudioDecoderExt for O {}