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::{ffi, SourceBufferAppendMode};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
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            let f: &F = &*(f as *const F);
552            f(&from_glib_borrow(this))
553        }
554        unsafe {
555            let f: Box_<F> = Box_::new(f);
556            connect_raw(
557                self.as_ptr() as *mut _,
558                c"on-abort".as_ptr() as *const _,
559                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
560                    on_abort_trampoline::<F> as *const (),
561                )),
562                Box_::into_raw(f),
563            )
564        }
565    }
566
567    /// Emitted when `self_` has encountered an error after a call to
568    /// [`append_buffer()`][Self::append_buffer()].
569    ///
570    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onerror)
571    #[doc(alias = "on-error")]
572    pub fn connect_on_error<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
573        unsafe extern "C" fn on_error_trampoline<F: Fn(&SourceBuffer) + Send + Sync + 'static>(
574            this: *mut ffi::GstSourceBuffer,
575            f: glib::ffi::gpointer,
576        ) {
577            let f: &F = &*(f as *const F);
578            f(&from_glib_borrow(this))
579        }
580        unsafe {
581            let f: Box_<F> = Box_::new(f);
582            connect_raw(
583                self.as_ptr() as *mut _,
584                c"on-error".as_ptr() as *const _,
585                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
586                    on_error_trampoline::<F> as *const (),
587                )),
588                Box_::into_raw(f),
589            )
590        }
591    }
592
593    /// Emitted when `self_` has successfully processed data after a call to
594    /// [`append_buffer()`][Self::append_buffer()].
595    ///
596    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdate)
597    #[doc(alias = "on-update")]
598    pub fn connect_on_update<F: Fn(&Self) + Send + Sync + 'static>(&self, f: F) -> SignalHandlerId {
599        unsafe extern "C" fn on_update_trampoline<F: Fn(&SourceBuffer) + Send + Sync + 'static>(
600            this: *mut ffi::GstSourceBuffer,
601            f: glib::ffi::gpointer,
602        ) {
603            let f: &F = &*(f as *const F);
604            f(&from_glib_borrow(this))
605        }
606        unsafe {
607            let f: Box_<F> = Box_::new(f);
608            connect_raw(
609                self.as_ptr() as *mut _,
610                c"on-update".as_ptr() as *const _,
611                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
612                    on_update_trampoline::<F> as *const (),
613                )),
614                Box_::into_raw(f),
615            )
616        }
617    }
618
619    /// Emitted when `self_` is no longer in the updating state after a call to
620    /// [`append_buffer()`][Self::append_buffer()]. This can happen after a successful or
621    /// unsuccessful append.
622    ///
623    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdateend)
624    #[doc(alias = "on-update-end")]
625    pub fn connect_on_update_end<F: Fn(&Self) + Send + Sync + 'static>(
626        &self,
627        f: F,
628    ) -> SignalHandlerId {
629        unsafe extern "C" fn on_update_end_trampoline<
630            F: Fn(&SourceBuffer) + Send + Sync + 'static,
631        >(
632            this: *mut ffi::GstSourceBuffer,
633            f: glib::ffi::gpointer,
634        ) {
635            let f: &F = &*(f as *const F);
636            f(&from_glib_borrow(this))
637        }
638        unsafe {
639            let f: Box_<F> = Box_::new(f);
640            connect_raw(
641                self.as_ptr() as *mut _,
642                c"on-update-end".as_ptr() as *const _,
643                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
644                    on_update_end_trampoline::<F> as *const (),
645                )),
646                Box_::into_raw(f),
647            )
648        }
649    }
650
651    /// Emitted when `self_` has begun to process data after a call to
652    /// [`append_buffer()`][Self::append_buffer()].
653    ///
654    /// [Specification](https://www.w3.org/TR/media-source-2/`dom`-sourcebuffer-onupdatestart)
655    #[doc(alias = "on-update-start")]
656    pub fn connect_on_update_start<F: Fn(&Self) + Send + Sync + 'static>(
657        &self,
658        f: F,
659    ) -> SignalHandlerId {
660        unsafe extern "C" fn on_update_start_trampoline<
661            F: Fn(&SourceBuffer) + Send + Sync + 'static,
662        >(
663            this: *mut ffi::GstSourceBuffer,
664            f: glib::ffi::gpointer,
665        ) {
666            let f: &F = &*(f as *const F);
667            f(&from_glib_borrow(this))
668        }
669        unsafe {
670            let f: Box_<F> = Box_::new(f);
671            connect_raw(
672                self.as_ptr() as *mut _,
673                c"on-update-start".as_ptr() as *const _,
674                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
675                    on_update_start_trampoline::<F> as *const (),
676                )),
677                Box_::into_raw(f),
678            )
679        }
680    }
681
682    #[doc(alias = "append-mode")]
683    pub fn connect_append_mode_notify<F: Fn(&Self) + Send + Sync + 'static>(
684        &self,
685        f: F,
686    ) -> SignalHandlerId {
687        unsafe extern "C" fn notify_append_mode_trampoline<
688            F: Fn(&SourceBuffer) + Send + Sync + 'static,
689        >(
690            this: *mut ffi::GstSourceBuffer,
691            _param_spec: glib::ffi::gpointer,
692            f: glib::ffi::gpointer,
693        ) {
694            let f: &F = &*(f as *const F);
695            f(&from_glib_borrow(this))
696        }
697        unsafe {
698            let f: Box_<F> = Box_::new(f);
699            connect_raw(
700                self.as_ptr() as *mut _,
701                c"notify::append-mode".as_ptr() as *const _,
702                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
703                    notify_append_mode_trampoline::<F> as *const (),
704                )),
705                Box_::into_raw(f),
706            )
707        }
708    }
709
710    #[doc(alias = "append-window-end")]
711    pub fn connect_append_window_end_notify<F: Fn(&Self) + Send + Sync + 'static>(
712        &self,
713        f: F,
714    ) -> SignalHandlerId {
715        unsafe extern "C" fn notify_append_window_end_trampoline<
716            F: Fn(&SourceBuffer) + Send + Sync + 'static,
717        >(
718            this: *mut ffi::GstSourceBuffer,
719            _param_spec: glib::ffi::gpointer,
720            f: glib::ffi::gpointer,
721        ) {
722            let f: &F = &*(f as *const F);
723            f(&from_glib_borrow(this))
724        }
725        unsafe {
726            let f: Box_<F> = Box_::new(f);
727            connect_raw(
728                self.as_ptr() as *mut _,
729                c"notify::append-window-end".as_ptr() as *const _,
730                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
731                    notify_append_window_end_trampoline::<F> as *const (),
732                )),
733                Box_::into_raw(f),
734            )
735        }
736    }
737
738    #[doc(alias = "append-window-start")]
739    pub fn connect_append_window_start_notify<F: Fn(&Self) + Send + Sync + 'static>(
740        &self,
741        f: F,
742    ) -> SignalHandlerId {
743        unsafe extern "C" fn notify_append_window_start_trampoline<
744            F: Fn(&SourceBuffer) + Send + Sync + 'static,
745        >(
746            this: *mut ffi::GstSourceBuffer,
747            _param_spec: glib::ffi::gpointer,
748            f: glib::ffi::gpointer,
749        ) {
750            let f: &F = &*(f as *const F);
751            f(&from_glib_borrow(this))
752        }
753        unsafe {
754            let f: Box_<F> = Box_::new(f);
755            connect_raw(
756                self.as_ptr() as *mut _,
757                c"notify::append-window-start".as_ptr() as *const _,
758                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
759                    notify_append_window_start_trampoline::<F> as *const (),
760                )),
761                Box_::into_raw(f),
762            )
763        }
764    }
765
766    #[doc(alias = "buffered")]
767    pub fn connect_buffered_notify<F: Fn(&Self) + Send + Sync + 'static>(
768        &self,
769        f: F,
770    ) -> SignalHandlerId {
771        unsafe extern "C" fn notify_buffered_trampoline<
772            F: Fn(&SourceBuffer) + Send + Sync + 'static,
773        >(
774            this: *mut ffi::GstSourceBuffer,
775            _param_spec: glib::ffi::gpointer,
776            f: glib::ffi::gpointer,
777        ) {
778            let f: &F = &*(f as *const F);
779            f(&from_glib_borrow(this))
780        }
781        unsafe {
782            let f: Box_<F> = Box_::new(f);
783            connect_raw(
784                self.as_ptr() as *mut _,
785                c"notify::buffered".as_ptr() as *const _,
786                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
787                    notify_buffered_trampoline::<F> as *const (),
788                )),
789                Box_::into_raw(f),
790            )
791        }
792    }
793
794    #[doc(alias = "content-type")]
795    pub fn connect_content_type_notify<F: Fn(&Self) + Send + Sync + 'static>(
796        &self,
797        f: F,
798    ) -> SignalHandlerId {
799        unsafe extern "C" fn notify_content_type_trampoline<
800            F: Fn(&SourceBuffer) + Send + Sync + 'static,
801        >(
802            this: *mut ffi::GstSourceBuffer,
803            _param_spec: glib::ffi::gpointer,
804            f: glib::ffi::gpointer,
805        ) {
806            let f: &F = &*(f as *const F);
807            f(&from_glib_borrow(this))
808        }
809        unsafe {
810            let f: Box_<F> = Box_::new(f);
811            connect_raw(
812                self.as_ptr() as *mut _,
813                c"notify::content-type".as_ptr() as *const _,
814                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
815                    notify_content_type_trampoline::<F> as *const (),
816                )),
817                Box_::into_raw(f),
818            )
819        }
820    }
821
822    #[doc(alias = "timestamp-offset")]
823    pub fn connect_timestamp_offset_notify<F: Fn(&Self) + Send + Sync + 'static>(
824        &self,
825        f: F,
826    ) -> SignalHandlerId {
827        unsafe extern "C" fn notify_timestamp_offset_trampoline<
828            F: Fn(&SourceBuffer) + Send + Sync + 'static,
829        >(
830            this: *mut ffi::GstSourceBuffer,
831            _param_spec: glib::ffi::gpointer,
832            f: glib::ffi::gpointer,
833        ) {
834            let f: &F = &*(f as *const F);
835            f(&from_glib_borrow(this))
836        }
837        unsafe {
838            let f: Box_<F> = Box_::new(f);
839            connect_raw(
840                self.as_ptr() as *mut _,
841                c"notify::timestamp-offset".as_ptr() as *const _,
842                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
843                    notify_timestamp_offset_trampoline::<F> as *const (),
844                )),
845                Box_::into_raw(f),
846            )
847        }
848    }
849
850    #[doc(alias = "updating")]
851    pub fn connect_updating_notify<F: Fn(&Self) + Send + Sync + 'static>(
852        &self,
853        f: F,
854    ) -> SignalHandlerId {
855        unsafe extern "C" fn notify_updating_trampoline<
856            F: Fn(&SourceBuffer) + Send + Sync + 'static,
857        >(
858            this: *mut ffi::GstSourceBuffer,
859            _param_spec: glib::ffi::gpointer,
860            f: glib::ffi::gpointer,
861        ) {
862            let f: &F = &*(f as *const F);
863            f(&from_glib_borrow(this))
864        }
865        unsafe {
866            let f: Box_<F> = Box_::new(f);
867            connect_raw(
868                self.as_ptr() as *mut _,
869                c"notify::updating".as_ptr() as *const _,
870                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
871                    notify_updating_trampoline::<F> as *const (),
872                )),
873                Box_::into_raw(f),
874            )
875        }
876    }
877}
878
879unsafe impl Send for SourceBuffer {}
880unsafe impl Sync for SourceBuffer {}