From 86f422592b160f9aff2eb58c5ab05a0612c152e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 22 Nov 2021 11:04:26 +0200 Subject: [PATCH] Update for `glib::Enum` / `glib::Boxed` / `glib::flags!` macro renames --- audio/audiofx/src/ebur128level/imp.rs | 14 ++++----- generic/fmp4/src/fmp4mux/mod.rs | 4 +-- generic/threadshare/tests/pad.rs | 5 ++-- net/reqwest/src/reqwesthttpsrc/imp.rs | 4 +-- net/rusoto/src/aws_transcriber/mod.rs | 10 +++---- tutorial/src/progressbin/mod.rs | 8 ++--- utils/fallbackswitch/src/fallbacksrc/mod.rs | 8 ++--- .../fallbackswitch/src/fallbackswitch/imp.rs | 8 ++--- video/closedcaption/src/ttutils.rs | 4 +-- video/rspng/src/pngenc/mod.rs | 29 +++++++++---------- 10 files changed, 46 insertions(+), 48 deletions(-) diff --git a/audio/audiofx/src/ebur128level/imp.rs b/audio/audiofx/src/ebur128level/imp.rs index abc2bfed..792b9dc3 100644 --- a/audio/audiofx/src/ebur128level/imp.rs +++ b/audio/audiofx/src/ebur128level/imp.rs @@ -33,22 +33,22 @@ static CAT: Lazy = Lazy::new(|| { ) }); -#[glib::gflags("EbuR128LevelMode")] +#[glib::flags(name = "EbuR128LevelMode")] enum Mode { - #[gflags(name = "Calculate momentary loudness (400ms)", nick = "momentary")] + #[flags_value(name = "Calculate momentary loudness (400ms)", nick = "momentary")] MOMENTARY = 0b00000001, - #[gflags(name = "Calculate short-term loudness (3s)", nick = "short-term")] + #[flags_value(name = "Calculate short-term loudness (3s)", nick = "short-term")] SHORT_TERM = 0b00000010, - #[gflags( + #[flags_value( name = "Calculate relative threshold and global loudness", nick = "global" )] GLOBAL = 0b00000100, - #[gflags(name = "Calculate loudness range", nick = "loudness-range")] + #[flags_value(name = "Calculate loudness range", nick = "loudness-range")] LOUDNESS_RANGE = 0b00001000, - #[gflags(name = "Calculate sample peak", nick = "sample-peak")] + #[flags_value(name = "Calculate sample peak", nick = "sample-peak")] SAMPLE_PEAK = 0b00010000, - #[gflags(name = "Calculate true peak", nick = "true-peak")] + #[flags_value(name = "Calculate true peak", nick = "true-peak")] TRUE_PEAK = 0b00100000, } diff --git a/generic/fmp4/src/fmp4mux/mod.rs b/generic/fmp4/src/fmp4mux/mod.rs index 914d7875..eadfb017 100644 --- a/generic/fmp4/src/fmp4mux/mod.rs +++ b/generic/fmp4/src/fmp4mux/mod.rs @@ -108,9 +108,9 @@ pub(crate) struct FragmentOffset { } #[allow(clippy::upper_case_acronyms)] -#[derive(Debug, Clone, Copy, PartialEq, Eq, glib::GEnum)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, glib::Enum)] #[repr(i32)] -#[genum(type_name = "GstFMP4MuxHeaderUpdateMode")] +#[enum_type(name = "GstFMP4MuxHeaderUpdateMode")] pub(crate) enum HeaderUpdateMode { None, Rewrite, diff --git a/generic/threadshare/tests/pad.rs b/generic/threadshare/tests/pad.rs index 91476c46..bfe5ac69 100644 --- a/generic/threadshare/tests/pad.rs +++ b/generic/threadshare/tests/pad.rs @@ -21,7 +21,6 @@ use futures::future::BoxFuture; use futures::lock::Mutex as FutMutex; use futures::prelude::*; -use glib::GBoxed; use gst::glib; use gst::prelude::*; @@ -61,8 +60,8 @@ pub enum Item { Event(gst::Event), } -#[derive(Clone, Debug, GBoxed)] -#[gboxed(type_name = "TsTestItemSender")] +#[derive(Clone, Debug, glib::Boxed)] +#[boxed_type(name = "TsTestItemSender")] struct ItemSender { sender: mpsc::Sender, } diff --git a/net/reqwest/src/reqwesthttpsrc/imp.rs b/net/reqwest/src/reqwesthttpsrc/imp.rs index bf04d096..1af019be 100644 --- a/net/reqwest/src/reqwesthttpsrc/imp.rs +++ b/net/reqwest/src/reqwesthttpsrc/imp.rs @@ -112,8 +112,8 @@ fn proxy_from_str(s: Option) -> Result, glib::Error> { const REQWEST_CLIENT_CONTEXT: &str = "gst.reqwest.client"; -#[derive(Clone, Debug, glib::GBoxed)] -#[gboxed(type_name = "ReqwestClientContext")] +#[derive(Clone, Debug, glib::Boxed)] +#[boxed_type(name = "ReqwestClientContext")] struct ClientContext(Arc); #[derive(Debug)] diff --git a/net/rusoto/src/aws_transcriber/mod.rs b/net/rusoto/src/aws_transcriber/mod.rs index 7907d29c..fc44742a 100644 --- a/net/rusoto/src/aws_transcriber/mod.rs +++ b/net/rusoto/src/aws_transcriber/mod.rs @@ -21,18 +21,18 @@ use gst::prelude::*; mod imp; mod packet; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] -#[genum(type_name = "GstAwsTranscriberResultStability")] +#[enum_type(name = "GstAwsTranscriberResultStability")] pub enum AwsTranscriberResultStability { - #[genum(name = "High: stabilize results as fast as possible", nick = "high")] + #[enum_value(name = "High: stabilize results as fast as possible", nick = "high")] High = 0, - #[genum( + #[enum_value( name = "Medium: balance between stability and accuracy", nick = "medium" )] Medium = 1, - #[genum( + #[enum_value( name = "Low: relatively less stable partial transcription results with higher accuracy", nick = "low" )] diff --git a/tutorial/src/progressbin/mod.rs b/tutorial/src/progressbin/mod.rs index 0e38f75a..a7bf70e6 100644 --- a/tutorial/src/progressbin/mod.rs +++ b/tutorial/src/progressbin/mod.rs @@ -14,16 +14,16 @@ mod imp; // This enum may be used to control what type of output the progressbin should produce. // It also serves the secondary purpose of illustrating how to add enum-type properties // to a plugin written in rust. -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] -#[genum(type_name = "GstProgressBinOutput")] +#[enum_type(name = "GstProgressBinOutput")] pub enum ProgressBinOutput { - #[genum( + #[enum_value( name = "Println: Outputs the progress using a println! macro.", nick = "println" )] Println = 0, - #[genum( + #[enum_value( name = "Debug Category: Outputs the progress as info logs under the element's debug category.", nick = "debug-category" )] diff --git a/utils/fallbackswitch/src/fallbacksrc/mod.rs b/utils/fallbackswitch/src/fallbacksrc/mod.rs index 33a66ba3..7532dc30 100644 --- a/utils/fallbackswitch/src/fallbacksrc/mod.rs +++ b/utils/fallbackswitch/src/fallbacksrc/mod.rs @@ -22,9 +22,9 @@ mod custom_source; mod imp; mod video_fallback; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] -#[genum(type_name = "GstFallbackSourceRetryReason")] +#[enum_type(name = "GstFallbackSourceRetryReason")] enum RetryReason { None, Error, @@ -33,9 +33,9 @@ enum RetryReason { Timeout, } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] -#[genum(type_name = "GstFallbackSourceStatus")] +#[enum_type(name = "GstFallbackSourceStatus")] enum Status { Stopped, Buffering, diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index 5a0a1f51..7162d94b 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -26,13 +26,13 @@ use once_cell::sync::Lazy; use std::sync::{Mutex, RwLock}; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] -#[genum(type_name = "GstFallbackSwitchStreamHealth")] +#[enum_type(name = "GstFallbackSwitchStreamHealth")] pub(crate) enum StreamHealth { - #[genum(name = "Data flow is inactive or late", nick = "inactive")] + #[enum_value(name = "Data flow is inactive or late", nick = "inactive")] Inactive = 0, - #[genum(name = "Data is currently flowing in the stream", nick = "present")] + #[enum_value(name = "Data is currently flowing in the stream", nick = "present")] Present = 1, } diff --git a/video/closedcaption/src/ttutils.rs b/video/closedcaption/src/ttutils.rs index 19ce7c07..5223f282 100644 --- a/video/closedcaption/src/ttutils.rs +++ b/video/closedcaption/src/ttutils.rs @@ -19,10 +19,10 @@ use gst::glib; use serde::{Deserialize, Serialize}; #[derive( - Serialize, Deserialize, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum, + Serialize, Deserialize, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum, )] #[repr(u32)] -#[genum(type_name = "GstTtToCea608Mode")] +#[enum_type(name = "GstTtToCea608Mode")] pub enum Cea608Mode { PopOn, PaintOn, diff --git a/video/rspng/src/pngenc/mod.rs b/video/rspng/src/pngenc/mod.rs index 9abe76ba..c1649743 100644 --- a/video/rspng/src/pngenc/mod.rs +++ b/video/rspng/src/pngenc/mod.rs @@ -6,50 +6,49 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use glib::GEnum; use gst::glib; use gst::prelude::*; mod imp; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] -#[genum(type_name = "GstRsPngCompressionLevel")] +#[enum_type(name = "GstRsPngCompressionLevel")] pub(crate) enum CompressionLevel { - #[genum(name = "Default: Use the default compression level.", nick = "default")] + #[enum_value(name = "Default: Use the default compression level.", nick = "default")] Default, - #[genum(name = "Fast: A fast compression algorithm.", nick = "fast")] + #[enum_value(name = "Fast: A fast compression algorithm.", nick = "fast")] Fast, - #[genum( + #[enum_value( name = "Best: Uses the algorithm with the best results.", nick = "best" )] Best, - #[genum(name = "Huffman: Huffman compression.", nick = "huffman")] + #[enum_value(name = "Huffman: Huffman compression.", nick = "huffman")] Huffman, - #[genum(name = "Rle: Rle compression.", nick = "rle")] + #[enum_value(name = "Rle: Rle compression.", nick = "rle")] Rle, } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, GEnum)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::Enum)] #[repr(u32)] -#[genum(type_name = "GstRsPngFilterType")] +#[enum_type(name = "GstRsPngFilterType")] pub(crate) enum FilterType { - #[genum( + #[enum_value( name = "NoFilter: No filtering applied to the output.", nick = "nofilter" )] NoFilter, - #[genum(name = "Sub: filter applied to each pixel.", nick = "sub")] + #[enum_value(name = "Sub: filter applied to each pixel.", nick = "sub")] Sub, - #[genum(name = "Up: Up filter similar to Sub.", nick = "up")] + #[enum_value(name = "Up: Up filter similar to Sub.", nick = "up")] Up, - #[genum( + #[enum_value( name = "Avg: The Average filter uses the average of the two neighboring pixels.", nick = "avg" )] Avg, - #[genum( + #[enum_value( name = "Paeth: The Paeth filter computes a simple linear function of the three neighboring pixels.", nick = "paeth" )]