Skip to main content

gstreamer_mse/auto/
source_buffer.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{SourceBufferAppendMode, ffi};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// The Source Buffer is the primary means of data flow between an application
17    /// and the Media Source API. It represents a single timeline of media,
18    /// containing some combination of audio, video, and text tracks.
19    /// An application is responsible for feeding raw data into the Source Buffer
20    /// using [`append_buffer()`][Self::append_buffer()] and the Source Buffer will
21    /// asynchronously process the data into tracks of time-coded multimedia samples.
22    ///
23    /// The application as well as the associated playback component can then select
24    /// to play media from any subset of tracks across all Source Buffers of a Media
25    /// Source.
26    ///
27    /// A few control points are also provided to customize the behavior.
28    ///
29    ///  - [`append-mode`][struct@crate::SourceBuffer#append-mode] controls how timestamps of processed samples are
30    ///  interpreted. They are either inserted in the timeline directly where the
31    ///  decoded media states they should, or inserted directly after the previously
32    ///  encountered sample.
33    ///
34    ///  - [`append-window-start`][struct@crate::SourceBuffer#append-window-start] / [`append-window-end`][struct@crate::SourceBuffer#append-window-end]
35    ///  control the planned time window where media from appended data can be added
36    ///  to the current timeline. Any samples outside that range may be ignored.
37    ///
38    ///  - [`timestamp-offset`][struct@crate::SourceBuffer#timestamp-offset] is added to the start time of any sample
39    ///  processed.
40    ///
41    /// ## Properties
42    ///
43    ///
44    /// #### `append-mode`
45    ///  Affects how timestamps of processed media segments are interpreted.
46    /// In [`SourceBufferAppendMode::Segments`][crate::SourceBufferAppendMode::Segments], the start timestamp of a
47    /// processed media segment is used directly along with
48    /// [`timestamp-offset`][struct@crate::SourceBuffer#timestamp-offset] .
49    /// In [`SourceBufferAppendMode::Sequence`][crate::SourceBufferAppendMode::Sequence], the timestamp of a
50    /// processed media segment is ignored and replaced with the end time of the
51    /// most recently appended segment.
52    ///
53    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-mode)
54    ///
55    /// Readable | Writeable
56    ///
57    ///
58    /// #### `append-window-end`
59    ///  Any segments processed which have a start time greater than this value will
60    /// be ignored by this Source Buffer.
61    ///
62    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-appendwindowend)
63    ///
64    /// Readable
65    ///
66    ///
67    /// #### `append-window-start`
68    ///  Any segments processed which end before this value will be ignored by this
69    /// Source Buffer.
70    ///
71    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-appendwindowstart)
72    ///
73    /// Readable
74    ///
75    ///
76    /// #### `buffered`
77    ///  The set of Time Intervals that have been loaded into the current Source
78    /// Buffer
79    ///
80    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-buffered)
81    ///
82    /// Readable
83    ///
84    ///
85    /// #### `content-type`
86    ///  The MIME content-type of the data stream
87    ///
88    /// Readable | Writeable | Construct
89    ///
90    ///
91    /// #### `timestamp-offset`
92    ///  The next media segment appended to the current Source Buffer will have its
93    /// start timestamp increased by this amount.
94    ///
95    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-timestampoffset)
96    ///
97    /// Readable | Writeable
98    ///
99    ///
100    /// #### `updating`
101    ///  Whether the current source buffer is still asynchronously processing
102    /// previously issued commands.
103    ///
104    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-updating)
105    ///
106    /// Readable
107    /// <details><summary><h4>Object</h4></summary>
108    ///
109    ///
110    /// #### `name`
111    ///  Readable | Writeable | Construct
112    ///
113    ///
114    /// #### `parent`
115    ///  The parent of the object. Please note, that when changing the 'parent'
116    /// property, we don't emit `GObject::notify` and [`deep-notify`][struct@crate::gst::Object#deep-notify]
117    /// signals due to locking issues. In some cases one can use
118    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
119    /// achieve a similar effect.
120    ///
121    /// Readable | Writeable
122    /// </details>
123    ///
124    /// ## Signals
125    ///
126    ///
127    /// #### `on-abort`
128    ///  Emitted when `self_` was aborted after a call to [`SourceBuffer::abort()`][crate::SourceBuffer::abort()].
129    ///
130    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onabort)
131    ///
132    ///
133    ///
134    ///
135    /// #### `on-error`
136    ///  Emitted when `self_` has encountered an error after a call to
137    /// [`SourceBuffer::append_buffer()`][crate::SourceBuffer::append_buffer()].
138    ///
139    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onerror)
140    ///
141    ///
142    ///
143    ///
144    /// #### `on-update`
145    ///  Emitted when `self_` has successfully processed data after a call to
146    /// [`SourceBuffer::append_buffer()`][crate::SourceBuffer::append_buffer()].
147    ///
148    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdate)
149    ///
150    ///
151    ///
152    ///
153    /// #### `on-update-end`
154    ///  Emitted when `self_` is no longer in the updating state after a call to
155    /// [`SourceBuffer::append_buffer()`][crate::SourceBuffer::append_buffer()]. This can happen after a successful or
156    /// unsuccessful append.
157    ///
158    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdateend)
159    ///
160    ///
161    ///
162    ///
163    /// #### `on-update-start`
164    ///  Emitted when `self_` has begun to process data after a call to
165    /// [`SourceBuffer::append_buffer()`][crate::SourceBuffer::append_buffer()].
166    ///
167    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdatestart)
168    ///
169    ///
170    /// <details><summary><h4>Object</h4></summary>
171    ///
172    ///
173    /// #### `deep-notify`
174    ///  The deep notify signal is used to be notified of property changes. It is
175    /// typically attached to the toplevel bin to receive notifications from all
176    /// the elements contained in that bin.
177    ///
178    /// Detailed
179    /// </details>
180    ///
181    /// # Implements
182    ///
183    /// [`trait@gst::prelude::ObjectExt`]
184    #[doc(alias = "GstSourceBuffer")]
185    pub struct SourceBuffer(Object<ffi::GstSourceBuffer, ffi::GstSourceBufferClass>) @extends gst::Object;
186
187    match fn {
188        type_ => || ffi::gst_source_buffer_get_type(),
189    }
190}
191
192impl SourceBuffer {
193    /// Attempts to end any processing of the currently pending data and reset the
194    /// media parser.
195    ///
196    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-abort)
197    ///
198    /// # Returns
199    ///
200    /// `TRUE` on success, `FALSE` otherwise
201    #[doc(alias = "gst_source_buffer_abort")]
202    pub fn abort(&self) -> Result<(), glib::Error> {
203        unsafe {
204            let mut error = std::ptr::null_mut();
205            let is_ok = ffi::gst_source_buffer_abort(self.to_glib_none().0, &mut error);
206            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
207            if error.is_null() {
208                Ok(())
209            } else {
210                Err(from_glib_full(error))
211            }
212        }
213    }
214
215    /// Schedules the bytes inside `buf` to be processed by `self`. When it is possible
216    /// to accept the supplied data, it will be processed asynchronously and fill in
217    /// the track buffers for playback purposes.
218    ///
219    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-appendbuffer)
220    /// ## `buf`
221    /// The media data to append
222    ///
223    /// # Returns
224    ///
225    /// `TRUE` on success, `FALSE` otherwise
226    #[doc(alias = "gst_source_buffer_append_buffer")]
227    pub fn append_buffer(&self, buf: gst::Buffer) -> Result<(), glib::Error> {
228        unsafe {
229            let mut error = std::ptr::null_mut();
230            let is_ok = ffi::gst_source_buffer_append_buffer(
231                self.to_glib_none().0,
232                buf.into_glib_ptr(),
233                &mut error,
234            );
235            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
236            if error.is_null() {
237                Ok(())
238            } else {
239                Err(from_glib_full(error))
240            }
241        }
242    }
243
244    /// Attempts to change the content type of `self` to `type_`. Any new data appended
245    /// to the Source Buffer must be of the supplied `type_` afterward.
246    /// ## `type_`
247    /// the desired content type
248    ///
249    /// # Returns
250    ///
251    /// `TRUE` on success, `FALSE` otherwise
252    #[doc(alias = "gst_source_buffer_change_content_type")]
253    pub fn change_content_type(&self, type_: &str) -> Result<(), glib::Error> {
254        unsafe {
255            let mut error = std::ptr::null_mut();
256            let is_ok = ffi::gst_source_buffer_change_content_type(
257                self.to_glib_none().0,
258                type_.to_glib_none().0,
259                &mut error,
260            );
261            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
262            if error.is_null() {
263                Ok(())
264            } else {
265                Err(from_glib_full(error))
266            }
267        }
268    }
269
270    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-mode)
271    ///
272    /// # Returns
273    ///
274    /// The current [`SourceBufferAppendMode`][crate::SourceBufferAppendMode]
275    #[doc(alias = "gst_source_buffer_get_append_mode")]
276    #[doc(alias = "get_append_mode")]
277    #[doc(alias = "append-mode")]
278    pub fn append_mode(&self) -> SourceBufferAppendMode {
279        unsafe {
280            from_glib(ffi::gst_source_buffer_get_append_mode(
281                self.to_glib_none().0,
282            ))
283        }
284    }
285
286    /// Returns the current append window end time. Any segment processed that starts
287    /// after this value will be ignored.
288    ///
289    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-appendwindowend)
290    ///
291    /// # Returns
292    ///
293    /// The current Append Window end time as a `GstClockTime`
294    #[doc(alias = "gst_source_buffer_get_append_window_end")]
295    #[doc(alias = "get_append_window_end")]
296    #[doc(alias = "append-window-end")]
297    pub fn append_window_end(&self) -> Option<gst::ClockTime> {
298        unsafe {
299            from_glib(ffi::gst_source_buffer_get_append_window_end(
300                self.to_glib_none().0,
301            ))
302        }
303    }
304
305    /// Returns the current append window start time. Any segment processed that ends
306    /// earlier than this value will be ignored.
307    ///
308    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-appendwindowstart)
309    ///
310    /// # Returns
311    ///
312    /// The current Append Window start time as a `GstClockTime`
313    #[doc(alias = "gst_source_buffer_get_append_window_start")]
314    #[doc(alias = "get_append_window_start")]
315    #[doc(alias = "append-window-start")]
316    pub fn append_window_start(&self) -> Option<gst::ClockTime> {
317        unsafe {
318            from_glib(ffi::gst_source_buffer_get_append_window_start(
319                self.to_glib_none().0,
320            ))
321        }
322    }
323
324    //#[doc(alias = "gst_source_buffer_get_buffered")]
325    //#[doc(alias = "get_buffered")]
326    //pub fn buffered(&self) -> Result</*Unknown conversion*//*Unimplemented*/Array TypeId { ns_id: 1, id: 5 }, glib::Error> {
327    //    unsafe { TODO: call ffi:gst_source_buffer_get_buffered() }
328    //}
329
330    /// Returns the current content type of `self`.
331    ///
332    /// # Returns
333    ///
334    /// a string representing the content type
335    #[doc(alias = "gst_source_buffer_get_content_type")]
336    #[doc(alias = "get_content_type")]
337    #[doc(alias = "content-type")]
338    pub fn content_type(&self) -> glib::GString {
339        unsafe {
340            from_glib_full(ffi::gst_source_buffer_get_content_type(
341                self.to_glib_none().0,
342            ))
343        }
344    }
345
346    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-timestampoffset)
347    ///
348    /// # Returns
349    ///
350    /// The current timestamp offset as a `GstClockTime`
351    #[doc(alias = "gst_source_buffer_get_timestamp_offset")]
352    #[doc(alias = "get_timestamp_offset")]
353    #[doc(alias = "timestamp-offset")]
354    pub fn timestamp_offset(&self) -> Option<gst::ClockTime> {
355        unsafe {
356            from_glib(ffi::gst_source_buffer_get_timestamp_offset(
357                self.to_glib_none().0,
358            ))
359        }
360    }
361
362    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-updating)
363    ///
364    /// # Returns
365    ///
366    /// Whether `self` is currently adding or removing media content.
367    #[doc(alias = "gst_source_buffer_get_updating")]
368    #[doc(alias = "get_updating")]
369    #[doc(alias = "updating")]
370    pub fn is_updating(&self) -> bool {
371        unsafe { from_glib(ffi::gst_source_buffer_get_updating(self.to_glib_none().0)) }
372    }
373
374    /// Attempts to remove any parsed data between `start` and `end` from `self`.
375    ///
376    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-remove)
377    /// ## `start`
378    /// The beginning timestamp of data to remove
379    /// ## `end`
380    /// The end timestamp of data to remove
381    ///
382    /// # Returns
383    ///
384    /// `TRUE` on success, `FALSE` otherwise
385    #[doc(alias = "gst_source_buffer_remove")]
386    pub fn remove(
387        &self,
388        start: impl Into<Option<gst::ClockTime>>,
389        end: impl Into<Option<gst::ClockTime>>,
390    ) -> Result<(), glib::Error> {
391        unsafe {
392            let mut error = std::ptr::null_mut();
393            let is_ok = ffi::gst_source_buffer_remove(
394                self.to_glib_none().0,
395                start.into().into_glib(),
396                end.into().into_glib(),
397                &mut error,
398            );
399            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
400            if error.is_null() {
401                Ok(())
402            } else {
403                Err(from_glib_full(error))
404            }
405        }
406    }
407
408    /// Changes the Append Mode of `self`. This influences what timestamps will be
409    /// assigned to media processed by this Source Buffer. In Segment mode, the
410    /// timestamps in each segment determine the position of each sample after it
411    /// is processed. In Sequence mode, the timestamp of each processed sample is
412    /// generated based on the end of the most recently processed segment.
413    ///
414    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-mode)
415    /// ## `mode`
416    /// [`SourceBufferAppendMode`][crate::SourceBufferAppendMode] the desired Append Mode
417    ///
418    /// # Returns
419    ///
420    /// `TRUE` on success, `FALSE` otherwise
421    #[doc(alias = "gst_source_buffer_set_append_mode")]
422    #[doc(alias = "append-mode")]
423    pub fn set_append_mode(&self, mode: SourceBufferAppendMode) -> Result<(), glib::Error> {
424        unsafe {
425            let mut error = std::ptr::null_mut();
426            let is_ok = ffi::gst_source_buffer_set_append_mode(
427                self.to_glib_none().0,
428                mode.into_glib(),
429                &mut error,
430            );
431            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
432            if error.is_null() {
433                Ok(())
434            } else {
435                Err(from_glib_full(error))
436            }
437        }
438    }
439
440    /// Modifies the current append window end of `self`. If successful, samples
441    /// processed after setting this value that start after this point will be
442    /// ignored.
443    ///
444    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-appendwindowend)
445    /// ## `end`
446    /// the append window end
447    ///
448    /// # Returns
449    ///
450    /// `TRUE` on success, `FALSE` otherwise
451    #[doc(alias = "gst_source_buffer_set_append_window_end")]
452    pub fn set_append_window_end(
453        &self,
454        end: impl Into<Option<gst::ClockTime>>,
455    ) -> Result<(), glib::Error> {
456        unsafe {
457            let mut error = std::ptr::null_mut();
458            let is_ok = ffi::gst_source_buffer_set_append_window_end(
459                self.to_glib_none().0,
460                end.into().into_glib(),
461                &mut error,
462            );
463            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
464            if error.is_null() {
465                Ok(())
466            } else {
467                Err(from_glib_full(error))
468            }
469        }
470    }
471
472    /// Modifies the current append window start of `self`. If successful, samples
473    /// processed after setting this value that end before this point will be
474    /// ignored.
475    ///
476    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-appendwindowstart)
477    /// ## `start`
478    /// the append window start
479    ///
480    /// # Returns
481    ///
482    /// `TRUE` on success, `FALSE` otherwise
483    #[doc(alias = "gst_source_buffer_set_append_window_start")]
484    pub fn set_append_window_start(
485        &self,
486        start: impl Into<Option<gst::ClockTime>>,
487    ) -> Result<(), glib::Error> {
488        unsafe {
489            let mut error = std::ptr::null_mut();
490            let is_ok = ffi::gst_source_buffer_set_append_window_start(
491                self.to_glib_none().0,
492                start.into().into_glib(),
493                &mut error,
494            );
495            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
496            if error.is_null() {
497                Ok(())
498            } else {
499                Err(from_glib_full(error))
500            }
501        }
502    }
503
504    /// Attempt to set the timestamp offset of `self`. Any media processed after this
505    /// value is set will have this value added to its start time.
506    ///
507    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-timestampoffset)
508    /// ## `offset`
509    /// The new timestamp offset
510    ///
511    /// # Returns
512    ///
513    /// `TRUE` on success, `FALSE` otherwise
514    #[doc(alias = "gst_source_buffer_set_timestamp_offset")]
515    #[doc(alias = "timestamp-offset")]
516    pub fn set_timestamp_offset(
517        &self,
518        offset: impl Into<Option<gst::ClockTime>>,
519    ) -> Result<(), glib::Error> {
520        unsafe {
521            let mut error = std::ptr::null_mut();
522            let is_ok = ffi::gst_source_buffer_set_timestamp_offset(
523                self.to_glib_none().0,
524                offset.into().into_glib(),
525                &mut error,
526            );
527            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
528            if error.is_null() {
529                Ok(())
530            } else {
531                Err(from_glib_full(error))
532            }
533        }
534    }
535
536    /// The MIME content-type of the data stream
537    #[doc(alias = "content-type")]
538    pub fn set_content_type(&self, content_type: Option<&str>) {
539        ObjectExt::set_property(self, "content-type", content_type)
540    }
541
542    /// Emitted when `self_` was aborted after a call to [`abort()`][Self::abort()].
543    ///
544    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onabort)
545    #[doc(alias = "on-abort")]
546    pub fn connect_on_abort<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
547        unsafe extern "C" fn on_abort_trampoline<F: Fn(&SourceBuffer) + Send + Sync + 'static>(
548            this: *mut ffi::GstSourceBuffer,
549            f: glib::ffi::gpointer,
550        ) {
551            unsafe {
552                let f: &F = &*(f as *const F);
553                f(&from_glib_borrow(this))
554            }
555        }
556        unsafe {
557            let f: Box_<F> = Box_::new(f);
558            connect_raw(
559                self.as_ptr() as *mut _,
560                c"on-abort".as_ptr(),
561                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
562                    on_abort_trampoline::<F> as *const (),
563                )),
564                Box_::into_raw(f),
565            )
566        }
567    }
568
569    /// Emitted when `self_` has encountered an error after a call to
570    /// [`append_buffer()`][Self::append_buffer()].
571    ///
572    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onerror)
573    #[doc(alias = "on-error")]
574    pub fn connect_on_error<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
575        unsafe extern "C" fn on_error_trampoline<F: Fn(&SourceBuffer) + Send + Sync + 'static>(
576            this: *mut ffi::GstSourceBuffer,
577            f: glib::ffi::gpointer,
578        ) {
579            unsafe {
580                let f: &F = &*(f as *const F);
581                f(&from_glib_borrow(this))
582            }
583        }
584        unsafe {
585            let f: Box_<F> = Box_::new(f);
586            connect_raw(
587                self.as_ptr() as *mut _,
588                c"on-error".as_ptr(),
589                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
590                    on_error_trampoline::<F> as *const (),
591                )),
592                Box_::into_raw(f),
593            )
594        }
595    }
596
597    /// Emitted when `self_` has successfully processed data after a call to
598    /// [`append_buffer()`][Self::append_buffer()].
599    ///
600    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdate)
601    #[doc(alias = "on-update")]
602    pub fn connect_on_update<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
603        unsafe extern "C" fn on_update_trampoline<F: Fn(&SourceBuffer) + Send + Sync + 'static>(
604            this: *mut ffi::GstSourceBuffer,
605            f: glib::ffi::gpointer,
606        ) {
607            unsafe {
608                let f: &F = &*(f as *const F);
609                f(&from_glib_borrow(this))
610            }
611        }
612        unsafe {
613            let f: Box_<F> = Box_::new(f);
614            connect_raw(
615                self.as_ptr() as *mut _,
616                c"on-update".as_ptr(),
617                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
618                    on_update_trampoline::<F> as *const (),
619                )),
620                Box_::into_raw(f),
621            )
622        }
623    }
624
625    /// Emitted when `self_` is no longer in the updating state after a call to
626    /// [`append_buffer()`][Self::append_buffer()]. This can happen after a successful or
627    /// unsuccessful append.
628    ///
629    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdateend)
630    #[doc(alias = "on-update-end")]
631    pub fn connect_on_update_end<F: Fn(&Self) + Send + Sync + 'static>(
632        &self,
633        f: F,
634    ) -> SignalHandlerId {
635        unsafe extern "C" fn on_update_end_trampoline<
636            F: Fn(&SourceBuffer) + Send + Sync + 'static,
637        >(
638            this: *mut ffi::GstSourceBuffer,
639            f: glib::ffi::gpointer,
640        ) {
641            unsafe {
642                let f: &F = &*(f as *const F);
643                f(&from_glib_borrow(this))
644            }
645        }
646        unsafe {
647            let f: Box_<F> = Box_::new(f);
648            connect_raw(
649                self.as_ptr() as *mut _,
650                c"on-update-end".as_ptr(),
651                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
652                    on_update_end_trampoline::<F> as *const (),
653                )),
654                Box_::into_raw(f),
655            )
656        }
657    }
658
659    /// Emitted when `self_` has begun to process data after a call to
660    /// [`append_buffer()`][Self::append_buffer()].
661    ///
662    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdatestart)
663    #[doc(alias = "on-update-start")]
664    pub fn connect_on_update_start<F: Fn(&Self) + Send + Sync + 'static>(
665        &self,
666        f: F,
667    ) -> SignalHandlerId {
668        unsafe extern "C" fn on_update_start_trampoline<
669            F: Fn(&SourceBuffer) + Send + Sync + 'static,
670        >(
671            this: *mut ffi::GstSourceBuffer,
672            f: glib::ffi::gpointer,
673        ) {
674            unsafe {
675                let f: &F = &*(f as *const F);
676                f(&from_glib_borrow(this))
677            }
678        }
679        unsafe {
680            let f: Box_<F> = Box_::new(f);
681            connect_raw(
682                self.as_ptr() as *mut _,
683                c"on-update-start".as_ptr(),
684                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
685                    on_update_start_trampoline::<F> as *const (),
686                )),
687                Box_::into_raw(f),
688            )
689        }
690    }
691
692    #[doc(alias = "append-mode")]
693    pub fn connect_append_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
694        &self,
695        f: F,
696    ) -> SignalHandlerId {
697        unsafe extern "C" fn notify_append_mode_trampoline<
698            F: Fn(&SourceBuffer) + Send + Sync + 'static,
699        >(
700            this: *mut ffi::GstSourceBuffer,
701            _param_spec: glib::ffi::gpointer,
702            f: glib::ffi::gpointer,
703        ) {
704            unsafe {
705                let f: &F = &*(f as *const F);
706                f(&from_glib_borrow(this))
707            }
708        }
709        unsafe {
710            let f: Box_<F> = Box_::new(f);
711            connect_raw(
712                self.as_ptr() as *mut _,
713                c"notify::append-mode".as_ptr(),
714                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
715                    notify_append_mode_trampoline::<F> as *const (),
716                )),
717                Box_::into_raw(f),
718            )
719        }
720    }
721
722    #[doc(alias = "append-window-end")]
723    pub fn connect_append_window_end_notify<F: Fn(&Self) + Send + Sync + 'static>(
724        &self,
725        f: F,
726    ) -> SignalHandlerId {
727        unsafe extern "C" fn notify_append_window_end_trampoline<
728            F: Fn(&SourceBuffer) + Send + Sync + 'static,
729        >(
730            this: *mut ffi::GstSourceBuffer,
731            _param_spec: glib::ffi::gpointer,
732            f: glib::ffi::gpointer,
733        ) {
734            unsafe {
735                let f: &F = &*(f as *const F);
736                f(&from_glib_borrow(this))
737            }
738        }
739        unsafe {
740            let f: Box_<F> = Box_::new(f);
741            connect_raw(
742                self.as_ptr() as *mut _,
743                c"notify::append-window-end".as_ptr(),
744                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
745                    notify_append_window_end_trampoline::<F> as *const (),
746                )),
747                Box_::into_raw(f),
748            )
749        }
750    }
751
752    #[doc(alias = "append-window-start")]
753    pub fn connect_append_window_start_notify<F: Fn(&Self) + Send + Sync + 'static>(
754        &self,
755        f: F,
756    ) -> SignalHandlerId {
757        unsafe extern "C" fn notify_append_window_start_trampoline<
758            F: Fn(&SourceBuffer) + Send + Sync + 'static,
759        >(
760            this: *mut ffi::GstSourceBuffer,
761            _param_spec: glib::ffi::gpointer,
762            f: glib::ffi::gpointer,
763        ) {
764            unsafe {
765                let f: &F = &*(f as *const F);
766                f(&from_glib_borrow(this))
767            }
768        }
769        unsafe {
770            let f: Box_<F> = Box_::new(f);
771            connect_raw(
772                self.as_ptr() as *mut _,
773                c"notify::append-window-start".as_ptr(),
774                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
775                    notify_append_window_start_trampoline::<F> as *const (),
776                )),
777                Box_::into_raw(f),
778            )
779        }
780    }
781
782    #[doc(alias = "buffered")]
783    pub fn connect_buffered_notify<F: Fn(&Self) + Send + Sync + 'static>(
784        &self,
785        f: F,
786    ) -> SignalHandlerId {
787        unsafe extern "C" fn notify_buffered_trampoline<
788            F: Fn(&SourceBuffer) + Send + Sync + 'static,
789        >(
790            this: *mut ffi::GstSourceBuffer,
791            _param_spec: glib::ffi::gpointer,
792            f: glib::ffi::gpointer,
793        ) {
794            unsafe {
795                let f: &F = &*(f as *const F);
796                f(&from_glib_borrow(this))
797            }
798        }
799        unsafe {
800            let f: Box_<F> = Box_::new(f);
801            connect_raw(
802                self.as_ptr() as *mut _,
803                c"notify::buffered".as_ptr(),
804                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
805                    notify_buffered_trampoline::<F> as *const (),
806                )),
807                Box_::into_raw(f),
808            )
809        }
810    }
811
812    #[doc(alias = "content-type")]
813    pub fn connect_content_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
814        &self,
815        f: F,
816    ) -> SignalHandlerId {
817        unsafe extern "C" fn notify_content_type_trampoline<
818            F: Fn(&SourceBuffer) + Send + Sync + 'static,
819        >(
820            this: *mut ffi::GstSourceBuffer,
821            _param_spec: glib::ffi::gpointer,
822            f: glib::ffi::gpointer,
823        ) {
824            unsafe {
825                let f: &F = &*(f as *const F);
826                f(&from_glib_borrow(this))
827            }
828        }
829        unsafe {
830            let f: Box_<F> = Box_::new(f);
831            connect_raw(
832                self.as_ptr() as *mut _,
833                c"notify::content-type".as_ptr(),
834                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
835                    notify_content_type_trampoline::<F> as *const (),
836                )),
837                Box_::into_raw(f),
838            )
839        }
840    }
841
842    #[doc(alias = "timestamp-offset")]
843    pub fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
844        &self,
845        f: F,
846    ) -> SignalHandlerId {
847        unsafe extern "C" fn notify_timestamp_offset_trampoline<
848            F: Fn(&SourceBuffer) + Send + Sync + 'static,
849        >(
850            this: *mut ffi::GstSourceBuffer,
851            _param_spec: glib::ffi::gpointer,
852            f: glib::ffi::gpointer,
853        ) {
854            unsafe {
855                let f: &F = &*(f as *const F);
856                f(&from_glib_borrow(this))
857            }
858        }
859        unsafe {
860            let f: Box_<F> = Box_::new(f);
861            connect_raw(
862                self.as_ptr() as *mut _,
863                c"notify::timestamp-offset".as_ptr(),
864                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
865                    notify_timestamp_offset_trampoline::<F> as *const (),
866                )),
867                Box_::into_raw(f),
868            )
869        }
870    }
871
872    #[doc(alias = "updating")]
873    pub fn connect_updating_notify<F: Fn(&Self) + Send + Sync + 'static>(
874        &self,
875        f: F,
876    ) -> SignalHandlerId {
877        unsafe extern "C" fn notify_updating_trampoline<
878            F: Fn(&SourceBuffer) + Send + Sync + 'static,
879        >(
880            this: *mut ffi::GstSourceBuffer,
881            _param_spec: glib::ffi::gpointer,
882            f: glib::ffi::gpointer,
883        ) {
884            unsafe {
885                let f: &F = &*(f as *const F);
886                f(&from_glib_borrow(this))
887            }
888        }
889        unsafe {
890            let f: Box_<F> = Box_::new(f);
891            connect_raw(
892                self.as_ptr() as *mut _,
893                c"notify::updating".as_ptr(),
894                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
895                    notify_updating_trampoline::<F> as *const (),
896                )),
897                Box_::into_raw(f),
898            )
899        }
900    }
901}
902
903unsafe impl Send for SourceBuffer {}
904unsafe impl Sync for SourceBuffer {}