From 6132788b02b38b5f0d0019f40a66a52e2d33177e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 15 Jan 2023 22:57:14 +0200 Subject: [PATCH] Update for caps/structure-related string API changes Part-of: --- mux/flavors/src/flvdemux/imp.rs | 25 +++++++-------- mux/fmp4/src/fmp4mux/boxes.rs | 31 ++++++++++--------- mux/fmp4/src/fmp4mux/imp.rs | 2 +- mux/mp4/src/mp4mux/boxes.rs | 29 +++++++++-------- mux/mp4/src/mp4mux/imp.rs | 2 +- net/hlssink3/src/imp.rs | 2 +- net/ndi/src/lib.rs | 4 +-- net/onvif/src/onvifmetadataoverlay/imp.rs | 4 +-- net/reqwest/src/reqwesthttpsrc/imp.rs | 2 +- net/webrtc/src/webrtcsink/imp.rs | 29 +++++++++-------- net/webrtchttp/src/whepsrc/imp.rs | 8 ++--- text/regex/src/gstregex/imp.rs | 2 +- .../fallbackswitch/src/fallbackswitch/imp.rs | 2 +- video/cdg/src/cdgdec/imp.rs | 2 +- video/closedcaption/src/cea608overlay/imp.rs | 4 +-- video/gtk4/src/sink/imp.rs | 25 ++++++++------- 16 files changed, 89 insertions(+), 84 deletions(-) diff --git a/mux/flavors/src/flvdemux/imp.rs b/mux/flavors/src/flvdemux/imp.rs index dfcdb8d9..d92f2376 100644 --- a/mux/flavors/src/flvdemux/imp.rs +++ b/mux/flavors/src/flvdemux/imp.rs @@ -1331,16 +1331,14 @@ impl AudioFormat { if self.rate != 0 { if let Some(ref mut caps) = caps.as_mut() { - caps.get_mut() - .unwrap() - .set_simple(&[("rate", &(self.rate as i32))]) + caps.get_mut().unwrap().set("rate", self.rate as i32) } } if self.channels != 0 { if let Some(ref mut caps) = caps.as_mut() { caps.get_mut() .unwrap() - .set_simple(&[("channels", &(self.channels as i32))]) + .set("channels", self.channels as i32) } } @@ -1441,19 +1439,19 @@ impl VideoFormat { if let (Some(width), Some(height)) = (self.width, self.height) { if let Some(ref mut caps) = caps.as_mut() { - caps.get_mut() - .unwrap() - .set_simple(&[("width", &(width as i32)), ("height", &(height as i32))]) + let caps = caps.get_mut().unwrap(); + caps.set("width", width as i32); + caps.set("height", height as i32); } } if let Some(par) = self.pixel_aspect_ratio { if *par.numer() != 0 && par.numer() != par.denom() { if let Some(ref mut caps) = caps.as_mut() { - caps.get_mut().unwrap().set_simple(&[( + caps.get_mut().unwrap().set( "pixel-aspect-ratio", - &gst::Fraction::new(*par.numer(), *par.denom()), - )]) + gst::Fraction::new(*par.numer(), *par.denom()), + ); } } } @@ -1461,10 +1459,9 @@ impl VideoFormat { if let Some(fps) = self.framerate { if *fps.numer() != 0 { if let Some(ref mut caps) = caps.as_mut() { - caps.get_mut().unwrap().set_simple(&[( - "framerate", - &gst::Fraction::new(*fps.numer(), *fps.denom()), - )]) + caps.get_mut() + .unwrap() + .set("framerate", gst::Fraction::new(*fps.numer(), *fps.denom())); } } } diff --git a/mux/fmp4/src/fmp4mux/boxes.rs b/mux/fmp4/src/fmp4mux/boxes.rs index 52f956d6..fe7c77e1 100644 --- a/mux/fmp4/src/fmp4mux/boxes.rs +++ b/mux/fmp4/src/fmp4mux/boxes.rs @@ -57,7 +57,7 @@ fn write_full_box) -> Result>( fn cmaf_brands_from_caps(caps: &gst::CapsRef, compatible_brands: &mut Vec<&'static [u8; 4]>) { let s = caps.structure(0).unwrap(); - match s.name() { + match s.name().as_str() { "video/x-h264" => { let width = s.get::("width").ok(); let height = s.get::("height").ok(); @@ -411,7 +411,10 @@ fn write_moov(v: &mut Vec, cfg: &super::HeaderConfiguration) -> Result<(), E for (idx, other_stream) in cfg.streams.iter().enumerate() { let s = other_stream.caps.structure(0).unwrap(); - if matches!(s.name(), "video/x-h264" | "video/x-h265" | "image/jpeg") { + if matches!( + s.name().as_str(), + "video/x-h264" | "video/x-h265" | "image/jpeg" + ) { references.push(TrackReference { reference_type: *b"cdsc", track_ids: vec![idx as u32 + 1], @@ -600,7 +603,7 @@ fn write_tkhd( // Volume let s = stream.caps.structure(0).unwrap(); - match s.name() { + match s.name().as_str() { "audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => { v.extend((1u16 << 8).to_be_bytes()) } @@ -628,7 +631,7 @@ fn write_tkhd( ); // Width/height - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { let width = s.get::("width").context("video caps without width")? as u32; let height = s @@ -738,7 +741,7 @@ fn write_hdlr( v.extend([0u8; 4]); let s = stream.caps.structure(0).unwrap(); - let (handler_type, name) = match s.name() { + let (handler_type, name) = match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { (b"vide", b"VideoHandler\0".as_slice()) } @@ -768,7 +771,7 @@ fn write_minf( ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { // Flags are always 1 for unspecified reasons write_full_box(v, b"vmhd", FULL_BOX_VERSION_0, 1, |v| write_vmhd(v, cfg))? @@ -879,7 +882,7 @@ fn write_stsd( v.extend(1u32.to_be_bytes()); let s = stream.caps.structure(0).unwrap(); - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { write_visual_sample_entry(v, cfg, stream)? } @@ -915,7 +918,7 @@ fn write_visual_sample_entry( stream: &super::HeaderStream, ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - let fourcc = match s.name() { + let fourcc = match s.name().as_str() { "video/x-h264" => { let stream_format = s.get::<&str>("stream-format").context("no stream-format")?; match stream_format { @@ -977,7 +980,7 @@ fn write_visual_sample_entry( v.extend((-1i16).to_be_bytes()); // Codec specific boxes - match s.name() { + match s.name().as_str() { "video/x-h264" => { let codec_data = s .get::<&gst::BufferRef>("codec_data") @@ -1132,7 +1135,7 @@ fn write_visual_sample_entry( } // Write fiel box for codecs that require it - if ["image/jpeg"].contains(&s.name()) { + if ["image/jpeg"].contains(&s.name().as_str()) { let interlace_mode = s .get::<&str>("interlace-mode") .ok() @@ -1176,7 +1179,7 @@ fn write_audio_sample_entry( stream: &super::HeaderStream, ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - let fourcc = match s.name() { + let fourcc = match s.name().as_str() { "audio/mpeg" => b"mp4a", "audio/x-opus" => b"Opus", "audio/x-alaw" => b"alaw", @@ -1192,7 +1195,7 @@ fn write_audio_sample_entry( _ => unreachable!(), }; - let sample_size = match s.name() { + let sample_size = match s.name().as_str() { "audio/x-adpcm" => { let bitrate = s.get::("bitrate").context("no ADPCM bitrate field")?; (bitrate / 8000) as u16 @@ -1223,7 +1226,7 @@ fn write_audio_sample_entry( v.extend((u32::from(rate) << 16).to_be_bytes()); // Codec specific boxes - match s.name() { + match s.name().as_str() { "audio/mpeg" => { let codec_data = s .get::<&gst::BufferRef>("codec_data") @@ -1439,7 +1442,7 @@ fn write_xml_meta_data_sample_entry( stream: &super::HeaderStream, ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - let namespace = match s.name() { + let namespace = match s.name().as_str() { "application/x-onvif-metadata" => b"http://www.onvif.org/ver10/schema", _ => unreachable!(), }; diff --git a/mux/fmp4/src/fmp4mux/imp.rs b/mux/fmp4/src/fmp4mux/imp.rs index 21e6ebcf..30f15deb 100644 --- a/mux/fmp4/src/fmp4mux/imp.rs +++ b/mux/fmp4/src/fmp4mux/imp.rs @@ -1638,7 +1638,7 @@ impl FMP4Mux { let s = caps.structure(0).unwrap(); let mut delta_frames = DeltaFrames::IntraOnly; - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" => { if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) { gst::error!(CAT, obj: pad, "Received caps without codec_data"); diff --git a/mux/mp4/src/mp4mux/boxes.rs b/mux/mp4/src/mp4mux/boxes.rs index 9db658ee..b40ec202 100644 --- a/mux/mp4/src/mp4mux/boxes.rs +++ b/mux/mp4/src/mp4mux/boxes.rs @@ -190,7 +190,10 @@ fn write_moov(v: &mut Vec, header: &super::Header) -> Result<(), Error> { for (idx, other_stream) in header.streams.iter().enumerate() { let s = other_stream.caps.structure(0).unwrap(); - if matches!(s.name(), "video/x-h264" | "video/x-h265" | "image/jpeg") { + if matches!( + s.name().as_str(), + "video/x-h264" | "video/x-h265" | "image/jpeg" + ) { references.push(TrackReference { reference_type: *b"cdsc", track_ids: vec![idx as u32 + 1], @@ -378,7 +381,7 @@ fn write_tkhd( // Volume let s = stream.caps.structure(0).unwrap(); - match s.name() { + match s.name().as_str() { "audio/mpeg" | "audio/x-opus" | "audio/x-alaw" | "audio/x-mulaw" | "audio/x-adpcm" => { v.extend((1u16 << 8).to_be_bytes()) } @@ -406,7 +409,7 @@ fn write_tkhd( ); // Width/height - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { let width = s.get::("width").context("video caps without width")? as u32; let height = s @@ -507,7 +510,7 @@ fn write_hdlr( v.extend([0u8; 4]); let s = stream.caps.structure(0).unwrap(); - let (handler_type, name) = match s.name() { + let (handler_type, name) = match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { (b"vide", b"VideoHandler\0".as_slice()) } @@ -537,7 +540,7 @@ fn write_minf( ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { // Flags are always 1 for unspecified reasons write_full_box(v, b"vmhd", FULL_BOX_VERSION_0, 1, |v| write_vmhd(v, header))? @@ -696,7 +699,7 @@ fn write_stsd( v.extend(1u32.to_be_bytes()); let s = stream.caps.structure(0).unwrap(); - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" | "video/x-vp9" | "image/jpeg" => { write_visual_sample_entry(v, header, stream)? } @@ -732,7 +735,7 @@ fn write_visual_sample_entry( stream: &super::Stream, ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - let fourcc = match s.name() { + let fourcc = match s.name().as_str() { "video/x-h264" => { let stream_format = s.get::<&str>("stream-format").context("no stream-format")?; match stream_format { @@ -794,7 +797,7 @@ fn write_visual_sample_entry( v.extend((-1i16).to_be_bytes()); // Codec specific boxes - match s.name() { + match s.name().as_str() { "video/x-h264" => { let codec_data = s .get::<&gst::BufferRef>("codec_data") @@ -949,7 +952,7 @@ fn write_visual_sample_entry( } // Write fiel box for codecs that require it - if ["image/jpeg"].contains(&s.name()) { + if ["image/jpeg"].contains(&s.name().as_str()) { let interlace_mode = s .get::<&str>("interlace-mode") .ok() @@ -993,7 +996,7 @@ fn write_audio_sample_entry( stream: &super::Stream, ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - let fourcc = match s.name() { + let fourcc = match s.name().as_str() { "audio/mpeg" => b"mp4a", "audio/x-opus" => b"Opus", "audio/x-alaw" => b"alaw", @@ -1009,7 +1012,7 @@ fn write_audio_sample_entry( _ => unreachable!(), }; - let sample_size = match s.name() { + let sample_size = match s.name().as_str() { "audio/x-adpcm" => { let bitrate = s.get::("bitrate").context("no ADPCM bitrate field")?; (bitrate / 8000) as u16 @@ -1040,7 +1043,7 @@ fn write_audio_sample_entry( v.extend((u32::from(rate) << 16).to_be_bytes()); // Codec specific boxes - match s.name() { + match s.name().as_str() { "audio/mpeg" => { let codec_data = s .get::<&gst::BufferRef>("codec_data") @@ -1256,7 +1259,7 @@ fn write_xml_meta_data_sample_entry( stream: &super::Stream, ) -> Result<(), Error> { let s = stream.caps.structure(0).unwrap(); - let namespace = match s.name() { + let namespace = match s.name().as_str() { "application/x-onvif-metadata" => b"http://www.onvif.org/ver10/schema", _ => unreachable!(), }; diff --git a/mux/mp4/src/mp4mux/imp.rs b/mux/mp4/src/mp4mux/imp.rs index 6a8cd19c..964815c5 100644 --- a/mux/mp4/src/mp4mux/imp.rs +++ b/mux/mp4/src/mp4mux/imp.rs @@ -870,7 +870,7 @@ impl MP4Mux { let s = caps.structure(0).unwrap(); let mut delta_frames = super::DeltaFrames::IntraOnly; - match s.name() { + match s.name().as_str() { "video/x-h264" | "video/x-h265" => { if !s.has_field_with_type("codec_data", gst::Buffer::static_type()) { gst::error!(CAT, obj: pad, "Received caps without codec_data"); diff --git a/net/hlssink3/src/imp.rs b/net/hlssink3/src/imp.rs index 09e66ed6..2fcca82b 100644 --- a/net/hlssink3/src/imp.rs +++ b/net/hlssink3/src/imp.rs @@ -389,7 +389,7 @@ impl BinImpl for HlsSink3 { } let s = msg.structure().unwrap(); - match s.name() { + match s.name().as_str() { "splitmuxsink-fragment-opened" => { if let Ok(new_fragment_opened_at) = s.get::("running-time") { diff --git a/net/ndi/src/lib.rs b/net/ndi/src/lib.rs index 97a0fc6a..1edf3712 100644 --- a/net/ndi/src/lib.rs +++ b/net/ndi/src/lib.rs @@ -148,9 +148,9 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { } static TIMECODE_CAPS: Lazy = - Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timecode", &[])); + Lazy::new(|| gst::Caps::new_empty_simple("timestamp/x-ndi-timecode")); static TIMESTAMP_CAPS: Lazy = - Lazy::new(|| gst::Caps::new_simple("timestamp/x-ndi-timestamp", &[])); + Lazy::new(|| gst::Caps::new_empty_simple("timestamp/x-ndi-timestamp")); gst::plugin_define!( ndi, diff --git a/net/onvif/src/onvifmetadataoverlay/imp.rs b/net/onvif/src/onvifmetadataoverlay/imp.rs index 1640b393..55459e31 100644 --- a/net/onvif/src/onvifmetadataoverlay/imp.rs +++ b/net/onvif/src/onvifmetadataoverlay/imp.rs @@ -91,7 +91,7 @@ impl OnvifMetadataOverlay { let upstream_has_meta = caps .features(0) - .map(|f| f.contains(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION)) + .map(|f| f.contains(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION)) .unwrap_or(false); if !upstream_has_meta { @@ -99,7 +99,7 @@ impl OnvifMetadataOverlay { let overlay_caps = caps_clone.make_mut(); if let Some(features) = overlay_caps.features_mut(0) { - features.add(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); + features.add(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); let peercaps = self.srcpad.peer_query_caps(Some(&caps_clone)); downstream_accepts_meta = !peercaps.is_empty(); if downstream_accepts_meta { diff --git a/net/reqwest/src/reqwesthttpsrc/imp.rs b/net/reqwest/src/reqwesthttpsrc/imp.rs index 65eeb723..3b129ab2 100644 --- a/net/reqwest/src/reqwesthttpsrc/imp.rs +++ b/net/reqwest/src/reqwesthttpsrc/imp.rs @@ -379,7 +379,7 @@ impl ReqwestHttpSrc { if let Some(ref extra_headers) = settings.extra_headers { for (field, value) in extra_headers.iter() { - let field = match HeaderName::try_from(field) { + let field = match HeaderName::try_from(field.as_str()) { Ok(field) => field, Err(err) => { gst::warning!( diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index db6dd9c4..c41ac165 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -263,12 +263,12 @@ impl Default for Settings { fn default() -> Self { Self { video_caps: ["video/x-vp8", "video/x-h264", "video/x-vp9", "video/x-h265"] - .iter() - .map(|s| gst::Structure::new_empty(s)) + .into_iter() + .map(gst::Structure::new_empty) .collect::(), audio_caps: ["audio/x-opus"] - .iter() - .map(|s| gst::Structure::new_empty(s)) + .into_iter() + .map(gst::Structure::new_empty) .collect::(), stun_server: DEFAULT_STUN_SERVER.map(String::from), turn_servers: gst::Array::new(Vec::new() as Vec), @@ -848,7 +848,7 @@ impl Session { { let payloader_caps_mut = payloader_caps.make_mut(); - payloader_caps_mut.set_simple(&[("ssrc", &ssrc)]); + payloader_caps_mut.set("ssrc", ssrc); } gst::info!( @@ -949,7 +949,7 @@ impl Session { .property::("transceiver"); transceiver.set_property("codec-preferences", None::); - let mut global_caps = gst::Caps::new_simple("application/x-unknown", &[]); + let mut global_caps = gst::Caps::new_empty_simple("application/x-unknown"); let sdp = self.sdp.as_ref().unwrap(); let sdp_media = sdp.media(webrtc_pad.media_idx).unwrap(); @@ -1107,10 +1107,9 @@ impl NavigationEventHandler { "create-data-channel", &[ &"input", - &gst::Structure::new( - "config", - &[("priority", &gst_webrtc::WebRTCPriorityType::High)], - ), + &gst::Structure::builder("config") + .field("priority", gst_webrtc::WebRTCPriorityType::High) + .build(), ], ); @@ -2138,7 +2137,7 @@ impl WebRTCSink { if let Some(s) = caps.structure(0) { let mut s = s.to_owned(); - s.remove_fields(&[ + s.remove_fields([ "timestamp-offset", "seqnum-offset", "ssrc", @@ -2173,7 +2172,7 @@ impl WebRTCSink { ) -> (String, gst::Caps) { let sink_caps = in_caps.as_ref().to_owned(); - let is_video = match sink_caps.structure(0).unwrap().name() { + let is_video = match sink_caps.structure(0).unwrap().name().as_str() { "video/x-raw" => true, "audio/x-raw" => false, _ => unreachable!(), @@ -2710,15 +2709,15 @@ impl ElementImpl for WebRTCSink { .structure(gst::Structure::builder("video/x-raw").build()) .structure_with_features( gst::Structure::builder("video/x-raw").build(), - gst::CapsFeatures::new(&[CUDA_MEMORY_FEATURE]), + gst::CapsFeatures::new([CUDA_MEMORY_FEATURE]), ) .structure_with_features( gst::Structure::builder("video/x-raw").build(), - gst::CapsFeatures::new(&[GL_MEMORY_FEATURE]), + gst::CapsFeatures::new([GL_MEMORY_FEATURE]), ) .structure_with_features( gst::Structure::builder("video/x-raw").build(), - gst::CapsFeatures::new(&[NVMM_MEMORY_FEATURE]), + gst::CapsFeatures::new([NVMM_MEMORY_FEATURE]), ) .build(); let video_pad_template = gst::PadTemplate::new( diff --git a/net/webrtchttp/src/whepsrc/imp.rs b/net/webrtchttp/src/whepsrc/imp.rs index 29d5f2d5..1bcc35f6 100644 --- a/net/webrtchttp/src/whepsrc/imp.rs +++ b/net/webrtchttp/src/whepsrc/imp.rs @@ -59,12 +59,12 @@ impl Default for Settings { "video/x-h265", "video/x-av1", ] - .iter() - .map(|s| gst::Structure::new_empty(s)) + .into_iter() + .map(gst::Structure::new_empty) .collect::(), audio_caps: ["audio/x-opus"] - .iter() - .map(|s| gst::Structure::new_empty(s)) + .into_iter() + .map(gst::Structure::new_empty) .collect::(), stun_server: None, turn_server: None, diff --git a/text/regex/src/gstregex/imp.rs b/text/regex/src/gstregex/imp.rs index 39cfd7e8..c09f251e 100644 --- a/text/regex/src/gstregex/imp.rs +++ b/text/regex/src/gstregex/imp.rs @@ -202,7 +202,7 @@ impl ObjectImpl for RegEx { } }; - match operation { + match operation.as_str() { "replace-all" | "replace_all" => { let replacement = match s.get::>("replacement") { Ok(Some(pattern)) => pattern, diff --git a/utils/fallbackswitch/src/fallbackswitch/imp.rs b/utils/fallbackswitch/src/fallbackswitch/imp.rs index 5a9e86de..6b7e1590 100644 --- a/utils/fallbackswitch/src/fallbackswitch/imp.rs +++ b/utils/fallbackswitch/src/fallbackswitch/imp.rs @@ -860,7 +860,7 @@ impl FallbackSwitch { let caps = caps.caps(); debug!(CAT, obj: pad, "Received caps {}", caps); - let caps_info = match caps.structure(0).unwrap().name() { + let caps_info = match caps.structure(0).unwrap().name().as_str() { "audio/x-raw" => { CapsInfo::Audio(gst_audio::AudioInfo::from_caps(caps).unwrap()) } diff --git a/video/cdg/src/cdgdec/imp.rs b/video/cdg/src/cdgdec/imp.rs index 9d077731..ae6874c8 100644 --- a/video/cdg/src/cdgdec/imp.rs +++ b/video/cdg/src/cdgdec/imp.rs @@ -204,7 +204,7 @@ impl VideoDecoderImpl for CdgDec { let pools = query.allocation_pools(); if let Some((Some(ref pool), _, _, _)) = pools.first() { let mut config = pool.config(); - config.add_option(&gst_video::BUFFER_POOL_OPTION_VIDEO_META); + config.add_option(gst_video::BUFFER_POOL_OPTION_VIDEO_META); pool.set_config(config) .map_err(|_| gst::loggable_error!(CAT, "Failed to configure buffer pool"))?; } diff --git a/video/closedcaption/src/cea608overlay/imp.rs b/video/closedcaption/src/cea608overlay/imp.rs index 13a03b56..b6a78f7f 100644 --- a/video/closedcaption/src/cea608overlay/imp.rs +++ b/video/closedcaption/src/cea608overlay/imp.rs @@ -266,7 +266,7 @@ impl Cea608Overlay { let upstream_has_meta = caps .features(0) - .map(|f| f.contains(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION)) + .map(|f| f.contains(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION)) .unwrap_or(false); if !upstream_has_meta { @@ -274,7 +274,7 @@ impl Cea608Overlay { let overlay_caps = caps_clone.make_mut(); if let Some(features) = overlay_caps.features_mut(0) { - features.add(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); + features.add(gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); let peercaps = self.srcpad.peer_query_caps(Some(&caps_clone)); downstream_accepts_meta = !peercaps.is_empty(); if downstream_accepts_meta { diff --git a/video/gtk4/src/sink/imp.rs b/video/gtk4/src/sink/imp.rs index db4d64cf..caa8361d 100644 --- a/video/gtk4/src/sink/imp.rs +++ b/video/gtk4/src/sink/imp.rs @@ -147,10 +147,16 @@ impl ElementImpl for PaintableSink { for features in [ None, - Some(&["memory:GLMemory", "meta:GstVideoOverlayComposition"][..]), - Some(&["memory:GLMemory"][..]), - Some(&["memory:SystemMemory", "meta:GstVideoOverlayComposition"][..]), - Some(&["meta:GstVideoOverlayComposition"][..]), + Some(gst::CapsFeatures::new([ + "memory:GLMemory", + "meta:GstVideoOverlayComposition", + ])), + Some(gst::CapsFeatures::new(["memory:GLMemory"])), + Some(gst::CapsFeatures::new([ + "memory:SystemMemory", + "meta:GstVideoOverlayComposition", + ])), + Some(gst::CapsFeatures::new(["meta:GstVideoOverlayComposition"])), ] { let mut c = gst_video::video_make_raw_caps(&[ gst_video::VideoFormat::Bgra, @@ -163,15 +169,12 @@ impl ElementImpl for PaintableSink { .build(); if let Some(features) = features { - c.get_mut() - .unwrap() - .set_features_simple(Some(gst::CapsFeatures::new(features))); + let c = c.get_mut().unwrap(); - if features.contains(&"memory:GLMemory") { - c.get_mut() - .unwrap() - .set_simple(&[("texture-target", &"2D")]) + if features.contains("memory:GLMemory") { + c.set("texture-target", "2D") } + c.set_features_simple(Some(features)); } caps.append(c);