From 1ee7c8b9e3aabd88302f3a434b7eafd865a55ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 23 Jan 2017 18:26:42 +0200 Subject: [PATCH] Return stream IDs directly instead of creating an owned String --- gst-plugin/src/streams.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gst-plugin/src/streams.rs b/gst-plugin/src/streams.rs index 80ae2416..a1a7a687 100644 --- a/gst-plugin/src/streams.rs +++ b/gst-plugin/src/streams.rs @@ -95,7 +95,7 @@ impl Stream { StreamType::from_bits_truncate(unsafe { gst_stream_get_stream_type(self.0) }) } - pub fn get_stream_id(&self) -> String { + pub fn get_stream_id(&self) -> &str { extern "C" { fn gst_stream_get_stream_id(collection: *mut c_void) -> *mut c_char; } @@ -104,7 +104,6 @@ impl Stream { CStr::from_ptr(gst_stream_get_stream_id(self.0)) .to_str() .unwrap() - .into() } } @@ -209,7 +208,7 @@ impl StreamCollection { unsafe { gst_stream_collection_get_size(self.0) } } - pub fn get_upstream_id(&self) -> String { + pub fn get_upstream_id(&self) -> &str { extern "C" { fn gst_stream_collection_get_upstream_id(collection: *mut c_void) -> *mut c_char; } @@ -218,7 +217,6 @@ impl StreamCollection { CStr::from_ptr(gst_stream_collection_get_upstream_id(self.0)) .to_str() .unwrap() - .into() } }