gstreamer/auto/
toc_setter.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, Element, Object, Toc};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    /// Element interface that allows setting of the TOC.
11    ///
12    /// Elements that support some kind of chapters or editions (or tracks like in
13    /// the FLAC cue sheet) will implement this interface.
14    ///
15    /// If you just want to retrieve the TOC in your application then all you
16    /// need to do is watch for TOC messages on your pipeline's bus (or you can
17    /// perform TOC query). This interface is only for setting TOC data, not for
18    /// extracting it. To set TOC from the application, find proper tocsetter element
19    /// and set TOC using [`TocSetterExt::set_toc()`][crate::prelude::TocSetterExt::set_toc()].
20    ///
21    /// Elements implementing the [`TocSetter`][crate::TocSetter] interface can extend existing TOC
22    /// by getting extend UID for that (you can use [`Toc::find_entry()`][crate::Toc::find_entry()] to retrieve it)
23    /// with any TOC entries received from downstream.
24    ///
25    /// # Implements
26    ///
27    /// [`TocSetterExt`][trait@crate::prelude::TocSetterExt], [`ElementExt`][trait@crate::prelude::ElementExt], [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`], [`ElementExtManual`][trait@crate::prelude::ElementExtManual]
28    #[doc(alias = "GstTocSetter")]
29    pub struct TocSetter(Interface<ffi::GstTocSetter, ffi::GstTocSetterInterface>) @requires Element, Object;
30
31    match fn {
32        type_ => || ffi::gst_toc_setter_get_type(),
33    }
34}
35
36impl TocSetter {
37    pub const NONE: Option<&'static TocSetter> = None;
38}
39
40unsafe impl Send for TocSetter {}
41unsafe impl Sync for TocSetter {}
42
43mod sealed {
44    pub trait Sealed {}
45    impl<T: super::IsA<super::TocSetter>> Sealed for T {}
46}
47
48/// Trait containing all [`struct@TocSetter`] methods.
49///
50/// # Implementors
51///
52/// [`TocSetter`][struct@crate::TocSetter]
53pub trait TocSetterExt: IsA<TocSetter> + sealed::Sealed + 'static {
54    /// Return current TOC the setter uses. The TOC should not be
55    /// modified without making it writable first.
56    ///
57    /// # Returns
58    ///
59    /// TOC set, or [`None`]. Unref with
60    ///  `gst_toc_unref()` when no longer needed
61    #[doc(alias = "gst_toc_setter_get_toc")]
62    #[doc(alias = "get_toc")]
63    fn toc(&self) -> Option<Toc> {
64        unsafe { from_glib_full(ffi::gst_toc_setter_get_toc(self.as_ref().to_glib_none().0)) }
65    }
66
67    /// Reset the internal TOC. Elements should call this from within the
68    /// state-change handler.
69    #[doc(alias = "gst_toc_setter_reset")]
70    fn reset(&self) {
71        unsafe {
72            ffi::gst_toc_setter_reset(self.as_ref().to_glib_none().0);
73        }
74    }
75
76    /// Set the given TOC on the setter. Previously set TOC will be
77    /// unreffed before setting a new one.
78    /// ## `toc`
79    /// a [`Toc`][crate::Toc] to set.
80    #[doc(alias = "gst_toc_setter_set_toc")]
81    fn set_toc(&self, toc: Option<&Toc>) {
82        unsafe {
83            ffi::gst_toc_setter_set_toc(self.as_ref().to_glib_none().0, toc.to_glib_none().0);
84        }
85    }
86}
87
88impl<O: IsA<TocSetter>> TocSetterExt for O {}