Needless pass by value

Avoid an unnecessary allocation by passing the Caps by reference instead of
by value.

Fixes https://github.com/sdroege/gstreamer-rs/pull/46
Fixes https://github.com/sdroege/gstreamer-rs/issues/45
This commit is contained in:
Luis de Bethencourt 2017-10-22 14:07:19 +01:00 committed by Sebastian Dröge
parent 95dc336b65
commit e82e8e0c34

View file

@ -3,7 +3,7 @@ use gst::prelude::*;
use gst::MessageView;
fn print_caps(caps: gst::Caps, prefix: &str) {
fn print_caps(caps: &gst::Caps, prefix: &str) {
if caps.is_any() {
println!("{}ANY", prefix);
return;
@ -55,7 +55,7 @@ fn print_pad_template_information(factory: &gst::ElementFactory) {
let caps = pad_template.get_caps();
println!(" Capabilities:");
print_caps(caps, " ");
print_caps(&caps, " ");
}
}
@ -67,11 +67,11 @@ fn print_pad_capabilities(element: &gst::Element, pad_name: &str) {
println!("Caps for the {} pad:", pad_name);
match pad.get_current_caps() {
Some(caps) => {
print_caps(caps, " ");
print_caps(&caps, " ");
}
None => {
let caps = pad.query_caps(None).expect("Failed to query caps on pad");
print_caps(caps, " ");
print_caps(&caps, " ");
}
}
}