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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::object::IsA;
use glib::translate::*;
use gst_sys;
use Element;
use Object;
use Toc;

glib_wrapper! {
    /// Element interface that allows setting of the TOC.
    ///
    /// Elements that support some kind of chapters or editions (or tracks like in
    /// the FLAC cue sheet) will implement this interface.
    ///
    /// If you just want to retrieve the TOC in your application then all you
    /// need to do is watch for TOC messages on your pipeline's bus (or you can
    /// perform TOC query). This interface is only for setting TOC data, not for
    /// extracting it. To set TOC from the application, find proper tocsetter element
    /// and set TOC using `TocSetter::set_toc`.
    ///
    /// Elements implementing the `TocSetter` interface can extend existing TOC
    /// by getting extend UID for that (you can use `Toc::find_entry` to retrieve it)
    /// with any TOC entries received from downstream.
    ///
    /// # Implements
    ///
    /// [`TocSetterExt`](trait.TocSetterExt.html), [`ElementExt`](trait.ElementExt.html), [`GstObjectExt`](trait.GstObjectExt.html), [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html), [`ElementExtManual`](prelude/trait.ElementExtManual.html)
    pub struct TocSetter(Interface<gst_sys::GstTocSetter>) @requires Element, Object;

    match fn {
        get_type => || gst_sys::gst_toc_setter_get_type(),
    }
}

unsafe impl Send for TocSetter {}
unsafe impl Sync for TocSetter {}

pub const NONE_TOC_SETTER: Option<&TocSetter> = None;

/// Trait containing all `TocSetter` methods.
///
/// # Implementors
///
/// [`TocSetter`](struct.TocSetter.html)
pub trait TocSetterExt: 'static {
    /// Return current TOC the setter uses. The TOC should not be
    /// modified without making it writable first.
    ///
    /// # Returns
    ///
    /// TOC set, or `None`. Unref with
    ///  `gst_toc_unref` when no longer needed
    fn get_toc(&self) -> Option<Toc>;

    /// Reset the internal TOC. Elements should call this from within the
    /// state-change handler.
    fn reset(&self);

    /// Set the given TOC on the setter. Previously set TOC will be
    /// unreffed before setting a new one.
    /// ## `toc`
    /// a `Toc` to set.
    fn set_toc(&self, toc: Option<&Toc>);
}

impl<O: IsA<TocSetter>> TocSetterExt for O {
    fn get_toc(&self) -> Option<Toc> {
        unsafe {
            from_glib_full(gst_sys::gst_toc_setter_get_toc(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    fn reset(&self) {
        unsafe {
            gst_sys::gst_toc_setter_reset(self.as_ref().to_glib_none().0);
        }
    }

    fn set_toc(&self, toc: Option<&Toc>) {
        unsafe {
            gst_sys::gst_toc_setter_set_toc(self.as_ref().to_glib_none().0, toc.to_glib_none().0);
        }
    }
}