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
34/// Trait containing all [`struct@PlayerStreamInfo`] methods.
35///
36/// # Implementors
37///
38/// [`PlayerAudioInfo`][struct@crate::PlayerAudioInfo], [`PlayerStreamInfo`][struct@crate::PlayerStreamInfo], [`PlayerSubtitleInfo`][struct@crate::PlayerSubtitleInfo], [`PlayerVideoInfo`][struct@crate::PlayerVideoInfo]
39pub trait PlayerStreamInfoExt: IsA<PlayerStreamInfo> + 'static {
40    ///
41    /// # Returns
42    ///
43    /// the [`gst::Caps`][crate::gst::Caps] of the stream.
44    #[doc(alias = "gst_player_stream_info_get_caps")]
45    #[doc(alias = "get_caps")]
46    fn caps(&self) -> Option<gst::Caps> {
47        unsafe {
48            from_glib_none(ffi::gst_player_stream_info_get_caps(const_override(
49                self.as_ref().to_glib_none().0,
50            )))
51        }
52    }
53
54    /// A string describing codec used in [`PlayerStreamInfo`][crate::PlayerStreamInfo].
55    ///
56    /// # Returns
57    ///
58    /// codec string or [`None`] on unknown.
59    #[doc(alias = "gst_player_stream_info_get_codec")]
60    #[doc(alias = "get_codec")]
61    fn codec(&self) -> Option<glib::GString> {
62        unsafe {
63            from_glib_none(ffi::gst_player_stream_info_get_codec(const_override(
64                self.as_ref().to_glib_none().0,
65            )))
66        }
67    }
68
69    /// Function to get stream index from [`PlayerStreamInfo`][crate::PlayerStreamInfo] instance or -1 if
70    /// unknown.
71    ///
72    /// # Returns
73    ///
74    /// the stream index of this stream.
75    #[doc(alias = "gst_player_stream_info_get_index")]
76    #[doc(alias = "get_index")]
77    fn index(&self) -> i32 {
78        unsafe {
79            ffi::gst_player_stream_info_get_index(const_override(self.as_ref().to_glib_none().0))
80        }
81    }
82
83    /// Function to return human readable name for the stream type
84    /// of the given `self` (ex: "audio", "video", "subtitle")
85    ///
86    /// # Returns
87    ///
88    /// a human readable name
89    #[doc(alias = "gst_player_stream_info_get_stream_type")]
90    #[doc(alias = "get_stream_type")]
91    fn stream_type(&self) -> glib::GString {
92        unsafe {
93            from_glib_none(ffi::gst_player_stream_info_get_stream_type(const_override(
94                self.as_ref().to_glib_none().0,
95            )))
96        }
97    }
98
99    ///
100    /// # Returns
101    ///
102    /// the tags contained in this stream.
103    #[doc(alias = "gst_player_stream_info_get_tags")]
104    #[doc(alias = "get_tags")]
105    fn tags(&self) -> Option<gst::TagList> {
106        unsafe {
107            from_glib_none(ffi::gst_player_stream_info_get_tags(const_override(
108                self.as_ref().to_glib_none().0,
109            )))
110        }
111    }
112}
113
114impl<O: IsA<PlayerStreamInfo>> PlayerStreamInfoExt for O {}