diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2021-11-06 10:34:10 +0300 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2021-11-06 10:34:10 +0300 |
commit | d9bda62a4720c0539a443a4e489645e9bb4af1eb (patch) | |
tree | d59eef871715fda4a9b37e355909a345dbd598d0 /video/cdg | |
parent | c99b7785f941fa4f9388a88e52d74c0fa34129ec (diff) |
Update for GLib/GStreamer API changes
And clean up a lot of related property/caps/structure code.
Diffstat (limited to 'video/cdg')
-rw-r--r-- | video/cdg/src/cdgdec/imp.rs | 19 | ||||
-rw-r--r-- | video/cdg/src/cdgparse/imp.rs | 32 | ||||
-rw-r--r-- | video/cdg/src/typefind.rs | 4 | ||||
-rw-r--r-- | video/cdg/tests/cdgdec.rs | 2 |
4 files changed, 25 insertions, 32 deletions
diff --git a/video/cdg/src/cdgdec/imp.rs b/video/cdg/src/cdgdec/imp.rs index e096b830b..529d900ff 100644 --- a/video/cdg/src/cdgdec/imp.rs +++ b/video/cdg/src/cdgdec/imp.rs @@ -54,7 +54,9 @@ impl ElementImpl for CdgDec { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { - let sink_caps = gst::Caps::new_simple("video/x-cdg", &[("parsed", &true)]); + let sink_caps = gst::Caps::builder("video/x-cdg") + .field("parsed", true) + .build(); let sink_pad_template = gst::PadTemplate::new( "sink", gst::PadDirection::Sink, @@ -63,15 +65,12 @@ impl ElementImpl for CdgDec { ) .unwrap(); - let src_caps = gst::Caps::new_simple( - "video/x-raw", - &[ - ("format", &gst_video::VideoFormat::Rgba.to_str()), - ("width", &(CDG_WIDTH as i32)), - ("height", &(CDG_HEIGHT as i32)), - ("framerate", &gst::Fraction::new(0, 1)), - ], - ); + let src_caps = gst::Caps::builder("video/x-raw") + .field("format", gst_video::VideoFormat::Rgba.to_str()) + .field("width", CDG_WIDTH as i32) + .field("height", CDG_HEIGHT as i32) + .field("framerate", gst::Fraction::new(0, 1)) + .build(); let src_pad_template = gst::PadTemplate::new( "src", gst::PadDirection::Src, diff --git a/video/cdg/src/cdgparse/imp.rs b/video/cdg/src/cdgparse/imp.rs index ab02f56a6..8dac5353d 100644 --- a/video/cdg/src/cdgparse/imp.rs +++ b/video/cdg/src/cdgparse/imp.rs @@ -60,7 +60,7 @@ impl ElementImpl for CdgParse { fn pad_templates() -> &'static [gst::PadTemplate] { static PAD_TEMPLATES: Lazy<Vec<gst::PadTemplate>> = Lazy::new(|| { - let sink_caps = gst::Caps::new_simple("video/x-cdg", &[]); + let sink_caps = gst::Caps::builder("video/x-cdg").build(); let sink_pad_template = gst::PadTemplate::new( "sink", gst::PadDirection::Sink, @@ -69,15 +69,12 @@ impl ElementImpl for CdgParse { ) .unwrap(); - let src_caps = gst::Caps::new_simple( - "video/x-cdg", - &[ - ("width", &(CDG_WIDTH as i32)), - ("height", &(CDG_HEIGHT as i32)), - ("framerate", &gst::Fraction::new(0, 1)), - ("parsed", &true), - ], - ); + let src_caps = gst::Caps::builder("video/x-cdg") + .field("width", CDG_WIDTH as i32) + .field("height", CDG_HEIGHT as i32) + .field("framerate", gst::Fraction::new(0, 1)) + .field("parsed", true) + .build(); let src_pad_template = gst::PadTemplate::new( "src", gst::PadDirection::Src, @@ -136,15 +133,12 @@ impl BaseParseImpl for CdgParse { let pad = element.src_pad(); if pad.current_caps().is_none() { // Set src pad caps - let src_caps = gst::Caps::new_simple( - "video/x-cdg", - &[ - ("width", &(CDG_WIDTH as i32)), - ("height", &(CDG_HEIGHT as i32)), - ("framerate", &gst::Fraction::new(0, 1)), - ("parsed", &true), - ], - ); + let src_caps = gst::Caps::builder("video/x-cdg") + .field("width", CDG_WIDTH as i32) + .field("height", CDG_HEIGHT as i32) + .field("framerate", gst::Fraction::new(0, 1)) + .field("parsed", true) + .build(); pad.push_event(gst::event::Caps::new(&src_caps)); } diff --git a/video/cdg/src/typefind.rs b/video/cdg/src/typefind.rs index 9add2469f..44f32052a 100644 --- a/video/cdg/src/typefind.rs +++ b/video/cdg/src/typefind.rs @@ -77,12 +77,12 @@ pub fn register(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { "cdg_typefind", gst::Rank::None, Some("cdg"), - Some(&Caps::new_simple("video/x-cdg", &[])), + Some(&Caps::builder("video/x-cdg").build()), |mut typefind| { let proba = compute_probability(&mut typefind); if proba != gst::TypeFindProbability::None { - typefind.suggest(proba, &Caps::new_simple("video/x-cdg", &[])); + typefind.suggest(proba, &Caps::builder("video/x-cdg").build()); } }, ) diff --git a/video/cdg/tests/cdgdec.rs b/video/cdg/tests/cdgdec.rs index e55b02316..21d678dde 100644 --- a/video/cdg/tests/cdgdec.rs +++ b/video/cdg/tests/cdgdec.rs @@ -37,7 +37,7 @@ fn test_cdgdec() { // Ensure we are in push mode so 'blocksize' prop is used let filesrc = gst::ElementFactory::make("pushfilesrc", None).unwrap(); filesrc - .set_property("location", &input_path.to_str().unwrap()) + .set_property("location", input_path.to_str().unwrap()) .expect("failed to set 'location' property"); { let child_proxy = filesrc.dynamic_cast_ref::<gst::ChildProxy>().unwrap(); |