gstreamer_player/auto/
player_media_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, PlayerAudioInfo, PlayerStreamInfo, PlayerSubtitleInfo, PlayerVideoInfo};
7use glib::translate::*;
8
9glib::wrapper! {
10    /// Structure containing the media information of a URI.
11    ///
12    /// # Implements
13    ///
14    /// [`trait@glib::ObjectExt`]
15    #[doc(alias = "GstPlayerMediaInfo")]
16    pub struct PlayerMediaInfo(Object<ffi::GstPlayerMediaInfo, ffi::GstPlayerMediaInfoClass>);
17
18    match fn {
19        type_ => || ffi::gst_player_media_info_get_type(),
20    }
21}
22
23impl PlayerMediaInfo {
24    ///
25    /// # Returns
26    ///
27    /// A `GList` of
28    /// matching [`PlayerAudioInfo`][crate::PlayerAudioInfo].
29    #[doc(alias = "gst_player_media_info_get_audio_streams")]
30    #[doc(alias = "get_audio_streams")]
31    pub fn audio_streams(&self) -> Vec<PlayerAudioInfo> {
32        unsafe {
33            FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_audio_streams(
34                self.to_glib_none().0,
35            ))
36        }
37    }
38
39    ///
40    /// # Returns
41    ///
42    /// the container format or [`None`] if unknown.
43    #[doc(alias = "gst_player_media_info_get_container_format")]
44    #[doc(alias = "get_container_format")]
45    pub fn container_format(&self) -> Option<glib::GString> {
46        unsafe {
47            from_glib_none(ffi::gst_player_media_info_get_container_format(
48                self.to_glib_none().0,
49            ))
50        }
51    }
52
53    ///
54    /// # Returns
55    ///
56    /// duration of the media or `GST_CLOCK_TIME_NONE` if unknown.
57    #[doc(alias = "gst_player_media_info_get_duration")]
58    #[doc(alias = "get_duration")]
59    pub fn duration(&self) -> Option<gst::ClockTime> {
60        unsafe {
61            from_glib(ffi::gst_player_media_info_get_duration(
62                self.to_glib_none().0,
63            ))
64        }
65    }
66
67    /// Function to get the image (or preview-image) stored in taglist.
68    /// Application can use `gst_sample_*`_()`` API's to get caps, buffer etc.
69    ///
70    /// # Returns
71    ///
72    /// GstSample or [`None`].
73    #[doc(alias = "gst_player_media_info_get_image_sample")]
74    #[doc(alias = "get_image_sample")]
75    pub fn image_sample(&self) -> Option<gst::Sample> {
76        unsafe {
77            from_glib_none(ffi::gst_player_media_info_get_image_sample(
78                self.to_glib_none().0,
79            ))
80        }
81    }
82
83    ///
84    /// # Returns
85    ///
86    /// number of audio streams or 0 if unknown.
87    #[doc(alias = "gst_player_media_info_get_number_of_audio_streams")]
88    #[doc(alias = "get_number_of_audio_streams")]
89    pub fn number_of_audio_streams(&self) -> u32 {
90        unsafe { ffi::gst_player_media_info_get_number_of_audio_streams(self.to_glib_none().0) }
91    }
92
93    ///
94    /// # Returns
95    ///
96    /// number of total streams or 0 if unknown.
97    #[doc(alias = "gst_player_media_info_get_number_of_streams")]
98    #[doc(alias = "get_number_of_streams")]
99    pub fn number_of_streams(&self) -> u32 {
100        unsafe { ffi::gst_player_media_info_get_number_of_streams(self.to_glib_none().0) }
101    }
102
103    ///
104    /// # Returns
105    ///
106    /// number of subtitle streams or 0 if unknown.
107    #[doc(alias = "gst_player_media_info_get_number_of_subtitle_streams")]
108    #[doc(alias = "get_number_of_subtitle_streams")]
109    pub fn number_of_subtitle_streams(&self) -> u32 {
110        unsafe { ffi::gst_player_media_info_get_number_of_subtitle_streams(self.to_glib_none().0) }
111    }
112
113    ///
114    /// # Returns
115    ///
116    /// number of video streams or 0 if unknown.
117    #[doc(alias = "gst_player_media_info_get_number_of_video_streams")]
118    #[doc(alias = "get_number_of_video_streams")]
119    pub fn number_of_video_streams(&self) -> u32 {
120        unsafe { ffi::gst_player_media_info_get_number_of_video_streams(self.to_glib_none().0) }
121    }
122
123    ///
124    /// # Returns
125    ///
126    /// A `GList` of
127    /// matching [`PlayerStreamInfo`][crate::PlayerStreamInfo].
128    #[doc(alias = "gst_player_media_info_get_stream_list")]
129    #[doc(alias = "get_stream_list")]
130    pub fn stream_list(&self) -> Vec<PlayerStreamInfo> {
131        unsafe {
132            FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_stream_list(
133                self.to_glib_none().0,
134            ))
135        }
136    }
137
138    ///
139    /// # Returns
140    ///
141    /// A `GList` of
142    /// matching [`PlayerSubtitleInfo`][crate::PlayerSubtitleInfo].
143    #[doc(alias = "gst_player_media_info_get_subtitle_streams")]
144    #[doc(alias = "get_subtitle_streams")]
145    pub fn subtitle_streams(&self) -> Vec<PlayerSubtitleInfo> {
146        unsafe {
147            FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_subtitle_streams(
148                self.to_glib_none().0,
149            ))
150        }
151    }
152
153    ///
154    /// # Returns
155    ///
156    /// the tags contained in media info.
157    #[doc(alias = "gst_player_media_info_get_tags")]
158    #[doc(alias = "get_tags")]
159    pub fn tags(&self) -> Option<gst::TagList> {
160        unsafe { from_glib_none(ffi::gst_player_media_info_get_tags(self.to_glib_none().0)) }
161    }
162
163    ///
164    /// # Returns
165    ///
166    /// the media title or [`None`] if unknown.
167    #[doc(alias = "gst_player_media_info_get_title")]
168    #[doc(alias = "get_title")]
169    pub fn title(&self) -> Option<glib::GString> {
170        unsafe { from_glib_none(ffi::gst_player_media_info_get_title(self.to_glib_none().0)) }
171    }
172
173    ///
174    /// # Returns
175    ///
176    /// the URI associated with [`PlayerMediaInfo`][crate::PlayerMediaInfo].
177    #[doc(alias = "gst_player_media_info_get_uri")]
178    #[doc(alias = "get_uri")]
179    pub fn uri(&self) -> glib::GString {
180        unsafe { from_glib_none(ffi::gst_player_media_info_get_uri(self.to_glib_none().0)) }
181    }
182
183    ///
184    /// # Returns
185    ///
186    /// A `GList` of
187    /// matching [`PlayerVideoInfo`][crate::PlayerVideoInfo].
188    #[doc(alias = "gst_player_media_info_get_video_streams")]
189    #[doc(alias = "get_video_streams")]
190    pub fn video_streams(&self) -> Vec<PlayerVideoInfo> {
191        unsafe {
192            FromGlibPtrContainer::from_glib_none(ffi::gst_player_media_info_get_video_streams(
193                self.to_glib_none().0,
194            ))
195        }
196    }
197
198    ///
199    /// # Returns
200    ///
201    /// [`true`] if the media is live.
202    #[doc(alias = "gst_player_media_info_is_live")]
203    pub fn is_live(&self) -> bool {
204        unsafe { from_glib(ffi::gst_player_media_info_is_live(self.to_glib_none().0)) }
205    }
206
207    ///
208    /// # Returns
209    ///
210    /// [`true`] if the media is seekable.
211    #[doc(alias = "gst_player_media_info_is_seekable")]
212    pub fn is_seekable(&self) -> bool {
213        unsafe {
214            from_glib(ffi::gst_player_media_info_is_seekable(
215                self.to_glib_none().0,
216            ))
217        }
218    }
219}
220
221unsafe impl Send for PlayerMediaInfo {}
222unsafe impl Sync for PlayerMediaInfo {}