gstreamer_pbutils/auto/discoverer_stream_info.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;
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10 /// Base structure for information concerning a media stream. Depending on the
11 /// stream type, one can find more media-specific information in
12 /// [`DiscovererAudioInfo`][crate::DiscovererAudioInfo], [`DiscovererVideoInfo`][crate::DiscovererVideoInfo], and
13 /// [`DiscovererContainerInfo`][crate::DiscovererContainerInfo].
14 ///
15 /// The [`DiscovererStreamInfo`][crate::DiscovererStreamInfo] represents the topology of the stream. Siblings
16 /// can be iterated over with [`DiscovererStreamInfoExt::next()`][crate::prelude::DiscovererStreamInfoExt::next()] and
17 /// [`DiscovererStreamInfoExt::previous()`][crate::prelude::DiscovererStreamInfoExt::previous()]. Children (sub-streams) of a
18 /// stream can be accessed using the [`DiscovererContainerInfo`][crate::DiscovererContainerInfo] API.
19 ///
20 /// As a simple example, if you run [`Discoverer`][crate::Discoverer] on an AVI file with one audio
21 /// and one video stream, you will get a [`DiscovererContainerInfo`][crate::DiscovererContainerInfo]
22 /// corresponding to the AVI container, which in turn will have a
23 /// [`DiscovererAudioInfo`][crate::DiscovererAudioInfo] sub-stream and a [`DiscovererVideoInfo`][crate::DiscovererVideoInfo] sub-stream
24 /// for the audio and video streams respectively.
25 ///
26 /// # Implements
27 ///
28 /// [`DiscovererStreamInfoExt`][trait@crate::prelude::DiscovererStreamInfoExt], [`trait@glib::ObjectExt`], [`DiscovererStreamInfoExtManual`][trait@crate::prelude::DiscovererStreamInfoExtManual]
29 #[doc(alias = "GstDiscovererStreamInfo")]
30 pub struct DiscovererStreamInfo(Object<ffi::GstDiscovererStreamInfo>);
31
32 match fn {
33 type_ => || ffi::gst_discoverer_stream_info_get_type(),
34 }
35}
36
37impl DiscovererStreamInfo {
38 pub const NONE: Option<&'static DiscovererStreamInfo> = None;
39}
40
41unsafe impl Send for DiscovererStreamInfo {}
42unsafe impl Sync for DiscovererStreamInfo {}
43
44/// Trait containing all [`struct@DiscovererStreamInfo`] methods.
45///
46/// # Implementors
47///
48/// [`DiscovererAudioInfo`][struct@crate::DiscovererAudioInfo], [`DiscovererContainerInfo`][struct@crate::DiscovererContainerInfo], [`DiscovererStreamInfo`][struct@crate::DiscovererStreamInfo], [`DiscovererSubtitleInfo`][struct@crate::DiscovererSubtitleInfo], [`DiscovererVideoInfo`][struct@crate::DiscovererVideoInfo]
49pub trait DiscovererStreamInfoExt: IsA<DiscovererStreamInfo> + 'static {
50 ///
51 /// # Returns
52 ///
53 /// the [`gst::Caps`][crate::gst::Caps] of the stream. Unref with
54 /// `gst_caps_unref` after usage.
55 #[doc(alias = "gst_discoverer_stream_info_get_caps")]
56 #[doc(alias = "get_caps")]
57 fn caps(&self) -> Option<gst::Caps> {
58 unsafe {
59 from_glib_full(ffi::gst_discoverer_stream_info_get_caps(
60 self.as_ref().to_glib_none().0,
61 ))
62 }
63 }
64
65 ///
66 /// # Deprecated
67 ///
68 /// This functions is deprecated since version 1.4, use
69 /// `gst_discoverer_info_get_missing_elements_installer_details`
70 ///
71 /// # Returns
72 ///
73 /// additional information regarding the stream (for
74 /// example codec version, profile, etc..). If you wish to use the [`gst::Structure`][crate::gst::Structure]
75 /// after the life-time of `self` you will need to copy it.
76 #[doc(alias = "gst_discoverer_stream_info_get_misc")]
77 #[doc(alias = "get_misc")]
78 fn misc(&self) -> Option<gst::Structure> {
79 unsafe {
80 from_glib_none(ffi::gst_discoverer_stream_info_get_misc(
81 self.as_ref().to_glib_none().0,
82 ))
83 }
84 }
85
86 ///
87 /// # Returns
88 ///
89 /// the next [`DiscovererStreamInfo`][crate::DiscovererStreamInfo] in a chain. [`None`]
90 /// for final streams.
91 /// Unref with `gst_discoverer_stream_info_unref` after usage.
92 #[doc(alias = "gst_discoverer_stream_info_get_next")]
93 #[doc(alias = "get_next")]
94 #[must_use]
95 fn next(&self) -> Option<DiscovererStreamInfo> {
96 unsafe {
97 from_glib_full(ffi::gst_discoverer_stream_info_get_next(
98 self.as_ref().to_glib_none().0,
99 ))
100 }
101 }
102
103 ///
104 /// # Returns
105 ///
106 /// the previous [`DiscovererStreamInfo`][crate::DiscovererStreamInfo] in a chain.
107 /// [`None`] for starting points. Unref with `gst_discoverer_stream_info_unref`
108 /// after usage.
109 #[doc(alias = "gst_discoverer_stream_info_get_previous")]
110 #[doc(alias = "get_previous")]
111 #[must_use]
112 fn previous(&self) -> Option<DiscovererStreamInfo> {
113 unsafe {
114 from_glib_full(ffi::gst_discoverer_stream_info_get_previous(
115 self.as_ref().to_glib_none().0,
116 ))
117 }
118 }
119
120 ///
121 /// # Returns
122 ///
123 /// the stream ID of this stream. If you wish to
124 /// use the stream ID after the life-time of `self` you will need to copy it.
125 #[doc(alias = "gst_discoverer_stream_info_get_stream_id")]
126 #[doc(alias = "get_stream_id")]
127 fn stream_id(&self) -> Option<glib::GString> {
128 unsafe {
129 from_glib_none(ffi::gst_discoverer_stream_info_get_stream_id(
130 self.as_ref().to_glib_none().0,
131 ))
132 }
133 }
134
135 /// Get the stream number of `self`, a stable identifier of the stream within its
136 /// [`DiscovererInfo`][crate::DiscovererInfo].
137 ///
138 /// The contract of the stream number is:
139 ///
140 /// * Elementary streams are numbered from 0, in the order the demuxer exposes
141 /// them (their declaration order in the container) - the same order in which a
142 /// `GstStreamCollection` enumerates them. This usually matches the stream index
143 /// other tools such as `ffprobe` report, but the order is the demuxer's, so it
144 /// may differ between tools for containers without a canonical stream order.
145 /// * Each actual (elementary) stream is given exactly one number. Extra caps
146 /// nodes that a parser may expose for a *single* stream do not get their own
147 /// number.
148 /// * A container is not an elementary stream and has a stream number of -1.
149 ///
150 /// # Returns
151 ///
152 /// the stream number, or -1 if it could not be determined.
153 #[cfg(feature = "v1_20")]
154 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
155 #[doc(alias = "gst_discoverer_stream_info_get_stream_number")]
156 #[doc(alias = "get_stream_number")]
157 fn stream_number(&self) -> i32 {
158 unsafe { ffi::gst_discoverer_stream_info_get_stream_number(self.as_ref().to_glib_none().0) }
159 }
160
161 ///
162 /// # Returns
163 ///
164 /// a human readable name for the stream type of the given `self` (ex : "audio",
165 /// "container",...).
166 #[doc(alias = "gst_discoverer_stream_info_get_stream_type_nick")]
167 #[doc(alias = "get_stream_type_nick")]
168 fn stream_type_nick(&self) -> glib::GString {
169 unsafe {
170 from_glib_none(ffi::gst_discoverer_stream_info_get_stream_type_nick(
171 self.as_ref().to_glib_none().0,
172 ))
173 }
174 }
175
176 ///
177 /// # Returns
178 ///
179 /// the tags contained in this stream. If you wish to
180 /// use the tags after the life-time of `self` you will need to copy them.
181 #[doc(alias = "gst_discoverer_stream_info_get_tags")]
182 #[doc(alias = "get_tags")]
183 fn tags(&self) -> Option<gst::TagList> {
184 unsafe {
185 from_glib_none(ffi::gst_discoverer_stream_info_get_tags(
186 self.as_ref().to_glib_none().0,
187 ))
188 }
189 }
190
191 ///
192 /// # Returns
193 ///
194 /// the TOC contained in this stream. If you wish to
195 /// use the TOC after the life-time of `self` you will need to copy it.
196 #[doc(alias = "gst_discoverer_stream_info_get_toc")]
197 #[doc(alias = "get_toc")]
198 fn toc(&self) -> Option<gst::Toc> {
199 unsafe {
200 from_glib_none(ffi::gst_discoverer_stream_info_get_toc(
201 self.as_ref().to_glib_none().0,
202 ))
203 }
204 }
205}
206
207impl<O: IsA<DiscovererStreamInfo>> DiscovererStreamInfoExt for O {}