gstreamer: fix parent vfunc invocations when needed

Fixes #180
This commit is contained in:
François Laignel 2019-01-31 17:07:04 +01:00 committed by Sebastian Dröge
parent 338215bd53
commit 56c00d9250

View file

@ -1,4 +1,4 @@
// Copyright (C) 2017,2018 Sebastian Dröge <sebastian@centricular.com> // Copyright (C) 2017-2019 Sebastian Dröge <sebastian@centricular.com>
// //
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
@ -70,10 +70,10 @@ pub trait ElementImpl: ObjectImpl + Send + Sync + 'static {
let data = self.get_type_data(); let data = self.get_type_data();
let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass; let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstElementClass;
(*parent_class) let f = (*parent_class)
.change_state .change_state
.map(|f| from_glib(f(element.to_glib_none().0, transition.to_glib()))) .expect("Missing parent function `change_state`");
.unwrap_or(::StateChangeReturn::Success) StateChangeReturn::from_glib(f(element.to_glib_none().0, transition.to_glib()))
.into_result() .into_result()
} }
} }