gstreamer_pbutils/auto/
discoverer_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#![allow(deprecated)]
6
7use crate::{
8    ffi, DiscovererAudioInfo, DiscovererContainerInfo, DiscovererResult, DiscovererSerializeFlags,
9    DiscovererStreamInfo, DiscovererSubtitleInfo, DiscovererVideoInfo,
10};
11use glib::translate::*;
12
13glib::wrapper! {
14    /// Structure containing the information of a URI analyzed by [`Discoverer`][crate::Discoverer].
15    ///
16    /// # Implements
17    ///
18    /// [`trait@glib::ObjectExt`]
19    #[doc(alias = "GstDiscovererInfo")]
20    pub struct DiscovererInfo(Object<ffi::GstDiscovererInfo>);
21
22    match fn {
23        type_ => || ffi::gst_discoverer_info_get_type(),
24    }
25}
26
27impl DiscovererInfo {
28    #[doc(alias = "gst_discoverer_info_copy")]
29    #[must_use]
30    pub fn copy(&self) -> DiscovererInfo {
31        unsafe { from_glib_full(ffi::gst_discoverer_info_copy(self.to_glib_none().0)) }
32    }
33
34    /// Finds all the [`DiscovererAudioInfo`][crate::DiscovererAudioInfo] contained in `self`
35    ///
36    /// # Returns
37    ///
38    /// A `GList` of
39    /// matching [`DiscovererStreamInfo`][crate::DiscovererStreamInfo]. The caller should free it with
40    /// `gst_discoverer_stream_info_list_free()`.
41    #[doc(alias = "gst_discoverer_info_get_audio_streams")]
42    #[doc(alias = "get_audio_streams")]
43    pub fn audio_streams(&self) -> Vec<DiscovererAudioInfo> {
44        unsafe {
45            FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_audio_streams(
46                self.to_glib_none().0,
47            ))
48        }
49    }
50
51    /// Finds all the [`DiscovererContainerInfo`][crate::DiscovererContainerInfo] contained in `self`
52    ///
53    /// # Returns
54    ///
55    /// A `GList` of
56    /// matching [`DiscovererStreamInfo`][crate::DiscovererStreamInfo]. The caller should free it with
57    /// `gst_discoverer_stream_info_list_free()`.
58    #[doc(alias = "gst_discoverer_info_get_container_streams")]
59    #[doc(alias = "get_container_streams")]
60    pub fn container_streams(&self) -> Vec<DiscovererContainerInfo> {
61        unsafe {
62            FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_container_streams(
63                self.to_glib_none().0,
64            ))
65        }
66    }
67
68    ///
69    /// # Returns
70    ///
71    /// the duration of the URI in `GstClockTime` (nanoseconds).
72    #[doc(alias = "gst_discoverer_info_get_duration")]
73    #[doc(alias = "get_duration")]
74    pub fn duration(&self) -> Option<gst::ClockTime> {
75        unsafe { from_glib(ffi::gst_discoverer_info_get_duration(self.to_glib_none().0)) }
76    }
77
78    ///
79    /// # Returns
80    ///
81    /// whether the URI is live.
82    #[doc(alias = "gst_discoverer_info_get_live")]
83    #[doc(alias = "get_live")]
84    pub fn is_live(&self) -> bool {
85        unsafe { from_glib(ffi::gst_discoverer_info_get_live(self.to_glib_none().0)) }
86    }
87
88    ///
89    /// # Deprecated
90    ///
91    /// This functions is deprecated since version 1.4, use
92    /// `gst_discoverer_info_get_missing_elements_installer_details`
93    ///
94    /// # Returns
95    ///
96    /// Miscellaneous information stored as a [`gst::Structure`][crate::gst::Structure]
97    /// (for example: information about missing plugins). If you wish to use the
98    /// [`gst::Structure`][crate::gst::Structure] after the life-time of `self`, you will need to copy it.
99    #[doc(alias = "gst_discoverer_info_get_misc")]
100    #[doc(alias = "get_misc")]
101    pub fn misc(&self) -> Option<gst::Structure> {
102        unsafe { from_glib_none(ffi::gst_discoverer_info_get_misc(self.to_glib_none().0)) }
103    }
104
105    /// Get the installer details for missing elements
106    ///
107    /// # Returns
108    ///
109    /// An array of strings
110    /// containing information about how to install the various missing elements
111    /// for `self` to be usable. If you wish to use the strings after the life-time
112    /// of `self`, you will need to copy them.
113    #[doc(alias = "gst_discoverer_info_get_missing_elements_installer_details")]
114    #[doc(alias = "get_missing_elements_installer_details")]
115    pub fn missing_elements_installer_details(&self) -> Vec<glib::GString> {
116        unsafe {
117            FromGlibPtrContainer::from_glib_none(
118                ffi::gst_discoverer_info_get_missing_elements_installer_details(
119                    self.to_glib_none().0,
120                ),
121            )
122        }
123    }
124
125    ///
126    /// # Returns
127    ///
128    /// the result of the discovery as a [`DiscovererResult`][crate::DiscovererResult].
129    #[doc(alias = "gst_discoverer_info_get_result")]
130    #[doc(alias = "get_result")]
131    pub fn result(&self) -> DiscovererResult {
132        unsafe { from_glib(ffi::gst_discoverer_info_get_result(self.to_glib_none().0)) }
133    }
134
135    ///
136    /// # Returns
137    ///
138    /// the whether the URI is seekable.
139    #[doc(alias = "gst_discoverer_info_get_seekable")]
140    #[doc(alias = "get_seekable")]
141    pub fn is_seekable(&self) -> bool {
142        unsafe { from_glib(ffi::gst_discoverer_info_get_seekable(self.to_glib_none().0)) }
143    }
144
145    ///
146    /// # Returns
147    ///
148    /// the structure (or topology) of the URI as a
149    /// [`DiscovererStreamInfo`][crate::DiscovererStreamInfo].
150    /// This structure can be traversed to see the original hierarchy. Unref with
151    /// `gst_discoverer_stream_info_unref()` after usage.
152    #[doc(alias = "gst_discoverer_info_get_stream_info")]
153    #[doc(alias = "get_stream_info")]
154    pub fn stream_info(&self) -> Option<DiscovererStreamInfo> {
155        unsafe {
156            from_glib_full(ffi::gst_discoverer_info_get_stream_info(
157                self.to_glib_none().0,
158            ))
159        }
160    }
161
162    ///
163    /// # Returns
164    ///
165    /// the list of
166    /// all streams contained in the `info`. Free after usage
167    /// with `gst_discoverer_stream_info_list_free()`.
168    #[doc(alias = "gst_discoverer_info_get_stream_list")]
169    #[doc(alias = "get_stream_list")]
170    pub fn stream_list(&self) -> Vec<DiscovererStreamInfo> {
171        unsafe {
172            FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_stream_list(
173                self.to_glib_none().0,
174            ))
175        }
176    }
177
178    /// Finds the [`DiscovererStreamInfo`][crate::DiscovererStreamInfo] contained in `self` that match the
179    /// given `streamtype`.
180    /// ## `streamtype`
181    /// a `GType` derived from [`DiscovererStreamInfo`][crate::DiscovererStreamInfo]
182    ///
183    /// # Returns
184    ///
185    /// A `GList` of
186    /// matching [`DiscovererStreamInfo`][crate::DiscovererStreamInfo]. The caller should free it with
187    /// `gst_discoverer_stream_info_list_free()`.
188    #[doc(alias = "gst_discoverer_info_get_streams")]
189    #[doc(alias = "get_streams")]
190    pub fn streams(&self, streamtype: glib::types::Type) -> Vec<DiscovererStreamInfo> {
191        unsafe {
192            FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_streams(
193                self.to_glib_none().0,
194                streamtype.into_glib(),
195            ))
196        }
197    }
198
199    /// Finds all the [`DiscovererSubtitleInfo`][crate::DiscovererSubtitleInfo] contained in `self`
200    ///
201    /// # Returns
202    ///
203    /// A `GList` of
204    /// matching [`DiscovererStreamInfo`][crate::DiscovererStreamInfo]. The caller should free it with
205    /// `gst_discoverer_stream_info_list_free()`.
206    #[doc(alias = "gst_discoverer_info_get_subtitle_streams")]
207    #[doc(alias = "get_subtitle_streams")]
208    pub fn subtitle_streams(&self) -> Vec<DiscovererSubtitleInfo> {
209        unsafe {
210            FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_subtitle_streams(
211                self.to_glib_none().0,
212            ))
213        }
214    }
215
216    ///
217    /// # Deprecated since 1.20
218    ///
219    /// Use gst_discoverer_{container,stream}`_info_get_tags()` instead.
220    ///
221    /// # Returns
222    ///
223    /// all tags contained in the URI. If you wish to use
224    /// the tags after the life-time of `self`, you will need to copy them.
225    #[cfg_attr(feature = "v1_20", deprecated = "Since 1.20")]
226    #[allow(deprecated)]
227    #[doc(alias = "gst_discoverer_info_get_tags")]
228    #[doc(alias = "get_tags")]
229    pub fn tags(&self) -> Option<gst::TagList> {
230        unsafe { from_glib_none(ffi::gst_discoverer_info_get_tags(self.to_glib_none().0)) }
231    }
232
233    ///
234    /// # Returns
235    ///
236    /// TOC contained in the URI. If you wish to use
237    /// the TOC after the life-time of `self`, you will need to copy it.
238    #[doc(alias = "gst_discoverer_info_get_toc")]
239    #[doc(alias = "get_toc")]
240    pub fn toc(&self) -> Option<gst::Toc> {
241        unsafe { from_glib_none(ffi::gst_discoverer_info_get_toc(self.to_glib_none().0)) }
242    }
243
244    ///
245    /// # Returns
246    ///
247    /// the URI to which this information corresponds to.
248    /// Copy it if you wish to use it after the life-time of `self`.
249    #[doc(alias = "gst_discoverer_info_get_uri")]
250    #[doc(alias = "get_uri")]
251    pub fn uri(&self) -> glib::GString {
252        unsafe { from_glib_none(ffi::gst_discoverer_info_get_uri(self.to_glib_none().0)) }
253    }
254
255    /// Finds all the [`DiscovererVideoInfo`][crate::DiscovererVideoInfo] contained in `self`
256    ///
257    /// # Returns
258    ///
259    /// A `GList` of
260    /// matching [`DiscovererStreamInfo`][crate::DiscovererStreamInfo]. The caller should free it with
261    /// `gst_discoverer_stream_info_list_free()`.
262    #[doc(alias = "gst_discoverer_info_get_video_streams")]
263    #[doc(alias = "get_video_streams")]
264    pub fn video_streams(&self) -> Vec<DiscovererVideoInfo> {
265        unsafe {
266            FromGlibPtrContainer::from_glib_full(ffi::gst_discoverer_info_get_video_streams(
267                self.to_glib_none().0,
268            ))
269        }
270    }
271
272    /// Serializes `self` to a [`glib::Variant`][struct@crate::glib::Variant] that can be parsed again
273    /// through [`from_variant()`][Self::from_variant()].
274    ///
275    /// Note that any [`gst::Toc`][crate::gst::Toc] (s) that might have been discovered will not be serialized
276    /// for now.
277    /// ## `flags`
278    /// A combination of [`DiscovererSerializeFlags`][crate::DiscovererSerializeFlags] to specify
279    /// what needs to be serialized.
280    ///
281    /// # Returns
282    ///
283    /// A newly-allocated [`glib::Variant`][struct@crate::glib::Variant] representing `self`.
284    #[doc(alias = "gst_discoverer_info_to_variant")]
285    pub fn to_variant(&self, flags: DiscovererSerializeFlags) -> glib::Variant {
286        unsafe {
287            from_glib_full(ffi::gst_discoverer_info_to_variant(
288                self.to_glib_none().0,
289                flags.into_glib(),
290            ))
291        }
292    }
293
294    /// Parses a [`glib::Variant`][struct@crate::glib::Variant] as produced by [`to_variant()`][Self::to_variant()]
295    /// back to a [`DiscovererInfo`][crate::DiscovererInfo].
296    /// ## `variant`
297    /// A [`glib::Variant`][struct@crate::glib::Variant] to deserialize into a [`DiscovererInfo`][crate::DiscovererInfo].
298    ///
299    /// # Returns
300    ///
301    /// A newly-allocated [`DiscovererInfo`][crate::DiscovererInfo].
302    #[doc(alias = "gst_discoverer_info_from_variant")]
303    pub fn from_variant(variant: &glib::Variant) -> DiscovererInfo {
304        assert_initialized_main_thread!();
305        unsafe {
306            from_glib_full(ffi::gst_discoverer_info_from_variant(
307                variant.to_glib_none().0,
308            ))
309        }
310    }
311}
312
313unsafe impl Send for DiscovererInfo {}
314unsafe impl Sync for DiscovererInfo {}