gstreamer/auto/
stream_collection.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, Object, Stream};
7use glib::translate::*;
8
9glib::wrapper! {
10    /// A collection of [`Stream`][crate::Stream] that are available.
11    ///
12    /// A [`StreamCollection`][crate::StreamCollection] will be provided by elements that can make those
13    /// streams available. Applications can use the collection to show the user
14    /// what streams are available by using [`stream()`][Self::stream()]
15    ///
16    /// Once posted, a [`StreamCollection`][crate::StreamCollection] is immutable. Updates are made by sending
17    /// a new [`StreamCollection`][crate::StreamCollection] message, which may or may not share some of
18    /// the [`Stream`][crate::Stream] objects from the collection it replaces. The receiver can check
19    /// the sender of a stream collection message to know which collection is
20    /// obsoleted.
21    ///
22    /// Several elements in a pipeline can provide [`StreamCollection`][crate::StreamCollection].
23    ///
24    /// Applications can activate streams from a collection by using the
25    /// [`EventType::SelectStreams`][crate::EventType::SelectStreams] event on a pipeline, bin or element.
26    ///
27    /// ## Properties
28    ///
29    ///
30    /// #### `upstream-id`
31    ///  stream-id
32    ///
33    /// Readable | Writeable | Construct
34    /// <details><summary><h4>Object</h4></summary>
35    ///
36    ///
37    /// #### `name`
38    ///  Readable | Writeable | Construct
39    ///
40    ///
41    /// #### `parent`
42    ///  The parent of the object. Please note, that when changing the 'parent'
43    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::Object#deep-notify]
44    /// signals due to locking issues. In some cases one can use
45    /// [`element-added`][struct@crate::Bin#element-added] or [`element-removed`][struct@crate::Bin#element-removed] signals on the parent to
46    /// achieve a similar effect.
47    ///
48    /// Readable | Writeable
49    /// </details>
50    ///
51    /// ## Signals
52    ///
53    ///
54    /// #### `stream-notify`
55    ///  The stream notify signal is used to be notified of property changes to
56    /// streams within the collection.
57    ///
58    /// Detailed
59    /// <details><summary><h4>Object</h4></summary>
60    ///
61    ///
62    /// #### `deep-notify`
63    ///  The deep notify signal is used to be notified of property changes. It is
64    /// typically attached to the toplevel bin to receive notifications from all
65    /// the elements contained in that bin.
66    ///
67    /// Detailed
68    /// </details>
69    ///
70    /// # Implements
71    ///
72    /// [`GstObjectExt`][trait@crate::prelude::GstObjectExt], [`trait@glib::ObjectExt`]
73    #[doc(alias = "GstStreamCollection")]
74    pub struct StreamCollection(Object<ffi::GstStreamCollection, ffi::GstStreamCollectionClass>) @extends Object;
75
76    match fn {
77        type_ => || ffi::gst_stream_collection_get_type(),
78    }
79}
80
81impl StreamCollection {
82    /// Get the number of streams this collection contains
83    ///
84    /// # Returns
85    ///
86    /// The number of streams that `self` contains
87    #[doc(alias = "gst_stream_collection_get_size")]
88    #[doc(alias = "get_size")]
89    pub fn size(&self) -> u32 {
90        unsafe { ffi::gst_stream_collection_get_size(self.to_glib_none().0) }
91    }
92
93    /// Retrieve the [`Stream`][crate::Stream] with index `index` from the collection.
94    ///
95    /// The caller should not modify the returned [`Stream`][crate::Stream]
96    /// ## `index`
97    /// Index of the stream to retrieve
98    ///
99    /// # Returns
100    ///
101    /// A [`Stream`][crate::Stream]
102    #[doc(alias = "gst_stream_collection_get_stream")]
103    #[doc(alias = "get_stream")]
104    pub fn stream(&self, index: u32) -> Option<Stream> {
105        unsafe {
106            from_glib_none(ffi::gst_stream_collection_get_stream(
107                self.to_glib_none().0,
108                index,
109            ))
110        }
111    }
112
113    /// Returns the upstream id of the `self`.
114    ///
115    /// # Returns
116    ///
117    /// The upstream id
118    #[doc(alias = "gst_stream_collection_get_upstream_id")]
119    #[doc(alias = "get_upstream_id")]
120    #[doc(alias = "upstream-id")]
121    pub fn upstream_id(&self) -> Option<glib::GString> {
122        unsafe {
123            from_glib_none(ffi::gst_stream_collection_get_upstream_id(
124                self.to_glib_none().0,
125            ))
126        }
127    }
128
129    //#[doc(alias = "stream-notify")]
130    //pub fn connect_stream_notify<Unsupported or ignored types>(&self, detail: Option<&str>, f: F) -> SignalHandlerId {
131    //    Ignored prop: GObject.ParamSpec
132    //}
133}
134
135unsafe impl Send for StreamCollection {}
136unsafe impl Sync for StreamCollection {}