From 0e8b95f1d029530ad3f84a3f08a20d8dfd80a089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 24 Oct 2020 20:10:13 +0300 Subject: [PATCH] urihandler: Provide URIType as associated constant when implementing the gst::URIHandler interface The supported protocols still stay a function because they might have to be probed at runtime, but they return a static string array now as they must not randomly change at runtime. --- gstreamer/src/subclass/uri_handler.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gstreamer/src/subclass/uri_handler.rs b/gstreamer/src/subclass/uri_handler.rs index 7f38b7440..f8bce2d47 100644 --- a/gstreamer/src/subclass/uri_handler.rs +++ b/gstreamer/src/subclass/uri_handler.rs @@ -9,10 +9,10 @@ use crate::URIHandler; use crate::URIType; pub trait URIHandlerImpl: super::element::ElementImpl { + const URI_TYPE: URIType; + fn get_protocols() -> &'static [&'static str]; fn get_uri(&self, element: &Self::Type) -> Option; fn set_uri(&self, element: &Self::Type, uri: &str) -> Result<(), glib::Error>; - fn get_uri_type() -> URIType; - fn get_protocols() -> Vec; } unsafe impl IsImplementable for URIHandler { @@ -43,7 +43,7 @@ unsafe impl IsImplementable for URIHandler { unsafe extern "C" fn uri_handler_get_type( _type_: glib::ffi::GType, ) -> ffi::GstURIType { - ::get_uri_type().to_glib() + ::URI_TYPE.to_glib() } unsafe extern "C" fn uri_handler_get_protocols(