Move some extern C functions into the place where they're used

This commit is contained in:
Sebastian Dröge 2016-08-27 11:22:55 +03:00
parent 742515aac1
commit b47d7df776

View file

@ -41,7 +41,18 @@ use std::os::raw::c_void;
use libc::c_char;
use std::ffi::CString;
extern "C" {
unsafe fn source_register(plugin: *const c_void,
name: &str,
long_name: &str,
description: &str,
classification: &str,
author: &str,
rank: i32,
create_instance: *const c_void,
protocols: &str,
push_only: bool) {
extern "C" {
fn gst_rs_source_register(plugin: *const c_void,
name: *const c_char,
long_name: *const c_char,
@ -53,31 +64,8 @@ extern "C" {
protocols: *const c_char,
push_only: GBoolean)
-> GBoolean;
}
}
extern "C" {
fn gst_rs_sink_register(plugin: *const c_void,
name: *const c_char,
long_name: *const c_char,
description: *const c_char,
classification: *const c_char,
author: *const c_char,
rank: i32,
create_instance: *const c_void,
protocols: *const c_char)
-> GBoolean;
}
unsafe fn source_register(plugin: *const c_void,
name: &str,
long_name: &str,
description: &str,
classification: &str,
author: &str,
rank: i32,
create_instance: *const c_void,
protocols: &str,
push_only: bool) {
let cname = CString::new(name).unwrap();
let clong_name = CString::new(long_name).unwrap();
let cdescription = CString::new(description).unwrap();
@ -134,6 +122,19 @@ unsafe fn sink_register(plugin: *const c_void,
rank: i32,
create_instance: *const c_void,
protocols: &str) {
extern "C" {
fn gst_rs_sink_register(plugin: *const c_void,
name: *const c_char,
long_name: *const c_char,
description: *const c_char,
classification: *const c_char,
author: *const c_char,
rank: i32,
create_instance: *const c_void,
protocols: *const c_char)
-> GBoolean;
}
let cname = CString::new(name).unwrap();
let clong_name = CString::new(long_name).unwrap();
let cdescription = CString::new(description).unwrap();