diff --git a/gstreamer-play/Gir.toml b/gstreamer-play/Gir.toml index c19d9429f..5aa2889cc 100644 --- a/gstreamer-play/Gir.toml +++ b/gstreamer-play/Gir.toml @@ -160,6 +160,22 @@ status = "generate" final_type = true visibility = "crate" + [[object.function]] + name = "parse_error_missing_plugin" + manual = true + + [[object.function]] + name = "parse_warning_missing_plugin" + manual = true + + [[object.function]] + name = "get_uri" + manual = true + + [[object.function]] + name = "get_stream_id" + manual = true + [[object]] name = "GstPlay.PlaySignalAdapter" status = "generate" diff --git a/gstreamer-play/src/auto/enums.rs b/gstreamer-play/src/auto/enums.rs index fa39499fa..6ad6fab09 100644 --- a/gstreamer-play/src/auto/enums.rs +++ b/gstreamer-play/src/auto/enums.rs @@ -309,24 +309,6 @@ impl PlayMessage { } } - #[cfg(feature = "v1_26")] - #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] - #[doc(alias = "gst_play_message_get_stream_id")] - #[doc(alias = "get_stream_id")] - pub fn stream_id(msg: &gst::Message) -> Option { - assert_initialized_main_thread!(); - unsafe { from_glib_none(ffi::gst_play_message_get_stream_id(msg.to_glib_none().0)) } - } - - #[cfg(feature = "v1_26")] - #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] - #[doc(alias = "gst_play_message_get_uri")] - #[doc(alias = "get_uri")] - pub fn uri(msg: &gst::Message) -> glib::GString { - assert_initialized_main_thread!(); - unsafe { from_glib_none(ffi::gst_play_message_get_uri(msg.to_glib_none().0)) } - } - #[cfg(feature = "v1_26")] #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] #[doc(alias = "gst_play_message_parse_buffering")] @@ -395,32 +377,6 @@ impl PlayMessage { } } - #[cfg(feature = "v1_26")] - #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] - #[doc(alias = "gst_play_message_parse_error_missing_plugin")] - pub fn parse_error_missing_plugin( - msg: &gst::Message, - ) -> Option<(glib::GString, Option)> { - assert_initialized_main_thread!(); - unsafe { - let mut descriptions = std::ptr::null_mut(); - let mut installer_details = std::ptr::null_mut(); - let ret = from_glib(ffi::gst_play_message_parse_error_missing_plugin( - msg.to_glib_none().0, - &mut descriptions, - &mut installer_details, - )); - if ret { - Some(( - from_glib_full(descriptions), - from_glib_full(installer_details), - )) - } else { - None - } - } - } - #[doc(alias = "gst_play_message_parse_media_info_updated")] pub fn parse_media_info_updated(msg: &gst::Message) -> PlayMediaInfo { assert_initialized_main_thread!(); @@ -533,32 +489,6 @@ impl PlayMessage { (from_glib_full(error), from_glib_full(details)) } } - - #[cfg(feature = "v1_26")] - #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] - #[doc(alias = "gst_play_message_parse_warning_missing_plugin")] - pub fn parse_warning_missing_plugin( - msg: &gst::Message, - ) -> Option<(glib::GString, Option)> { - assert_initialized_main_thread!(); - unsafe { - let mut descriptions = std::ptr::null_mut(); - let mut installer_details = std::ptr::null_mut(); - let ret = from_glib(ffi::gst_play_message_parse_warning_missing_plugin( - msg.to_glib_none().0, - &mut descriptions, - &mut installer_details, - )); - if ret { - Some(( - from_glib_full(descriptions), - from_glib_full(installer_details), - )) - } else { - None - } - } - } } impl std::fmt::Display for PlayMessage { diff --git a/gstreamer-play/src/play_message.rs b/gstreamer-play/src/play_message.rs index a3c18f2d5..e7e0e455a 100644 --- a/gstreamer-play/src/play_message.rs +++ b/gstreamer-play/src/play_message.rs @@ -117,6 +117,21 @@ impl PositionUpdated { pub fn position(&self) -> Option { self.message().structure().unwrap().get("position").unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for PositionUpdated { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -132,6 +147,21 @@ impl DurationChanged { pub fn duration(&self) -> Option { self.message().structure().unwrap().get("duration").unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for DurationChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -151,6 +181,21 @@ impl StateChanged { .get("play-state") .unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for StateChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -171,6 +216,21 @@ impl Buffering { .get("bufferring-percent") .unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for Buffering { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -203,6 +263,78 @@ impl Error { .get_optional("error-details") .unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_stream_id")] + pub fn stream_id(&self) -> Option { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_stream_id(mut_override( + self.message().as_ptr(), + ))) + } + } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_parse_error_missing_plugin")] + pub fn missing_plugin(&self) -> Option> { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + let mut descriptions = std::ptr::null_mut(); + let mut installer_details = std::ptr::null_mut(); + let ret = from_glib(ffi::gst_play_message_parse_error_missing_plugin( + mut_override(self.message().as_ptr()), + &mut descriptions, + &mut installer_details, + )); + if ret { + let mut ret = Vec::new(); + for idx in 0.. { + let description = *descriptions.add(idx); + let installer_detail = *installer_details.add(idx); + + if description.is_null() { + assert!(installer_detail.is_null()); + break; + } + + ret.push(( + glib::GString::from_glib_full(description), + glib::GString::from_glib_full(installer_detail), + )); + } + glib::ffi::g_free(descriptions as glib::ffi::gpointer); + glib::ffi::g_free(installer_details as glib::ffi::gpointer); + + Some(ret) + } else { + None + } + } + } } impl std::fmt::Debug for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -227,6 +359,78 @@ impl Warning { .get_optional("warning-details") .unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_stream_id")] + pub fn stream_id(&self) -> Option { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_stream_id(mut_override( + self.message().as_ptr(), + ))) + } + } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_parse_warning_missing_plugin")] + pub fn missing_plugin(&self) -> Option> { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + let mut descriptions = std::ptr::null_mut(); + let mut installer_details = std::ptr::null_mut(); + let ret = from_glib(ffi::gst_play_message_parse_warning_missing_plugin( + mut_override(self.message().as_ptr()), + &mut descriptions, + &mut installer_details, + )); + if ret { + let mut ret = Vec::new(); + for idx in 0.. { + let description = *descriptions.add(idx); + let installer_detail = *installer_details.add(idx); + + if description.is_null() { + assert!(installer_detail.is_null()); + break; + } + + ret.push(( + glib::GString::from_glib_full(description), + glib::GString::from_glib_full(installer_detail), + )); + } + glib::ffi::g_free(descriptions as glib::ffi::gpointer); + glib::ffi::g_free(installer_details as glib::ffi::gpointer); + + Some(ret) + } else { + None + } + } + } } impl std::fmt::Debug for Warning { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -255,6 +459,21 @@ impl VideoDimensionsChanged { .get("video-height") .unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for VideoDimensionsChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -275,6 +494,21 @@ impl MediaInfoUpdated { .get("media-info") .unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for MediaInfoUpdated { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -290,6 +524,21 @@ impl VolumeChanged { pub fn volume(&self) -> f64 { self.message().structure().unwrap().get("volume").unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for VolumeChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -305,6 +554,21 @@ impl MuteChanged { pub fn is_muted(&self) -> bool { self.message().structure().unwrap().get("is-muted").unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for MuteChanged { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -320,6 +584,21 @@ impl SeekDone { pub fn position(&self) -> Option { self.message().structure().unwrap().get("position").unwrap() } + + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } } impl std::fmt::Debug for SeekDone { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { @@ -331,6 +610,24 @@ impl std::fmt::Debug for SeekDone { } declare_concrete_message!(Other); + +impl Other { + #[cfg(feature = "v1_26")] + #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))] + #[doc(alias = "gst_play_message_get_uri")] + pub fn uri(&self) -> glib::GString { + use crate::ffi; + use glib::translate::*; + + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::gst_play_message_get_uri(mut_override( + self.message().as_ptr(), + ))) + } + } +} + impl std::fmt::Debug for Other { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Other")