gstreamer_player/auto/
player_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
11    /// the stream type, one can find more media-specific information in
12    /// [`PlayerVideoInfo`][crate::PlayerVideoInfo], [`PlayerAudioInfo`][crate::PlayerAudioInfo], [`PlayerSubtitleInfo`][crate::PlayerSubtitleInfo].
13    ///
14    /// This is an Abstract Base Class, you cannot instantiate it.
15    ///
16    /// # Implements
17    ///
18    /// [`PlayerStreamInfoExt`][trait@crate::prelude::PlayerStreamInfoExt], [`trait@glib::ObjectExt`]
19    #[doc(alias = "GstPlayerStreamInfo")]
20    pub struct PlayerStreamInfo(Object<ffi::GstPlayerStreamInfo, ffi::GstPlayerStreamInfoClass>);
21
22    match fn {
23        type_ => || ffi::gst_player_stream_info_get_type(),
24    }
25}
26
27impl PlayerStreamInfo {
28    pub const NONE: Option<&'static PlayerStreamInfo> = None;
29}
30
31unsafe impl Send for PlayerStreamInfo {}
32unsafe impl Sync for PlayerStreamInfo {}
33
34mod sealed {
35    pub trait Sealed {}
36    impl<T: super::IsA<super::PlayerStreamInfo>> Sealed for T {}
37}
38
39/// Trait containing all [`struct@PlayerStreamInfo`] methods.
40///
41/// # Implementors
42///
43/// [`PlayerAudioInfo`][struct@crate::PlayerAudioInfo], [`PlayerStreamInfo`][struct@crate::PlayerStreamInfo], [`PlayerSubtitleInfo`][struct@crate::PlayerSubtitleInfo], [`PlayerVideoInfo`][struct@crate::PlayerVideoInfo]
44pub trait PlayerStreamInfoExt: IsA<PlayerStreamInfo> + sealed::Sealed + 'static {
45    ///
46    /// # Returns
47    ///
48    /// the [`gst::Caps`][crate::gst::Caps] of the stream.
49    #[doc(alias = "gst_player_stream_info_get_caps")]
50    #[doc(alias = "get_caps")]
51    fn caps(&self) -> Option<gst::Caps> {
52        unsafe {
53            from_glib_none(ffi::gst_player_stream_info_get_caps(const_override(
54                self.as_ref().to_glib_none().0,
55            )))
56        }
57    }
58
59    /// A string describing codec used in [`PlayerStreamInfo`][crate::PlayerStreamInfo].
60    ///
61    /// # Returns
62    ///
63    /// codec string or [`None`] on unknown.
64    #[doc(alias = "gst_player_stream_info_get_codec")]
65    #[doc(alias = "get_codec")]
66    fn codec(&self) -> Option<glib::GString> {
67        unsafe {
68            from_glib_none(ffi::gst_player_stream_info_get_codec(const_override(
69                self.as_ref().to_glib_none().0,
70            )))
71        }
72    }
73
74    /// Function to get stream index from [`PlayerStreamInfo`][crate::PlayerStreamInfo] instance or -1 if
75    /// unknown.
76    ///
77    /// # Returns
78    ///
79    /// the stream index of this stream.
80    #[doc(alias = "gst_player_stream_info_get_index")]
81    #[doc(alias = "get_index")]
82    fn index(&self) -> i32 {
83        unsafe {
84            ffi::gst_player_stream_info_get_index(const_override(self.as_ref().to_glib_none().0))
85        }
86    }
87
88    /// Function to return human readable name for the stream type
89    /// of the given `self` (ex: "audio", "video", "subtitle")
90    ///
91    /// # Returns
92    ///
93    /// a human readable name
94    #[doc(alias = "gst_player_stream_info_get_stream_type")]
95    #[doc(alias = "get_stream_type")]
96    fn stream_type(&self) -> glib::GString {
97        unsafe {
98            from_glib_none(ffi::gst_player_stream_info_get_stream_type(const_override(
99                self.as_ref().to_glib_none().0,
100            )))
101        }
102    }
103
104    ///
105    /// # Returns
106    ///
107    /// the tags contained in this stream.
108    #[doc(alias = "gst_player_stream_info_get_tags")]
109    #[doc(alias = "get_tags")]
110    fn tags(&self) -> Option<gst::TagList> {
111        unsafe {
112            from_glib_none(ffi::gst_player_stream_info_get_tags(const_override(
113                self.as_ref().to_glib_none().0,
114            )))
115        }
116    }
117}
118
119impl<O: IsA<PlayerStreamInfo>> PlayerStreamInfoExt for O {}