mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-22 09:31:06 +00:00
gstreamer: serde: Update for glib::FlagsClass
API changes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1253>
This commit is contained in:
parent
b1577af7cf
commit
0585476687
5 changed files with 7 additions and 7 deletions
|
@ -12,7 +12,7 @@ macro_rules! bitflags_serialize_impl {
|
||||||
where
|
where
|
||||||
S: serde::Serializer,
|
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 this = self.to_value();
|
||||||
|
|
||||||
let mut handled = Self::empty().to_value();
|
let mut handled = Self::empty().to_value();
|
||||||
|
@ -49,7 +49,7 @@ macro_rules! bitflags_serialize_impl {
|
||||||
let mut res = String::new();
|
let mut res = String::new();
|
||||||
|
|
||||||
static SORTED_VALUES: Lazy<Vec<(u32, String)>> = Lazy::new(|| {
|
static SORTED_VALUES: Lazy<Vec<(u32, String)>> = 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)> =
|
let mut sorted_values: Vec<(u32, String)> =
|
||||||
class.values().iter()
|
class.values().iter()
|
||||||
.map(|f| (f.value(), f.nick().to_owned()))
|
.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 mut gvalue = unsafe { glib::Value::from_type_unchecked(Self::Value::static_type()) };
|
||||||
let tokens = value.split('+');
|
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 {
|
for token in tokens {
|
||||||
gvalue = class.set_by_nick(gvalue, token).map_err(|_| {
|
gvalue = class.set_by_nick(gvalue, token).map_err(|_| {
|
||||||
|
|
|
@ -114,7 +114,7 @@ fn tutorial_main() -> Result<(), Error> {
|
||||||
|
|
||||||
// Set flags to show Audio and Video but ignore Subtitles
|
// Set flags to show Audio and Video but ignore Subtitles
|
||||||
let flags = playbin.property_value("flags");
|
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
|
let flags = flags_class
|
||||||
.builder_with_value(flags)
|
.builder_with_value(flags)
|
||||||
|
|
|
@ -119,7 +119,7 @@ fn tutorial_main() -> Result<(), Error> {
|
||||||
|
|
||||||
// Set flags to show Audio, Video and Subtitles
|
// Set flags to show Audio, Video and Subtitles
|
||||||
let flags = playbin.property_value("flags");
|
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
|
let flags = flags_class
|
||||||
.builder_with_value(flags)
|
.builder_with_value(flags)
|
||||||
|
|
|
@ -26,7 +26,7 @@ fn tutorial_main() -> Result<(), Error> {
|
||||||
|
|
||||||
// Set the download flag
|
// Set the download flag
|
||||||
let flags = pipeline.property_value("flags");
|
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
|
let flags = flags_class
|
||||||
.builder_with_value(flags)
|
.builder_with_value(flags)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
@ -49,7 +49,7 @@ fn tutorial_main() -> Result<(), Error> {
|
||||||
|
|
||||||
// Set the visualization flag
|
// Set the visualization flag
|
||||||
let flags = pipeline.property_value("flags");
|
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
|
let flags = flags_class
|
||||||
.builder_with_value(flags)
|
.builder_with_value(flags)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
Loading…
Reference in a new issue