From 0585476687af4b88a6ac50d56c32fc7e07670d5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 24 Apr 2023 09:43:48 +0300 Subject: [PATCH] gstreamer: serde: Update for `glib::FlagsClass` API changes Part-of: --- gstreamer/src/serde_macros.rs | 6 +++--- tutorials/src/bin/playback-tutorial-1.rs | 2 +- tutorials/src/bin/playback-tutorial-2.rs | 2 +- tutorials/src/bin/playback-tutorial-4.rs | 2 +- tutorials/src/bin/playback-tutorial-6.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gstreamer/src/serde_macros.rs b/gstreamer/src/serde_macros.rs index 27b4a5a23..c0e27bceb 100644 --- a/gstreamer/src/serde_macros.rs +++ b/gstreamer/src/serde_macros.rs @@ -12,7 +12,7 @@ macro_rules! bitflags_serialize_impl { where S: serde::Serializer, { - let class = FlagsClass::new(Self::static_type()).unwrap(); + let class = FlagsClass::with_type(Self::static_type()).unwrap(); let this = self.to_value(); let mut handled = Self::empty().to_value(); @@ -49,7 +49,7 @@ macro_rules! bitflags_serialize_impl { let mut res = String::new(); static SORTED_VALUES: Lazy> = Lazy::new(|| { - let class = FlagsClass::new(<$type>::static_type()).unwrap(); + let class = FlagsClass::with_type(<$type>::static_type()).unwrap(); let mut sorted_values: Vec<(u32, String)> = class.values().iter() .map(|f| (f.value(), f.nick().to_owned())) @@ -114,7 +114,7 @@ macro_rules! bitflags_deserialize_impl { let mut gvalue = unsafe { glib::Value::from_type_unchecked(Self::Value::static_type()) }; let tokens = value.split('+'); - let class = FlagsClass::new(Self::Value::static_type()).unwrap(); + let class = FlagsClass::with_type(Self::Value::static_type()).unwrap(); for token in tokens { gvalue = class.set_by_nick(gvalue, token).map_err(|_| { diff --git a/tutorials/src/bin/playback-tutorial-1.rs b/tutorials/src/bin/playback-tutorial-1.rs index 702547728..997c82ed9 100644 --- a/tutorials/src/bin/playback-tutorial-1.rs +++ b/tutorials/src/bin/playback-tutorial-1.rs @@ -114,7 +114,7 @@ fn tutorial_main() -> Result<(), Error> { // Set flags to show Audio and Video but ignore Subtitles let flags = playbin.property_value("flags"); - let flags_class = FlagsClass::new(flags.type_()).unwrap(); + let flags_class = FlagsClass::with_type(flags.type_()).unwrap(); let flags = flags_class .builder_with_value(flags) diff --git a/tutorials/src/bin/playback-tutorial-2.rs b/tutorials/src/bin/playback-tutorial-2.rs index bd9d4ec58..28c8feec8 100644 --- a/tutorials/src/bin/playback-tutorial-2.rs +++ b/tutorials/src/bin/playback-tutorial-2.rs @@ -119,7 +119,7 @@ fn tutorial_main() -> Result<(), Error> { // Set flags to show Audio, Video and Subtitles let flags = playbin.property_value("flags"); - let flags_class = FlagsClass::new(flags.type_()).unwrap(); + let flags_class = FlagsClass::with_type(flags.type_()).unwrap(); let flags = flags_class .builder_with_value(flags) diff --git a/tutorials/src/bin/playback-tutorial-4.rs b/tutorials/src/bin/playback-tutorial-4.rs index 39d73fd07..e0dca8bd3 100644 --- a/tutorials/src/bin/playback-tutorial-4.rs +++ b/tutorials/src/bin/playback-tutorial-4.rs @@ -26,7 +26,7 @@ fn tutorial_main() -> Result<(), Error> { // Set the download flag let flags = pipeline.property_value("flags"); - let flags_class = FlagsClass::new(flags.type_()).unwrap(); + let flags_class = FlagsClass::with_type(flags.type_()).unwrap(); let flags = flags_class .builder_with_value(flags) .unwrap() diff --git a/tutorials/src/bin/playback-tutorial-6.rs b/tutorials/src/bin/playback-tutorial-6.rs index e4c1629ff..450a4da1e 100644 --- a/tutorials/src/bin/playback-tutorial-6.rs +++ b/tutorials/src/bin/playback-tutorial-6.rs @@ -49,7 +49,7 @@ fn tutorial_main() -> Result<(), Error> { // Set the visualization flag let flags = pipeline.property_value("flags"); - let flags_class = FlagsClass::new(flags.type_()).unwrap(); + let flags_class = FlagsClass::with_type(flags.type_()).unwrap(); let flags = flags_class .builder_with_value(flags) .unwrap()