diff --git a/examples/src/bin/decodebin.rs b/examples/src/bin/decodebin.rs index fbf89ea77..d8bc68988 100644 --- a/examples/src/bin/decodebin.rs +++ b/examples/src/bin/decodebin.rs @@ -133,7 +133,7 @@ fn example_main() -> Result<(), Error> { ("Failed to insert sink"), details: gst::Structure::builder("error-details") .field("error", - glib::AnySendValue::new(Arc::new(Mutex::new(Some(err))))) + &glib::AnySendValue::new(Arc::new(Mutex::new(Some(err))))) .build() ); diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index 50b10dfdc..ed0b2a3de 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -382,7 +382,7 @@ impl Builder { } } - pub fn field(mut self, name: &str, value: V) -> Self { + pub fn field(mut self, name: &str, value: &V) -> Self { self.s.set(name, value); self } @@ -440,11 +440,11 @@ mod tests { ::init().unwrap(); let caps = Caps::builder("foo/bar") - .field("int", 12) - .field("bool", true) - .field("string", "bla") - .field("fraction", Fraction::new(1, 2)) - .field("array", Array::new(&[&1, &2])) + .field("int", &12) + .field("bool", &true) + .field("string", &"bla") + .field("fraction", &Fraction::new(1, 2)) + .field("array", &Array::new(&[&1, &2])) .build(); assert_eq!( caps.to_string(), diff --git a/gstreamer/src/sample.rs b/gstreamer/src/sample.rs index e017fcf8e..b2c0c712d 100644 --- a/gstreamer/src/sample.rs +++ b/gstreamer/src/sample.rs @@ -30,8 +30,8 @@ unsafe impl MiniObject for SampleRef { impl GstRc { pub fn new( - buffer: Option, - caps: Option, + buffer: Option<&Buffer>, + caps: Option<&Caps>, segment: Option<&Segment>, info: Option<&StructureRef>, ) -> Self { diff --git a/gstreamer/src/structure.rs b/gstreamer/src/structure.rs index 865de18a0..53d177767 100644 --- a/gstreamer/src/structure.rs +++ b/gstreamer/src/structure.rs @@ -305,7 +305,7 @@ impl StructureRef { } } - pub fn set(&mut self, name: &str, value: T) { + pub fn set(&mut self, name: &str, value: &T) { let value = value.to_send_value(); self.set_value(name, value); } @@ -608,7 +608,7 @@ impl Builder { } } - pub fn field(mut self, name: &str, value: V) -> Self { + pub fn field(mut self, name: &str, value: &V) -> Self { self.s.set(name, value); self } @@ -629,9 +629,9 @@ mod tests { let mut s = Structure::new_empty("test"); assert_eq!(s.get_name(), "test"); - s.set("f1", "abc"); - s.set("f2", String::from("bcd")); - s.set("f3", 123i32); + s.set("f1", &"abc"); + s.set("f2", &String::from("bcd")); + s.set("f3", &123i32); assert_eq!(s.get::<&str>("f1").unwrap(), "abc"); assert_eq!(s.get::<&str>("f2").unwrap(), "bcd"); @@ -657,9 +657,9 @@ mod tests { ::init().unwrap(); let s = Structure::builder("test") - .field("f1", "abc") - .field("f2", String::from("bcd")) - .field("f3", 123i32) + .field("f1", &"abc") + .field("f2", &String::from("bcd")) + .field("f3", &123i32) .build(); assert_eq!(s.get_name(), "test"); diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index ac91e6eb1..cb66ff27f 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -255,7 +255,7 @@ impl Default for GstRc { } impl TagListRef { - pub fn add<'a, T: Tag<'a>>(&mut self, value: T::TagType, mode: TagMergeMode) + pub fn add<'a, T: Tag<'a>>(&mut self, value: &T::TagType, mode: TagMergeMode) where T::TagType: ToSendValue, { @@ -442,8 +442,8 @@ mod tests { assert_eq!(tags.to_string(), "taglist;"); { let tags = tags.get_mut().unwrap(); - tags.add::("some title".into(), TagMergeMode::Append); - tags.add::<Duration>((1000u64 * 1000 * 1000 * 120).into(), TagMergeMode::Append); + tags.add::<Title>(&"some title", TagMergeMode::Append); + tags.add::<Duration>(&(1000u64 * 1000 * 1000 * 120).into(), TagMergeMode::Append); } assert_eq!( tags.to_string(), @@ -459,8 +459,8 @@ mod tests { assert_eq!(tags.to_string(), "taglist;"); { let tags = tags.get_mut().unwrap(); - tags.add::<Title>("some title".into(), TagMergeMode::Append); - tags.add::<Duration>((1000u64 * 1000 * 1000 * 120).into(), TagMergeMode::Append); + tags.add::<Title>(&"some title", TagMergeMode::Append); + tags.add::<Duration>(&(1000u64 * 1000 * 1000 * 120).into(), TagMergeMode::Append); } assert_eq!(tags.get::<Title>().unwrap().get(), Some("some title")); diff --git a/gstreamer/src/toc.rs b/gstreamer/src/toc.rs index 29d396be0..5adf725f3 100644 --- a/gstreamer/src/toc.rs +++ b/gstreamer/src/toc.rs @@ -80,7 +80,7 @@ impl TocRef { } } - pub fn merge_tags(&mut self, tag_list: TagList, mode: TagMergeMode) { + pub fn merge_tags(&mut self, tag_list: &TagList, mode: TagMergeMode) { unsafe { ffi::gst_toc_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib()); } @@ -208,7 +208,7 @@ impl TocEntryRef { } } - pub fn merge_tags(&mut self, tag_list: TagList, mode: TagMergeMode) { + pub fn merge_tags(&mut self, tag_list: &TagList, mode: TagMergeMode) { unsafe { ffi::gst_toc_entry_merge_tags(self.as_mut_ptr(), tag_list.as_mut_ptr(), mode.to_glib()); }