Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivia Nikolaidou <vivia@ahiru.eu>2022-08-18 15:04:15 +0300
committerVivia Nikolaidou <vivia@ahiru.eu>2022-08-22 17:58:43 +0300
commit560611134588f63270a569e92160ecac5ceabc37 (patch)
treeac5f4447c55c1e5dd4d8f15f92c335c36aa5bab8 /video/closedcaption
parent84f6484140098826b3f074d806e0eb052198df43 (diff)
plugins: Simplify code using ParamSpecBuilder
Diffstat (limited to 'video/closedcaption')
-rw-r--r--video/closedcaption/src/ccdetect/imp.rs42
-rw-r--r--video/closedcaption/src/cea608overlay/imp.rs46
-rw-r--r--video/closedcaption/src/cea608tojson/imp.rs15
-rw-r--r--video/closedcaption/src/mcc_enc/imp.rs24
-rw-r--r--video/closedcaption/src/scc_enc/imp.rs15
-rw-r--r--video/closedcaption/src/transcriberbin/imp.rs99
-rw-r--r--video/closedcaption/src/tttocea608/imp.rs62
-rw-r--r--video/closedcaption/src/tttojson/imp.rs16
8 files changed, 143 insertions, 176 deletions
diff --git a/video/closedcaption/src/ccdetect/imp.rs b/video/closedcaption/src/ccdetect/imp.rs
index 8e5baa1d9..e2b1f6150 100644
--- a/video/closedcaption/src/ccdetect/imp.rs
+++ b/video/closedcaption/src/ccdetect/imp.rs
@@ -218,29 +218,25 @@ impl ObjectImpl for CCDetect {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
- glib::ParamSpecUInt64::new(
- "window",
- "Window",
- "Window of time (in ns) to determine if captions exist in the stream",
- 0,
- u64::MAX - 1,
- DEFAULT_WINDOW.nseconds(),
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecBoolean::new(
- "cc608",
- "cc608",
- "Whether CEA608 captions (CC1/CC3) have been detected",
- DEFAULT_CC608,
- glib::ParamFlags::READABLE,
- ),
- glib::ParamSpecBoolean::new(
- "cc708",
- "cc608",
- "Whether CEA708 captions (cc_data) have been detected",
- DEFAULT_CC708,
- glib::ParamFlags::READABLE,
- ),
+ glib::ParamSpecUInt64::builder("window")
+ .nick("Window")
+ .blurb("Window of time (in ns) to determine if captions exist in the stream")
+ .maximum(u64::MAX - 1)
+ .default_value(DEFAULT_WINDOW.nseconds())
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecBoolean::builder("cc608")
+ .nick("cc608")
+ .blurb("Whether CEA608 captions (CC1/CC3) have been detected")
+ .default_value(DEFAULT_CC608)
+ .read_only()
+ .build(),
+ glib::ParamSpecBoolean::builder("cc708")
+ .nick("cc608")
+ .blurb("Whether CEA708 captions (cc_data) have been detected")
+ .default_value(DEFAULT_CC708)
+ .read_only()
+ .build(),
]
});
diff --git a/video/closedcaption/src/cea608overlay/imp.rs b/video/closedcaption/src/cea608overlay/imp.rs
index 00ca3036c..4f0fbf44d 100644
--- a/video/closedcaption/src/cea608overlay/imp.rs
+++ b/video/closedcaption/src/cea608overlay/imp.rs
@@ -618,31 +618,27 @@ impl ObjectImpl for Cea608Overlay {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
- glib::ParamSpecInt::new(
- "field",
- "Field",
- "The field to render the caption for when available, (-1=automatic)",
- -1,
- 1,
- DEFAULT_FIELD,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecBoolean::new(
- "black-background",
- "Black background",
- "Whether a black background should be drawn behind text",
- DEFAULT_BLACK_BACKGROUND,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecUInt64::new(
- "timeout",
- "Timeout",
- "Duration after which to erase overlay when no cc data has arrived for the selected field",
- gst::ClockTime::from_seconds(16).nseconds(),
- u64::MAX,
- u64::MAX,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
+ glib::ParamSpecInt::builder("field")
+ .nick("Field")
+ .blurb("The field to render the caption for when available, (-1=automatic)")
+ .minimum(-1)
+ .maximum(1)
+ .default_value(DEFAULT_FIELD)
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecBoolean::builder("black-background")
+ .nick("Black background")
+ .blurb("Whether a black background should be drawn behind text")
+ .default_value(DEFAULT_BLACK_BACKGROUND)
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecUInt64::builder("timeout")
+ .nick("Timeout")
+ .blurb("Duration after which to erase overlay when no cc data has arrived for the selected field")
+ .minimum(gst::ClockTime::from_seconds(16).nseconds())
+ .default_value(u64::MAX)
+ .mutable_playing()
+ .build(),
]
});
diff --git a/video/closedcaption/src/cea608tojson/imp.rs b/video/closedcaption/src/cea608tojson/imp.rs
index c3a4107d1..bb65a93de 100644
--- a/video/closedcaption/src/cea608tojson/imp.rs
+++ b/video/closedcaption/src/cea608tojson/imp.rs
@@ -1014,14 +1014,15 @@ impl ObjectImpl for Cea608ToJson {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
- vec![glib::ParamSpecBoolean::new(
- "unbuffered",
- "Unbuffered",
- "Whether captions should be output at display time, \
+ vec![glib::ParamSpecBoolean::builder("unbuffered")
+ .nick("Unbuffered")
+ .blurb(
+ "Whether captions should be output at display time, \
instead of waiting to determine durations. Useful with live input",
- DEFAULT_UNBUFFERED,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- )]
+ )
+ .default_value(DEFAULT_UNBUFFERED)
+ .mutable_ready()
+ .build()]
});
PROPERTIES.as_ref()
diff --git a/video/closedcaption/src/mcc_enc/imp.rs b/video/closedcaption/src/mcc_enc/imp.rs
index 11dfbe60d..ff766b09d 100644
--- a/video/closedcaption/src/mcc_enc/imp.rs
+++ b/video/closedcaption/src/mcc_enc/imp.rs
@@ -476,20 +476,16 @@ impl ObjectImpl for MccEnc {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
- glib::ParamSpecString::new(
- "uuid",
- "UUID",
- "UUID for the output file",
- None,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- ),
- glib::ParamSpecBoxed::new(
- "creation-date",
- "Creation Date",
- "Creation date for the output file",
- glib::DateTime::static_type(),
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- ),
+ glib::ParamSpecString::builder("uuid")
+ .nick("UUID")
+ .blurb("UUID for the output file")
+ .mutable_ready()
+ .build(),
+ glib::ParamSpecBoxed::builder("creation-date", glib::DateTime::static_type())
+ .nick("Creation Date")
+ .blurb("Creation date for the output file")
+ .mutable_ready()
+ .build(),
]
});
diff --git a/video/closedcaption/src/scc_enc/imp.rs b/video/closedcaption/src/scc_enc/imp.rs
index ed9b5da9b..d8ef2547c 100644
--- a/video/closedcaption/src/scc_enc/imp.rs
+++ b/video/closedcaption/src/scc_enc/imp.rs
@@ -418,15 +418,16 @@ impl ObjectImpl for SccEnc {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
- vec![glib::ParamSpecBoolean::new(
- "output-padding",
- "Output padding",
- "Whether the encoder should output padding captions. \
+ vec![glib::ParamSpecBoolean::builder("output-padding")
+ .nick("Output padding")
+ .blurb(
+ "Whether the encoder should output padding captions. \
The element will never add padding, but will encode padding \
buffers it receives if this property is set to true.",
- DEFAULT_OUTPUT_PADDING,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- )]
+ )
+ .default_value(DEFAULT_OUTPUT_PADDING)
+ .mutable_ready()
+ .build()]
});
PROPERTIES.as_ref()
diff --git a/video/closedcaption/src/transcriberbin/imp.rs b/video/closedcaption/src/transcriberbin/imp.rs
index a15d00e0e..671a6baae 100644
--- a/video/closedcaption/src/transcriberbin/imp.rs
+++ b/video/closedcaption/src/transcriberbin/imp.rs
@@ -597,64 +597,49 @@ impl ObjectImpl for TranscriberBin {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
- glib::ParamSpecBoolean::new(
- "passthrough",
- "Passthrough",
- "Whether transcription should occur",
- DEFAULT_PASSTHROUGH,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecUInt::new(
- "latency",
- "Latency",
- "Amount of milliseconds to allow the transcriber",
- 0u32,
- std::u32::MAX,
- DEFAULT_LATENCY.mseconds() as u32,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- ),
- glib::ParamSpecUInt::new(
- "accumulate-time",
- "accumulate-time",
- "Cut-off time for textwrap accumulation, in milliseconds (0=do not accumulate). \
- Set this to a non-default value if you plan to switch to pop-on mode",
- 0,
- u32::MAX,
- DEFAULT_ACCUMULATE.mseconds() as u32,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- ),
- glib::ParamSpecEnum::new(
- "mode",
- "Mode",
- "Which closed caption mode to operate in",
- Cea608Mode::static_type(),
- DEFAULT_MODE as i32,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecBoxed::new(
- "cc-caps",
- "Closed Caption caps",
- "The expected format of the closed captions",
- gst::Caps::static_type(),
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- ),
- glib::ParamSpecObject::new(
- "transcriber",
- "Transcriber",
- "The transcriber element to use",
- gst::Element::static_type(),
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- ),
- glib::ParamSpecEnum::new(
- "caption-source",
- "Caption source",
- "Caption source to use. \
+ glib::ParamSpecBoolean::builder("passthrough")
+ .nick("Passthrough")
+ .blurb("Whether transcription should occur")
+ .default_value(DEFAULT_PASSTHROUGH)
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecUInt::builder("latency")
+ .nick("Latency")
+ .blurb("Amount of milliseconds to allow the transcriber")
+ .default_value(DEFAULT_LATENCY.mseconds() as u32)
+ .mutable_ready()
+ .build(),
+ glib::ParamSpecUInt::builder("accumulate-time")
+ .nick("accumulate-time")
+ .blurb("Cut-off time for textwrap accumulation, in milliseconds (0=do not accumulate). \
+ Set this to a non-default value if you plan to switch to pop-on mode")
+ .default_value(DEFAULT_ACCUMULATE.mseconds() as u32)
+ .mutable_ready()
+ .build(),
+ glib::ParamSpecEnum::builder("mode", Cea608Mode::static_type())
+ .nick("Mode")
+ .blurb("Which closed caption mode to operate in")
+ .default_value(DEFAULT_MODE as i32)
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecBoxed::builder("cc-caps", gst::Caps::static_type())
+ .nick("Closed Caption caps")
+ .blurb("The expected format of the closed captions")
+ .mutable_ready()
+ .build(),
+ glib::ParamSpecObject::builder("transcriber", gst::Element::static_type())
+ .nick("Transcriber")
+ .blurb("The transcriber element to use")
+ .mutable_ready()
+ .build(),
+ glib::ParamSpecEnum::builder("caption-source", CaptionSource::static_type())
+ .nick("Caption source")
+ .blurb("Caption source to use. \
If \"Transcription\" or \"Inband\" is selected, the caption meta \
- of the other source will be dropped by transcriberbin",
- CaptionSource::static_type(),
- DEFAULT_CAPTION_SOURCE as i32,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
+ of the other source will be dropped by transcriberbin")
+ .default_value(DEFAULT_CAPTION_SOURCE as i32)
+ .mutable_playing()
+ .build(),
]
});
diff --git a/video/closedcaption/src/tttocea608/imp.rs b/video/closedcaption/src/tttocea608/imp.rs
index 76c0ef4d7..0846d0419 100644
--- a/video/closedcaption/src/tttocea608/imp.rs
+++ b/video/closedcaption/src/tttocea608/imp.rs
@@ -1061,41 +1061,33 @@ impl ObjectImpl for TtToCea608 {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
vec![
- glib::ParamSpecEnum::new(
- "mode",
- "Mode",
- "Which mode to operate in",
- Cea608Mode::static_type(),
- DEFAULT_MODE as i32,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecInt::new(
- "origin-row",
- "Origin row",
- "Origin row, (-1=automatic)",
- -1,
- 14,
- DEFAULT_ORIGIN_ROW,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecUInt::new(
- "origin-column",
- "Origin column",
- "Origin column",
- 0,
- 31,
- DEFAULT_ORIGIN_COLUMN,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
- glib::ParamSpecUInt64::new(
- "roll-up-timeout",
- "Roll-Up Timeout",
- "Duration after which to erase display memory in roll-up mode",
- 0,
- u64::MAX,
- u64::MAX,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING,
- ),
+ glib::ParamSpecEnum::builder("mode", Cea608Mode::static_type())
+ .nick("Mode")
+ .blurb("Which mode to operate in")
+ .default_value(DEFAULT_MODE as i32)
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecInt::builder("origin-row")
+ .nick("Origin row")
+ .blurb("Origin row, (-1=automatic)")
+ .minimum(-1)
+ .maximum(14)
+ .default_value(DEFAULT_ORIGIN_ROW)
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecUInt::builder("origin-column")
+ .nick("Origin column")
+ .blurb("Origin column")
+ .maximum(31)
+ .default_value(DEFAULT_ORIGIN_COLUMN)
+ .mutable_playing()
+ .build(),
+ glib::ParamSpecUInt64::builder("roll-up-timeout")
+ .nick("Roll-Up Timeout")
+ .blurb("Duration after which to erase display memory in roll-up mode")
+ .default_value(u64::MAX)
+ .mutable_playing()
+ .build(),
]
});
diff --git a/video/closedcaption/src/tttojson/imp.rs b/video/closedcaption/src/tttojson/imp.rs
index 3ce093fc9..ec0d7eff4 100644
--- a/video/closedcaption/src/tttojson/imp.rs
+++ b/video/closedcaption/src/tttojson/imp.rs
@@ -223,14 +223,14 @@ impl ObjectSubclass for TtToJson {
impl ObjectImpl for TtToJson {
fn properties() -> &'static [glib::ParamSpec] {
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
- vec![glib::ParamSpecEnum::new(
- "mode",
- "Mode",
- "Which mode to operate in",
- Cea608Mode::static_type(),
- DEFAULT_MODE as i32,
- glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY,
- )]
+ vec![
+ glib::ParamSpecEnum::builder("mode", Cea608Mode::static_type())
+ .nick("Mode")
+ .blurb("Which mode to operate in")
+ .default_value(DEFAULT_MODE as i32)
+ .mutable_ready()
+ .build(),
+ ]
});
PROPERTIES.as_ref()