From a8146f333f522ab2c29623f58df903d7ff05f45e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Wed, 20 Nov 2024 20:11:02 +0100 Subject: [PATCH] all: use builder conditional setters where applicable Part-of: --- generic/inter/tests/inter.rs | 6 ++- generic/threadshare/examples/benchmark.rs | 9 +--- .../examples/udpsrc_benchmark_sender.rs | 10 +--- generic/threadshare/tests/pad.rs | 5 +- net/mpegtslive/src/mpegtslive/imp.rs | 14 +++--- net/ndi/src/device_provider/imp.rs | 10 ++-- net/ndi/src/ndisrc/imp.rs | 5 +- net/ndi/src/ndisrcdemux/imp.rs | 43 +++++++++-------- net/raptorq/src/raptorqdec/imp.rs | 2 +- net/rtp/src/jpeg/depay/imp.rs | 11 ++--- net/rtp/src/opus/tests/tests.rs | 7 +-- .../examples/webrtc-precise-sync-recv.rs | 23 ++++------ net/webrtc/examples/whipserver.rs | 36 +++++++-------- net/webrtc/src/utils.rs | 8 +--- text/json/src/jsongstparse/imp.rs | 46 ++++++++----------- .../src/fallbacksrc/custom_source/mod.rs | 5 +- utils/fallbackswitch/tests/fallbackswitch.rs | 9 +--- video/closedcaption/src/mcc_parse/imp.rs | 36 ++++++--------- video/closedcaption/src/scc_parse/imp.rs | 36 ++++++--------- video/gtk4/src/sink/mod.rs | 2 +- 20 files changed, 140 insertions(+), 183 deletions(-) diff --git a/generic/inter/tests/inter.rs b/generic/inter/tests/inter.rs index 5170074b..f041d0af 100644 --- a/generic/inter/tests/inter.rs +++ b/generic/inter/tests/inter.rs @@ -27,9 +27,11 @@ fn start_consumer(producer_name: &str) -> gst_check::Harness { } fn start_producer(producer_name: &str) -> (gst::Pad, gst::Element) { - let element = gst::ElementFactory::make("intersink").build().unwrap(); + let element = gst::ElementFactory::make("intersink") + .property("producer-name", producer_name) + .build() + .unwrap(); - element.set_property("producer-name", producer_name); element.set_state(gst::State::Playing).unwrap(); let sinkpad = element.static_pad("sink").unwrap(); diff --git a/generic/threadshare/examples/benchmark.rs b/generic/threadshare/examples/benchmark.rs index 963b666f..06769fd3 100644 --- a/generic/threadshare/examples/benchmark.rs +++ b/generic/threadshare/examples/benchmark.rs @@ -114,13 +114,10 @@ fn main() { .property("port", 5004i32 + i as i32) .property("context", &context) .property("context-wait", wait) + .property_if("caps", &rtp_caps, is_rtp) .build() .unwrap(); - if is_rtp { - source.set_property("caps", &rtp_caps); - } - (source, Some(context)) } "tcpclientsrc" => { @@ -177,11 +174,9 @@ fn main() { .name(format!("jb-{i}").as_str()) .property("context-wait", wait) .property("latency", wait) + .property_if_some("context", context.as_ref()) .build() .unwrap(); - if let Some(context) = context { - jb.set_property("context", &context); - } let elements = &[&source, &jb, &sink]; pipeline.add_many(elements).unwrap(); diff --git a/generic/threadshare/examples/udpsrc_benchmark_sender.rs b/generic/threadshare/examples/udpsrc_benchmark_sender.rs index 51351de0..d3f9e49f 100644 --- a/generic/threadshare/examples/udpsrc_benchmark_sender.rs +++ b/generic/threadshare/examples/udpsrc_benchmark_sender.rs @@ -94,13 +94,10 @@ fn send_test_buffers(n_streams: u16, num_buffers: Option) { .property("context-wait", 20u32) .property("is-live", true) .property("do-timestamp", true) + .property_if_some("num-buffers", num_buffers) .build() .unwrap(); - if let Some(num_buffers) = num_buffers { - src.set_property("num-buffers", num_buffers); - } - #[cfg(feature = "tuning")] if i == 0 { src.set_property("main-elem", true); @@ -129,13 +126,10 @@ fn send_rtp_buffers(n_streams: u16, num_buffers: Option) { .property("context-wait", 20u32) .property("is-live", true) .property("do-timestamp", true) + .property_if_some("num-buffers", num_buffers) .build() .unwrap(); - if let Some(num_buffers) = num_buffers { - src.set_property("num-buffers", num_buffers); - } - #[cfg(feature = "tuning")] if i == 0 { src.set_property("main-elem", true); diff --git a/generic/threadshare/tests/pad.rs b/generic/threadshare/tests/pad.rs index 1c5767b5..8aa1d7da 100644 --- a/generic/threadshare/tests/pad.rs +++ b/generic/threadshare/tests/pad.rs @@ -715,9 +715,10 @@ fn setup( // Sink let (sender, receiver) = mpsc::channel::(10); - let sink_element = glib::Object::builder::() + let sink_element = gst::Object::builder::() .property("sender", ItemSender { sender }) - .build(); + .build() + .unwrap(); pipeline.add(&sink_element).unwrap(); last_element.link(&sink_element).unwrap(); diff --git a/net/mpegtslive/src/mpegtslive/imp.rs b/net/mpegtslive/src/mpegtslive/imp.rs index e1dde021..a25d7921 100644 --- a/net/mpegtslive/src/mpegtslive/imp.rs +++ b/net/mpegtslive/src/mpegtslive/imp.rs @@ -922,14 +922,16 @@ impl ObjectSubclass for MpegTsLiveSource { | gst::PadFlags::PROXY_SCHEDULING, ) .build(); - let internal_clock = glib::Object::builder::() + let internal_clock = gst::Object::builder::() + .name("mpegts-internal-clock") .property("clock-type", gst::ClockType::Monotonic) - .property("name", "mpegts-internal-clock") - .build(); - let external_clock = glib::Object::builder::() + .build() + .unwrap(); + let external_clock = gst::Object::builder::() + .name("mpegts-live-clock") .property("clock-type", gst::ClockType::Monotonic) - .property("name", "mpegts-live-clock") - .build(); + .build() + .unwrap(); // Return an instance of our struct Self { srcpad, diff --git a/net/ndi/src/device_provider/imp.rs b/net/ndi/src/device_provider/imp.rs index 9f8e207f..215e6ed9 100644 --- a/net/ndi/src/device_provider/imp.rs +++ b/net/ndi/src/device_provider/imp.rs @@ -212,11 +212,12 @@ impl GstObjectImpl for Device {} impl DeviceImpl for Device { fn create_element(&self, name: Option<&str>) -> Result { let source_info = self.source.get().unwrap(); - let element = glib::Object::builder::() - .property("name", name) + let element = gst::Object::builder::() + .name_if_some(name) .property("ndi-name", source_info.ndi_name()) .property("url-address", source_info.url_address()) .build() + .unwrap() .upcast::(); Ok(element) @@ -239,12 +240,13 @@ impl super::Device { .field("url-address", source.url_address()) .build(); - let device = glib::Object::builder::() + let device = gst::Object::builder::() .property("caps", caps) .property("display-name", display_name) .property("device-class", device_class) .property("properties", extra_properties) - .build(); + .build() + .unwrap(); let imp = device.imp(); imp.source.set(source.to_owned()).unwrap(); diff --git a/net/ndi/src/ndisrc/imp.rs b/net/ndi/src/ndisrc/imp.rs index 099179e9..a76d48ad 100644 --- a/net/ndi/src/ndisrc/imp.rs +++ b/net/ndi/src/ndisrc/imp.rs @@ -448,9 +448,10 @@ impl ElementImpl for NdiSrc { state.receiver = Some(receiver); state.timestamp_mode = settings.timestamp_mode; if state.timestamp_mode == TimestampMode::Clocked { - let clock = glib::Object::builder::() - .property("name", format!("{}-clock", self.obj().name())) + let clock = gst::Object::builder::() + .name(format!("{}-clock", self.obj().name())) .build() + .unwrap() .upcast::(); state.clock_state = Some(ClockState { clock: clock.clone(), diff --git a/net/ndi/src/ndisrcdemux/imp.rs b/net/ndi/src/ndisrcdemux/imp.rs index 4545f3ce..9722e7b3 100644 --- a/net/ndi/src/ndisrcdemux/imp.rs +++ b/net/ndi/src/ndisrcdemux/imp.rs @@ -238,18 +238,16 @@ impl NdiSrcDemux { #[allow(irrefutable_let_patterns)] if let AudioInfo::Audio(ref info) = info { - let mut builder = gst_audio::AudioInfo::builder( + let non_interleaved_info = gst_audio::AudioInfo::builder( info.format(), info.rate(), info.channels(), ) - .layout(gst_audio::AudioLayout::NonInterleaved); + .layout(gst_audio::AudioLayout::NonInterleaved) + .positions_if_some(info.positions()) + .build() + .unwrap(); - if let Some(positions) = info.positions() { - builder = builder.positions(positions); - } - - let non_interleaved_info = builder.build().unwrap(); state.audio_caps_non_interleaved = Some(non_interleaved_info.to_caps().unwrap()); state.audio_info_non_interleaved = Some(non_interleaved_info); @@ -640,22 +638,21 @@ impl NdiSrcDemux { // supported by GStreamer }; - let mut builder = gst_video::VideoInfo::builder( + let info = gst_video::VideoInfo::builder( format, video_frame.xres() as u32, video_frame.yres() as u32, ) .fps(gst::Fraction::from(video_frame.frame_rate())) .par(par) - .interlace_mode(interlace_mode); - - if video_frame.frame_format_type() - == ndisys::NDIlib_frame_format_type_e::NDIlib_frame_format_type_interleaved - { - builder = builder.field_order(gst_video::VideoFieldOrder::TopFieldFirst); - } - - return Ok(VideoInfo::Video(builder.build().map_err(|_| { + .interlace_mode(interlace_mode) + .field_order_if( + gst_video::VideoFieldOrder::TopFieldFirst, + video_frame.frame_format_type() + == ndisys::NDIlib_frame_format_type_e::NDIlib_frame_format_type_interleaved, + ) + .build() + .map_err(|_| { gst::element_imp_error!( self, gst::StreamError::Format, @@ -663,7 +660,9 @@ impl NdiSrcDemux { ); gst::FlowError::NotNegotiated - })?)); + })?; + + return Ok(VideoInfo::Video(info)); } #[cfg(feature = "advanced-sdk")] @@ -1211,14 +1210,14 @@ impl NdiSrcDemux { ); } - let builder = gst_audio::AudioInfo::builder( + let info = gst_audio::AudioInfo::builder( gst_audio::AUDIO_FORMAT_F32, audio_frame.sample_rate() as u32, channels, ) - .positions(&positions[..channels as usize]); - - let info = builder.build().map_err(|_| { + .positions(&positions[..channels as usize]) + .build() + .map_err(|_| { gst::element_imp_error!( self, gst::StreamError::Format, diff --git a/net/raptorq/src/raptorqdec/imp.rs b/net/raptorq/src/raptorqdec/imp.rs index 38032338..5403bf7b 100644 --- a/net/raptorq/src/raptorqdec/imp.rs +++ b/net/raptorq/src/raptorqdec/imp.rs @@ -822,7 +822,7 @@ impl ElementImpl for RaptorqDec { } let sinkpad_fec = gst::Pad::builder_from_template(templ) - .maybe_name(name) + .name_if_some(name) .chain_function(|pad, parent, buffer| { Self::catch_panic_pad_function( parent, diff --git a/net/rtp/src/jpeg/depay/imp.rs b/net/rtp/src/jpeg/depay/imp.rs index 6493f46e..8fe00edc 100644 --- a/net/rtp/src/jpeg/depay/imp.rs +++ b/net/rtp/src/jpeg/depay/imp.rs @@ -355,7 +355,7 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { || state.dimensions != Some((width, height)) || state.framerate != state.sdp_framerate { - let mut caps_builder = gst::Caps::builder("image/jpeg") + let caps = gst::Caps::builder("image/jpeg") .field("parsed", true) .field("width", width) .field("height", height) @@ -368,12 +368,9 @@ impl RtpBaseDepay2Impl for RtpJpegDepay { } else { "YCbCr-4:2:0" }, - ); - if let Some(framerate) = state.sdp_framerate { - caps_builder = caps_builder.field("framerate", framerate); - } - - let caps = caps_builder.build(); + ) + .field_if_some("framerate", state.sdp_framerate) + .build(); gst::debug!(CAT, imp = self, "Setting caps {caps:?}"); self.obj().set_src_caps(&caps); state.dimensions = Some((width, height)); diff --git a/net/rtp/src/opus/tests/tests.rs b/net/rtp/src/opus/tests/tests.rs index 3036848a..c74f787c 100644 --- a/net/rtp/src/opus/tests/tests.rs +++ b/net/rtp/src/opus/tests/tests.rs @@ -291,9 +291,10 @@ fn test_opus_payloader_get_caps() { fn get_allowed_opus_caps_for_rtp_caps_string(recv_caps_str: &str) -> gst::Caps { let src = gst::ElementFactory::make("appsrc").build().unwrap(); let pay = gst::ElementFactory::make("rtpopuspay2").build().unwrap(); - let sink = gst::ElementFactory::make("appsink").build().unwrap(); - - sink.set_property_from_str("caps", recv_caps_str); + let sink = gst::ElementFactory::make("appsink") + .property_from_str("caps", recv_caps_str) + .build() + .unwrap(); gst::Element::link_many([&src, &pay, &sink]).unwrap(); diff --git a/net/webrtc/examples/webrtc-precise-sync-recv.rs b/net/webrtc/examples/webrtc-precise-sync-recv.rs index 7b08201c..1f5dada2 100644 --- a/net/webrtc/examples/webrtc-precise-sync-recv.rs +++ b/net/webrtc/examples/webrtc-precise-sync-recv.rs @@ -125,23 +125,18 @@ fn spawn_consumer( pipeline.add(&bin).context("Adding consumer bin")?; let webrtcsrc = gst::ElementFactory::make("webrtcsrc") - .build() - .context("Creating webrtcsrc")?; - - if args.expect_clock_signalling { + .name( + meta.as_ref() + .map_or_else(|| peer_id.clone(), serde_json::Value::to_string), + ) // Discard retransmission in RFC 7273 mode. See: // * https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/914 // * https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1574 - webrtcsrc.set_property("do-retransmission", false); - } - - if !args.audio_codecs.is_empty() { - webrtcsrc.set_property("audio-codecs", gst::Array::new(&args.audio_codecs)); - } - - if !args.video_codecs.is_empty() { - webrtcsrc.set_property("video-codecs", gst::Array::new(&args.video_codecs)); - } + .property_if("do-retransmission", false, args.expect_clock_signalling) + .property_if_not_empty::("audio-codecs", &args.audio_codecs) + .property_if_not_empty::("video-codecs", &args.video_codecs) + .build() + .context("Creating webrtcsrc")?; bin.add(&webrtcsrc).context("Adding webrtcsrc")?; diff --git a/net/webrtc/examples/whipserver.rs b/net/webrtc/examples/whipserver.rs index 061d68db..125fec4b 100644 --- a/net/webrtc/examples/whipserver.rs +++ b/net/webrtc/examples/whipserver.rs @@ -10,16 +10,14 @@ struct Args { } fn link_video(pad: &gst::Pad, pipeline: &gst::Pipeline) { - let q = gst::ElementFactory::make_with_name( - "queue", - Some(format!("queue_{}", pad.name()).as_str()), - ) - .unwrap(); - let vsink = gst::ElementFactory::make_with_name( - "autovideosink", - Some(format!("vsink_{}", pad.name()).as_str()), - ) - .unwrap(); + let q = gst::ElementFactory::make("queue") + .name(format!("queue_{}", pad.name())) + .build() + .unwrap(); + let vsink = gst::ElementFactory::make("autovideosink") + .name(format!("vsink_{}", pad.name())) + .build() + .unwrap(); pipeline.add_many([&q, &vsink]).unwrap(); gst::Element::link_many([&q, &vsink]).unwrap(); @@ -45,17 +43,15 @@ fn unlink_video(pad: &gst::Pad, pipeline: &gst::Pipeline) { } fn link_audio(pad: &gst::Pad, pipeline: &gst::Pipeline) { - let aq = gst::ElementFactory::make_with_name( - "queue", - Some(format!("aqueue_{}", pad.name()).as_str()), - ) - .unwrap(); + let aq = gst::ElementFactory::make("queue") + .name(format!("aqueue_{}", pad.name())) + .build() + .unwrap(); - let asink = gst::ElementFactory::make_with_name( - "autoaudiosink", - Some(format!("asink_{}", pad.name()).as_str()), - ) - .unwrap(); + let asink = gst::ElementFactory::make("autoaudiosink") + .name(format!("asink_{}", pad.name())) + .build() + .unwrap(); pipeline.add_many([&aq, &asink]).unwrap(); gst::Element::link_many([&aq, &asink]).unwrap(); diff --git a/net/webrtc/src/utils.rs b/net/webrtc/src/utils.rs index 32b4e210..4f9a1e3e 100644 --- a/net/webrtc/src/utils.rs +++ b/net/webrtc/src/utils.rs @@ -402,12 +402,8 @@ pub fn build_link_header(url_str: &str) -> Result { /// Wrapper around `gst::ElementFactory::make` with a better error /// message pub fn make_element(element: &str, name: Option<&str>) -> Result { - let mut builder = gst::ElementFactory::make(element); - if let Some(name) = name { - builder = builder.name(name); - } - - builder + gst::ElementFactory::make(element) + .name_if_some(name) .build() .with_context(|| format!("Failed to make element {element}")) } diff --git a/text/json/src/jsongstparse/imp.rs b/text/json/src/jsongstparse/imp.rs index 7d3b2d72..f3236a57 100644 --- a/text/json/src/jsongstparse/imp.rs +++ b/text/json/src/jsongstparse/imp.rs @@ -128,13 +128,11 @@ impl State { let mut events = Vec::new(); if self.need_flush_stop { - let mut b = gst::event::FlushStop::builder(true); - - if let Some(seek_seqnum) = self.seek_seqnum { - b = b.seqnum(seek_seqnum); - } - - events.push(b.build()); + events.push( + gst::event::FlushStop::builder(true) + .seqnum_if_some(self.seek_seqnum) + .build(), + ); self.need_flush_stop = false; } @@ -146,13 +144,9 @@ impl State { } if self.need_caps { - let mut caps_builder = gst::Caps::builder("application/x-json"); - - if let Some(format) = &self.format { - caps_builder = caps_builder.field("format", format); - } - - let caps = caps_builder.build(); + let caps = gst::Caps::builder("application/x-json") + .field_if_some("format", self.format.as_ref()) + .build(); events.push(gst::event::Caps::new(&caps)); gst::info!(CAT, imp = imp, "Caps changed to {:?}", &caps); @@ -160,13 +154,11 @@ impl State { } if self.need_segment { - let mut b = gst::event::Segment::builder(&self.segment); - - if let Some(seek_seqnum) = self.seek_seqnum { - b = b.seqnum(seek_seqnum); - } - - events.push(b.build()); + events.push( + gst::event::Segment::builder(&self.segment) + .seqnum_if_some(self.seek_seqnum) + .build(), + ); self.need_segment = false; } @@ -486,13 +478,11 @@ impl JsonGstParse { } let mut events = state.create_events(self); - let mut eos_event = gst::event::Eos::builder(); - - if let Some(seek_seqnum) = state.seek_seqnum { - eos_event = eos_event.seqnum(seek_seqnum); - } - - events.push(eos_event.build()); + events.push( + gst::event::Eos::builder() + .seqnum_if_some(state.seek_seqnum) + .build(), + ); // Drop our state mutex while we push out events drop(state); diff --git a/utils/fallbackswitch/src/fallbacksrc/custom_source/mod.rs b/utils/fallbackswitch/src/fallbacksrc/custom_source/mod.rs index 4424d256..d94d2cfb 100644 --- a/utils/fallbackswitch/src/fallbacksrc/custom_source/mod.rs +++ b/utils/fallbackswitch/src/fallbacksrc/custom_source/mod.rs @@ -16,6 +16,9 @@ glib::wrapper! { impl CustomSource { pub fn new(source: &gst::Element) -> CustomSource { - glib::Object::builder().property("source", source).build() + gst::Object::builder() + .property("source", source) + .build() + .unwrap() } } diff --git a/utils/fallbackswitch/tests/fallbackswitch.rs b/utils/fallbackswitch/tests/fallbackswitch.rs index c5eb4174..a99b4b3b 100644 --- a/utils/fallbackswitch/tests/fallbackswitch.rs +++ b/utils/fallbackswitch/tests/fallbackswitch.rs @@ -492,16 +492,11 @@ fn setup_pipeline( let switch = gst::ElementFactory::make("fallbackswitch") .name("switch") .property("timeout", 3.seconds()) + .property_if_some("immediate-fallback", immediate_fallback) + .property_if_some("auto-switch", auto_switch) .build() .unwrap(); - if let Some(imm) = immediate_fallback { - switch.set_property("immediate-fallback", imm); - } - if let Some(auto_switch) = auto_switch { - switch.set_property("auto-switch", auto_switch); - } - let sink = gst_app::AppSink::builder().name("sink").sync(false).build(); let queue = gst::ElementFactory::make("queue").build().unwrap(); diff --git a/video/closedcaption/src/mcc_parse/imp.rs b/video/closedcaption/src/mcc_parse/imp.rs index 4626da3b..1d26982a 100644 --- a/video/closedcaption/src/mcc_parse/imp.rs +++ b/video/closedcaption/src/mcc_parse/imp.rs @@ -251,13 +251,11 @@ impl State { let mut events = Vec::new(); if self.need_flush_stop { - let mut b = gst::event::FlushStop::builder(true); - - if let Some(seek_seqnum) = self.seek_seqnum { - b = b.seqnum(seek_seqnum); - } - - events.push(b.build()); + events.push( + gst::event::FlushStop::builder(true) + .seqnum_if_some(self.seek_seqnum) + .build(), + ); self.need_flush_stop = false; } @@ -289,13 +287,11 @@ impl State { } if self.need_segment { - let mut b = gst::event::Segment::builder(&self.segment); - - if let Some(seek_seqnum) = self.seek_seqnum { - b = b.seqnum(seek_seqnum); - } - - events.push(b.build()); + events.push( + gst::event::Segment::builder(&self.segment) + .seqnum_if_some(self.seek_seqnum) + .build(), + ); self.need_segment = false; } @@ -695,13 +691,11 @@ impl MccParse { match parse_timecode_rate(state.timecode_rate) { Ok((framerate, _)) => { let mut events = state.create_events(self, None, framerate); - let mut eos_event = gst::event::Eos::builder(); - - if let Some(seek_seqnum) = state.seek_seqnum { - eos_event = eos_event.seqnum(seek_seqnum); - } - - events.push(eos_event.build()); + events.push( + gst::event::Eos::builder() + .seqnum_if_some(state.seek_seqnum) + .build(), + ); // Drop our state mutex while we push out events drop(state); diff --git a/video/closedcaption/src/scc_parse/imp.rs b/video/closedcaption/src/scc_parse/imp.rs index 1d1d9718..3d5b35b8 100644 --- a/video/closedcaption/src/scc_parse/imp.rs +++ b/video/closedcaption/src/scc_parse/imp.rs @@ -219,13 +219,11 @@ impl State { let mut events = Vec::new(); if self.need_flush_stop { - let mut b = gst::event::FlushStop::builder(true); - - if let Some(seek_seqnum) = self.seek_seqnum { - b = b.seqnum(seek_seqnum); - } - - events.push(b.build()); + events.push( + gst::event::FlushStop::builder(true) + .seqnum_if_some(self.seek_seqnum) + .build(), + ); self.need_flush_stop = false; } @@ -252,13 +250,11 @@ impl State { } if self.need_segment { - let mut b = gst::event::Segment::builder(&self.segment); - - if let Some(seek_seqnum) = self.seek_seqnum { - b = b.seqnum(seek_seqnum); - } - - events.push(b.build()); + events.push( + gst::event::Segment::builder(&self.segment) + .seqnum_if_some(self.seek_seqnum) + .build(), + ); self.need_segment = false; } @@ -608,13 +604,11 @@ impl SccParse { } let mut events = state.create_events(self, None); - let mut eos_event = gst::event::Eos::builder(); - - if let Some(seek_seqnum) = state.seek_seqnum { - eos_event = eos_event.seqnum(seek_seqnum); - } - - events.push(eos_event.build()); + events.push( + gst::event::Eos::builder() + .seqnum_if_some(state.seek_seqnum) + .build(), + ); // Drop our state mutex while we push out events drop(state); diff --git a/video/gtk4/src/sink/mod.rs b/video/gtk4/src/sink/mod.rs index dd938891..f1b0d88a 100644 --- a/video/gtk4/src/sink/mod.rs +++ b/video/gtk4/src/sink/mod.rs @@ -55,7 +55,7 @@ glib::wrapper! { impl PaintableSink { pub fn new(name: Option<&str>) -> Self { - glib::Object::builder().property("name", name).build() + gst::Object::builder().name_if_some(name).build().unwrap() } }