From 25460455932f6aa3cc2fdd476d8af5ced3ae6be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 3 Jul 2017 12:26:40 +0300 Subject: [PATCH] Implement init() around gst_init_check() --- gstreamer/src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gstreamer/src/lib.rs b/gstreamer/src/lib.rs index 5bc2c0a86..c0c3ed147 100644 --- a/gstreamer/src/lib.rs +++ b/gstreamer/src/lib.rs @@ -9,6 +9,8 @@ extern crate gstreamer_sys as ffi; #[macro_use] extern crate glib; +use glib::translate::{from_glib, from_glib_full}; + macro_rules! callback_guard { () => ( let _guard = ::glib::CallbackGuard::new(); @@ -32,8 +34,13 @@ mod auto; use std::ptr; -pub fn init() { +pub fn init() -> Result<(), glib::Error> { unsafe { - ffi::gst_init(ptr::null_mut(), ptr::null_mut()) + let mut error = ptr::null_mut(); + if from_glib(ffi::gst_init_check(ptr::null_mut(), ptr::null_mut(), &mut error)) { + Ok(()) + } else { + Err(from_glib_full(error)) + } } }