Update for glib::Enum / glib::Boxed / glib::flags! macro renames

This commit is contained in:
Sebastian Dröge 2021-11-22 11:04:26 +02:00
parent 651ea7de5f
commit 86f422592b
10 changed files with 46 additions and 48 deletions

View file

@ -33,22 +33,22 @@ static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
) )
}); });
#[glib::gflags("EbuR128LevelMode")] #[glib::flags(name = "EbuR128LevelMode")]
enum Mode { enum Mode {
#[gflags(name = "Calculate momentary loudness (400ms)", nick = "momentary")] #[flags_value(name = "Calculate momentary loudness (400ms)", nick = "momentary")]
MOMENTARY = 0b00000001, 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, SHORT_TERM = 0b00000010,
#[gflags( #[flags_value(
name = "Calculate relative threshold and global loudness", name = "Calculate relative threshold and global loudness",
nick = "global" nick = "global"
)] )]
GLOBAL = 0b00000100, GLOBAL = 0b00000100,
#[gflags(name = "Calculate loudness range", nick = "loudness-range")] #[flags_value(name = "Calculate loudness range", nick = "loudness-range")]
LOUDNESS_RANGE = 0b00001000, LOUDNESS_RANGE = 0b00001000,
#[gflags(name = "Calculate sample peak", nick = "sample-peak")] #[flags_value(name = "Calculate sample peak", nick = "sample-peak")]
SAMPLE_PEAK = 0b00010000, SAMPLE_PEAK = 0b00010000,
#[gflags(name = "Calculate true peak", nick = "true-peak")] #[flags_value(name = "Calculate true peak", nick = "true-peak")]
TRUE_PEAK = 0b00100000, TRUE_PEAK = 0b00100000,
} }

View file

@ -108,9 +108,9 @@ pub(crate) struct FragmentOffset {
} }
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, glib::GEnum)] #[derive(Debug, Clone, Copy, PartialEq, Eq, glib::Enum)]
#[repr(i32)] #[repr(i32)]
#[genum(type_name = "GstFMP4MuxHeaderUpdateMode")] #[enum_type(name = "GstFMP4MuxHeaderUpdateMode")]
pub(crate) enum HeaderUpdateMode { pub(crate) enum HeaderUpdateMode {
None, None,
Rewrite, Rewrite,

View file

@ -21,7 +21,6 @@ use futures::future::BoxFuture;
use futures::lock::Mutex as FutMutex; use futures::lock::Mutex as FutMutex;
use futures::prelude::*; use futures::prelude::*;
use glib::GBoxed;
use gst::glib; use gst::glib;
use gst::prelude::*; use gst::prelude::*;
@ -61,8 +60,8 @@ pub enum Item {
Event(gst::Event), Event(gst::Event),
} }
#[derive(Clone, Debug, GBoxed)] #[derive(Clone, Debug, glib::Boxed)]
#[gboxed(type_name = "TsTestItemSender")] #[boxed_type(name = "TsTestItemSender")]
struct ItemSender { struct ItemSender {
sender: mpsc::Sender<Item>, sender: mpsc::Sender<Item>,
} }

View file

@ -112,8 +112,8 @@ fn proxy_from_str(s: Option<String>) -> Result<Option<String>, glib::Error> {
const REQWEST_CLIENT_CONTEXT: &str = "gst.reqwest.client"; const REQWEST_CLIENT_CONTEXT: &str = "gst.reqwest.client";
#[derive(Clone, Debug, glib::GBoxed)] #[derive(Clone, Debug, glib::Boxed)]
#[gboxed(type_name = "ReqwestClientContext")] #[boxed_type(name = "ReqwestClientContext")]
struct ClientContext(Arc<ClientContextInner>); struct ClientContext(Arc<ClientContextInner>);
#[derive(Debug)] #[derive(Debug)]

View file

@ -21,18 +21,18 @@ use gst::prelude::*;
mod imp; mod imp;
mod packet; 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)] #[repr(u32)]
#[genum(type_name = "GstAwsTranscriberResultStability")] #[enum_type(name = "GstAwsTranscriberResultStability")]
pub enum AwsTranscriberResultStability { 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, High = 0,
#[genum( #[enum_value(
name = "Medium: balance between stability and accuracy", name = "Medium: balance between stability and accuracy",
nick = "medium" nick = "medium"
)] )]
Medium = 1, Medium = 1,
#[genum( #[enum_value(
name = "Low: relatively less stable partial transcription results with higher accuracy", name = "Low: relatively less stable partial transcription results with higher accuracy",
nick = "low" nick = "low"
)] )]

View file

@ -14,16 +14,16 @@ mod imp;
// This enum may be used to control what type of output the progressbin should produce. // 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 // It also serves the secondary purpose of illustrating how to add enum-type properties
// to a plugin written in rust. // 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)] #[repr(u32)]
#[genum(type_name = "GstProgressBinOutput")] #[enum_type(name = "GstProgressBinOutput")]
pub enum ProgressBinOutput { pub enum ProgressBinOutput {
#[genum( #[enum_value(
name = "Println: Outputs the progress using a println! macro.", name = "Println: Outputs the progress using a println! macro.",
nick = "println" nick = "println"
)] )]
Println = 0, Println = 0,
#[genum( #[enum_value(
name = "Debug Category: Outputs the progress as info logs under the element's debug category.", name = "Debug Category: Outputs the progress as info logs under the element's debug category.",
nick = "debug-category" nick = "debug-category"
)] )]

View file

@ -22,9 +22,9 @@ mod custom_source;
mod imp; mod imp;
mod video_fallback; 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)] #[repr(u32)]
#[genum(type_name = "GstFallbackSourceRetryReason")] #[enum_type(name = "GstFallbackSourceRetryReason")]
enum RetryReason { enum RetryReason {
None, None,
Error, Error,
@ -33,9 +33,9 @@ enum RetryReason {
Timeout, 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)] #[repr(u32)]
#[genum(type_name = "GstFallbackSourceStatus")] #[enum_type(name = "GstFallbackSourceStatus")]
enum Status { enum Status {
Stopped, Stopped,
Buffering, Buffering,

View file

@ -26,13 +26,13 @@ use once_cell::sync::Lazy;
use std::sync::{Mutex, RwLock}; 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)] #[repr(u32)]
#[genum(type_name = "GstFallbackSwitchStreamHealth")] #[enum_type(name = "GstFallbackSwitchStreamHealth")]
pub(crate) enum StreamHealth { 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, 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, Present = 1,
} }

View file

@ -19,10 +19,10 @@ use gst::glib;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive( #[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)] #[repr(u32)]
#[genum(type_name = "GstTtToCea608Mode")] #[enum_type(name = "GstTtToCea608Mode")]
pub enum Cea608Mode { pub enum Cea608Mode {
PopOn, PopOn,
PaintOn, PaintOn,

View file

@ -6,50 +6,49 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use glib::GEnum;
use gst::glib; use gst::glib;
use gst::prelude::*; use gst::prelude::*;
mod imp; 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)] #[repr(u32)]
#[genum(type_name = "GstRsPngCompressionLevel")] #[enum_type(name = "GstRsPngCompressionLevel")]
pub(crate) enum CompressionLevel { 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, Default,
#[genum(name = "Fast: A fast compression algorithm.", nick = "fast")] #[enum_value(name = "Fast: A fast compression algorithm.", nick = "fast")]
Fast, Fast,
#[genum( #[enum_value(
name = "Best: Uses the algorithm with the best results.", name = "Best: Uses the algorithm with the best results.",
nick = "best" nick = "best"
)] )]
Best, Best,
#[genum(name = "Huffman: Huffman compression.", nick = "huffman")] #[enum_value(name = "Huffman: Huffman compression.", nick = "huffman")]
Huffman, Huffman,
#[genum(name = "Rle: Rle compression.", nick = "rle")] #[enum_value(name = "Rle: Rle compression.", nick = "rle")]
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)] #[repr(u32)]
#[genum(type_name = "GstRsPngFilterType")] #[enum_type(name = "GstRsPngFilterType")]
pub(crate) enum FilterType { pub(crate) enum FilterType {
#[genum( #[enum_value(
name = "NoFilter: No filtering applied to the output.", name = "NoFilter: No filtering applied to the output.",
nick = "nofilter" nick = "nofilter"
)] )]
NoFilter, NoFilter,
#[genum(name = "Sub: filter applied to each pixel.", nick = "sub")] #[enum_value(name = "Sub: filter applied to each pixel.", nick = "sub")]
Sub, Sub,
#[genum(name = "Up: Up filter similar to Sub.", nick = "up")] #[enum_value(name = "Up: Up filter similar to Sub.", nick = "up")]
Up, Up,
#[genum( #[enum_value(
name = "Avg: The Average filter uses the average of the two neighboring pixels.", name = "Avg: The Average filter uses the average of the two neighboring pixels.",
nick = "avg" nick = "avg"
)] )]
Avg, Avg,
#[genum( #[enum_value(
name = "Paeth: The Paeth filter computes a simple linear function of the three neighboring pixels.", name = "Paeth: The Paeth filter computes a simple linear function of the three neighboring pixels.",
nick = "paeth" nick = "paeth"
)] )]