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
43/// Trait containing all [`struct@TocSetter`] methods.
44///
45/// # Implementors
46///
47/// [`TocSetter`][struct@crate::TocSetter]
48pub trait TocSetterExt: IsA<TocSetter> + 'static {
49    /// Return current TOC the setter uses. The TOC should not be
50    /// modified without making it writable first.
51    ///
52    /// # Returns
53    ///
54    /// TOC set, or [`None`]. Unref with
55    ///  `gst_toc_unref()` when no longer needed
56    #[doc(alias = "gst_toc_setter_get_toc")]
57    #[doc(alias = "get_toc")]
58    fn toc(&self) -> Option<Toc> {
59        unsafe { from_glib_full(ffi::gst_toc_setter_get_toc(self.as_ref().to_glib_none().0)) }
60    }
61
62    /// Reset the internal TOC. Elements should call this from within the
63    /// state-change handler.
64    #[doc(alias = "gst_toc_setter_reset")]
65    fn reset(&self) {
66        unsafe {
67            ffi::gst_toc_setter_reset(self.as_ref().to_glib_none().0);
68        }
69    }
70
71    /// Set the given TOC on the setter. Previously set TOC will be
72    /// unreffed before setting a new one.
73    /// ## `toc`
74    /// a [`Toc`][crate::Toc] to set.
75    #[doc(alias = "gst_toc_setter_set_toc")]
76    fn set_toc(&self, toc: Option<&Toc>) {
77        unsafe {
78            ffi::gst_toc_setter_set_toc(self.as_ref().to_glib_none().0, toc.to_glib_none().0);
79        }
80    }
81}
82
83impl<O: IsA<TocSetter>> TocSetterExt for O {}