Run everything through rustfmt

This commit is contained in:
Sebastian Dröge 2019-06-18 13:04:39 +03:00
parent 77a9f4b459
commit be0f64ce93
52 changed files with 21392 additions and 6858 deletions

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

View file

@ -3,17 +3,22 @@
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
#![allow(
clippy::approx_constant,
clippy::type_complexity,
clippy::unreadable_literal
)]
extern crate libc;
extern crate glib_sys as glib;
extern crate gstreamer_sys as gst;
extern crate gstreamer_base_sys as gst_base;
extern crate gstreamer_sys as gst;
extern crate libc;
#[allow(unused_imports)]
use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
c_short, c_ushort, c_long, c_ulong,
c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
@ -37,10 +42,10 @@ pub struct GstAppSinkCallbacks {
impl ::std::fmt::Debug for GstAppSinkCallbacks {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSinkCallbacks @ {:?}", self as *const _))
.field("eos", &self.eos)
.field("new_preroll", &self.new_preroll)
.field("new_sample", &self.new_sample)
.finish()
.field("eos", &self.eos)
.field("new_preroll", &self.new_preroll)
.field("new_sample", &self.new_sample)
.finish()
}
}
@ -53,23 +58,25 @@ pub struct GstAppSinkClass {
pub new_sample: Option<unsafe extern "C" fn(*mut GstAppSink) -> gst::GstFlowReturn>,
pub pull_preroll: Option<unsafe extern "C" fn(*mut GstAppSink) -> *mut gst::GstSample>,
pub pull_sample: Option<unsafe extern "C" fn(*mut GstAppSink) -> *mut gst::GstSample>,
pub try_pull_preroll: Option<unsafe extern "C" fn(*mut GstAppSink, gst::GstClockTime) -> *mut gst::GstSample>,
pub try_pull_sample: Option<unsafe extern "C" fn(*mut GstAppSink, gst::GstClockTime) -> *mut gst::GstSample>,
pub try_pull_preroll:
Option<unsafe extern "C" fn(*mut GstAppSink, gst::GstClockTime) -> *mut gst::GstSample>,
pub try_pull_sample:
Option<unsafe extern "C" fn(*mut GstAppSink, gst::GstClockTime) -> *mut gst::GstSample>,
pub _gst_reserved: [gpointer; 2],
}
impl ::std::fmt::Debug for GstAppSinkClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSinkClass @ {:?}", self as *const _))
.field("basesink_class", &self.basesink_class)
.field("eos", &self.eos)
.field("new_preroll", &self.new_preroll)
.field("new_sample", &self.new_sample)
.field("pull_preroll", &self.pull_preroll)
.field("pull_sample", &self.pull_sample)
.field("try_pull_preroll", &self.try_pull_preroll)
.field("try_pull_sample", &self.try_pull_sample)
.finish()
.field("basesink_class", &self.basesink_class)
.field("eos", &self.eos)
.field("new_preroll", &self.new_preroll)
.field("new_sample", &self.new_sample)
.field("pull_preroll", &self.pull_preroll)
.field("pull_sample", &self.pull_sample)
.field("try_pull_preroll", &self.try_pull_preroll)
.field("try_pull_sample", &self.try_pull_sample)
.finish()
}
}
@ -90,10 +97,10 @@ pub struct GstAppSrcCallbacks {
impl ::std::fmt::Debug for GstAppSrcCallbacks {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSrcCallbacks @ {:?}", self as *const _))
.field("need_data", &self.need_data)
.field("enough_data", &self.enough_data)
.field("seek_data", &self.seek_data)
.finish()
.field("need_data", &self.need_data)
.field("enough_data", &self.enough_data)
.field("seek_data", &self.seek_data)
.finish()
}
}
@ -104,25 +111,28 @@ pub struct GstAppSrcClass {
pub need_data: Option<unsafe extern "C" fn(*mut GstAppSrc, c_uint)>,
pub enough_data: Option<unsafe extern "C" fn(*mut GstAppSrc)>,
pub seek_data: Option<unsafe extern "C" fn(*mut GstAppSrc, u64) -> gboolean>,
pub push_buffer: Option<unsafe extern "C" fn(*mut GstAppSrc, *mut gst::GstBuffer) -> gst::GstFlowReturn>,
pub push_buffer:
Option<unsafe extern "C" fn(*mut GstAppSrc, *mut gst::GstBuffer) -> gst::GstFlowReturn>,
pub end_of_stream: Option<unsafe extern "C" fn(*mut GstAppSrc) -> gst::GstFlowReturn>,
pub push_sample: Option<unsafe extern "C" fn(*mut GstAppSrc, *mut gst::GstSample) -> gst::GstFlowReturn>,
pub push_buffer_list: Option<unsafe extern "C" fn(*mut GstAppSrc, *mut gst::GstBufferList) -> gst::GstFlowReturn>,
pub push_sample:
Option<unsafe extern "C" fn(*mut GstAppSrc, *mut gst::GstSample) -> gst::GstFlowReturn>,
pub push_buffer_list:
Option<unsafe extern "C" fn(*mut GstAppSrc, *mut gst::GstBufferList) -> gst::GstFlowReturn>,
pub _gst_reserved: [gpointer; 2],
}
impl ::std::fmt::Debug for GstAppSrcClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSrcClass @ {:?}", self as *const _))
.field("basesrc_class", &self.basesrc_class)
.field("need_data", &self.need_data)
.field("enough_data", &self.enough_data)
.field("seek_data", &self.seek_data)
.field("push_buffer", &self.push_buffer)
.field("end_of_stream", &self.end_of_stream)
.field("push_sample", &self.push_sample)
.field("push_buffer_list", &self.push_buffer_list)
.finish()
.field("basesrc_class", &self.basesrc_class)
.field("need_data", &self.need_data)
.field("enough_data", &self.enough_data)
.field("seek_data", &self.seek_data)
.field("push_buffer", &self.push_buffer)
.field("end_of_stream", &self.end_of_stream)
.field("push_sample", &self.push_sample)
.field("push_buffer_list", &self.push_buffer_list)
.finish()
}
}
@ -143,8 +153,8 @@ pub struct GstAppSink {
impl ::std::fmt::Debug for GstAppSink {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSink @ {:?}", self as *const _))
.field("basesink", &self.basesink)
.finish()
.field("basesink", &self.basesink)
.finish()
}
}
@ -159,8 +169,8 @@ pub struct GstAppSrc {
impl ::std::fmt::Debug for GstAppSrc {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAppSrc @ {:?}", self as *const _))
.field("basesrc", &self.basesrc)
.finish()
.field("basesrc", &self.basesrc)
.finish()
}
}
@ -187,16 +197,27 @@ extern "C" {
pub fn gst_app_sink_pull_sample(appsink: *mut GstAppSink) -> *mut gst::GstSample;
#[cfg(any(feature = "v1_12", feature = "dox"))]
pub fn gst_app_sink_set_buffer_list_support(appsink: *mut GstAppSink, enable_lists: gboolean);
pub fn gst_app_sink_set_callbacks(appsink: *mut GstAppSink, callbacks: *mut GstAppSinkCallbacks, user_data: gpointer, notify: glib::GDestroyNotify);
pub fn gst_app_sink_set_callbacks(
appsink: *mut GstAppSink,
callbacks: *mut GstAppSinkCallbacks,
user_data: gpointer,
notify: glib::GDestroyNotify,
);
pub fn gst_app_sink_set_caps(appsink: *mut GstAppSink, caps: *const gst::GstCaps);
pub fn gst_app_sink_set_drop(appsink: *mut GstAppSink, drop: gboolean);
pub fn gst_app_sink_set_emit_signals(appsink: *mut GstAppSink, emit: gboolean);
pub fn gst_app_sink_set_max_buffers(appsink: *mut GstAppSink, max: c_uint);
pub fn gst_app_sink_set_wait_on_eos(appsink: *mut GstAppSink, wait: gboolean);
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn gst_app_sink_try_pull_preroll(appsink: *mut GstAppSink, timeout: gst::GstClockTime) -> *mut gst::GstSample;
pub fn gst_app_sink_try_pull_preroll(
appsink: *mut GstAppSink,
timeout: gst::GstClockTime,
) -> *mut gst::GstSample;
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn gst_app_sink_try_pull_sample(appsink: *mut GstAppSink, timeout: gst::GstClockTime) -> *mut gst::GstSample;
pub fn gst_app_sink_try_pull_sample(
appsink: *mut GstAppSink,
timeout: gst::GstClockTime,
) -> *mut gst::GstSample;
//=========================================================================
// GstAppSrc
@ -213,12 +234,26 @@ extern "C" {
pub fn gst_app_src_get_max_bytes(appsrc: *mut GstAppSrc) -> u64;
pub fn gst_app_src_get_size(appsrc: *mut GstAppSrc) -> i64;
pub fn gst_app_src_get_stream_type(appsrc: *mut GstAppSrc) -> GstAppStreamType;
pub fn gst_app_src_push_buffer(appsrc: *mut GstAppSrc, buffer: *mut gst::GstBuffer) -> gst::GstFlowReturn;
pub fn gst_app_src_push_buffer(
appsrc: *mut GstAppSrc,
buffer: *mut gst::GstBuffer,
) -> gst::GstFlowReturn;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn gst_app_src_push_buffer_list(appsrc: *mut GstAppSrc, buffer_list: *mut gst::GstBufferList) -> gst::GstFlowReturn;
pub fn gst_app_src_push_buffer_list(
appsrc: *mut GstAppSrc,
buffer_list: *mut gst::GstBufferList,
) -> gst::GstFlowReturn;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_app_src_push_sample(appsrc: *mut GstAppSrc, sample: *mut gst::GstSample) -> gst::GstFlowReturn;
pub fn gst_app_src_set_callbacks(appsrc: *mut GstAppSrc, callbacks: *mut GstAppSrcCallbacks, user_data: gpointer, notify: glib::GDestroyNotify);
pub fn gst_app_src_push_sample(
appsrc: *mut GstAppSrc,
sample: *mut gst::GstSample,
) -> gst::GstFlowReturn;
pub fn gst_app_src_set_callbacks(
appsrc: *mut GstAppSrc,
callbacks: *mut GstAppSrcCallbacks,
user_data: gpointer,
notify: glib::GDestroyNotify,
);
pub fn gst_app_src_set_caps(appsrc: *mut GstAppSrc, caps: *const gst::GstCaps);
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn gst_app_src_set_duration(appsrc: *mut GstAppSrc, duration: gst::GstClockTime);

View file

@ -5,13 +5,13 @@
extern crate gstreamer_app_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_app_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_app_sys::*;
static PACKAGES: &[&str] = &["gstreamer-app-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,28 +229,71 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstAppSink", Layout {size: size_of::<GstAppSink>(), alignment: align_of::<GstAppSink>()}),
("GstAppSinkCallbacks", Layout {size: size_of::<GstAppSinkCallbacks>(), alignment: align_of::<GstAppSinkCallbacks>()}),
("GstAppSinkClass", Layout {size: size_of::<GstAppSinkClass>(), alignment: align_of::<GstAppSinkClass>()}),
("GstAppSrc", Layout {size: size_of::<GstAppSrc>(), alignment: align_of::<GstAppSrc>()}),
("GstAppSrcCallbacks", Layout {size: size_of::<GstAppSrcCallbacks>(), alignment: align_of::<GstAppSrcCallbacks>()}),
("GstAppSrcClass", Layout {size: size_of::<GstAppSrcClass>(), alignment: align_of::<GstAppSrcClass>()}),
("GstAppStreamType", Layout {size: size_of::<GstAppStreamType>(), alignment: align_of::<GstAppStreamType>()}),
(
"GstAppSink",
Layout {
size: size_of::<GstAppSink>(),
alignment: align_of::<GstAppSink>(),
},
),
(
"GstAppSinkCallbacks",
Layout {
size: size_of::<GstAppSinkCallbacks>(),
alignment: align_of::<GstAppSinkCallbacks>(),
},
),
(
"GstAppSinkClass",
Layout {
size: size_of::<GstAppSinkClass>(),
alignment: align_of::<GstAppSinkClass>(),
},
),
(
"GstAppSrc",
Layout {
size: size_of::<GstAppSrc>(),
alignment: align_of::<GstAppSrc>(),
},
),
(
"GstAppSrcCallbacks",
Layout {
size: size_of::<GstAppSrcCallbacks>(),
alignment: align_of::<GstAppSrcCallbacks>(),
},
),
(
"GstAppSrcClass",
Layout {
size: size_of::<GstAppSrcClass>(),
alignment: align_of::<GstAppSrcClass>(),
},
),
(
"GstAppStreamType",
Layout {
size: size_of::<GstAppStreamType>(),
alignment: align_of::<GstAppStreamType>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -252,5 +301,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_APP_STREAM_TYPE_SEEKABLE", "1"),
("(gint) GST_APP_STREAM_TYPE_STREAM", "0"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

View file

@ -5,13 +5,13 @@
extern crate gstreamer_audio_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_audio_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_audio_sys::*;
static PACKAGES: &[&str] = &["gstreamer-audio-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,78 +229,421 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstAudioAggregator", Layout {size: size_of::<GstAudioAggregator>(), alignment: align_of::<GstAudioAggregator>()}),
("GstAudioAggregatorClass", Layout {size: size_of::<GstAudioAggregatorClass>(), alignment: align_of::<GstAudioAggregatorClass>()}),
("GstAudioAggregatorConvertPad", Layout {size: size_of::<GstAudioAggregatorConvertPad>(), alignment: align_of::<GstAudioAggregatorConvertPad>()}),
("GstAudioAggregatorConvertPadClass", Layout {size: size_of::<GstAudioAggregatorConvertPadClass>(), alignment: align_of::<GstAudioAggregatorConvertPadClass>()}),
("GstAudioAggregatorPad", Layout {size: size_of::<GstAudioAggregatorPad>(), alignment: align_of::<GstAudioAggregatorPad>()}),
("GstAudioAggregatorPadClass", Layout {size: size_of::<GstAudioAggregatorPadClass>(), alignment: align_of::<GstAudioAggregatorPadClass>()}),
("GstAudioBaseSink", Layout {size: size_of::<GstAudioBaseSink>(), alignment: align_of::<GstAudioBaseSink>()}),
("GstAudioBaseSinkClass", Layout {size: size_of::<GstAudioBaseSinkClass>(), alignment: align_of::<GstAudioBaseSinkClass>()}),
("GstAudioBaseSinkDiscontReason", Layout {size: size_of::<GstAudioBaseSinkDiscontReason>(), alignment: align_of::<GstAudioBaseSinkDiscontReason>()}),
("GstAudioBaseSinkSlaveMethod", Layout {size: size_of::<GstAudioBaseSinkSlaveMethod>(), alignment: align_of::<GstAudioBaseSinkSlaveMethod>()}),
("GstAudioBaseSrc", Layout {size: size_of::<GstAudioBaseSrc>(), alignment: align_of::<GstAudioBaseSrc>()}),
("GstAudioBaseSrcClass", Layout {size: size_of::<GstAudioBaseSrcClass>(), alignment: align_of::<GstAudioBaseSrcClass>()}),
("GstAudioBaseSrcSlaveMethod", Layout {size: size_of::<GstAudioBaseSrcSlaveMethod>(), alignment: align_of::<GstAudioBaseSrcSlaveMethod>()}),
("GstAudioBuffer", Layout {size: size_of::<GstAudioBuffer>(), alignment: align_of::<GstAudioBuffer>()}),
("GstAudioCdSrc", Layout {size: size_of::<GstAudioCdSrc>(), alignment: align_of::<GstAudioCdSrc>()}),
("GstAudioCdSrcClass", Layout {size: size_of::<GstAudioCdSrcClass>(), alignment: align_of::<GstAudioCdSrcClass>()}),
("GstAudioCdSrcMode", Layout {size: size_of::<GstAudioCdSrcMode>(), alignment: align_of::<GstAudioCdSrcMode>()}),
("GstAudioCdSrcTrack", Layout {size: size_of::<GstAudioCdSrcTrack>(), alignment: align_of::<GstAudioCdSrcTrack>()}),
("GstAudioChannelMixerFlags", Layout {size: size_of::<GstAudioChannelMixerFlags>(), alignment: align_of::<GstAudioChannelMixerFlags>()}),
("GstAudioChannelPosition", Layout {size: size_of::<GstAudioChannelPosition>(), alignment: align_of::<GstAudioChannelPosition>()}),
("GstAudioClippingMeta", Layout {size: size_of::<GstAudioClippingMeta>(), alignment: align_of::<GstAudioClippingMeta>()}),
("GstAudioClock", Layout {size: size_of::<GstAudioClock>(), alignment: align_of::<GstAudioClock>()}),
("GstAudioClockClass", Layout {size: size_of::<GstAudioClockClass>(), alignment: align_of::<GstAudioClockClass>()}),
("GstAudioConverterFlags", Layout {size: size_of::<GstAudioConverterFlags>(), alignment: align_of::<GstAudioConverterFlags>()}),
("GstAudioDecoder", Layout {size: size_of::<GstAudioDecoder>(), alignment: align_of::<GstAudioDecoder>()}),
("GstAudioDecoderClass", Layout {size: size_of::<GstAudioDecoderClass>(), alignment: align_of::<GstAudioDecoderClass>()}),
("GstAudioDitherMethod", Layout {size: size_of::<GstAudioDitherMethod>(), alignment: align_of::<GstAudioDitherMethod>()}),
("GstAudioDownmixMeta", Layout {size: size_of::<GstAudioDownmixMeta>(), alignment: align_of::<GstAudioDownmixMeta>()}),
("GstAudioEncoder", Layout {size: size_of::<GstAudioEncoder>(), alignment: align_of::<GstAudioEncoder>()}),
("GstAudioEncoderClass", Layout {size: size_of::<GstAudioEncoderClass>(), alignment: align_of::<GstAudioEncoderClass>()}),
("GstAudioFilter", Layout {size: size_of::<GstAudioFilter>(), alignment: align_of::<GstAudioFilter>()}),
("GstAudioFilterClass", Layout {size: size_of::<GstAudioFilterClass>(), alignment: align_of::<GstAudioFilterClass>()}),
("GstAudioFlags", Layout {size: size_of::<GstAudioFlags>(), alignment: align_of::<GstAudioFlags>()}),
("GstAudioFormat", Layout {size: size_of::<GstAudioFormat>(), alignment: align_of::<GstAudioFormat>()}),
("GstAudioFormatFlags", Layout {size: size_of::<GstAudioFormatFlags>(), alignment: align_of::<GstAudioFormatFlags>()}),
("GstAudioFormatInfo", Layout {size: size_of::<GstAudioFormatInfo>(), alignment: align_of::<GstAudioFormatInfo>()}),
("GstAudioInfo", Layout {size: size_of::<GstAudioInfo>(), alignment: align_of::<GstAudioInfo>()}),
("GstAudioLayout", Layout {size: size_of::<GstAudioLayout>(), alignment: align_of::<GstAudioLayout>()}),
("GstAudioMeta", Layout {size: size_of::<GstAudioMeta>(), alignment: align_of::<GstAudioMeta>()}),
("GstAudioNoiseShapingMethod", Layout {size: size_of::<GstAudioNoiseShapingMethod>(), alignment: align_of::<GstAudioNoiseShapingMethod>()}),
("GstAudioPackFlags", Layout {size: size_of::<GstAudioPackFlags>(), alignment: align_of::<GstAudioPackFlags>()}),
("GstAudioQuantizeFlags", Layout {size: size_of::<GstAudioQuantizeFlags>(), alignment: align_of::<GstAudioQuantizeFlags>()}),
("GstAudioResamplerFilterInterpolation", Layout {size: size_of::<GstAudioResamplerFilterInterpolation>(), alignment: align_of::<GstAudioResamplerFilterInterpolation>()}),
("GstAudioResamplerFilterMode", Layout {size: size_of::<GstAudioResamplerFilterMode>(), alignment: align_of::<GstAudioResamplerFilterMode>()}),
("GstAudioResamplerFlags", Layout {size: size_of::<GstAudioResamplerFlags>(), alignment: align_of::<GstAudioResamplerFlags>()}),
("GstAudioResamplerMethod", Layout {size: size_of::<GstAudioResamplerMethod>(), alignment: align_of::<GstAudioResamplerMethod>()}),
("GstAudioRingBuffer", Layout {size: size_of::<GstAudioRingBuffer>(), alignment: align_of::<GstAudioRingBuffer>()}),
("GstAudioRingBufferClass", Layout {size: size_of::<GstAudioRingBufferClass>(), alignment: align_of::<GstAudioRingBufferClass>()}),
("GstAudioRingBufferFormatType", Layout {size: size_of::<GstAudioRingBufferFormatType>(), alignment: align_of::<GstAudioRingBufferFormatType>()}),
("GstAudioRingBufferSpec", Layout {size: size_of::<GstAudioRingBufferSpec>(), alignment: align_of::<GstAudioRingBufferSpec>()}),
("GstAudioRingBufferState", Layout {size: size_of::<GstAudioRingBufferState>(), alignment: align_of::<GstAudioRingBufferState>()}),
("GstAudioSink", Layout {size: size_of::<GstAudioSink>(), alignment: align_of::<GstAudioSink>()}),
("GstAudioSinkClass", Layout {size: size_of::<GstAudioSinkClass>(), alignment: align_of::<GstAudioSinkClass>()}),
("GstAudioSrc", Layout {size: size_of::<GstAudioSrc>(), alignment: align_of::<GstAudioSrc>()}),
("GstAudioSrcClass", Layout {size: size_of::<GstAudioSrcClass>(), alignment: align_of::<GstAudioSrcClass>()}),
("GstStreamVolumeFormat", Layout {size: size_of::<GstStreamVolumeFormat>(), alignment: align_of::<GstStreamVolumeFormat>()}),
("GstStreamVolumeInterface", Layout {size: size_of::<GstStreamVolumeInterface>(), alignment: align_of::<GstStreamVolumeInterface>()}),
(
"GstAudioAggregator",
Layout {
size: size_of::<GstAudioAggregator>(),
alignment: align_of::<GstAudioAggregator>(),
},
),
(
"GstAudioAggregatorClass",
Layout {
size: size_of::<GstAudioAggregatorClass>(),
alignment: align_of::<GstAudioAggregatorClass>(),
},
),
(
"GstAudioAggregatorConvertPad",
Layout {
size: size_of::<GstAudioAggregatorConvertPad>(),
alignment: align_of::<GstAudioAggregatorConvertPad>(),
},
),
(
"GstAudioAggregatorConvertPadClass",
Layout {
size: size_of::<GstAudioAggregatorConvertPadClass>(),
alignment: align_of::<GstAudioAggregatorConvertPadClass>(),
},
),
(
"GstAudioAggregatorPad",
Layout {
size: size_of::<GstAudioAggregatorPad>(),
alignment: align_of::<GstAudioAggregatorPad>(),
},
),
(
"GstAudioAggregatorPadClass",
Layout {
size: size_of::<GstAudioAggregatorPadClass>(),
alignment: align_of::<GstAudioAggregatorPadClass>(),
},
),
(
"GstAudioBaseSink",
Layout {
size: size_of::<GstAudioBaseSink>(),
alignment: align_of::<GstAudioBaseSink>(),
},
),
(
"GstAudioBaseSinkClass",
Layout {
size: size_of::<GstAudioBaseSinkClass>(),
alignment: align_of::<GstAudioBaseSinkClass>(),
},
),
(
"GstAudioBaseSinkDiscontReason",
Layout {
size: size_of::<GstAudioBaseSinkDiscontReason>(),
alignment: align_of::<GstAudioBaseSinkDiscontReason>(),
},
),
(
"GstAudioBaseSinkSlaveMethod",
Layout {
size: size_of::<GstAudioBaseSinkSlaveMethod>(),
alignment: align_of::<GstAudioBaseSinkSlaveMethod>(),
},
),
(
"GstAudioBaseSrc",
Layout {
size: size_of::<GstAudioBaseSrc>(),
alignment: align_of::<GstAudioBaseSrc>(),
},
),
(
"GstAudioBaseSrcClass",
Layout {
size: size_of::<GstAudioBaseSrcClass>(),
alignment: align_of::<GstAudioBaseSrcClass>(),
},
),
(
"GstAudioBaseSrcSlaveMethod",
Layout {
size: size_of::<GstAudioBaseSrcSlaveMethod>(),
alignment: align_of::<GstAudioBaseSrcSlaveMethod>(),
},
),
(
"GstAudioBuffer",
Layout {
size: size_of::<GstAudioBuffer>(),
alignment: align_of::<GstAudioBuffer>(),
},
),
(
"GstAudioCdSrc",
Layout {
size: size_of::<GstAudioCdSrc>(),
alignment: align_of::<GstAudioCdSrc>(),
},
),
(
"GstAudioCdSrcClass",
Layout {
size: size_of::<GstAudioCdSrcClass>(),
alignment: align_of::<GstAudioCdSrcClass>(),
},
),
(
"GstAudioCdSrcMode",
Layout {
size: size_of::<GstAudioCdSrcMode>(),
alignment: align_of::<GstAudioCdSrcMode>(),
},
),
(
"GstAudioCdSrcTrack",
Layout {
size: size_of::<GstAudioCdSrcTrack>(),
alignment: align_of::<GstAudioCdSrcTrack>(),
},
),
(
"GstAudioChannelMixerFlags",
Layout {
size: size_of::<GstAudioChannelMixerFlags>(),
alignment: align_of::<GstAudioChannelMixerFlags>(),
},
),
(
"GstAudioChannelPosition",
Layout {
size: size_of::<GstAudioChannelPosition>(),
alignment: align_of::<GstAudioChannelPosition>(),
},
),
(
"GstAudioClippingMeta",
Layout {
size: size_of::<GstAudioClippingMeta>(),
alignment: align_of::<GstAudioClippingMeta>(),
},
),
(
"GstAudioClock",
Layout {
size: size_of::<GstAudioClock>(),
alignment: align_of::<GstAudioClock>(),
},
),
(
"GstAudioClockClass",
Layout {
size: size_of::<GstAudioClockClass>(),
alignment: align_of::<GstAudioClockClass>(),
},
),
(
"GstAudioConverterFlags",
Layout {
size: size_of::<GstAudioConverterFlags>(),
alignment: align_of::<GstAudioConverterFlags>(),
},
),
(
"GstAudioDecoder",
Layout {
size: size_of::<GstAudioDecoder>(),
alignment: align_of::<GstAudioDecoder>(),
},
),
(
"GstAudioDecoderClass",
Layout {
size: size_of::<GstAudioDecoderClass>(),
alignment: align_of::<GstAudioDecoderClass>(),
},
),
(
"GstAudioDitherMethod",
Layout {
size: size_of::<GstAudioDitherMethod>(),
alignment: align_of::<GstAudioDitherMethod>(),
},
),
(
"GstAudioDownmixMeta",
Layout {
size: size_of::<GstAudioDownmixMeta>(),
alignment: align_of::<GstAudioDownmixMeta>(),
},
),
(
"GstAudioEncoder",
Layout {
size: size_of::<GstAudioEncoder>(),
alignment: align_of::<GstAudioEncoder>(),
},
),
(
"GstAudioEncoderClass",
Layout {
size: size_of::<GstAudioEncoderClass>(),
alignment: align_of::<GstAudioEncoderClass>(),
},
),
(
"GstAudioFilter",
Layout {
size: size_of::<GstAudioFilter>(),
alignment: align_of::<GstAudioFilter>(),
},
),
(
"GstAudioFilterClass",
Layout {
size: size_of::<GstAudioFilterClass>(),
alignment: align_of::<GstAudioFilterClass>(),
},
),
(
"GstAudioFlags",
Layout {
size: size_of::<GstAudioFlags>(),
alignment: align_of::<GstAudioFlags>(),
},
),
(
"GstAudioFormat",
Layout {
size: size_of::<GstAudioFormat>(),
alignment: align_of::<GstAudioFormat>(),
},
),
(
"GstAudioFormatFlags",
Layout {
size: size_of::<GstAudioFormatFlags>(),
alignment: align_of::<GstAudioFormatFlags>(),
},
),
(
"GstAudioFormatInfo",
Layout {
size: size_of::<GstAudioFormatInfo>(),
alignment: align_of::<GstAudioFormatInfo>(),
},
),
(
"GstAudioInfo",
Layout {
size: size_of::<GstAudioInfo>(),
alignment: align_of::<GstAudioInfo>(),
},
),
(
"GstAudioLayout",
Layout {
size: size_of::<GstAudioLayout>(),
alignment: align_of::<GstAudioLayout>(),
},
),
(
"GstAudioMeta",
Layout {
size: size_of::<GstAudioMeta>(),
alignment: align_of::<GstAudioMeta>(),
},
),
(
"GstAudioNoiseShapingMethod",
Layout {
size: size_of::<GstAudioNoiseShapingMethod>(),
alignment: align_of::<GstAudioNoiseShapingMethod>(),
},
),
(
"GstAudioPackFlags",
Layout {
size: size_of::<GstAudioPackFlags>(),
alignment: align_of::<GstAudioPackFlags>(),
},
),
(
"GstAudioQuantizeFlags",
Layout {
size: size_of::<GstAudioQuantizeFlags>(),
alignment: align_of::<GstAudioQuantizeFlags>(),
},
),
(
"GstAudioResamplerFilterInterpolation",
Layout {
size: size_of::<GstAudioResamplerFilterInterpolation>(),
alignment: align_of::<GstAudioResamplerFilterInterpolation>(),
},
),
(
"GstAudioResamplerFilterMode",
Layout {
size: size_of::<GstAudioResamplerFilterMode>(),
alignment: align_of::<GstAudioResamplerFilterMode>(),
},
),
(
"GstAudioResamplerFlags",
Layout {
size: size_of::<GstAudioResamplerFlags>(),
alignment: align_of::<GstAudioResamplerFlags>(),
},
),
(
"GstAudioResamplerMethod",
Layout {
size: size_of::<GstAudioResamplerMethod>(),
alignment: align_of::<GstAudioResamplerMethod>(),
},
),
(
"GstAudioRingBuffer",
Layout {
size: size_of::<GstAudioRingBuffer>(),
alignment: align_of::<GstAudioRingBuffer>(),
},
),
(
"GstAudioRingBufferClass",
Layout {
size: size_of::<GstAudioRingBufferClass>(),
alignment: align_of::<GstAudioRingBufferClass>(),
},
),
(
"GstAudioRingBufferFormatType",
Layout {
size: size_of::<GstAudioRingBufferFormatType>(),
alignment: align_of::<GstAudioRingBufferFormatType>(),
},
),
(
"GstAudioRingBufferSpec",
Layout {
size: size_of::<GstAudioRingBufferSpec>(),
alignment: align_of::<GstAudioRingBufferSpec>(),
},
),
(
"GstAudioRingBufferState",
Layout {
size: size_of::<GstAudioRingBufferState>(),
alignment: align_of::<GstAudioRingBufferState>(),
},
),
(
"GstAudioSink",
Layout {
size: size_of::<GstAudioSink>(),
alignment: align_of::<GstAudioSink>(),
},
),
(
"GstAudioSinkClass",
Layout {
size: size_of::<GstAudioSinkClass>(),
alignment: align_of::<GstAudioSinkClass>(),
},
),
(
"GstAudioSrc",
Layout {
size: size_of::<GstAudioSrc>(),
alignment: align_of::<GstAudioSrc>(),
},
),
(
"GstAudioSrcClass",
Layout {
size: size_of::<GstAudioSrcClass>(),
alignment: align_of::<GstAudioSrcClass>(),
},
),
(
"GstStreamVolumeFormat",
Layout {
size: size_of::<GstStreamVolumeFormat>(),
alignment: align_of::<GstStreamVolumeFormat>(),
},
),
(
"GstStreamVolumeInterface",
Layout {
size: size_of::<GstStreamVolumeInterface>(),
alignment: align_of::<GstStreamVolumeInterface>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -492,5 +841,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_STREAM_VOLUME_FORMAT_DB", "2"),
("(gint) GST_STREAM_VOLUME_FORMAT_LINEAR", "0"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -56,7 +56,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -78,8 +78,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -93,4 +95,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

View file

@ -5,13 +5,13 @@
extern crate gstreamer_base_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_base_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_base_sys::*;
static PACKAGES: &[&str] = &["gstreamer-base-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,50 +229,225 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstAggregator", Layout {size: size_of::<GstAggregator>(), alignment: align_of::<GstAggregator>()}),
("GstAggregatorClass", Layout {size: size_of::<GstAggregatorClass>(), alignment: align_of::<GstAggregatorClass>()}),
("GstAggregatorPad", Layout {size: size_of::<GstAggregatorPad>(), alignment: align_of::<GstAggregatorPad>()}),
("GstAggregatorPadClass", Layout {size: size_of::<GstAggregatorPadClass>(), alignment: align_of::<GstAggregatorPadClass>()}),
("GstBaseParse", Layout {size: size_of::<GstBaseParse>(), alignment: align_of::<GstBaseParse>()}),
("GstBaseParseClass", Layout {size: size_of::<GstBaseParseClass>(), alignment: align_of::<GstBaseParseClass>()}),
("GstBaseParseFrame", Layout {size: size_of::<GstBaseParseFrame>(), alignment: align_of::<GstBaseParseFrame>()}),
("GstBaseParseFrameFlags", Layout {size: size_of::<GstBaseParseFrameFlags>(), alignment: align_of::<GstBaseParseFrameFlags>()}),
("GstBaseSink", Layout {size: size_of::<GstBaseSink>(), alignment: align_of::<GstBaseSink>()}),
("GstBaseSinkClass", Layout {size: size_of::<GstBaseSinkClass>(), alignment: align_of::<GstBaseSinkClass>()}),
("GstBaseSrc", Layout {size: size_of::<GstBaseSrc>(), alignment: align_of::<GstBaseSrc>()}),
("GstBaseSrcClass", Layout {size: size_of::<GstBaseSrcClass>(), alignment: align_of::<GstBaseSrcClass>()}),
("GstBaseSrcFlags", Layout {size: size_of::<GstBaseSrcFlags>(), alignment: align_of::<GstBaseSrcFlags>()}),
("GstBaseTransform", Layout {size: size_of::<GstBaseTransform>(), alignment: align_of::<GstBaseTransform>()}),
("GstBaseTransformClass", Layout {size: size_of::<GstBaseTransformClass>(), alignment: align_of::<GstBaseTransformClass>()}),
("GstBitReader", Layout {size: size_of::<GstBitReader>(), alignment: align_of::<GstBitReader>()}),
("GstBitWriter", Layout {size: size_of::<GstBitWriter>(), alignment: align_of::<GstBitWriter>()}),
("GstByteReader", Layout {size: size_of::<GstByteReader>(), alignment: align_of::<GstByteReader>()}),
("GstByteWriter", Layout {size: size_of::<GstByteWriter>(), alignment: align_of::<GstByteWriter>()}),
("GstCollectData", Layout {size: size_of::<GstCollectData>(), alignment: align_of::<GstCollectData>()}),
("GstCollectPads", Layout {size: size_of::<GstCollectPads>(), alignment: align_of::<GstCollectPads>()}),
("GstCollectPadsClass", Layout {size: size_of::<GstCollectPadsClass>(), alignment: align_of::<GstCollectPadsClass>()}),
("GstCollectPadsStateFlags", Layout {size: size_of::<GstCollectPadsStateFlags>(), alignment: align_of::<GstCollectPadsStateFlags>()}),
("GstDataQueue", Layout {size: size_of::<GstDataQueue>(), alignment: align_of::<GstDataQueue>()}),
("GstDataQueueClass", Layout {size: size_of::<GstDataQueueClass>(), alignment: align_of::<GstDataQueueClass>()}),
("GstDataQueueItem", Layout {size: size_of::<GstDataQueueItem>(), alignment: align_of::<GstDataQueueItem>()}),
("GstDataQueueSize", Layout {size: size_of::<GstDataQueueSize>(), alignment: align_of::<GstDataQueueSize>()}),
("GstPushSrc", Layout {size: size_of::<GstPushSrc>(), alignment: align_of::<GstPushSrc>()}),
("GstPushSrcClass", Layout {size: size_of::<GstPushSrcClass>(), alignment: align_of::<GstPushSrcClass>()}),
(
"GstAggregator",
Layout {
size: size_of::<GstAggregator>(),
alignment: align_of::<GstAggregator>(),
},
),
(
"GstAggregatorClass",
Layout {
size: size_of::<GstAggregatorClass>(),
alignment: align_of::<GstAggregatorClass>(),
},
),
(
"GstAggregatorPad",
Layout {
size: size_of::<GstAggregatorPad>(),
alignment: align_of::<GstAggregatorPad>(),
},
),
(
"GstAggregatorPadClass",
Layout {
size: size_of::<GstAggregatorPadClass>(),
alignment: align_of::<GstAggregatorPadClass>(),
},
),
(
"GstBaseParse",
Layout {
size: size_of::<GstBaseParse>(),
alignment: align_of::<GstBaseParse>(),
},
),
(
"GstBaseParseClass",
Layout {
size: size_of::<GstBaseParseClass>(),
alignment: align_of::<GstBaseParseClass>(),
},
),
(
"GstBaseParseFrame",
Layout {
size: size_of::<GstBaseParseFrame>(),
alignment: align_of::<GstBaseParseFrame>(),
},
),
(
"GstBaseParseFrameFlags",
Layout {
size: size_of::<GstBaseParseFrameFlags>(),
alignment: align_of::<GstBaseParseFrameFlags>(),
},
),
(
"GstBaseSink",
Layout {
size: size_of::<GstBaseSink>(),
alignment: align_of::<GstBaseSink>(),
},
),
(
"GstBaseSinkClass",
Layout {
size: size_of::<GstBaseSinkClass>(),
alignment: align_of::<GstBaseSinkClass>(),
},
),
(
"GstBaseSrc",
Layout {
size: size_of::<GstBaseSrc>(),
alignment: align_of::<GstBaseSrc>(),
},
),
(
"GstBaseSrcClass",
Layout {
size: size_of::<GstBaseSrcClass>(),
alignment: align_of::<GstBaseSrcClass>(),
},
),
(
"GstBaseSrcFlags",
Layout {
size: size_of::<GstBaseSrcFlags>(),
alignment: align_of::<GstBaseSrcFlags>(),
},
),
(
"GstBaseTransform",
Layout {
size: size_of::<GstBaseTransform>(),
alignment: align_of::<GstBaseTransform>(),
},
),
(
"GstBaseTransformClass",
Layout {
size: size_of::<GstBaseTransformClass>(),
alignment: align_of::<GstBaseTransformClass>(),
},
),
(
"GstBitReader",
Layout {
size: size_of::<GstBitReader>(),
alignment: align_of::<GstBitReader>(),
},
),
(
"GstBitWriter",
Layout {
size: size_of::<GstBitWriter>(),
alignment: align_of::<GstBitWriter>(),
},
),
(
"GstByteReader",
Layout {
size: size_of::<GstByteReader>(),
alignment: align_of::<GstByteReader>(),
},
),
(
"GstByteWriter",
Layout {
size: size_of::<GstByteWriter>(),
alignment: align_of::<GstByteWriter>(),
},
),
(
"GstCollectData",
Layout {
size: size_of::<GstCollectData>(),
alignment: align_of::<GstCollectData>(),
},
),
(
"GstCollectPads",
Layout {
size: size_of::<GstCollectPads>(),
alignment: align_of::<GstCollectPads>(),
},
),
(
"GstCollectPadsClass",
Layout {
size: size_of::<GstCollectPadsClass>(),
alignment: align_of::<GstCollectPadsClass>(),
},
),
(
"GstCollectPadsStateFlags",
Layout {
size: size_of::<GstCollectPadsStateFlags>(),
alignment: align_of::<GstCollectPadsStateFlags>(),
},
),
(
"GstDataQueue",
Layout {
size: size_of::<GstDataQueue>(),
alignment: align_of::<GstDataQueue>(),
},
),
(
"GstDataQueueClass",
Layout {
size: size_of::<GstDataQueueClass>(),
alignment: align_of::<GstDataQueueClass>(),
},
),
(
"GstDataQueueItem",
Layout {
size: size_of::<GstDataQueueItem>(),
alignment: align_of::<GstDataQueueItem>(),
},
),
(
"GstDataQueueSize",
Layout {
size: size_of::<GstDataQueueSize>(),
alignment: align_of::<GstDataQueueSize>(),
},
),
(
"GstPushSrc",
Layout {
size: size_of::<GstPushSrc>(),
alignment: align_of::<GstPushSrc>(),
},
),
(
"GstPushSrcClass",
Layout {
size: size_of::<GstPushSrcClass>(),
alignment: align_of::<GstPushSrcClass>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -289,5 +470,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(guint) GST_COLLECT_PADS_STATE_NEW_SEGMENT", "4"),
("(guint) GST_COLLECT_PADS_STATE_WAITING", "8"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

View file

@ -3,24 +3,31 @@
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
#![allow(
clippy::approx_constant,
clippy::type_complexity,
clippy::unreadable_literal
)]
extern crate libc;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
extern crate libc;
#[allow(unused_imports)]
use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
c_short, c_ushort, c_long, c_ulong,
c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
// Callbacks
pub type GstHarnessPrepareBufferFunc = Option<unsafe extern "C" fn(*mut GstHarness, gpointer) -> *mut gst::GstBuffer>;
pub type GstHarnessPrepareEventFunc = Option<unsafe extern "C" fn(*mut GstHarness, gpointer) -> *mut gst::GstEvent>;
pub type GstHarnessPrepareBufferFunc =
Option<unsafe extern "C" fn(*mut GstHarness, gpointer) -> *mut gst::GstBuffer>;
pub type GstHarnessPrepareEventFunc =
Option<unsafe extern "C" fn(*mut GstHarness, gpointer) -> *mut gst::GstEvent>;
// Records
#[repr(C)]
@ -37,12 +44,12 @@ pub struct GstHarness {
impl ::std::fmt::Debug for GstHarness {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstHarness @ {:?}", self as *const _))
.field("element", &self.element)
.field("srcpad", &self.srcpad)
.field("sinkpad", &self.sinkpad)
.field("src_harness", &self.src_harness)
.field("sink_harness", &self.sink_harness)
.finish()
.field("element", &self.element)
.field("srcpad", &self.srcpad)
.field("sinkpad", &self.sinkpad)
.field("src_harness", &self.src_harness)
.field("sink_harness", &self.sink_harness)
.finish()
}
}
@ -70,8 +77,8 @@ pub struct GstTestClockClass {
impl ::std::fmt::Debug for GstTestClockClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstTestClockClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.finish()
.field("parent_class", &self.parent_class)
.finish()
}
}
@ -91,8 +98,8 @@ pub struct GstTestClock {
impl ::std::fmt::Debug for GstTestClock {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstTestClock @ {:?}", self as *const _))
.field("parent", &self.parent)
.finish()
.field("parent", &self.parent)
.finish()
}
}
@ -102,7 +109,14 @@ extern "C" {
// GstHarness
//=========================================================================
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_element_full(h: *mut GstHarness, element: *mut gst::GstElement, hsrc: *mut gst::GstStaticPadTemplate, element_sinkpad_name: *const c_char, hsink: *mut gst::GstStaticPadTemplate, element_srcpad_name: *const c_char);
pub fn gst_harness_add_element_full(
h: *mut GstHarness,
element: *mut gst::GstElement,
hsrc: *mut gst::GstStaticPadTemplate,
element_sinkpad_name: *const c_char,
hsink: *mut gst::GstStaticPadTemplate,
element_srcpad_name: *const c_char,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_element_sink_pad(h: *mut GstHarness, sinkpad: *mut gst::GstPad);
#[cfg(any(feature = "v1_6", feature = "dox"))]
@ -110,9 +124,21 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_parse(h: *mut GstHarness, launchline: *const c_char);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_probe(h: *mut GstHarness, element_name: *const c_char, pad_name: *const c_char, mask: gst::GstPadProbeType, callback: gst::GstPadProbeCallback, user_data: gpointer, destroy_data: glib::GDestroyNotify);
pub fn gst_harness_add_probe(
h: *mut GstHarness,
element_name: *const c_char,
pad_name: *const c_char,
mask: gst::GstPadProbeType,
callback: gst::GstPadProbeCallback,
user_data: gpointer,
destroy_data: glib::GDestroyNotify,
);
#[cfg(any(feature = "v1_16", feature = "dox"))]
pub fn gst_harness_add_propose_allocation_meta(h: *mut GstHarness, api: GType, params: *const gst::GstStructure);
pub fn gst_harness_add_propose_allocation_meta(
h: *mut GstHarness,
api: GType,
params: *const gst::GstStructure,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_sink(h: *mut GstHarness, sink_element_name: *const c_char);
#[cfg(any(feature = "v1_6", feature = "dox"))]
@ -120,11 +146,23 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_sink_parse(h: *mut GstHarness, launchline: *const c_char);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_src(h: *mut GstHarness, src_element_name: *const c_char, has_clock_wait: gboolean);
pub fn gst_harness_add_src(
h: *mut GstHarness,
src_element_name: *const c_char,
has_clock_wait: gboolean,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_src_harness(h: *mut GstHarness, src_harness: *mut GstHarness, has_clock_wait: gboolean);
pub fn gst_harness_add_src_harness(
h: *mut GstHarness,
src_harness: *mut GstHarness,
has_clock_wait: gboolean,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_add_src_parse(h: *mut GstHarness, launchline: *const c_char, has_clock_wait: gboolean);
pub fn gst_harness_add_src_parse(
h: *mut GstHarness,
launchline: *const c_char,
has_clock_wait: gboolean,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_buffers_in_queue(h: *mut GstHarness) -> c_uint;
#[cfg(any(feature = "v1_6", feature = "dox"))]
@ -142,11 +180,23 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_events_received(h: *mut GstHarness) -> c_uint;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_find_element(h: *mut GstHarness, element_name: *const c_char) -> *mut gst::GstElement;
pub fn gst_harness_find_element(
h: *mut GstHarness,
element_name: *const c_char,
) -> *mut gst::GstElement;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_get(h: *mut GstHarness, element_name: *const c_char, first_property_name: *const c_char, ...);
pub fn gst_harness_get(
h: *mut GstHarness,
element_name: *const c_char,
first_property_name: *const c_char,
...
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_get_allocator(h: *mut GstHarness, allocator: *mut *mut gst::GstAllocator, params: *mut gst::GstAllocationParams);
pub fn gst_harness_get_allocator(
h: *mut GstHarness,
allocator: *mut *mut gst::GstAllocator,
params: *mut gst::GstAllocationParams,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_get_last_pushed_timestamp(h: *mut GstHarness) -> gst::GstClockTime;
#[cfg(any(feature = "v1_6", feature = "dox"))]
@ -162,7 +212,10 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_push(h: *mut GstHarness, buffer: *mut gst::GstBuffer) -> gst::GstFlowReturn;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_push_and_pull(h: *mut GstHarness, buffer: *mut gst::GstBuffer) -> *mut gst::GstBuffer;
pub fn gst_harness_push_and_pull(
h: *mut GstHarness,
buffer: *mut gst::GstBuffer,
) -> *mut gst::GstBuffer;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_push_event(h: *mut GstHarness, event: *mut gst::GstEvent) -> gboolean;
#[cfg(any(feature = "v1_6", feature = "dox"))]
@ -170,11 +223,19 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_push_to_sink(h: *mut GstHarness) -> gst::GstFlowReturn;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_push_upstream_event(h: *mut GstHarness, event: *mut gst::GstEvent) -> gboolean;
pub fn gst_harness_push_upstream_event(
h: *mut GstHarness,
event: *mut gst::GstEvent,
) -> gboolean;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_query_latency(h: *mut GstHarness) -> gst::GstClockTime;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_set(h: *mut GstHarness, element_name: *const c_char, first_property_name: *const c_char, ...);
pub fn gst_harness_set(
h: *mut GstHarness,
element_name: *const c_char,
first_property_name: *const c_char,
...
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_set_blocking_push_mode(h: *mut GstHarness);
#[cfg(any(feature = "v1_6", feature = "dox"))]
@ -186,7 +247,11 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_set_forwarding(h: *mut GstHarness, forwarding: gboolean);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_set_propose_allocator(h: *mut GstHarness, allocator: *mut gst::GstAllocator, params: *const gst::GstAllocationParams);
pub fn gst_harness_set_propose_allocator(
h: *mut GstHarness,
allocator: *mut gst::GstAllocator,
params: *const gst::GstAllocationParams,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_set_sink_caps(h: *mut GstHarness, caps: *mut gst::GstCaps);
#[cfg(any(feature = "v1_6", feature = "dox"))]
@ -202,29 +267,88 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_sink_push_many(h: *mut GstHarness, pushes: c_int) -> gst::GstFlowReturn;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_src_crank_and_push_many(h: *mut GstHarness, cranks: c_int, pushes: c_int) -> gst::GstFlowReturn;
pub fn gst_harness_src_crank_and_push_many(
h: *mut GstHarness,
cranks: c_int,
pushes: c_int,
) -> gst::GstFlowReturn;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_src_push_event(h: *mut GstHarness) -> gboolean;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_custom_start(h: *mut GstHarness, init: glib::GFunc, callback: glib::GFunc, data: gpointer, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_custom_start(
h: *mut GstHarness,
init: glib::GFunc,
callback: glib::GFunc,
data: gpointer,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_property_start_full(h: *mut GstHarness, name: *const c_char, value: *const gobject::GValue, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_property_start_full(
h: *mut GstHarness,
name: *const c_char,
value: *const gobject::GValue,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_push_buffer_start_full(h: *mut GstHarness, caps: *mut gst::GstCaps, segment: *const gst::GstSegment, buf: *mut gst::GstBuffer, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_push_buffer_start_full(
h: *mut GstHarness,
caps: *mut gst::GstCaps,
segment: *const gst::GstSegment,
buf: *mut gst::GstBuffer,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_push_buffer_with_cb_start_full(h: *mut GstHarness, caps: *mut gst::GstCaps, segment: *const gst::GstSegment, func: GstHarnessPrepareBufferFunc, data: gpointer, notify: glib::GDestroyNotify, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_push_buffer_with_cb_start_full(
h: *mut GstHarness,
caps: *mut gst::GstCaps,
segment: *const gst::GstSegment,
func: GstHarnessPrepareBufferFunc,
data: gpointer,
notify: glib::GDestroyNotify,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_push_event_start_full(h: *mut GstHarness, event: *mut gst::GstEvent, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_push_event_start_full(
h: *mut GstHarness,
event: *mut gst::GstEvent,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_harness_stress_push_event_with_cb_start_full(h: *mut GstHarness, func: GstHarnessPrepareEventFunc, data: gpointer, notify: glib::GDestroyNotify, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_push_event_with_cb_start_full(
h: *mut GstHarness,
func: GstHarnessPrepareEventFunc,
data: gpointer,
notify: glib::GDestroyNotify,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_push_upstream_event_start_full(h: *mut GstHarness, event: *mut gst::GstEvent, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_push_upstream_event_start_full(
h: *mut GstHarness,
event: *mut gst::GstEvent,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_harness_stress_push_upstream_event_with_cb_start_full(h: *mut GstHarness, func: GstHarnessPrepareEventFunc, data: gpointer, notify: glib::GDestroyNotify, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_push_upstream_event_with_cb_start_full(
h: *mut GstHarness,
func: GstHarnessPrepareEventFunc,
data: gpointer,
notify: glib::GDestroyNotify,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_requestpad_start_full(h: *mut GstHarness, templ: *mut gst::GstPadTemplate, name: *const c_char, caps: *mut gst::GstCaps, release: gboolean, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_requestpad_start_full(
h: *mut GstHarness,
templ: *mut gst::GstPadTemplate,
name: *const c_char,
caps: *mut gst::GstCaps,
release: gboolean,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_statechange_start_full(h: *mut GstHarness, sleep: c_ulong) -> *mut GstHarnessThread;
pub fn gst_harness_stress_statechange_start_full(
h: *mut GstHarness,
sleep: c_ulong,
) -> *mut GstHarnessThread;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn gst_harness_take_all_data(h: *mut GstHarness, size: *mut size_t) -> *mut u8;
#[cfg(any(feature = "v1_14", feature = "dox"))]
@ -248,21 +372,43 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_use_testclock(h: *mut GstHarness);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_wait_for_clock_id_waits(h: *mut GstHarness, waits: c_uint, timeout: c_uint) -> gboolean;
pub fn gst_harness_wait_for_clock_id_waits(
h: *mut GstHarness,
waits: c_uint,
timeout: c_uint,
) -> gboolean;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_new(element_name: *const c_char) -> *mut GstHarness;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_harness_new_empty() -> *mut GstHarness;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_new_full(element: *mut gst::GstElement, hsrc: *mut gst::GstStaticPadTemplate, element_sinkpad_name: *const c_char, hsink: *mut gst::GstStaticPadTemplate, element_srcpad_name: *const c_char) -> *mut GstHarness;
pub fn gst_harness_new_full(
element: *mut gst::GstElement,
hsrc: *mut gst::GstStaticPadTemplate,
element_sinkpad_name: *const c_char,
hsink: *mut gst::GstStaticPadTemplate,
element_srcpad_name: *const c_char,
) -> *mut GstHarness;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_new_parse(launchline: *const c_char) -> *mut GstHarness;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_new_with_element(element: *mut gst::GstElement, element_sinkpad_name: *const c_char, element_srcpad_name: *const c_char) -> *mut GstHarness;
pub fn gst_harness_new_with_element(
element: *mut gst::GstElement,
element_sinkpad_name: *const c_char,
element_srcpad_name: *const c_char,
) -> *mut GstHarness;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_new_with_padnames(element_name: *const c_char, element_sinkpad_name: *const c_char, element_srcpad_name: *const c_char) -> *mut GstHarness;
pub fn gst_harness_new_with_padnames(
element_name: *const c_char,
element_sinkpad_name: *const c_char,
element_srcpad_name: *const c_char,
) -> *mut GstHarness;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_new_with_templates(element_name: *const c_char, hsrc: *mut gst::GstStaticPadTemplate, hsink: *mut gst::GstStaticPadTemplate) -> *mut GstHarness;
pub fn gst_harness_new_with_templates(
element_name: *const c_char,
hsrc: *mut gst::GstStaticPadTemplate,
hsink: *mut gst::GstStaticPadTemplate,
) -> *mut GstHarness;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_harness_stress_thread_stop(t: *mut GstHarnessThread) -> c_uint;
@ -275,7 +421,9 @@ extern "C" {
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_new_with_start_time(start_time: gst::GstClockTime) -> *mut gst::GstClock;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_test_clock_id_list_get_latest_time(pending_list: *const glib::GList) -> gst::GstClockTime;
pub fn gst_test_clock_id_list_get_latest_time(
pending_list: *const glib::GList,
) -> gst::GstClockTime;
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_advance_time(test_clock: *mut GstTestClock, delta: gst::GstClockTimeDiff);
#[cfg(any(feature = "v1_8", feature = "dox"))]
@ -287,26 +435,47 @@ extern "C" {
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_peek_id_count(test_clock: *mut GstTestClock) -> c_uint;
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_peek_next_pending_id(test_clock: *mut GstTestClock, pending_id: *mut gst::GstClockID) -> gboolean;
pub fn gst_test_clock_peek_next_pending_id(
test_clock: *mut GstTestClock,
pending_id: *mut gst::GstClockID,
) -> gboolean;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_test_clock_process_id_list(test_clock: *mut GstTestClock, pending_list: *const glib::GList) -> c_uint;
pub fn gst_test_clock_process_id_list(
test_clock: *mut GstTestClock,
pending_list: *const glib::GList,
) -> c_uint;
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_process_next_clock_id(test_clock: *mut GstTestClock) -> gst::GstClockID;
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_set_time(test_clock: *mut GstTestClock, new_time: gst::GstClockTime);
#[cfg(any(feature = "v1_16", feature = "dox"))]
pub fn gst_test_clock_timed_wait_for_multiple_pending_ids(test_clock: *mut GstTestClock, count: c_uint, timeout_ms: c_uint, pending_list: *mut *mut glib::GList) -> gboolean;
pub fn gst_test_clock_timed_wait_for_multiple_pending_ids(
test_clock: *mut GstTestClock,
count: c_uint,
timeout_ms: c_uint,
pending_list: *mut *mut glib::GList,
) -> gboolean;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_test_clock_wait_for_multiple_pending_ids(test_clock: *mut GstTestClock, count: c_uint, pending_list: *mut *mut glib::GList);
pub fn gst_test_clock_wait_for_multiple_pending_ids(
test_clock: *mut GstTestClock,
count: c_uint,
pending_list: *mut *mut glib::GList,
);
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_wait_for_next_pending_id(test_clock: *mut GstTestClock, pending_id: *mut gst::GstClockID);
pub fn gst_test_clock_wait_for_next_pending_id(
test_clock: *mut GstTestClock,
pending_id: *mut gst::GstClockID,
);
#[cfg(any(feature = "v1_2", feature = "dox"))]
pub fn gst_test_clock_wait_for_pending_id_count(test_clock: *mut GstTestClock, count: c_uint);
//=========================================================================
// Other functions
//=========================================================================
pub fn gst_consistency_checker_add_pad(consist: *mut GstStreamConsistency, pad: *mut gst::GstPad) -> gboolean;
pub fn gst_consistency_checker_add_pad(
consist: *mut GstStreamConsistency,
pad: *mut gst::GstPad,
) -> gboolean;
pub fn gst_consistency_checker_free(consist: *mut GstStreamConsistency);
pub fn gst_consistency_checker_new(pad: *mut gst::GstPad) -> *mut GstStreamConsistency;
pub fn gst_consistency_checker_reset(consist: *mut GstStreamConsistency);

View file

@ -5,13 +5,13 @@
extern crate gstreamer_check_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_check_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_check_sys::*;
static PACKAGES: &[&str] = &["gstreamer-check-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,27 +229,43 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstHarness", Layout {size: size_of::<GstHarness>(), alignment: align_of::<GstHarness>()}),
("GstTestClock", Layout {size: size_of::<GstTestClock>(), alignment: align_of::<GstTestClock>()}),
("GstTestClockClass", Layout {size: size_of::<GstTestClockClass>(), alignment: align_of::<GstTestClockClass>()}),
(
"GstHarness",
Layout {
size: size_of::<GstHarness>(),
alignment: align_of::<GstHarness>(),
},
),
(
"GstTestClock",
Layout {
size: size_of::<GstTestClock>(),
alignment: align_of::<GstTestClock>(),
},
),
(
"GstTestClockClass",
Layout {
size: size_of::<GstTestClockClass>(),
alignment: align_of::<GstTestClockClass>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
];
const RUST_CONSTANTS: &[(&str, &str)] = &[];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -44,7 +44,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -66,8 +66,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -81,4 +83,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -34,7 +34,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -56,8 +56,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -71,4 +73,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,8 @@ use libc::c_char;
// See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/497
#[cfg(any(feature = "egl", feature = "dox"))]
pub const GST_GL_DISPLAY_EGL_NAME: *const c_char = b"gst.gl.display.egl\0" as *const u8 as *const c_char;
pub const GST_GL_DISPLAY_EGL_NAME: *const c_char =
b"gst.gl.display.egl\0" as *const u8 as *const c_char;
// See https://gitlab.gnome.org/GNOME/gobject-introspection/issues/238
pub const GST_GL_COLOR_CONVERT_VIDEO_CAPS: *const c_char = b"video/x-raw(memory:GLMemory), format = (string) { RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16 }, width = (int) [ 1, max ], height = (int) [ 1, max ], framerate = (fraction) [ 0, max ], texture-target = (string) { 2D, rectangle, external-oes } ; video/x-raw(memory:GLMemory,meta:GstVideoOverlayComposition), format = (string) { RGBA, RGB, RGBx, BGR, BGRx, BGRA, xRGB, xBGR, ARGB, ABGR, Y444, I420, YV12, Y42B, Y41B, NV12, NV21, YUY2, UYVY, AYUV, GRAY8, GRAY16_LE, GRAY16_BE, RGB16, BGR16 }, width = (int) [ 1, max ], height = (int) [ 1, max ], framerate = (fraction) [ 0, max ], texture-target = (string) { 2D, rectangle, external-oes }\0" as *const u8 as *const c_char;

View file

@ -5,13 +5,13 @@
extern crate gstreamer_gl_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_gl_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_gl_sys::*;
static PACKAGES: &[&str] = &["gstreamer-gl-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,96 +229,511 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstGLAPI", Layout {size: size_of::<GstGLAPI>(), alignment: align_of::<GstGLAPI>()}),
("GstGLAllocationParams", Layout {size: size_of::<GstGLAllocationParams>(), alignment: align_of::<GstGLAllocationParams>()}),
("GstGLAsyncDebug", Layout {size: size_of::<GstGLAsyncDebug>(), alignment: align_of::<GstGLAsyncDebug>()}),
("GstGLBaseFilter", Layout {size: size_of::<GstGLBaseFilter>(), alignment: align_of::<GstGLBaseFilter>()}),
("GstGLBaseFilterClass", Layout {size: size_of::<GstGLBaseFilterClass>(), alignment: align_of::<GstGLBaseFilterClass>()}),
("GstGLBaseMemory", Layout {size: size_of::<GstGLBaseMemory>(), alignment: align_of::<GstGLBaseMemory>()}),
("GstGLBaseMemoryAllocator", Layout {size: size_of::<GstGLBaseMemoryAllocator>(), alignment: align_of::<GstGLBaseMemoryAllocator>()}),
("GstGLBaseMemoryAllocatorClass", Layout {size: size_of::<GstGLBaseMemoryAllocatorClass>(), alignment: align_of::<GstGLBaseMemoryAllocatorClass>()}),
("GstGLBaseMemoryError", Layout {size: size_of::<GstGLBaseMemoryError>(), alignment: align_of::<GstGLBaseMemoryError>()}),
("GstGLBaseMemoryTransfer", Layout {size: size_of::<GstGLBaseMemoryTransfer>(), alignment: align_of::<GstGLBaseMemoryTransfer>()}),
("GstGLBuffer", Layout {size: size_of::<GstGLBuffer>(), alignment: align_of::<GstGLBuffer>()}),
("GstGLBufferAllocationParams", Layout {size: size_of::<GstGLBufferAllocationParams>(), alignment: align_of::<GstGLBufferAllocationParams>()}),
("GstGLBufferAllocator", Layout {size: size_of::<GstGLBufferAllocator>(), alignment: align_of::<GstGLBufferAllocator>()}),
("GstGLBufferAllocatorClass", Layout {size: size_of::<GstGLBufferAllocatorClass>(), alignment: align_of::<GstGLBufferAllocatorClass>()}),
("GstGLBufferPool", Layout {size: size_of::<GstGLBufferPool>(), alignment: align_of::<GstGLBufferPool>()}),
("GstGLBufferPoolClass", Layout {size: size_of::<GstGLBufferPoolClass>(), alignment: align_of::<GstGLBufferPoolClass>()}),
("GstGLColorConvert", Layout {size: size_of::<GstGLColorConvert>(), alignment: align_of::<GstGLColorConvert>()}),
("GstGLColorConvertClass", Layout {size: size_of::<GstGLColorConvertClass>(), alignment: align_of::<GstGLColorConvertClass>()}),
("GstGLContext", Layout {size: size_of::<GstGLContext>(), alignment: align_of::<GstGLContext>()}),
("GstGLContextClass", Layout {size: size_of::<GstGLContextClass>(), alignment: align_of::<GstGLContextClass>()}),
("GstGLContextError", Layout {size: size_of::<GstGLContextError>(), alignment: align_of::<GstGLContextError>()}),
("GstGLDisplay", Layout {size: size_of::<GstGLDisplay>(), alignment: align_of::<GstGLDisplay>()}),
("GstGLDisplayClass", Layout {size: size_of::<GstGLDisplayClass>(), alignment: align_of::<GstGLDisplayClass>()}),
(
"GstGLAPI",
Layout {
size: size_of::<GstGLAPI>(),
alignment: align_of::<GstGLAPI>(),
},
),
(
"GstGLAllocationParams",
Layout {
size: size_of::<GstGLAllocationParams>(),
alignment: align_of::<GstGLAllocationParams>(),
},
),
(
"GstGLAsyncDebug",
Layout {
size: size_of::<GstGLAsyncDebug>(),
alignment: align_of::<GstGLAsyncDebug>(),
},
),
(
"GstGLBaseFilter",
Layout {
size: size_of::<GstGLBaseFilter>(),
alignment: align_of::<GstGLBaseFilter>(),
},
),
(
"GstGLBaseFilterClass",
Layout {
size: size_of::<GstGLBaseFilterClass>(),
alignment: align_of::<GstGLBaseFilterClass>(),
},
),
(
"GstGLBaseMemory",
Layout {
size: size_of::<GstGLBaseMemory>(),
alignment: align_of::<GstGLBaseMemory>(),
},
),
(
"GstGLBaseMemoryAllocator",
Layout {
size: size_of::<GstGLBaseMemoryAllocator>(),
alignment: align_of::<GstGLBaseMemoryAllocator>(),
},
),
(
"GstGLBaseMemoryAllocatorClass",
Layout {
size: size_of::<GstGLBaseMemoryAllocatorClass>(),
alignment: align_of::<GstGLBaseMemoryAllocatorClass>(),
},
),
(
"GstGLBaseMemoryError",
Layout {
size: size_of::<GstGLBaseMemoryError>(),
alignment: align_of::<GstGLBaseMemoryError>(),
},
),
(
"GstGLBaseMemoryTransfer",
Layout {
size: size_of::<GstGLBaseMemoryTransfer>(),
alignment: align_of::<GstGLBaseMemoryTransfer>(),
},
),
(
"GstGLBuffer",
Layout {
size: size_of::<GstGLBuffer>(),
alignment: align_of::<GstGLBuffer>(),
},
),
(
"GstGLBufferAllocationParams",
Layout {
size: size_of::<GstGLBufferAllocationParams>(),
alignment: align_of::<GstGLBufferAllocationParams>(),
},
),
(
"GstGLBufferAllocator",
Layout {
size: size_of::<GstGLBufferAllocator>(),
alignment: align_of::<GstGLBufferAllocator>(),
},
),
(
"GstGLBufferAllocatorClass",
Layout {
size: size_of::<GstGLBufferAllocatorClass>(),
alignment: align_of::<GstGLBufferAllocatorClass>(),
},
),
(
"GstGLBufferPool",
Layout {
size: size_of::<GstGLBufferPool>(),
alignment: align_of::<GstGLBufferPool>(),
},
),
(
"GstGLBufferPoolClass",
Layout {
size: size_of::<GstGLBufferPoolClass>(),
alignment: align_of::<GstGLBufferPoolClass>(),
},
),
(
"GstGLColorConvert",
Layout {
size: size_of::<GstGLColorConvert>(),
alignment: align_of::<GstGLColorConvert>(),
},
),
(
"GstGLColorConvertClass",
Layout {
size: size_of::<GstGLColorConvertClass>(),
alignment: align_of::<GstGLColorConvertClass>(),
},
),
(
"GstGLContext",
Layout {
size: size_of::<GstGLContext>(),
alignment: align_of::<GstGLContext>(),
},
),
(
"GstGLContextClass",
Layout {
size: size_of::<GstGLContextClass>(),
alignment: align_of::<GstGLContextClass>(),
},
),
(
"GstGLContextError",
Layout {
size: size_of::<GstGLContextError>(),
alignment: align_of::<GstGLContextError>(),
},
),
(
"GstGLDisplay",
Layout {
size: size_of::<GstGLDisplay>(),
alignment: align_of::<GstGLDisplay>(),
},
),
(
"GstGLDisplayClass",
Layout {
size: size_of::<GstGLDisplayClass>(),
alignment: align_of::<GstGLDisplayClass>(),
},
),
#[cfg(any(feature = "egl", feature = "dox"))]
("GstGLDisplayEGL", Layout {size: size_of::<GstGLDisplayEGL>(), alignment: align_of::<GstGLDisplayEGL>()}),
(
"GstGLDisplayEGL",
Layout {
size: size_of::<GstGLDisplayEGL>(),
alignment: align_of::<GstGLDisplayEGL>(),
},
),
#[cfg(any(feature = "egl", feature = "dox"))]
("GstGLDisplayEGLClass", Layout {size: size_of::<GstGLDisplayEGLClass>(), alignment: align_of::<GstGLDisplayEGLClass>()}),
("GstGLDisplayType", Layout {size: size_of::<GstGLDisplayType>(), alignment: align_of::<GstGLDisplayType>()}),
(
"GstGLDisplayEGLClass",
Layout {
size: size_of::<GstGLDisplayEGLClass>(),
alignment: align_of::<GstGLDisplayEGLClass>(),
},
),
(
"GstGLDisplayType",
Layout {
size: size_of::<GstGLDisplayType>(),
alignment: align_of::<GstGLDisplayType>(),
},
),
#[cfg(any(feature = "wayland", feature = "dox"))]
("GstGLDisplayWayland", Layout {size: size_of::<GstGLDisplayWayland>(), alignment: align_of::<GstGLDisplayWayland>()}),
(
"GstGLDisplayWayland",
Layout {
size: size_of::<GstGLDisplayWayland>(),
alignment: align_of::<GstGLDisplayWayland>(),
},
),
#[cfg(any(feature = "wayland", feature = "dox"))]
("GstGLDisplayWaylandClass", Layout {size: size_of::<GstGLDisplayWaylandClass>(), alignment: align_of::<GstGLDisplayWaylandClass>()}),
(
"GstGLDisplayWaylandClass",
Layout {
size: size_of::<GstGLDisplayWaylandClass>(),
alignment: align_of::<GstGLDisplayWaylandClass>(),
},
),
#[cfg(any(feature = "x11", feature = "dox"))]
("GstGLDisplayX11", Layout {size: size_of::<GstGLDisplayX11>(), alignment: align_of::<GstGLDisplayX11>()}),
(
"GstGLDisplayX11",
Layout {
size: size_of::<GstGLDisplayX11>(),
alignment: align_of::<GstGLDisplayX11>(),
},
),
#[cfg(any(feature = "x11", feature = "dox"))]
("GstGLDisplayX11Class", Layout {size: size_of::<GstGLDisplayX11Class>(), alignment: align_of::<GstGLDisplayX11Class>()}),
("GstGLFilter", Layout {size: size_of::<GstGLFilter>(), alignment: align_of::<GstGLFilter>()}),
("GstGLFilterClass", Layout {size: size_of::<GstGLFilterClass>(), alignment: align_of::<GstGLFilterClass>()}),
("GstGLFormat", Layout {size: size_of::<GstGLFormat>(), alignment: align_of::<GstGLFormat>()}),
("GstGLFramebuffer", Layout {size: size_of::<GstGLFramebuffer>(), alignment: align_of::<GstGLFramebuffer>()}),
("GstGLFramebufferClass", Layout {size: size_of::<GstGLFramebufferClass>(), alignment: align_of::<GstGLFramebufferClass>()}),
("GstGLMemory", Layout {size: size_of::<GstGLMemory>(), alignment: align_of::<GstGLMemory>()}),
("GstGLMemoryAllocator", Layout {size: size_of::<GstGLMemoryAllocator>(), alignment: align_of::<GstGLMemoryAllocator>()}),
("GstGLMemoryAllocatorClass", Layout {size: size_of::<GstGLMemoryAllocatorClass>(), alignment: align_of::<GstGLMemoryAllocatorClass>()}),
("GstGLMemoryPBO", Layout {size: size_of::<GstGLMemoryPBO>(), alignment: align_of::<GstGLMemoryPBO>()}),
("GstGLMemoryPBOAllocator", Layout {size: size_of::<GstGLMemoryPBOAllocator>(), alignment: align_of::<GstGLMemoryPBOAllocator>()}),
("GstGLMemoryPBOAllocatorClass", Layout {size: size_of::<GstGLMemoryPBOAllocatorClass>(), alignment: align_of::<GstGLMemoryPBOAllocatorClass>()}),
("GstGLOverlayCompositor", Layout {size: size_of::<GstGLOverlayCompositor>(), alignment: align_of::<GstGLOverlayCompositor>()}),
("GstGLOverlayCompositorClass", Layout {size: size_of::<GstGLOverlayCompositorClass>(), alignment: align_of::<GstGLOverlayCompositorClass>()}),
("GstGLPlatform", Layout {size: size_of::<GstGLPlatform>(), alignment: align_of::<GstGLPlatform>()}),
("GstGLQuery", Layout {size: size_of::<GstGLQuery>(), alignment: align_of::<GstGLQuery>()}),
("GstGLQueryType", Layout {size: size_of::<GstGLQueryType>(), alignment: align_of::<GstGLQueryType>()}),
("GstGLRenderbuffer", Layout {size: size_of::<GstGLRenderbuffer>(), alignment: align_of::<GstGLRenderbuffer>()}),
("GstGLRenderbufferAllocationParams", Layout {size: size_of::<GstGLRenderbufferAllocationParams>(), alignment: align_of::<GstGLRenderbufferAllocationParams>()}),
("GstGLRenderbufferAllocator", Layout {size: size_of::<GstGLRenderbufferAllocator>(), alignment: align_of::<GstGLRenderbufferAllocator>()}),
("GstGLRenderbufferAllocatorClass", Layout {size: size_of::<GstGLRenderbufferAllocatorClass>(), alignment: align_of::<GstGLRenderbufferAllocatorClass>()}),
("GstGLSLError", Layout {size: size_of::<GstGLSLError>(), alignment: align_of::<GstGLSLError>()}),
("GstGLSLProfile", Layout {size: size_of::<GstGLSLProfile>(), alignment: align_of::<GstGLSLProfile>()}),
("GstGLSLStage", Layout {size: size_of::<GstGLSLStage>(), alignment: align_of::<GstGLSLStage>()}),
("GstGLSLStageClass", Layout {size: size_of::<GstGLSLStageClass>(), alignment: align_of::<GstGLSLStageClass>()}),
("GstGLSLVersion", Layout {size: size_of::<GstGLSLVersion>(), alignment: align_of::<GstGLSLVersion>()}),
("GstGLShader", Layout {size: size_of::<GstGLShader>(), alignment: align_of::<GstGLShader>()}),
("GstGLShaderClass", Layout {size: size_of::<GstGLShaderClass>(), alignment: align_of::<GstGLShaderClass>()}),
("GstGLStereoDownmix", Layout {size: size_of::<GstGLStereoDownmix>(), alignment: align_of::<GstGLStereoDownmix>()}),
("GstGLSyncMeta", Layout {size: size_of::<GstGLSyncMeta>(), alignment: align_of::<GstGLSyncMeta>()}),
("GstGLTextureTarget", Layout {size: size_of::<GstGLTextureTarget>(), alignment: align_of::<GstGLTextureTarget>()}),
("GstGLUpload", Layout {size: size_of::<GstGLUpload>(), alignment: align_of::<GstGLUpload>()}),
("GstGLUploadClass", Layout {size: size_of::<GstGLUploadClass>(), alignment: align_of::<GstGLUploadClass>()}),
("GstGLUploadReturn", Layout {size: size_of::<GstGLUploadReturn>(), alignment: align_of::<GstGLUploadReturn>()}),
("GstGLVideoAllocationParams", Layout {size: size_of::<GstGLVideoAllocationParams>(), alignment: align_of::<GstGLVideoAllocationParams>()}),
("GstGLViewConvert", Layout {size: size_of::<GstGLViewConvert>(), alignment: align_of::<GstGLViewConvert>()}),
("GstGLViewConvertClass", Layout {size: size_of::<GstGLViewConvertClass>(), alignment: align_of::<GstGLViewConvertClass>()}),
("GstGLWindow", Layout {size: size_of::<GstGLWindow>(), alignment: align_of::<GstGLWindow>()}),
("GstGLWindowClass", Layout {size: size_of::<GstGLWindowClass>(), alignment: align_of::<GstGLWindowClass>()}),
("GstGLWindowError", Layout {size: size_of::<GstGLWindowError>(), alignment: align_of::<GstGLWindowError>()}),
(
"GstGLDisplayX11Class",
Layout {
size: size_of::<GstGLDisplayX11Class>(),
alignment: align_of::<GstGLDisplayX11Class>(),
},
),
(
"GstGLFilter",
Layout {
size: size_of::<GstGLFilter>(),
alignment: align_of::<GstGLFilter>(),
},
),
(
"GstGLFilterClass",
Layout {
size: size_of::<GstGLFilterClass>(),
alignment: align_of::<GstGLFilterClass>(),
},
),
(
"GstGLFormat",
Layout {
size: size_of::<GstGLFormat>(),
alignment: align_of::<GstGLFormat>(),
},
),
(
"GstGLFramebuffer",
Layout {
size: size_of::<GstGLFramebuffer>(),
alignment: align_of::<GstGLFramebuffer>(),
},
),
(
"GstGLFramebufferClass",
Layout {
size: size_of::<GstGLFramebufferClass>(),
alignment: align_of::<GstGLFramebufferClass>(),
},
),
(
"GstGLMemory",
Layout {
size: size_of::<GstGLMemory>(),
alignment: align_of::<GstGLMemory>(),
},
),
(
"GstGLMemoryAllocator",
Layout {
size: size_of::<GstGLMemoryAllocator>(),
alignment: align_of::<GstGLMemoryAllocator>(),
},
),
(
"GstGLMemoryAllocatorClass",
Layout {
size: size_of::<GstGLMemoryAllocatorClass>(),
alignment: align_of::<GstGLMemoryAllocatorClass>(),
},
),
(
"GstGLMemoryPBO",
Layout {
size: size_of::<GstGLMemoryPBO>(),
alignment: align_of::<GstGLMemoryPBO>(),
},
),
(
"GstGLMemoryPBOAllocator",
Layout {
size: size_of::<GstGLMemoryPBOAllocator>(),
alignment: align_of::<GstGLMemoryPBOAllocator>(),
},
),
(
"GstGLMemoryPBOAllocatorClass",
Layout {
size: size_of::<GstGLMemoryPBOAllocatorClass>(),
alignment: align_of::<GstGLMemoryPBOAllocatorClass>(),
},
),
(
"GstGLOverlayCompositor",
Layout {
size: size_of::<GstGLOverlayCompositor>(),
alignment: align_of::<GstGLOverlayCompositor>(),
},
),
(
"GstGLOverlayCompositorClass",
Layout {
size: size_of::<GstGLOverlayCompositorClass>(),
alignment: align_of::<GstGLOverlayCompositorClass>(),
},
),
(
"GstGLPlatform",
Layout {
size: size_of::<GstGLPlatform>(),
alignment: align_of::<GstGLPlatform>(),
},
),
(
"GstGLQuery",
Layout {
size: size_of::<GstGLQuery>(),
alignment: align_of::<GstGLQuery>(),
},
),
(
"GstGLQueryType",
Layout {
size: size_of::<GstGLQueryType>(),
alignment: align_of::<GstGLQueryType>(),
},
),
(
"GstGLRenderbuffer",
Layout {
size: size_of::<GstGLRenderbuffer>(),
alignment: align_of::<GstGLRenderbuffer>(),
},
),
(
"GstGLRenderbufferAllocationParams",
Layout {
size: size_of::<GstGLRenderbufferAllocationParams>(),
alignment: align_of::<GstGLRenderbufferAllocationParams>(),
},
),
(
"GstGLRenderbufferAllocator",
Layout {
size: size_of::<GstGLRenderbufferAllocator>(),
alignment: align_of::<GstGLRenderbufferAllocator>(),
},
),
(
"GstGLRenderbufferAllocatorClass",
Layout {
size: size_of::<GstGLRenderbufferAllocatorClass>(),
alignment: align_of::<GstGLRenderbufferAllocatorClass>(),
},
),
(
"GstGLSLError",
Layout {
size: size_of::<GstGLSLError>(),
alignment: align_of::<GstGLSLError>(),
},
),
(
"GstGLSLProfile",
Layout {
size: size_of::<GstGLSLProfile>(),
alignment: align_of::<GstGLSLProfile>(),
},
),
(
"GstGLSLStage",
Layout {
size: size_of::<GstGLSLStage>(),
alignment: align_of::<GstGLSLStage>(),
},
),
(
"GstGLSLStageClass",
Layout {
size: size_of::<GstGLSLStageClass>(),
alignment: align_of::<GstGLSLStageClass>(),
},
),
(
"GstGLSLVersion",
Layout {
size: size_of::<GstGLSLVersion>(),
alignment: align_of::<GstGLSLVersion>(),
},
),
(
"GstGLShader",
Layout {
size: size_of::<GstGLShader>(),
alignment: align_of::<GstGLShader>(),
},
),
(
"GstGLShaderClass",
Layout {
size: size_of::<GstGLShaderClass>(),
alignment: align_of::<GstGLShaderClass>(),
},
),
(
"GstGLStereoDownmix",
Layout {
size: size_of::<GstGLStereoDownmix>(),
alignment: align_of::<GstGLStereoDownmix>(),
},
),
(
"GstGLSyncMeta",
Layout {
size: size_of::<GstGLSyncMeta>(),
alignment: align_of::<GstGLSyncMeta>(),
},
),
(
"GstGLTextureTarget",
Layout {
size: size_of::<GstGLTextureTarget>(),
alignment: align_of::<GstGLTextureTarget>(),
},
),
(
"GstGLUpload",
Layout {
size: size_of::<GstGLUpload>(),
alignment: align_of::<GstGLUpload>(),
},
),
(
"GstGLUploadClass",
Layout {
size: size_of::<GstGLUploadClass>(),
alignment: align_of::<GstGLUploadClass>(),
},
),
(
"GstGLUploadReturn",
Layout {
size: size_of::<GstGLUploadReturn>(),
alignment: align_of::<GstGLUploadReturn>(),
},
),
(
"GstGLVideoAllocationParams",
Layout {
size: size_of::<GstGLVideoAllocationParams>(),
alignment: align_of::<GstGLVideoAllocationParams>(),
},
),
(
"GstGLViewConvert",
Layout {
size: size_of::<GstGLViewConvert>(),
alignment: align_of::<GstGLViewConvert>(),
},
),
(
"GstGLViewConvertClass",
Layout {
size: size_of::<GstGLViewConvertClass>(),
alignment: align_of::<GstGLViewConvertClass>(),
},
),
(
"GstGLWindow",
Layout {
size: size_of::<GstGLWindow>(),
alignment: align_of::<GstGLWindow>(),
},
),
(
"GstGLWindowClass",
Layout {
size: size_of::<GstGLWindowClass>(),
alignment: align_of::<GstGLWindowClass>(),
},
),
(
"GstGLWindowError",
Layout {
size: size_of::<GstGLWindowError>(),
alignment: align_of::<GstGLWindowError>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -443,5 +864,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE", "2"),
("GST_MAP_GL", "131072"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

View file

@ -3,18 +3,23 @@
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
#![allow(
clippy::approx_constant,
clippy::type_complexity,
clippy::unreadable_literal
)]
extern crate libc;
extern crate gio_sys as gio;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gio_sys as gio;
extern crate gstreamer_sys as gst;
extern crate libc;
#[allow(unused_imports)]
use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
c_short, c_ushort, c_long, c_ulong,
c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
@ -22,13 +27,18 @@ use glib::{gboolean, gconstpointer, gpointer, GType};
// Constants
pub const GST_NET_TIME_PACKET_SIZE: c_int = 16;
pub const GST_PTP_CLOCK_ID_NONE: u64 = 18446744073709551615;
pub const GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED: *const c_char = b"GstPtpStatisticsBestMasterClockSelected\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_NEW_DOMAIN_FOUND: *const c_char = b"GstPtpStatisticsNewDomainFound\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_PATH_DELAY_MEASURED: *const c_char = b"GstPtpStatisticsPathDelayMeasured\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_TIME_UPDATED: *const c_char = b"GstPtpStatisticsTimeUpdated\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED: *const c_char =
b"GstPtpStatisticsBestMasterClockSelected\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_NEW_DOMAIN_FOUND: *const c_char =
b"GstPtpStatisticsNewDomainFound\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_PATH_DELAY_MEASURED: *const c_char =
b"GstPtpStatisticsPathDelayMeasured\0" as *const u8 as *const c_char;
pub const GST_PTP_STATISTICS_TIME_UPDATED: *const c_char =
b"GstPtpStatisticsTimeUpdated\0" as *const u8 as *const c_char;
// Callbacks
pub type GstPtpStatisticsCallback = Option<unsafe extern "C" fn(u8, *const gst::GstStructure, gpointer) -> gboolean>;
pub type GstPtpStatisticsCallback =
Option<unsafe extern "C" fn(u8, *const gst::GstStructure, gpointer) -> gboolean>;
// Records
#[repr(C)]
@ -41,9 +51,9 @@ pub struct GstNetAddressMeta {
impl ::std::fmt::Debug for GstNetAddressMeta {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNetAddressMeta @ {:?}", self as *const _))
.field("meta", &self.meta)
.field("addr", &self.addr)
.finish()
.field("meta", &self.meta)
.field("addr", &self.addr)
.finish()
}
}
@ -57,8 +67,8 @@ pub struct GstNetClientClockClass {
impl ::std::fmt::Debug for GstNetClientClockClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNetClientClockClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.finish()
.field("parent_class", &self.parent_class)
.finish()
}
}
@ -76,10 +86,13 @@ pub struct GstNetControlMessageMeta {
impl ::std::fmt::Debug for GstNetControlMessageMeta {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNetControlMessageMeta @ {:?}", self as *const _))
.field("meta", &self.meta)
.field("message", &self.message)
.finish()
f.debug_struct(&format!(
"GstNetControlMessageMeta @ {:?}",
self as *const _
))
.field("meta", &self.meta)
.field("message", &self.message)
.finish()
}
}
@ -93,9 +106,9 @@ pub struct GstNetTimePacket {
impl ::std::fmt::Debug for GstNetTimePacket {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNetTimePacket @ {:?}", self as *const _))
.field("local_time", &self.local_time)
.field("remote_time", &self.remote_time)
.finish()
.field("local_time", &self.local_time)
.field("remote_time", &self.remote_time)
.finish()
}
}
@ -109,9 +122,9 @@ pub struct GstNetTimeProviderClass {
impl ::std::fmt::Debug for GstNetTimeProviderClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNetTimeProviderClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("_gst_reserved", &self._gst_reserved)
.finish()
.field("parent_class", &self.parent_class)
.field("_gst_reserved", &self._gst_reserved)
.finish()
}
}
@ -130,8 +143,8 @@ pub struct GstNtpClockClass {
impl ::std::fmt::Debug for GstNtpClockClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNtpClockClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.finish()
.field("parent_class", &self.parent_class)
.finish()
}
}
@ -145,8 +158,8 @@ pub struct GstPtpClockClass {
impl ::std::fmt::Debug for GstPtpClockClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPtpClockClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.finish()
.field("parent_class", &self.parent_class)
.finish()
}
}
@ -167,8 +180,8 @@ pub struct GstNetClientClock {
impl ::std::fmt::Debug for GstNetClientClock {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNetClientClock @ {:?}", self as *const _))
.field("clock", &self.clock)
.finish()
.field("clock", &self.clock)
.finish()
}
}
@ -183,8 +196,8 @@ pub struct GstNetTimeProvider {
impl ::std::fmt::Debug for GstNetTimeProvider {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNetTimeProvider @ {:?}", self as *const _))
.field("parent", &self.parent)
.finish()
.field("parent", &self.parent)
.finish()
}
}
@ -199,8 +212,8 @@ pub struct GstNtpClock {
impl ::std::fmt::Debug for GstNtpClock {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstNtpClock @ {:?}", self as *const _))
.field("clock", &self.clock)
.finish()
.field("clock", &self.clock)
.finish()
}
}
@ -215,8 +228,8 @@ pub struct GstPtpClock {
impl ::std::fmt::Debug for GstPtpClock {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPtpClock @ {:?}", self as *const _))
.field("clock", &self.clock)
.finish()
.field("clock", &self.clock)
.finish()
}
}
@ -239,28 +252,51 @@ extern "C" {
pub fn gst_net_time_packet_new(buffer: *const u8) -> *mut GstNetTimePacket;
pub fn gst_net_time_packet_copy(packet: *const GstNetTimePacket) -> *mut GstNetTimePacket;
pub fn gst_net_time_packet_free(packet: *mut GstNetTimePacket);
pub fn gst_net_time_packet_send(packet: *const GstNetTimePacket, socket: *mut gio::GSocket, dest_address: *mut gio::GSocketAddress, error: *mut *mut glib::GError) -> gboolean;
pub fn gst_net_time_packet_send(
packet: *const GstNetTimePacket,
socket: *mut gio::GSocket,
dest_address: *mut gio::GSocketAddress,
error: *mut *mut glib::GError,
) -> gboolean;
pub fn gst_net_time_packet_serialize(packet: *const GstNetTimePacket) -> *mut u8;
pub fn gst_net_time_packet_receive(socket: *mut gio::GSocket, src_address: *mut *mut gio::GSocketAddress, error: *mut *mut glib::GError) -> *mut GstNetTimePacket;
pub fn gst_net_time_packet_receive(
socket: *mut gio::GSocket,
src_address: *mut *mut gio::GSocketAddress,
error: *mut *mut glib::GError,
) -> *mut GstNetTimePacket;
//=========================================================================
// GstNetClientClock
//=========================================================================
pub fn gst_net_client_clock_get_type() -> GType;
pub fn gst_net_client_clock_new(name: *const c_char, remote_address: *const c_char, remote_port: c_int, base_time: gst::GstClockTime) -> *mut gst::GstClock;
pub fn gst_net_client_clock_new(
name: *const c_char,
remote_address: *const c_char,
remote_port: c_int,
base_time: gst::GstClockTime,
) -> *mut gst::GstClock;
//=========================================================================
// GstNetTimeProvider
//=========================================================================
pub fn gst_net_time_provider_get_type() -> GType;
pub fn gst_net_time_provider_new(clock: *mut gst::GstClock, address: *const c_char, port: c_int) -> *mut GstNetTimeProvider;
pub fn gst_net_time_provider_new(
clock: *mut gst::GstClock,
address: *const c_char,
port: c_int,
) -> *mut GstNetTimeProvider;
//=========================================================================
// GstNtpClock
//=========================================================================
pub fn gst_ntp_clock_get_type() -> GType;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_ntp_clock_new(name: *const c_char, remote_address: *const c_char, remote_port: c_int, base_time: gst::GstClockTime) -> *mut gst::GstClock;
pub fn gst_ntp_clock_new(
name: *const c_char,
remote_address: *const c_char,
remote_port: c_int,
base_time: gst::GstClockTime,
) -> *mut gst::GstClock;
//=========================================================================
// GstPtpClock
@ -272,8 +308,14 @@ extern "C" {
//=========================================================================
// Other functions
//=========================================================================
pub fn gst_buffer_add_net_address_meta(buffer: *mut gst::GstBuffer, addr: *mut gio::GSocketAddress) -> *mut GstNetAddressMeta;
pub fn gst_buffer_add_net_control_message_meta(buffer: *mut gst::GstBuffer, message: *mut gio::GSocketControlMessage) -> *mut GstNetControlMessageMeta;
pub fn gst_buffer_add_net_address_meta(
buffer: *mut gst::GstBuffer,
addr: *mut gio::GSocketAddress,
) -> *mut GstNetAddressMeta;
pub fn gst_buffer_add_net_control_message_meta(
buffer: *mut gst::GstBuffer,
message: *mut gio::GSocketControlMessage,
) -> *mut GstNetControlMessageMeta;
pub fn gst_buffer_get_net_address_meta(buffer: *mut gst::GstBuffer) -> *mut GstNetAddressMeta;
pub fn gst_net_address_meta_api_get_type() -> GType;
pub fn gst_net_control_message_meta_api_get_type() -> GType;
@ -286,7 +328,11 @@ extern "C" {
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_ptp_is_supported() -> gboolean;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_ptp_statistics_callback_add(callback: GstPtpStatisticsCallback, user_data: gpointer, destroy_data: glib::GDestroyNotify) -> c_ulong;
pub fn gst_ptp_statistics_callback_add(
callback: GstPtpStatisticsCallback,
user_data: gpointer,
destroy_data: glib::GDestroyNotify,
) -> c_ulong;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_ptp_statistics_callback_remove(id: c_ulong);

View file

@ -5,13 +5,13 @@
extern crate gstreamer_net_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_net_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_net_sys::*;
static PACKAGES: &[&str] = &["gstreamer-net-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,41 +229,118 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstNetAddressMeta", Layout {size: size_of::<GstNetAddressMeta>(), alignment: align_of::<GstNetAddressMeta>()}),
("GstNetClientClock", Layout {size: size_of::<GstNetClientClock>(), alignment: align_of::<GstNetClientClock>()}),
("GstNetClientClockClass", Layout {size: size_of::<GstNetClientClockClass>(), alignment: align_of::<GstNetClientClockClass>()}),
("GstNetControlMessageMeta", Layout {size: size_of::<GstNetControlMessageMeta>(), alignment: align_of::<GstNetControlMessageMeta>()}),
("GstNetTimePacket", Layout {size: size_of::<GstNetTimePacket>(), alignment: align_of::<GstNetTimePacket>()}),
("GstNetTimeProvider", Layout {size: size_of::<GstNetTimeProvider>(), alignment: align_of::<GstNetTimeProvider>()}),
("GstNetTimeProviderClass", Layout {size: size_of::<GstNetTimeProviderClass>(), alignment: align_of::<GstNetTimeProviderClass>()}),
("GstNtpClock", Layout {size: size_of::<GstNtpClock>(), alignment: align_of::<GstNtpClock>()}),
("GstNtpClockClass", Layout {size: size_of::<GstNtpClockClass>(), alignment: align_of::<GstNtpClockClass>()}),
("GstPtpClock", Layout {size: size_of::<GstPtpClock>(), alignment: align_of::<GstPtpClock>()}),
("GstPtpClockClass", Layout {size: size_of::<GstPtpClockClass>(), alignment: align_of::<GstPtpClockClass>()}),
(
"GstNetAddressMeta",
Layout {
size: size_of::<GstNetAddressMeta>(),
alignment: align_of::<GstNetAddressMeta>(),
},
),
(
"GstNetClientClock",
Layout {
size: size_of::<GstNetClientClock>(),
alignment: align_of::<GstNetClientClock>(),
},
),
(
"GstNetClientClockClass",
Layout {
size: size_of::<GstNetClientClockClass>(),
alignment: align_of::<GstNetClientClockClass>(),
},
),
(
"GstNetControlMessageMeta",
Layout {
size: size_of::<GstNetControlMessageMeta>(),
alignment: align_of::<GstNetControlMessageMeta>(),
},
),
(
"GstNetTimePacket",
Layout {
size: size_of::<GstNetTimePacket>(),
alignment: align_of::<GstNetTimePacket>(),
},
),
(
"GstNetTimeProvider",
Layout {
size: size_of::<GstNetTimeProvider>(),
alignment: align_of::<GstNetTimeProvider>(),
},
),
(
"GstNetTimeProviderClass",
Layout {
size: size_of::<GstNetTimeProviderClass>(),
alignment: align_of::<GstNetTimeProviderClass>(),
},
),
(
"GstNtpClock",
Layout {
size: size_of::<GstNtpClock>(),
alignment: align_of::<GstNtpClock>(),
},
),
(
"GstNtpClockClass",
Layout {
size: size_of::<GstNtpClockClass>(),
alignment: align_of::<GstNtpClockClass>(),
},
),
(
"GstPtpClock",
Layout {
size: size_of::<GstPtpClock>(),
alignment: align_of::<GstPtpClock>(),
},
),
(
"GstPtpClockClass",
Layout {
size: size_of::<GstPtpClockClass>(),
alignment: align_of::<GstPtpClockClass>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_NET_TIME_PACKET_SIZE", "16"),
("GST_PTP_CLOCK_ID_NONE", "18446744073709551615"),
("GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED", "GstPtpStatisticsBestMasterClockSelected"),
("GST_PTP_STATISTICS_NEW_DOMAIN_FOUND", "GstPtpStatisticsNewDomainFound"),
("GST_PTP_STATISTICS_PATH_DELAY_MEASURED", "GstPtpStatisticsPathDelayMeasured"),
("GST_PTP_STATISTICS_TIME_UPDATED", "GstPtpStatisticsTimeUpdated"),
(
"GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED",
"GstPtpStatisticsBestMasterClockSelected",
),
(
"GST_PTP_STATISTICS_NEW_DOMAIN_FOUND",
"GstPtpStatisticsNewDomainFound",
),
(
"GST_PTP_STATISTICS_PATH_DELAY_MEASURED",
"GstPtpStatisticsPathDelayMeasured",
),
(
"GST_PTP_STATISTICS_TIME_UPDATED",
"GstPtpStatisticsTimeUpdated",
),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -46,7 +46,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -68,8 +68,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -83,4 +85,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

View file

@ -3,19 +3,24 @@
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
#![allow(
clippy::approx_constant,
clippy::type_complexity,
clippy::unreadable_literal
)]
extern crate libc;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
extern crate gstreamer_audio_sys as gst_audio;
extern crate gstreamer_sys as gst;
extern crate gstreamer_video_sys as gst_video;
extern crate libc;
#[allow(unused_imports)]
use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
c_short, c_ushort, c_long, c_ulong,
c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
@ -66,9 +71,12 @@ pub const GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS: GstInstallPluginsReturn = 203
// Constants
pub const GST_ENCODING_CATEGORY_CAPTURE: *const c_char = b"capture\0" as *const u8 as *const c_char;
pub const GST_ENCODING_CATEGORY_DEVICE: *const c_char = b"device\0" as *const u8 as *const c_char;
pub const GST_ENCODING_CATEGORY_FILE_EXTENSION: *const c_char = b"file-extension\0" as *const u8 as *const c_char;
pub const GST_ENCODING_CATEGORY_ONLINE_SERVICE: *const c_char = b"online-service\0" as *const u8 as *const c_char;
pub const GST_ENCODING_CATEGORY_STORAGE_EDITING: *const c_char = b"storage-editing\0" as *const u8 as *const c_char;
pub const GST_ENCODING_CATEGORY_FILE_EXTENSION: *const c_char =
b"file-extension\0" as *const u8 as *const c_char;
pub const GST_ENCODING_CATEGORY_ONLINE_SERVICE: *const c_char =
b"online-service\0" as *const u8 as *const c_char;
pub const GST_ENCODING_CATEGORY_STORAGE_EDITING: *const c_char =
b"storage-editing\0" as *const u8 as *const c_char;
// Flags
pub type GstDiscovererSerializeFlags = c_uint;
@ -79,8 +87,15 @@ pub const GST_DISCOVERER_SERIALIZE_MISC: GstDiscovererSerializeFlags = 4;
pub const GST_DISCOVERER_SERIALIZE_ALL: GstDiscovererSerializeFlags = 7;
// Callbacks
pub type GstAudioVisualizerShaderFunc = Option<unsafe extern "C" fn(*mut GstAudioVisualizer, *const gst_video::GstVideoFrame, *mut gst_video::GstVideoFrame)>;
pub type GstInstallPluginsResultFunc = Option<unsafe extern "C" fn(GstInstallPluginsReturn, gpointer)>;
pub type GstAudioVisualizerShaderFunc = Option<
unsafe extern "C" fn(
*mut GstAudioVisualizer,
*const gst_video::GstVideoFrame,
*mut gst_video::GstVideoFrame,
),
>;
pub type GstInstallPluginsResultFunc =
Option<unsafe extern "C" fn(GstInstallPluginsReturn, gpointer)>;
// Records
#[repr(C)]
@ -88,17 +103,24 @@ pub type GstInstallPluginsResultFunc = Option<unsafe extern "C" fn(GstInstallPlu
pub struct GstAudioVisualizerClass {
pub parent_class: gst::GstElementClass,
pub setup: Option<unsafe extern "C" fn(*mut GstAudioVisualizer) -> gboolean>,
pub render: Option<unsafe extern "C" fn(*mut GstAudioVisualizer, *mut gst::GstBuffer, *mut gst_video::GstVideoFrame) -> gboolean>,
pub decide_allocation: Option<unsafe extern "C" fn(*mut GstAudioVisualizer, *mut gst::GstQuery) -> gboolean>,
pub render: Option<
unsafe extern "C" fn(
*mut GstAudioVisualizer,
*mut gst::GstBuffer,
*mut gst_video::GstVideoFrame,
) -> gboolean,
>,
pub decide_allocation:
Option<unsafe extern "C" fn(*mut GstAudioVisualizer, *mut gst::GstQuery) -> gboolean>,
}
impl ::std::fmt::Debug for GstAudioVisualizerClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioVisualizerClass @ {:?}", self as *const _))
.field("setup", &self.setup)
.field("render", &self.render)
.field("decide_allocation", &self.decide_allocation)
.finish()
.field("setup", &self.setup)
.field("render", &self.render)
.field("decide_allocation", &self.decide_allocation)
.finish()
}
}
@ -113,7 +135,9 @@ pub struct GstDiscovererClass {
pub parentclass: gobject::GObjectClass,
pub finished: Option<unsafe extern "C" fn(*mut GstDiscoverer)>,
pub starting: Option<unsafe extern "C" fn(*mut GstDiscoverer)>,
pub discovered: Option<unsafe extern "C" fn(*mut GstDiscoverer, *mut GstDiscovererInfo, *const glib::GError)>,
pub discovered: Option<
unsafe extern "C" fn(*mut GstDiscoverer, *mut GstDiscovererInfo, *const glib::GError),
>,
pub source_setup: Option<unsafe extern "C" fn(*mut GstDiscoverer, *mut gst::GstElement)>,
pub _reserved: [gpointer; 4],
}
@ -121,13 +145,13 @@ pub struct GstDiscovererClass {
impl ::std::fmt::Debug for GstDiscovererClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscovererClass @ {:?}", self as *const _))
.field("parentclass", &self.parentclass)
.field("finished", &self.finished)
.field("starting", &self.starting)
.field("discovered", &self.discovered)
.field("source_setup", &self.source_setup)
.field("_reserved", &self._reserved)
.finish()
.field("parentclass", &self.parentclass)
.field("finished", &self.finished)
.field("starting", &self.starting)
.field("discovered", &self.discovered)
.field("source_setup", &self.source_setup)
.field("_reserved", &self._reserved)
.finish()
}
}
@ -161,8 +185,11 @@ pub struct GstInstallPluginsContext(c_void);
impl ::std::fmt::Debug for GstInstallPluginsContext {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstInstallPluginsContext @ {:?}", self as *const _))
.finish()
f.debug_struct(&format!(
"GstInstallPluginsContext @ {:?}",
self as *const _
))
.finish()
}
}
@ -180,11 +207,11 @@ pub struct GstAudioVisualizer {
impl ::std::fmt::Debug for GstAudioVisualizer {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstAudioVisualizer @ {:?}", self as *const _))
.field("parent", &self.parent)
.field("req_spf", &self.req_spf)
.field("vinfo", &self.vinfo)
.field("ainfo", &self.ainfo)
.finish()
.field("parent", &self.parent)
.field("req_spf", &self.req_spf)
.field("vinfo", &self.vinfo)
.field("ainfo", &self.ainfo)
.finish()
}
}
@ -199,8 +226,8 @@ pub struct GstDiscoverer {
impl ::std::fmt::Debug for GstDiscoverer {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscoverer @ {:?}", self as *const _))
.field("parent", &self.parent)
.finish()
.field("parent", &self.parent)
.finish()
}
}
@ -210,7 +237,7 @@ pub struct GstDiscovererAudioInfo(c_void);
impl ::std::fmt::Debug for GstDiscovererAudioInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscovererAudioInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -219,8 +246,11 @@ pub struct GstDiscovererContainerInfo(c_void);
impl ::std::fmt::Debug for GstDiscovererContainerInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscovererContainerInfo @ {:?}", self as *const _))
.finish()
f.debug_struct(&format!(
"GstDiscovererContainerInfo @ {:?}",
self as *const _
))
.finish()
}
}
@ -230,7 +260,7 @@ pub struct GstDiscovererInfo(c_void);
impl ::std::fmt::Debug for GstDiscovererInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscovererInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -240,7 +270,7 @@ pub struct GstDiscovererStreamInfo(c_void);
impl ::std::fmt::Debug for GstDiscovererStreamInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscovererStreamInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -249,8 +279,11 @@ pub struct GstDiscovererSubtitleInfo(c_void);
impl ::std::fmt::Debug for GstDiscovererSubtitleInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscovererSubtitleInfo @ {:?}", self as *const _))
.finish()
f.debug_struct(&format!(
"GstDiscovererSubtitleInfo @ {:?}",
self as *const _
))
.finish()
}
}
@ -260,7 +293,7 @@ pub struct GstDiscovererVideoInfo(c_void);
impl ::std::fmt::Debug for GstDiscovererVideoInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstDiscovererVideoInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -270,7 +303,7 @@ pub struct GstEncodingAudioProfile(c_void);
impl ::std::fmt::Debug for GstEncodingAudioProfile {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstEncodingAudioProfile @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -279,8 +312,11 @@ pub struct GstEncodingContainerProfile(c_void);
impl ::std::fmt::Debug for GstEncodingContainerProfile {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstEncodingContainerProfile @ {:?}", self as *const _))
.finish()
f.debug_struct(&format!(
"GstEncodingContainerProfile @ {:?}",
self as *const _
))
.finish()
}
}
@ -290,7 +326,7 @@ pub struct GstEncodingProfile(c_void);
impl ::std::fmt::Debug for GstEncodingProfile {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstEncodingProfile @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -300,7 +336,7 @@ pub struct GstEncodingTarget(c_void);
impl ::std::fmt::Debug for GstEncodingTarget {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstEncodingTarget @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -310,7 +346,7 @@ pub struct GstEncodingVideoProfile(c_void);
impl ::std::fmt::Debug for GstEncodingVideoProfile {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstEncodingVideoProfile @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -342,14 +378,25 @@ extern "C" {
//=========================================================================
pub fn gst_install_plugins_context_get_type() -> GType;
pub fn gst_install_plugins_context_new() -> *mut GstInstallPluginsContext;
pub fn gst_install_plugins_context_copy(ctx: *mut GstInstallPluginsContext) -> *mut GstInstallPluginsContext;
pub fn gst_install_plugins_context_copy(
ctx: *mut GstInstallPluginsContext,
) -> *mut GstInstallPluginsContext;
pub fn gst_install_plugins_context_free(ctx: *mut GstInstallPluginsContext);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_install_plugins_context_set_confirm_search(ctx: *mut GstInstallPluginsContext, confirm_search: gboolean);
pub fn gst_install_plugins_context_set_confirm_search(
ctx: *mut GstInstallPluginsContext,
confirm_search: gboolean,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_install_plugins_context_set_desktop_id(ctx: *mut GstInstallPluginsContext, desktop_id: *const c_char);
pub fn gst_install_plugins_context_set_desktop_id(
ctx: *mut GstInstallPluginsContext,
desktop_id: *const c_char,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_install_plugins_context_set_startup_notification_id(ctx: *mut GstInstallPluginsContext, startup_id: *const c_char);
pub fn gst_install_plugins_context_set_startup_notification_id(
ctx: *mut GstInstallPluginsContext,
startup_id: *const c_char,
);
pub fn gst_install_plugins_context_set_xid(ctx: *mut GstInstallPluginsContext, xid: c_uint);
//=========================================================================
@ -361,9 +408,19 @@ extern "C" {
// GstDiscoverer
//=========================================================================
pub fn gst_discoverer_get_type() -> GType;
pub fn gst_discoverer_new(timeout: gst::GstClockTime, error: *mut *mut glib::GError) -> *mut GstDiscoverer;
pub fn gst_discoverer_discover_uri(discoverer: *mut GstDiscoverer, uri: *const c_char, error: *mut *mut glib::GError) -> *mut GstDiscovererInfo;
pub fn gst_discoverer_discover_uri_async(discoverer: *mut GstDiscoverer, uri: *const c_char) -> gboolean;
pub fn gst_discoverer_new(
timeout: gst::GstClockTime,
error: *mut *mut glib::GError,
) -> *mut GstDiscoverer;
pub fn gst_discoverer_discover_uri(
discoverer: *mut GstDiscoverer,
uri: *const c_char,
error: *mut *mut glib::GError,
) -> *mut GstDiscovererInfo;
pub fn gst_discoverer_discover_uri_async(
discoverer: *mut GstDiscoverer,
uri: *const c_char,
) -> gboolean;
pub fn gst_discoverer_start(discoverer: *mut GstDiscoverer);
pub fn gst_discoverer_stop(discoverer: *mut GstDiscoverer);
@ -376,63 +433,103 @@ extern "C" {
pub fn gst_discoverer_audio_info_get_channel_mask(info: *const GstDiscovererAudioInfo) -> u64;
pub fn gst_discoverer_audio_info_get_channels(info: *const GstDiscovererAudioInfo) -> c_uint;
pub fn gst_discoverer_audio_info_get_depth(info: *const GstDiscovererAudioInfo) -> c_uint;
pub fn gst_discoverer_audio_info_get_language(info: *const GstDiscovererAudioInfo) -> *const c_char;
pub fn gst_discoverer_audio_info_get_max_bitrate(info: *const GstDiscovererAudioInfo) -> c_uint;
pub fn gst_discoverer_audio_info_get_sample_rate(info: *const GstDiscovererAudioInfo) -> c_uint;
pub fn gst_discoverer_audio_info_get_language(
info: *const GstDiscovererAudioInfo,
) -> *const c_char;
pub fn gst_discoverer_audio_info_get_max_bitrate(info: *const GstDiscovererAudioInfo)
-> c_uint;
pub fn gst_discoverer_audio_info_get_sample_rate(info: *const GstDiscovererAudioInfo)
-> c_uint;
//=========================================================================
// GstDiscovererContainerInfo
//=========================================================================
pub fn gst_discoverer_container_info_get_type() -> GType;
pub fn gst_discoverer_container_info_get_streams(info: *mut GstDiscovererContainerInfo) -> *mut glib::GList;
pub fn gst_discoverer_container_info_get_streams(
info: *mut GstDiscovererContainerInfo,
) -> *mut glib::GList;
//=========================================================================
// GstDiscovererInfo
//=========================================================================
pub fn gst_discoverer_info_get_type() -> GType;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_discoverer_info_from_variant(variant: *mut glib::GVariant) -> *mut GstDiscovererInfo;
pub fn gst_discoverer_info_from_variant(variant: *mut glib::GVariant)
-> *mut GstDiscovererInfo;
pub fn gst_discoverer_info_copy(ptr: *mut GstDiscovererInfo) -> *mut GstDiscovererInfo;
pub fn gst_discoverer_info_get_audio_streams(info: *mut GstDiscovererInfo) -> *mut glib::GList;
pub fn gst_discoverer_info_get_container_streams(info: *mut GstDiscovererInfo) -> *mut glib::GList;
pub fn gst_discoverer_info_get_container_streams(
info: *mut GstDiscovererInfo,
) -> *mut glib::GList;
pub fn gst_discoverer_info_get_duration(info: *const GstDiscovererInfo) -> gst::GstClockTime;
#[cfg(any(feature = "v1_14", feature = "dox"))]
pub fn gst_discoverer_info_get_live(info: *const GstDiscovererInfo) -> gboolean;
pub fn gst_discoverer_info_get_misc(info: *const GstDiscovererInfo) -> *const gst::GstStructure;
pub fn gst_discoverer_info_get_misc(info: *const GstDiscovererInfo)
-> *const gst::GstStructure;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_discoverer_info_get_missing_elements_installer_details(info: *const GstDiscovererInfo) -> *mut *const c_char;
pub fn gst_discoverer_info_get_missing_elements_installer_details(
info: *const GstDiscovererInfo,
) -> *mut *const c_char;
pub fn gst_discoverer_info_get_result(info: *const GstDiscovererInfo) -> GstDiscovererResult;
pub fn gst_discoverer_info_get_seekable(info: *const GstDiscovererInfo) -> gboolean;
pub fn gst_discoverer_info_get_stream_info(info: *mut GstDiscovererInfo) -> *mut GstDiscovererStreamInfo;
pub fn gst_discoverer_info_get_stream_info(
info: *mut GstDiscovererInfo,
) -> *mut GstDiscovererStreamInfo;
pub fn gst_discoverer_info_get_stream_list(info: *mut GstDiscovererInfo) -> *mut glib::GList;
pub fn gst_discoverer_info_get_streams(info: *mut GstDiscovererInfo, streamtype: GType) -> *mut glib::GList;
pub fn gst_discoverer_info_get_subtitle_streams(info: *mut GstDiscovererInfo) -> *mut glib::GList;
pub fn gst_discoverer_info_get_streams(
info: *mut GstDiscovererInfo,
streamtype: GType,
) -> *mut glib::GList;
pub fn gst_discoverer_info_get_subtitle_streams(
info: *mut GstDiscovererInfo,
) -> *mut glib::GList;
pub fn gst_discoverer_info_get_tags(info: *const GstDiscovererInfo) -> *const gst::GstTagList;
pub fn gst_discoverer_info_get_toc(info: *const GstDiscovererInfo) -> *const gst::GstToc;
pub fn gst_discoverer_info_get_uri(info: *const GstDiscovererInfo) -> *const c_char;
pub fn gst_discoverer_info_get_video_streams(info: *mut GstDiscovererInfo) -> *mut glib::GList;
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_discoverer_info_to_variant(info: *mut GstDiscovererInfo, flags: GstDiscovererSerializeFlags) -> *mut glib::GVariant;
pub fn gst_discoverer_info_to_variant(
info: *mut GstDiscovererInfo,
flags: GstDiscovererSerializeFlags,
) -> *mut glib::GVariant;
//=========================================================================
// GstDiscovererStreamInfo
//=========================================================================
pub fn gst_discoverer_stream_info_get_type() -> GType;
pub fn gst_discoverer_stream_info_list_free(infos: *mut glib::GList);
pub fn gst_discoverer_stream_info_get_caps(info: *mut GstDiscovererStreamInfo) -> *mut gst::GstCaps;
pub fn gst_discoverer_stream_info_get_misc(info: *mut GstDiscovererStreamInfo) -> *const gst::GstStructure;
pub fn gst_discoverer_stream_info_get_next(info: *mut GstDiscovererStreamInfo) -> *mut GstDiscovererStreamInfo;
pub fn gst_discoverer_stream_info_get_previous(info: *mut GstDiscovererStreamInfo) -> *mut GstDiscovererStreamInfo;
pub fn gst_discoverer_stream_info_get_stream_id(info: *mut GstDiscovererStreamInfo) -> *const c_char;
pub fn gst_discoverer_stream_info_get_stream_type_nick(info: *mut GstDiscovererStreamInfo) -> *const c_char;
pub fn gst_discoverer_stream_info_get_tags(info: *mut GstDiscovererStreamInfo) -> *const gst::GstTagList;
pub fn gst_discoverer_stream_info_get_toc(info: *mut GstDiscovererStreamInfo) -> *const gst::GstToc;
pub fn gst_discoverer_stream_info_get_caps(
info: *mut GstDiscovererStreamInfo,
) -> *mut gst::GstCaps;
pub fn gst_discoverer_stream_info_get_misc(
info: *mut GstDiscovererStreamInfo,
) -> *const gst::GstStructure;
pub fn gst_discoverer_stream_info_get_next(
info: *mut GstDiscovererStreamInfo,
) -> *mut GstDiscovererStreamInfo;
pub fn gst_discoverer_stream_info_get_previous(
info: *mut GstDiscovererStreamInfo,
) -> *mut GstDiscovererStreamInfo;
pub fn gst_discoverer_stream_info_get_stream_id(
info: *mut GstDiscovererStreamInfo,
) -> *const c_char;
pub fn gst_discoverer_stream_info_get_stream_type_nick(
info: *mut GstDiscovererStreamInfo,
) -> *const c_char;
pub fn gst_discoverer_stream_info_get_tags(
info: *mut GstDiscovererStreamInfo,
) -> *const gst::GstTagList;
pub fn gst_discoverer_stream_info_get_toc(
info: *mut GstDiscovererStreamInfo,
) -> *const gst::GstToc;
//=========================================================================
// GstDiscovererSubtitleInfo
//=========================================================================
pub fn gst_discoverer_subtitle_info_get_type() -> GType;
pub fn gst_discoverer_subtitle_info_get_language(info: *const GstDiscovererSubtitleInfo) -> *const c_char;
pub fn gst_discoverer_subtitle_info_get_language(
info: *const GstDiscovererSubtitleInfo,
) -> *const c_char;
//=========================================================================
// GstDiscovererVideoInfo
@ -440,93 +537,188 @@ extern "C" {
pub fn gst_discoverer_video_info_get_type() -> GType;
pub fn gst_discoverer_video_info_get_bitrate(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_depth(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_framerate_denom(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_framerate_num(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_framerate_denom(
info: *const GstDiscovererVideoInfo,
) -> c_uint;
pub fn gst_discoverer_video_info_get_framerate_num(
info: *const GstDiscovererVideoInfo,
) -> c_uint;
pub fn gst_discoverer_video_info_get_height(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_max_bitrate(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_max_bitrate(info: *const GstDiscovererVideoInfo)
-> c_uint;
pub fn gst_discoverer_video_info_get_par_denom(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_par_num(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_get_width(info: *const GstDiscovererVideoInfo) -> c_uint;
pub fn gst_discoverer_video_info_is_image(info: *const GstDiscovererVideoInfo) -> gboolean;
pub fn gst_discoverer_video_info_is_interlaced(info: *const GstDiscovererVideoInfo) -> gboolean;
pub fn gst_discoverer_video_info_is_interlaced(info: *const GstDiscovererVideoInfo)
-> gboolean;
//=========================================================================
// GstEncodingAudioProfile
//=========================================================================
pub fn gst_encoding_audio_profile_get_type() -> GType;
pub fn gst_encoding_audio_profile_new(format: *mut gst::GstCaps, preset: *const c_char, restriction: *mut gst::GstCaps, presence: c_uint) -> *mut GstEncodingAudioProfile;
pub fn gst_encoding_audio_profile_new(
format: *mut gst::GstCaps,
preset: *const c_char,
restriction: *mut gst::GstCaps,
presence: c_uint,
) -> *mut GstEncodingAudioProfile;
//=========================================================================
// GstEncodingContainerProfile
//=========================================================================
pub fn gst_encoding_container_profile_get_type() -> GType;
pub fn gst_encoding_container_profile_new(name: *const c_char, description: *const c_char, format: *mut gst::GstCaps, preset: *const c_char) -> *mut GstEncodingContainerProfile;
pub fn gst_encoding_container_profile_add_profile(container: *mut GstEncodingContainerProfile, profile: *mut GstEncodingProfile) -> gboolean;
pub fn gst_encoding_container_profile_contains_profile(container: *mut GstEncodingContainerProfile, profile: *mut GstEncodingProfile) -> gboolean;
pub fn gst_encoding_container_profile_get_profiles(profile: *mut GstEncodingContainerProfile) -> *const glib::GList;
pub fn gst_encoding_container_profile_new(
name: *const c_char,
description: *const c_char,
format: *mut gst::GstCaps,
preset: *const c_char,
) -> *mut GstEncodingContainerProfile;
pub fn gst_encoding_container_profile_add_profile(
container: *mut GstEncodingContainerProfile,
profile: *mut GstEncodingProfile,
) -> gboolean;
pub fn gst_encoding_container_profile_contains_profile(
container: *mut GstEncodingContainerProfile,
profile: *mut GstEncodingProfile,
) -> gboolean;
pub fn gst_encoding_container_profile_get_profiles(
profile: *mut GstEncodingContainerProfile,
) -> *const glib::GList;
//=========================================================================
// GstEncodingProfile
//=========================================================================
pub fn gst_encoding_profile_get_type() -> GType;
pub fn gst_encoding_profile_find(targetname: *const c_char, profilename: *const c_char, category: *const c_char) -> *mut GstEncodingProfile;
pub fn gst_encoding_profile_from_discoverer(info: *mut GstDiscovererInfo) -> *mut GstEncodingProfile;
pub fn gst_encoding_profile_find(
targetname: *const c_char,
profilename: *const c_char,
category: *const c_char,
) -> *mut GstEncodingProfile;
pub fn gst_encoding_profile_from_discoverer(
info: *mut GstDiscovererInfo,
) -> *mut GstEncodingProfile;
#[cfg(any(feature = "v1_12", feature = "dox"))]
pub fn gst_encoding_profile_copy(self_: *mut GstEncodingProfile) -> *mut GstEncodingProfile;
pub fn gst_encoding_profile_get_allow_dynamic_output(profile: *mut GstEncodingProfile) -> gboolean;
pub fn gst_encoding_profile_get_allow_dynamic_output(
profile: *mut GstEncodingProfile,
) -> gboolean;
pub fn gst_encoding_profile_get_description(profile: *mut GstEncodingProfile) -> *const c_char;
pub fn gst_encoding_profile_get_file_extension(profile: *mut GstEncodingProfile) -> *const c_char;
pub fn gst_encoding_profile_get_file_extension(
profile: *mut GstEncodingProfile,
) -> *const c_char;
pub fn gst_encoding_profile_get_format(profile: *mut GstEncodingProfile) -> *mut gst::GstCaps;
pub fn gst_encoding_profile_get_input_caps(profile: *mut GstEncodingProfile) -> *mut gst::GstCaps;
pub fn gst_encoding_profile_get_input_caps(
profile: *mut GstEncodingProfile,
) -> *mut gst::GstCaps;
pub fn gst_encoding_profile_get_name(profile: *mut GstEncodingProfile) -> *const c_char;
pub fn gst_encoding_profile_get_presence(profile: *mut GstEncodingProfile) -> c_uint;
pub fn gst_encoding_profile_get_preset(profile: *mut GstEncodingProfile) -> *const c_char;
pub fn gst_encoding_profile_get_preset_name(profile: *mut GstEncodingProfile) -> *const c_char;
pub fn gst_encoding_profile_get_restriction(profile: *mut GstEncodingProfile) -> *mut gst::GstCaps;
pub fn gst_encoding_profile_get_restriction(
profile: *mut GstEncodingProfile,
) -> *mut gst::GstCaps;
pub fn gst_encoding_profile_get_type_nick(profile: *mut GstEncodingProfile) -> *const c_char;
pub fn gst_encoding_profile_is_enabled(profile: *mut GstEncodingProfile) -> gboolean;
pub fn gst_encoding_profile_is_equal(a: *mut GstEncodingProfile, b: *mut GstEncodingProfile) -> gboolean;
pub fn gst_encoding_profile_set_allow_dynamic_output(profile: *mut GstEncodingProfile, allow_dynamic_output: gboolean);
pub fn gst_encoding_profile_set_description(profile: *mut GstEncodingProfile, description: *const c_char);
pub fn gst_encoding_profile_is_equal(
a: *mut GstEncodingProfile,
b: *mut GstEncodingProfile,
) -> gboolean;
pub fn gst_encoding_profile_set_allow_dynamic_output(
profile: *mut GstEncodingProfile,
allow_dynamic_output: gboolean,
);
pub fn gst_encoding_profile_set_description(
profile: *mut GstEncodingProfile,
description: *const c_char,
);
#[cfg(any(feature = "v1_6", feature = "dox"))]
pub fn gst_encoding_profile_set_enabled(profile: *mut GstEncodingProfile, enabled: gboolean);
pub fn gst_encoding_profile_set_format(profile: *mut GstEncodingProfile, format: *mut gst::GstCaps);
pub fn gst_encoding_profile_set_format(
profile: *mut GstEncodingProfile,
format: *mut gst::GstCaps,
);
pub fn gst_encoding_profile_set_name(profile: *mut GstEncodingProfile, name: *const c_char);
pub fn gst_encoding_profile_set_presence(profile: *mut GstEncodingProfile, presence: c_uint);
pub fn gst_encoding_profile_set_preset(profile: *mut GstEncodingProfile, preset: *const c_char);
pub fn gst_encoding_profile_set_preset_name(profile: *mut GstEncodingProfile, preset_name: *const c_char);
pub fn gst_encoding_profile_set_restriction(profile: *mut GstEncodingProfile, restriction: *mut gst::GstCaps);
pub fn gst_encoding_profile_set_preset_name(
profile: *mut GstEncodingProfile,
preset_name: *const c_char,
);
pub fn gst_encoding_profile_set_restriction(
profile: *mut GstEncodingProfile,
restriction: *mut gst::GstCaps,
);
//=========================================================================
// GstEncodingTarget
//=========================================================================
pub fn gst_encoding_target_get_type() -> GType;
pub fn gst_encoding_target_new(name: *const c_char, category: *const c_char, description: *const c_char, profiles: *const glib::GList) -> *mut GstEncodingTarget;
pub fn gst_encoding_target_load(name: *const c_char, category: *const c_char, error: *mut *mut glib::GError) -> *mut GstEncodingTarget;
pub fn gst_encoding_target_load_from_file(filepath: *const c_char, error: *mut *mut glib::GError) -> *mut GstEncodingTarget;
pub fn gst_encoding_target_add_profile(target: *mut GstEncodingTarget, profile: *mut GstEncodingProfile) -> gboolean;
pub fn gst_encoding_target_new(
name: *const c_char,
category: *const c_char,
description: *const c_char,
profiles: *const glib::GList,
) -> *mut GstEncodingTarget;
pub fn gst_encoding_target_load(
name: *const c_char,
category: *const c_char,
error: *mut *mut glib::GError,
) -> *mut GstEncodingTarget;
pub fn gst_encoding_target_load_from_file(
filepath: *const c_char,
error: *mut *mut glib::GError,
) -> *mut GstEncodingTarget;
pub fn gst_encoding_target_add_profile(
target: *mut GstEncodingTarget,
profile: *mut GstEncodingProfile,
) -> gboolean;
pub fn gst_encoding_target_get_category(target: *mut GstEncodingTarget) -> *const c_char;
pub fn gst_encoding_target_get_description(target: *mut GstEncodingTarget) -> *const c_char;
pub fn gst_encoding_target_get_name(target: *mut GstEncodingTarget) -> *const c_char;
pub fn gst_encoding_target_get_profile(target: *mut GstEncodingTarget, name: *const c_char) -> *mut GstEncodingProfile;
pub fn gst_encoding_target_get_profile(
target: *mut GstEncodingTarget,
name: *const c_char,
) -> *mut GstEncodingProfile;
pub fn gst_encoding_target_get_profiles(target: *mut GstEncodingTarget) -> *const glib::GList;
pub fn gst_encoding_target_save(target: *mut GstEncodingTarget, error: *mut *mut glib::GError) -> gboolean;
pub fn gst_encoding_target_save_to_file(target: *mut GstEncodingTarget, filepath: *const c_char, error: *mut *mut glib::GError) -> gboolean;
pub fn gst_encoding_target_save(
target: *mut GstEncodingTarget,
error: *mut *mut glib::GError,
) -> gboolean;
pub fn gst_encoding_target_save_to_file(
target: *mut GstEncodingTarget,
filepath: *const c_char,
error: *mut *mut glib::GError,
) -> gboolean;
//=========================================================================
// GstEncodingVideoProfile
//=========================================================================
pub fn gst_encoding_video_profile_get_type() -> GType;
pub fn gst_encoding_video_profile_new(format: *mut gst::GstCaps, preset: *const c_char, restriction: *mut gst::GstCaps, presence: c_uint) -> *mut GstEncodingVideoProfile;
pub fn gst_encoding_video_profile_new(
format: *mut gst::GstCaps,
preset: *const c_char,
restriction: *mut gst::GstCaps,
presence: c_uint,
) -> *mut GstEncodingVideoProfile;
pub fn gst_encoding_video_profile_get_pass(prof: *mut GstEncodingVideoProfile) -> c_uint;
pub fn gst_encoding_video_profile_get_variableframerate(prof: *mut GstEncodingVideoProfile) -> gboolean;
pub fn gst_encoding_video_profile_get_variableframerate(
prof: *mut GstEncodingVideoProfile,
) -> gboolean;
pub fn gst_encoding_video_profile_set_pass(prof: *mut GstEncodingVideoProfile, pass: c_uint);
pub fn gst_encoding_video_profile_set_variableframerate(prof: *mut GstEncodingVideoProfile, variableframerate: gboolean);
pub fn gst_encoding_video_profile_set_variableframerate(
prof: *mut GstEncodingVideoProfile,
variableframerate: gboolean,
);
//=========================================================================
// Other functions
//=========================================================================
pub fn gst_codec_utils_aac_caps_set_level_and_profile(caps: *mut gst::GstCaps, audio_config: *const u8, len: c_uint) -> gboolean;
pub fn gst_codec_utils_aac_caps_set_level_and_profile(
caps: *mut gst::GstCaps,
audio_config: *const u8,
len: c_uint,
) -> gboolean;
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn gst_codec_utils_aac_get_channels(audio_config: *const u8, len: c_uint) -> c_uint;
pub fn gst_codec_utils_aac_get_index_from_sample_rate(rate: c_uint) -> c_int;
@ -535,53 +727,150 @@ extern "C" {
#[cfg(any(feature = "v1_10", feature = "dox"))]
pub fn gst_codec_utils_aac_get_sample_rate(audio_config: *const u8, len: c_uint) -> c_uint;
pub fn gst_codec_utils_aac_get_sample_rate_from_index(sr_idx: c_uint) -> c_uint;
pub fn gst_codec_utils_h264_caps_set_level_and_profile(caps: *mut gst::GstCaps, sps: *const u8, len: c_uint) -> gboolean;
pub fn gst_codec_utils_h264_caps_set_level_and_profile(
caps: *mut gst::GstCaps,
sps: *const u8,
len: c_uint,
) -> gboolean;
pub fn gst_codec_utils_h264_get_level(sps: *const u8, len: c_uint) -> *const c_char;
pub fn gst_codec_utils_h264_get_level_idc(level: *const c_char) -> u8;
pub fn gst_codec_utils_h264_get_profile(sps: *const u8, len: c_uint) -> *const c_char;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_codec_utils_h265_caps_set_level_tier_and_profile(caps: *mut gst::GstCaps, profile_tier_level: *const u8, len: c_uint) -> gboolean;
pub fn gst_codec_utils_h265_caps_set_level_tier_and_profile(
caps: *mut gst::GstCaps,
profile_tier_level: *const u8,
len: c_uint,
) -> gboolean;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_codec_utils_h265_get_level(profile_tier_level: *const u8, len: c_uint) -> *const c_char;
pub fn gst_codec_utils_h265_get_level(
profile_tier_level: *const u8,
len: c_uint,
) -> *const c_char;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_codec_utils_h265_get_level_idc(level: *const c_char) -> u8;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_codec_utils_h265_get_profile(profile_tier_level: *const u8, len: c_uint) -> *const c_char;
pub fn gst_codec_utils_h265_get_profile(
profile_tier_level: *const u8,
len: c_uint,
) -> *const c_char;
#[cfg(any(feature = "v1_4", feature = "dox"))]
pub fn gst_codec_utils_h265_get_tier(profile_tier_level: *const u8, len: c_uint) -> *const c_char;
pub fn gst_codec_utils_mpeg4video_caps_set_level_and_profile(caps: *mut gst::GstCaps, vis_obj_seq: *const u8, len: c_uint) -> gboolean;
pub fn gst_codec_utils_mpeg4video_get_level(vis_obj_seq: *const u8, len: c_uint) -> *const c_char;
pub fn gst_codec_utils_mpeg4video_get_profile(vis_obj_seq: *const u8, len: c_uint) -> *const c_char;
pub fn gst_codec_utils_h265_get_tier(
profile_tier_level: *const u8,
len: c_uint,
) -> *const c_char;
pub fn gst_codec_utils_mpeg4video_caps_set_level_and_profile(
caps: *mut gst::GstCaps,
vis_obj_seq: *const u8,
len: c_uint,
) -> gboolean;
pub fn gst_codec_utils_mpeg4video_get_level(
vis_obj_seq: *const u8,
len: c_uint,
) -> *const c_char;
pub fn gst_codec_utils_mpeg4video_get_profile(
vis_obj_seq: *const u8,
len: c_uint,
) -> *const c_char;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_codec_utils_opus_create_caps(rate: u32, channels: u8, channel_mapping_family: u8, stream_count: u8, coupled_count: u8, channel_mapping: *const u8) -> *mut gst::GstCaps;
pub fn gst_codec_utils_opus_create_caps(
rate: u32,
channels: u8,
channel_mapping_family: u8,
stream_count: u8,
coupled_count: u8,
channel_mapping: *const u8,
) -> *mut gst::GstCaps;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_codec_utils_opus_create_caps_from_header(header: *mut gst::GstBuffer, comments: *mut gst::GstBuffer) -> *mut gst::GstCaps;
pub fn gst_codec_utils_opus_create_caps_from_header(
header: *mut gst::GstBuffer,
comments: *mut gst::GstBuffer,
) -> *mut gst::GstCaps;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_codec_utils_opus_create_header(rate: u32, channels: u8, channel_mapping_family: u8, stream_count: u8, coupled_count: u8, channel_mapping: *const u8, pre_skip: u16, output_gain: i16) -> *mut gst::GstBuffer;
pub fn gst_codec_utils_opus_create_header(
rate: u32,
channels: u8,
channel_mapping_family: u8,
stream_count: u8,
coupled_count: u8,
channel_mapping: *const u8,
pre_skip: u16,
output_gain: i16,
) -> *mut gst::GstBuffer;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_codec_utils_opus_parse_caps(caps: *mut gst::GstCaps, rate: *mut u32, channels: *mut u8, channel_mapping_family: *mut u8, stream_count: *mut u8, coupled_count: *mut u8, channel_mapping: *mut [u8; 256]) -> gboolean;
pub fn gst_codec_utils_opus_parse_caps(
caps: *mut gst::GstCaps,
rate: *mut u32,
channels: *mut u8,
channel_mapping_family: *mut u8,
stream_count: *mut u8,
coupled_count: *mut u8,
channel_mapping: *mut [u8; 256],
) -> gboolean;
#[cfg(any(feature = "v1_8", feature = "dox"))]
pub fn gst_codec_utils_opus_parse_header(header: *mut gst::GstBuffer, rate: *mut u32, channels: *mut u8, channel_mapping_family: *mut u8, stream_count: *mut u8, coupled_count: *mut u8, channel_mapping: *mut [u8; 256], pre_skip: *mut u16, output_gain: *mut i16) -> gboolean;
pub fn gst_codec_utils_opus_parse_header(
header: *mut gst::GstBuffer,
rate: *mut u32,
channels: *mut u8,
channel_mapping_family: *mut u8,
stream_count: *mut u8,
coupled_count: *mut u8,
channel_mapping: *mut [u8; 256],
pre_skip: *mut u16,
output_gain: *mut i16,
) -> gboolean;
pub fn gst_encoding_list_all_targets(categoryname: *const c_char) -> *mut glib::GList;
pub fn gst_encoding_list_available_categories() -> *mut glib::GList;
pub fn gst_install_plugins_async(details: *const *const c_char, ctx: *mut GstInstallPluginsContext, func: GstInstallPluginsResultFunc, user_data: gpointer) -> GstInstallPluginsReturn;
pub fn gst_install_plugins_async(
details: *const *const c_char,
ctx: *mut GstInstallPluginsContext,
func: GstInstallPluginsResultFunc,
user_data: gpointer,
) -> GstInstallPluginsReturn;
pub fn gst_install_plugins_installation_in_progress() -> gboolean;
pub fn gst_install_plugins_supported() -> gboolean;
pub fn gst_install_plugins_sync(details: *const *const c_char, ctx: *mut GstInstallPluginsContext) -> GstInstallPluginsReturn;
pub fn gst_install_plugins_sync(
details: *const *const c_char,
ctx: *mut GstInstallPluginsContext,
) -> GstInstallPluginsReturn;
pub fn gst_is_missing_plugin_message(msg: *mut gst::GstMessage) -> gboolean;
pub fn gst_missing_decoder_installer_detail_new(decode_caps: *const gst::GstCaps) -> *mut c_char;
pub fn gst_missing_decoder_message_new(element: *mut gst::GstElement, decode_caps: *const gst::GstCaps) -> *mut gst::GstMessage;
pub fn gst_missing_decoder_installer_detail_new(
decode_caps: *const gst::GstCaps,
) -> *mut c_char;
pub fn gst_missing_decoder_message_new(
element: *mut gst::GstElement,
decode_caps: *const gst::GstCaps,
) -> *mut gst::GstMessage;
pub fn gst_missing_element_installer_detail_new(factory_name: *const c_char) -> *mut c_char;
pub fn gst_missing_element_message_new(element: *mut gst::GstElement, factory_name: *const c_char) -> *mut gst::GstMessage;
pub fn gst_missing_encoder_installer_detail_new(encode_caps: *const gst::GstCaps) -> *mut c_char;
pub fn gst_missing_encoder_message_new(element: *mut gst::GstElement, encode_caps: *const gst::GstCaps) -> *mut gst::GstMessage;
pub fn gst_missing_element_message_new(
element: *mut gst::GstElement,
factory_name: *const c_char,
) -> *mut gst::GstMessage;
pub fn gst_missing_encoder_installer_detail_new(
encode_caps: *const gst::GstCaps,
) -> *mut c_char;
pub fn gst_missing_encoder_message_new(
element: *mut gst::GstElement,
encode_caps: *const gst::GstCaps,
) -> *mut gst::GstMessage;
pub fn gst_missing_plugin_message_get_description(msg: *mut gst::GstMessage) -> *mut c_char;
pub fn gst_missing_plugin_message_get_installer_detail(msg: *mut gst::GstMessage) -> *mut c_char;
pub fn gst_missing_plugin_message_get_installer_detail(
msg: *mut gst::GstMessage,
) -> *mut c_char;
pub fn gst_missing_uri_sink_installer_detail_new(protocol: *const c_char) -> *mut c_char;
pub fn gst_missing_uri_sink_message_new(element: *mut gst::GstElement, protocol: *const c_char) -> *mut gst::GstMessage;
pub fn gst_missing_uri_sink_message_new(
element: *mut gst::GstElement,
protocol: *const c_char,
) -> *mut gst::GstMessage;
pub fn gst_missing_uri_source_installer_detail_new(protocol: *const c_char) -> *mut c_char;
pub fn gst_missing_uri_source_message_new(element: *mut gst::GstElement, protocol: *const c_char) -> *mut gst::GstMessage;
pub fn gst_pb_utils_add_codec_description_to_tag_list(taglist: *mut gst::GstTagList, codec_tag: *const c_char, caps: *const gst::GstCaps) -> gboolean;
pub fn gst_missing_uri_source_message_new(
element: *mut gst::GstElement,
protocol: *const c_char,
) -> *mut gst::GstMessage;
pub fn gst_pb_utils_add_codec_description_to_tag_list(
taglist: *mut gst::GstTagList,
codec_tag: *const c_char,
caps: *const gst::GstCaps,
) -> gboolean;
pub fn gst_pb_utils_get_codec_description(caps: *const gst::GstCaps) -> *mut c_char;
pub fn gst_pb_utils_get_decoder_description(caps: *const gst::GstCaps) -> *mut c_char;
pub fn gst_pb_utils_get_element_description(factory_name: *const c_char) -> *mut c_char;
@ -589,7 +878,12 @@ extern "C" {
pub fn gst_pb_utils_get_sink_description(protocol: *const c_char) -> *mut c_char;
pub fn gst_pb_utils_get_source_description(protocol: *const c_char) -> *mut c_char;
pub fn gst_pb_utils_init();
pub fn gst_plugins_base_version(major: *mut c_uint, minor: *mut c_uint, micro: *mut c_uint, nano: *mut c_uint);
pub fn gst_plugins_base_version(
major: *mut c_uint,
minor: *mut c_uint,
micro: *mut c_uint,
nano: *mut c_uint,
);
pub fn gst_plugins_base_version_string() -> *mut c_char;
}

View file

@ -5,13 +5,13 @@
extern crate gstreamer_pbutils_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_pbutils_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_pbutils_sys::*;
static PACKAGES: &[&str] = &["gstreamer-pbutils-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,48 +229,154 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstAudioVisualizer", Layout {size: size_of::<GstAudioVisualizer>(), alignment: align_of::<GstAudioVisualizer>()}),
("GstAudioVisualizerClass", Layout {size: size_of::<GstAudioVisualizerClass>(), alignment: align_of::<GstAudioVisualizerClass>()}),
("GstAudioVisualizerShader", Layout {size: size_of::<GstAudioVisualizerShader>(), alignment: align_of::<GstAudioVisualizerShader>()}),
("GstDiscoverer", Layout {size: size_of::<GstDiscoverer>(), alignment: align_of::<GstDiscoverer>()}),
("GstDiscovererAudioInfoClass", Layout {size: size_of::<GstDiscovererAudioInfoClass>(), alignment: align_of::<GstDiscovererAudioInfoClass>()}),
("GstDiscovererClass", Layout {size: size_of::<GstDiscovererClass>(), alignment: align_of::<GstDiscovererClass>()}),
("GstDiscovererContainerInfoClass", Layout {size: size_of::<GstDiscovererContainerInfoClass>(), alignment: align_of::<GstDiscovererContainerInfoClass>()}),
("GstDiscovererInfoClass", Layout {size: size_of::<GstDiscovererInfoClass>(), alignment: align_of::<GstDiscovererInfoClass>()}),
("GstDiscovererResult", Layout {size: size_of::<GstDiscovererResult>(), alignment: align_of::<GstDiscovererResult>()}),
("GstDiscovererSerializeFlags", Layout {size: size_of::<GstDiscovererSerializeFlags>(), alignment: align_of::<GstDiscovererSerializeFlags>()}),
("GstDiscovererStreamInfoClass", Layout {size: size_of::<GstDiscovererStreamInfoClass>(), alignment: align_of::<GstDiscovererStreamInfoClass>()}),
("GstDiscovererSubtitleInfoClass", Layout {size: size_of::<GstDiscovererSubtitleInfoClass>(), alignment: align_of::<GstDiscovererSubtitleInfoClass>()}),
("GstDiscovererVideoInfoClass", Layout {size: size_of::<GstDiscovererVideoInfoClass>(), alignment: align_of::<GstDiscovererVideoInfoClass>()}),
("GstEncodingTargetClass", Layout {size: size_of::<GstEncodingTargetClass>(), alignment: align_of::<GstEncodingTargetClass>()}),
("GstInstallPluginsReturn", Layout {size: size_of::<GstInstallPluginsReturn>(), alignment: align_of::<GstInstallPluginsReturn>()}),
(
"GstAudioVisualizer",
Layout {
size: size_of::<GstAudioVisualizer>(),
alignment: align_of::<GstAudioVisualizer>(),
},
),
(
"GstAudioVisualizerClass",
Layout {
size: size_of::<GstAudioVisualizerClass>(),
alignment: align_of::<GstAudioVisualizerClass>(),
},
),
(
"GstAudioVisualizerShader",
Layout {
size: size_of::<GstAudioVisualizerShader>(),
alignment: align_of::<GstAudioVisualizerShader>(),
},
),
(
"GstDiscoverer",
Layout {
size: size_of::<GstDiscoverer>(),
alignment: align_of::<GstDiscoverer>(),
},
),
(
"GstDiscovererAudioInfoClass",
Layout {
size: size_of::<GstDiscovererAudioInfoClass>(),
alignment: align_of::<GstDiscovererAudioInfoClass>(),
},
),
(
"GstDiscovererClass",
Layout {
size: size_of::<GstDiscovererClass>(),
alignment: align_of::<GstDiscovererClass>(),
},
),
(
"GstDiscovererContainerInfoClass",
Layout {
size: size_of::<GstDiscovererContainerInfoClass>(),
alignment: align_of::<GstDiscovererContainerInfoClass>(),
},
),
(
"GstDiscovererInfoClass",
Layout {
size: size_of::<GstDiscovererInfoClass>(),
alignment: align_of::<GstDiscovererInfoClass>(),
},
),
(
"GstDiscovererResult",
Layout {
size: size_of::<GstDiscovererResult>(),
alignment: align_of::<GstDiscovererResult>(),
},
),
(
"GstDiscovererSerializeFlags",
Layout {
size: size_of::<GstDiscovererSerializeFlags>(),
alignment: align_of::<GstDiscovererSerializeFlags>(),
},
),
(
"GstDiscovererStreamInfoClass",
Layout {
size: size_of::<GstDiscovererStreamInfoClass>(),
alignment: align_of::<GstDiscovererStreamInfoClass>(),
},
),
(
"GstDiscovererSubtitleInfoClass",
Layout {
size: size_of::<GstDiscovererSubtitleInfoClass>(),
alignment: align_of::<GstDiscovererSubtitleInfoClass>(),
},
),
(
"GstDiscovererVideoInfoClass",
Layout {
size: size_of::<GstDiscovererVideoInfoClass>(),
alignment: align_of::<GstDiscovererVideoInfoClass>(),
},
),
(
"GstEncodingTargetClass",
Layout {
size: size_of::<GstEncodingTargetClass>(),
alignment: align_of::<GstEncodingTargetClass>(),
},
),
(
"GstInstallPluginsReturn",
Layout {
size: size_of::<GstInstallPluginsReturn>(),
alignment: align_of::<GstInstallPluginsReturn>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE", "1"),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN", "3"),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN", "7"),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT", "6"),
(
"(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN",
"7",
),
(
"(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT",
"6",
),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT", "4"),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT", "5"),
(
"(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT",
"5",
),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP", "2"),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN", "9"),
("(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT", "8"),
(
"(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN",
"9",
),
(
"(gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT",
"8",
),
("(gint) GST_AUDIO_VISUALIZER_SHADER_NONE", "0"),
("(gint) GST_DISCOVERER_BUSY", "4"),
("(gint) GST_DISCOVERER_ERROR", "2"),
@ -294,5 +406,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_INSTALL_PLUGINS_SUCCESS", "0"),
("(gint) GST_INSTALL_PLUGINS_USER_ABORT", "4"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -36,7 +36,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -58,8 +58,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -73,4 +75,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

View file

@ -3,18 +3,23 @@
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
#![allow(
clippy::approx_constant,
clippy::type_complexity,
clippy::unreadable_literal
)]
extern crate libc;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
extern crate gstreamer_video_sys as gst_video;
extern crate libc;
#[allow(unused_imports)]
use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
c_short, c_ushort, c_long, c_ulong,
c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
@ -59,7 +64,8 @@ pub type GstPlayerClass = *mut _GstPlayerClass;
#[repr(C)]
pub struct _GstPlayerGMainContextSignalDispatcherClass(c_void);
pub type GstPlayerGMainContextSignalDispatcherClass = *mut _GstPlayerGMainContextSignalDispatcherClass;
pub type GstPlayerGMainContextSignalDispatcherClass =
*mut _GstPlayerGMainContextSignalDispatcherClass;
#[repr(C)]
pub struct _GstPlayerMediaInfoClass(c_void);
@ -70,15 +76,26 @@ pub type GstPlayerMediaInfoClass = *mut _GstPlayerMediaInfoClass;
#[derive(Copy, Clone)]
pub struct GstPlayerSignalDispatcherInterface {
pub parent_iface: gobject::GTypeInterface,
pub dispatch: Option<unsafe extern "C" fn(*mut GstPlayerSignalDispatcher, *mut GstPlayer, GstPlayerSignalDispatcherFunc, gpointer, glib::GDestroyNotify)>,
pub dispatch: Option<
unsafe extern "C" fn(
*mut GstPlayerSignalDispatcher,
*mut GstPlayer,
GstPlayerSignalDispatcherFunc,
gpointer,
glib::GDestroyNotify,
),
>,
}
impl ::std::fmt::Debug for GstPlayerSignalDispatcherInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerSignalDispatcherInterface @ {:?}", self as *const _))
.field("parent_iface", &self.parent_iface)
.field("dispatch", &self.dispatch)
.finish()
f.debug_struct(&format!(
"GstPlayerSignalDispatcherInterface @ {:?}",
self as *const _
))
.field("parent_iface", &self.parent_iface)
.field("dispatch", &self.dispatch)
.finish()
}
}
@ -106,15 +123,20 @@ pub type GstPlayerVideoOverlayVideoRendererClass = *mut _GstPlayerVideoOverlayVi
#[derive(Copy, Clone)]
pub struct GstPlayerVideoRendererInterface {
pub parent_iface: gobject::GTypeInterface,
pub create_video_sink: Option<unsafe extern "C" fn(*mut GstPlayerVideoRenderer, *mut GstPlayer) -> *mut gst::GstElement>,
pub create_video_sink: Option<
unsafe extern "C" fn(*mut GstPlayerVideoRenderer, *mut GstPlayer) -> *mut gst::GstElement,
>,
}
impl ::std::fmt::Debug for GstPlayerVideoRendererInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerVideoRendererInterface @ {:?}", self as *const _))
.field("parent_iface", &self.parent_iface)
.field("create_video_sink", &self.create_video_sink)
.finish()
f.debug_struct(&format!(
"GstPlayerVideoRendererInterface @ {:?}",
self as *const _
))
.field("parent_iface", &self.parent_iface)
.field("create_video_sink", &self.create_video_sink)
.finish()
}
}
@ -128,9 +150,9 @@ pub struct GstPlayerVisualization {
impl ::std::fmt::Debug for GstPlayerVisualization {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerVisualization @ {:?}", self as *const _))
.field("name", &self.name)
.field("description", &self.description)
.finish()
.field("name", &self.name)
.field("description", &self.description)
.finish()
}
}
@ -141,7 +163,7 @@ pub struct GstPlayer(c_void);
impl ::std::fmt::Debug for GstPlayer {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayer @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -151,7 +173,7 @@ pub struct GstPlayerAudioInfo(c_void);
impl ::std::fmt::Debug for GstPlayerAudioInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerAudioInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -160,8 +182,11 @@ pub struct GstPlayerGMainContextSignalDispatcher(c_void);
impl ::std::fmt::Debug for GstPlayerGMainContextSignalDispatcher {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerGMainContextSignalDispatcher @ {:?}", self as *const _))
.finish()
f.debug_struct(&format!(
"GstPlayerGMainContextSignalDispatcher @ {:?}",
self as *const _
))
.finish()
}
}
@ -171,7 +196,7 @@ pub struct GstPlayerMediaInfo(c_void);
impl ::std::fmt::Debug for GstPlayerMediaInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerMediaInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -181,7 +206,7 @@ pub struct GstPlayerStreamInfo(c_void);
impl ::std::fmt::Debug for GstPlayerStreamInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerStreamInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -191,7 +216,7 @@ pub struct GstPlayerSubtitleInfo(c_void);
impl ::std::fmt::Debug for GstPlayerSubtitleInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerSubtitleInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -201,7 +226,7 @@ pub struct GstPlayerVideoInfo(c_void);
impl ::std::fmt::Debug for GstPlayerVideoInfo {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerVideoInfo @ {:?}", self as *const _))
.finish()
.finish()
}
}
@ -210,8 +235,11 @@ pub struct GstPlayerVideoOverlayVideoRenderer(c_void);
impl ::std::fmt::Debug for GstPlayerVideoOverlayVideoRenderer {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstPlayerVideoOverlayVideoRenderer @ {:?}", self as *const _))
.finish()
f.debug_struct(&format!(
"GstPlayerVideoOverlayVideoRenderer @ {:?}",
self as *const _
))
.finish()
}
}
@ -234,14 +262,15 @@ impl ::std::fmt::Debug for GstPlayerVideoRenderer {
}
}
extern "C" {
//=========================================================================
// GstPlayerColorBalanceType
//=========================================================================
pub fn gst_player_color_balance_type_get_type() -> GType;
pub fn gst_player_color_balance_type_get_name(type_: GstPlayerColorBalanceType) -> *const c_char;
pub fn gst_player_color_balance_type_get_name(
type_: GstPlayerColorBalanceType,
) -> *const c_char;
//=========================================================================
// GstPlayerError
@ -260,18 +289,28 @@ extern "C" {
// GstPlayerVisualization
//=========================================================================
pub fn gst_player_visualization_get_type() -> GType;
pub fn gst_player_visualization_copy(vis: *const GstPlayerVisualization) -> *mut GstPlayerVisualization;
pub fn gst_player_visualization_copy(
vis: *const GstPlayerVisualization,
) -> *mut GstPlayerVisualization;
pub fn gst_player_visualization_free(vis: *mut GstPlayerVisualization);
//=========================================================================
// GstPlayer
//=========================================================================
pub fn gst_player_get_type() -> GType;
pub fn gst_player_new(video_renderer: *mut GstPlayerVideoRenderer, signal_dispatcher: *mut GstPlayerSignalDispatcher) -> *mut GstPlayer;
pub fn gst_player_config_get_position_update_interval(config: *const gst::GstStructure) -> c_uint;
pub fn gst_player_new(
video_renderer: *mut GstPlayerVideoRenderer,
signal_dispatcher: *mut GstPlayerSignalDispatcher,
) -> *mut GstPlayer;
pub fn gst_player_config_get_position_update_interval(
config: *const gst::GstStructure,
) -> c_uint;
pub fn gst_player_config_get_seek_accurate(config: *const gst::GstStructure) -> gboolean;
pub fn gst_player_config_get_user_agent(config: *const gst::GstStructure) -> *mut c_char;
pub fn gst_player_config_set_position_update_interval(config: *mut gst::GstStructure, interval: c_uint);
pub fn gst_player_config_set_position_update_interval(
config: *mut gst::GstStructure,
interval: c_uint,
);
pub fn gst_player_config_set_seek_accurate(config: *mut gst::GstStructure, accurate: gboolean);
pub fn gst_player_config_set_user_agent(config: *mut gst::GstStructure, agent: *const c_char);
pub fn gst_player_get_audio_streams(info: *const GstPlayerMediaInfo) -> *mut glib::GList;
@ -280,16 +319,25 @@ extern "C" {
pub fn gst_player_visualizations_free(viss: *mut *mut GstPlayerVisualization);
pub fn gst_player_visualizations_get() -> *mut *mut GstPlayerVisualization;
pub fn gst_player_get_audio_video_offset(player: *mut GstPlayer) -> i64;
pub fn gst_player_get_color_balance(player: *mut GstPlayer, type_: GstPlayerColorBalanceType) -> c_double;
pub fn gst_player_get_color_balance(
player: *mut GstPlayer,
type_: GstPlayerColorBalanceType,
) -> c_double;
pub fn gst_player_get_config(player: *mut GstPlayer) -> *mut gst::GstStructure;
pub fn gst_player_get_current_audio_track(player: *mut GstPlayer) -> *mut GstPlayerAudioInfo;
pub fn gst_player_get_current_subtitle_track(player: *mut GstPlayer) -> *mut GstPlayerSubtitleInfo;
pub fn gst_player_get_current_subtitle_track(
player: *mut GstPlayer,
) -> *mut GstPlayerSubtitleInfo;
pub fn gst_player_get_current_video_track(player: *mut GstPlayer) -> *mut GstPlayerVideoInfo;
pub fn gst_player_get_current_visualization(player: *mut GstPlayer) -> *mut c_char;
pub fn gst_player_get_duration(player: *mut GstPlayer) -> gst::GstClockTime;
pub fn gst_player_get_media_info(player: *mut GstPlayer) -> *mut GstPlayerMediaInfo;
pub fn gst_player_get_multiview_flags(player: *mut GstPlayer) -> gst_video::GstVideoMultiviewFlags;
pub fn gst_player_get_multiview_mode(player: *mut GstPlayer) -> gst_video::GstVideoMultiviewFramePacking;
pub fn gst_player_get_multiview_flags(
player: *mut GstPlayer,
) -> gst_video::GstVideoMultiviewFlags;
pub fn gst_player_get_multiview_mode(
player: *mut GstPlayer,
) -> gst_video::GstVideoMultiviewFramePacking;
pub fn gst_player_get_mute(player: *mut GstPlayer) -> gboolean;
pub fn gst_player_get_pipeline(player: *mut GstPlayer) -> *mut gst::GstElement;
pub fn gst_player_get_position(player: *mut GstPlayer) -> gst::GstClockTime;
@ -298,7 +346,11 @@ extern "C" {
#[cfg(any(feature = "v1_16", feature = "dox"))]
pub fn gst_player_get_subtitle_video_offset(player: *mut GstPlayer) -> i64;
pub fn gst_player_get_uri(player: *mut GstPlayer) -> *mut c_char;
pub fn gst_player_get_video_snapshot(player: *mut GstPlayer, format: GstPlayerSnapshotFormat, config: *const gst::GstStructure) -> *mut gst::GstSample;
pub fn gst_player_get_video_snapshot(
player: *mut GstPlayer,
format: GstPlayerSnapshotFormat,
config: *const gst::GstStructure,
) -> *mut gst::GstSample;
pub fn gst_player_get_volume(player: *mut GstPlayer) -> c_double;
pub fn gst_player_has_color_balance(player: *mut GstPlayer) -> gboolean;
pub fn gst_player_pause(player: *mut GstPlayer);
@ -307,10 +359,23 @@ extern "C" {
pub fn gst_player_set_audio_track(player: *mut GstPlayer, stream_index: c_int) -> gboolean;
pub fn gst_player_set_audio_track_enabled(player: *mut GstPlayer, enabled: gboolean);
pub fn gst_player_set_audio_video_offset(player: *mut GstPlayer, offset: i64);
pub fn gst_player_set_color_balance(player: *mut GstPlayer, type_: GstPlayerColorBalanceType, value: c_double);
pub fn gst_player_set_config(player: *mut GstPlayer, config: *mut gst::GstStructure) -> gboolean;
pub fn gst_player_set_multiview_flags(player: *mut GstPlayer, flags: gst_video::GstVideoMultiviewFlags);
pub fn gst_player_set_multiview_mode(player: *mut GstPlayer, mode: gst_video::GstVideoMultiviewFramePacking);
pub fn gst_player_set_color_balance(
player: *mut GstPlayer,
type_: GstPlayerColorBalanceType,
value: c_double,
);
pub fn gst_player_set_config(
player: *mut GstPlayer,
config: *mut gst::GstStructure,
) -> gboolean;
pub fn gst_player_set_multiview_flags(
player: *mut GstPlayer,
flags: gst_video::GstVideoMultiviewFlags,
);
pub fn gst_player_set_multiview_mode(
player: *mut GstPlayer,
mode: gst_video::GstVideoMultiviewFramePacking,
);
pub fn gst_player_set_mute(player: *mut GstPlayer, val: gboolean);
pub fn gst_player_set_rate(player: *mut GstPlayer, rate: c_double);
pub fn gst_player_set_subtitle_track(player: *mut GstPlayer, stream_index: c_int) -> gboolean;
@ -340,26 +405,47 @@ extern "C" {
// GstPlayerGMainContextSignalDispatcher
//=========================================================================
pub fn gst_player_g_main_context_signal_dispatcher_get_type() -> GType;
pub fn gst_player_g_main_context_signal_dispatcher_new(application_context: *mut glib::GMainContext) -> *mut GstPlayerSignalDispatcher;
pub fn gst_player_g_main_context_signal_dispatcher_new(
application_context: *mut glib::GMainContext,
) -> *mut GstPlayerSignalDispatcher;
//=========================================================================
// GstPlayerMediaInfo
//=========================================================================
pub fn gst_player_media_info_get_type() -> GType;
pub fn gst_player_media_info_get_audio_streams(info: *const GstPlayerMediaInfo) -> *mut glib::GList;
pub fn gst_player_media_info_get_container_format(info: *const GstPlayerMediaInfo) -> *const c_char;
pub fn gst_player_media_info_get_duration(info: *const GstPlayerMediaInfo) -> gst::GstClockTime;
pub fn gst_player_media_info_get_image_sample(info: *const GstPlayerMediaInfo) -> *mut gst::GstSample;
pub fn gst_player_media_info_get_number_of_audio_streams(info: *const GstPlayerMediaInfo) -> c_uint;
pub fn gst_player_media_info_get_audio_streams(
info: *const GstPlayerMediaInfo,
) -> *mut glib::GList;
pub fn gst_player_media_info_get_container_format(
info: *const GstPlayerMediaInfo,
) -> *const c_char;
pub fn gst_player_media_info_get_duration(info: *const GstPlayerMediaInfo)
-> gst::GstClockTime;
pub fn gst_player_media_info_get_image_sample(
info: *const GstPlayerMediaInfo,
) -> *mut gst::GstSample;
pub fn gst_player_media_info_get_number_of_audio_streams(
info: *const GstPlayerMediaInfo,
) -> c_uint;
pub fn gst_player_media_info_get_number_of_streams(info: *const GstPlayerMediaInfo) -> c_uint;
pub fn gst_player_media_info_get_number_of_subtitle_streams(info: *const GstPlayerMediaInfo) -> c_uint;
pub fn gst_player_media_info_get_number_of_video_streams(info: *const GstPlayerMediaInfo) -> c_uint;
pub fn gst_player_media_info_get_stream_list(info: *const GstPlayerMediaInfo) -> *mut glib::GList;
pub fn gst_player_media_info_get_subtitle_streams(info: *const GstPlayerMediaInfo) -> *mut glib::GList;
pub fn gst_player_media_info_get_number_of_subtitle_streams(
info: *const GstPlayerMediaInfo,
) -> c_uint;
pub fn gst_player_media_info_get_number_of_video_streams(
info: *const GstPlayerMediaInfo,
) -> c_uint;
pub fn gst_player_media_info_get_stream_list(
info: *const GstPlayerMediaInfo,
) -> *mut glib::GList;
pub fn gst_player_media_info_get_subtitle_streams(
info: *const GstPlayerMediaInfo,
) -> *mut glib::GList;
pub fn gst_player_media_info_get_tags(info: *const GstPlayerMediaInfo) -> *mut gst::GstTagList;
pub fn gst_player_media_info_get_title(info: *const GstPlayerMediaInfo) -> *const c_char;
pub fn gst_player_media_info_get_uri(info: *const GstPlayerMediaInfo) -> *const c_char;
pub fn gst_player_media_info_get_video_streams(info: *const GstPlayerMediaInfo) -> *mut glib::GList;
pub fn gst_player_media_info_get_video_streams(
info: *const GstPlayerMediaInfo,
) -> *mut glib::GList;
pub fn gst_player_media_info_is_live(info: *const GstPlayerMediaInfo) -> gboolean;
pub fn gst_player_media_info_is_seekable(info: *const GstPlayerMediaInfo) -> gboolean;
@ -370,37 +456,75 @@ extern "C" {
pub fn gst_player_stream_info_get_caps(info: *const GstPlayerStreamInfo) -> *mut gst::GstCaps;
pub fn gst_player_stream_info_get_codec(info: *const GstPlayerStreamInfo) -> *const c_char;
pub fn gst_player_stream_info_get_index(info: *const GstPlayerStreamInfo) -> c_int;
pub fn gst_player_stream_info_get_stream_type(info: *const GstPlayerStreamInfo) -> *const c_char;
pub fn gst_player_stream_info_get_tags(info: *const GstPlayerStreamInfo) -> *mut gst::GstTagList;
pub fn gst_player_stream_info_get_stream_type(
info: *const GstPlayerStreamInfo,
) -> *const c_char;
pub fn gst_player_stream_info_get_tags(
info: *const GstPlayerStreamInfo,
) -> *mut gst::GstTagList;
//=========================================================================
// GstPlayerSubtitleInfo
//=========================================================================
pub fn gst_player_subtitle_info_get_type() -> GType;
pub fn gst_player_subtitle_info_get_language(info: *const GstPlayerSubtitleInfo) -> *const c_char;
pub fn gst_player_subtitle_info_get_language(
info: *const GstPlayerSubtitleInfo,
) -> *const c_char;
//=========================================================================
// GstPlayerVideoInfo
//=========================================================================
pub fn gst_player_video_info_get_type() -> GType;
pub fn gst_player_video_info_get_bitrate(info: *const GstPlayerVideoInfo) -> c_int;
pub fn gst_player_video_info_get_framerate(info: *const GstPlayerVideoInfo, fps_n: *mut c_int, fps_d: *mut c_int);
pub fn gst_player_video_info_get_framerate(
info: *const GstPlayerVideoInfo,
fps_n: *mut c_int,
fps_d: *mut c_int,
);
pub fn gst_player_video_info_get_height(info: *const GstPlayerVideoInfo) -> c_int;
pub fn gst_player_video_info_get_max_bitrate(info: *const GstPlayerVideoInfo) -> c_int;
pub fn gst_player_video_info_get_pixel_aspect_ratio(info: *const GstPlayerVideoInfo, par_n: *mut c_uint, par_d: *mut c_uint);
pub fn gst_player_video_info_get_pixel_aspect_ratio(
info: *const GstPlayerVideoInfo,
par_n: *mut c_uint,
par_d: *mut c_uint,
);
pub fn gst_player_video_info_get_width(info: *const GstPlayerVideoInfo) -> c_int;
//=========================================================================
// GstPlayerVideoOverlayVideoRenderer
//=========================================================================
pub fn gst_player_video_overlay_video_renderer_get_type() -> GType;
pub fn gst_player_video_overlay_video_renderer_new(window_handle: gpointer) -> *mut GstPlayerVideoRenderer;
pub fn gst_player_video_overlay_video_renderer_new_with_sink(window_handle: gpointer, video_sink: *mut gst::GstElement) -> *mut GstPlayerVideoRenderer;
pub fn gst_player_video_overlay_video_renderer_expose(self_: *mut GstPlayerVideoOverlayVideoRenderer);
pub fn gst_player_video_overlay_video_renderer_get_render_rectangle(self_: *mut GstPlayerVideoOverlayVideoRenderer, x: *mut c_int, y: *mut c_int, width: *mut c_int, height: *mut c_int);
pub fn gst_player_video_overlay_video_renderer_get_window_handle(self_: *mut GstPlayerVideoOverlayVideoRenderer) -> gpointer;
pub fn gst_player_video_overlay_video_renderer_set_render_rectangle(self_: *mut GstPlayerVideoOverlayVideoRenderer, x: c_int, y: c_int, width: c_int, height: c_int);
pub fn gst_player_video_overlay_video_renderer_set_window_handle(self_: *mut GstPlayerVideoOverlayVideoRenderer, window_handle: gpointer);
pub fn gst_player_video_overlay_video_renderer_new(
window_handle: gpointer,
) -> *mut GstPlayerVideoRenderer;
pub fn gst_player_video_overlay_video_renderer_new_with_sink(
window_handle: gpointer,
video_sink: *mut gst::GstElement,
) -> *mut GstPlayerVideoRenderer;
pub fn gst_player_video_overlay_video_renderer_expose(
self_: *mut GstPlayerVideoOverlayVideoRenderer,
);
pub fn gst_player_video_overlay_video_renderer_get_render_rectangle(
self_: *mut GstPlayerVideoOverlayVideoRenderer,
x: *mut c_int,
y: *mut c_int,
width: *mut c_int,
height: *mut c_int,
);
pub fn gst_player_video_overlay_video_renderer_get_window_handle(
self_: *mut GstPlayerVideoOverlayVideoRenderer,
) -> gpointer;
pub fn gst_player_video_overlay_video_renderer_set_render_rectangle(
self_: *mut GstPlayerVideoOverlayVideoRenderer,
x: c_int,
y: c_int,
width: c_int,
height: c_int,
);
pub fn gst_player_video_overlay_video_renderer_set_window_handle(
self_: *mut GstPlayerVideoOverlayVideoRenderer,
window_handle: gpointer,
);
//=========================================================================
// GstPlayerSignalDispatcher

View file

@ -5,13 +5,13 @@
extern crate gstreamer_player_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_player_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_player_sys::*;
static PACKAGES: &[&str] = &["gstreamer-player-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,28 +229,71 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstPlayerColorBalanceType", Layout {size: size_of::<GstPlayerColorBalanceType>(), alignment: align_of::<GstPlayerColorBalanceType>()}),
("GstPlayerError", Layout {size: size_of::<GstPlayerError>(), alignment: align_of::<GstPlayerError>()}),
("GstPlayerSignalDispatcherInterface", Layout {size: size_of::<GstPlayerSignalDispatcherInterface>(), alignment: align_of::<GstPlayerSignalDispatcherInterface>()}),
("GstPlayerSnapshotFormat", Layout {size: size_of::<GstPlayerSnapshotFormat>(), alignment: align_of::<GstPlayerSnapshotFormat>()}),
("GstPlayerState", Layout {size: size_of::<GstPlayerState>(), alignment: align_of::<GstPlayerState>()}),
("GstPlayerVideoRendererInterface", Layout {size: size_of::<GstPlayerVideoRendererInterface>(), alignment: align_of::<GstPlayerVideoRendererInterface>()}),
("GstPlayerVisualization", Layout {size: size_of::<GstPlayerVisualization>(), alignment: align_of::<GstPlayerVisualization>()}),
(
"GstPlayerColorBalanceType",
Layout {
size: size_of::<GstPlayerColorBalanceType>(),
alignment: align_of::<GstPlayerColorBalanceType>(),
},
),
(
"GstPlayerError",
Layout {
size: size_of::<GstPlayerError>(),
alignment: align_of::<GstPlayerError>(),
},
),
(
"GstPlayerSignalDispatcherInterface",
Layout {
size: size_of::<GstPlayerSignalDispatcherInterface>(),
alignment: align_of::<GstPlayerSignalDispatcherInterface>(),
},
),
(
"GstPlayerSnapshotFormat",
Layout {
size: size_of::<GstPlayerSnapshotFormat>(),
alignment: align_of::<GstPlayerSnapshotFormat>(),
},
),
(
"GstPlayerState",
Layout {
size: size_of::<GstPlayerState>(),
alignment: align_of::<GstPlayerState>(),
},
),
(
"GstPlayerVideoRendererInterface",
Layout {
size: size_of::<GstPlayerVideoRendererInterface>(),
alignment: align_of::<GstPlayerVideoRendererInterface>(),
},
),
(
"GstPlayerVisualization",
Layout {
size: size_of::<GstPlayerVisualization>(),
alignment: align_of::<GstPlayerVisualization>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -263,5 +312,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_PLAYER_THUMBNAIL_RAW_NATIVE", "0"),
("(gint) GST_PLAYER_THUMBNAIL_RAW_xRGB", "1"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

View file

@ -5,13 +5,13 @@
extern crate gstreamer_rtsp_server_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_rtsp_server_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_rtsp_server_sys::*;
static PACKAGES: &[&str] = &["gstreamer-rtsp-server-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,71 +229,372 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstRTSPAddress", Layout {size: size_of::<GstRTSPAddress>(), alignment: align_of::<GstRTSPAddress>()}),
("GstRTSPAddressFlags", Layout {size: size_of::<GstRTSPAddressFlags>(), alignment: align_of::<GstRTSPAddressFlags>()}),
("GstRTSPAddressPool", Layout {size: size_of::<GstRTSPAddressPool>(), alignment: align_of::<GstRTSPAddressPool>()}),
("GstRTSPAddressPoolClass", Layout {size: size_of::<GstRTSPAddressPoolClass>(), alignment: align_of::<GstRTSPAddressPoolClass>()}),
("GstRTSPAddressPoolResult", Layout {size: size_of::<GstRTSPAddressPoolResult>(), alignment: align_of::<GstRTSPAddressPoolResult>()}),
("GstRTSPAuth", Layout {size: size_of::<GstRTSPAuth>(), alignment: align_of::<GstRTSPAuth>()}),
("GstRTSPAuthClass", Layout {size: size_of::<GstRTSPAuthClass>(), alignment: align_of::<GstRTSPAuthClass>()}),
("GstRTSPClient", Layout {size: size_of::<GstRTSPClient>(), alignment: align_of::<GstRTSPClient>()}),
("GstRTSPClientClass", Layout {size: size_of::<GstRTSPClientClass>(), alignment: align_of::<GstRTSPClientClass>()}),
("GstRTSPContext", Layout {size: size_of::<GstRTSPContext>(), alignment: align_of::<GstRTSPContext>()}),
("GstRTSPFilterResult", Layout {size: size_of::<GstRTSPFilterResult>(), alignment: align_of::<GstRTSPFilterResult>()}),
("GstRTSPMedia", Layout {size: size_of::<GstRTSPMedia>(), alignment: align_of::<GstRTSPMedia>()}),
("GstRTSPMediaClass", Layout {size: size_of::<GstRTSPMediaClass>(), alignment: align_of::<GstRTSPMediaClass>()}),
("GstRTSPMediaFactory", Layout {size: size_of::<GstRTSPMediaFactory>(), alignment: align_of::<GstRTSPMediaFactory>()}),
("GstRTSPMediaFactoryClass", Layout {size: size_of::<GstRTSPMediaFactoryClass>(), alignment: align_of::<GstRTSPMediaFactoryClass>()}),
("GstRTSPMediaFactoryURI", Layout {size: size_of::<GstRTSPMediaFactoryURI>(), alignment: align_of::<GstRTSPMediaFactoryURI>()}),
("GstRTSPMediaFactoryURIClass", Layout {size: size_of::<GstRTSPMediaFactoryURIClass>(), alignment: align_of::<GstRTSPMediaFactoryURIClass>()}),
("GstRTSPMediaStatus", Layout {size: size_of::<GstRTSPMediaStatus>(), alignment: align_of::<GstRTSPMediaStatus>()}),
("GstRTSPMountPoints", Layout {size: size_of::<GstRTSPMountPoints>(), alignment: align_of::<GstRTSPMountPoints>()}),
("GstRTSPMountPointsClass", Layout {size: size_of::<GstRTSPMountPointsClass>(), alignment: align_of::<GstRTSPMountPointsClass>()}),
("GstRTSPOnvifClient", Layout {size: size_of::<GstRTSPOnvifClient>(), alignment: align_of::<GstRTSPOnvifClient>()}),
("GstRTSPOnvifClientClass", Layout {size: size_of::<GstRTSPOnvifClientClass>(), alignment: align_of::<GstRTSPOnvifClientClass>()}),
("GstRTSPOnvifMedia", Layout {size: size_of::<GstRTSPOnvifMedia>(), alignment: align_of::<GstRTSPOnvifMedia>()}),
("GstRTSPOnvifMediaClass", Layout {size: size_of::<GstRTSPOnvifMediaClass>(), alignment: align_of::<GstRTSPOnvifMediaClass>()}),
("GstRTSPOnvifMediaFactory", Layout {size: size_of::<GstRTSPOnvifMediaFactory>(), alignment: align_of::<GstRTSPOnvifMediaFactory>()}),
("GstRTSPOnvifMediaFactoryClass", Layout {size: size_of::<GstRTSPOnvifMediaFactoryClass>(), alignment: align_of::<GstRTSPOnvifMediaFactoryClass>()}),
("GstRTSPOnvifServer", Layout {size: size_of::<GstRTSPOnvifServer>(), alignment: align_of::<GstRTSPOnvifServer>()}),
("GstRTSPOnvifServerClass", Layout {size: size_of::<GstRTSPOnvifServerClass>(), alignment: align_of::<GstRTSPOnvifServerClass>()}),
("GstRTSPPermissions", Layout {size: size_of::<GstRTSPPermissions>(), alignment: align_of::<GstRTSPPermissions>()}),
("GstRTSPPublishClockMode", Layout {size: size_of::<GstRTSPPublishClockMode>(), alignment: align_of::<GstRTSPPublishClockMode>()}),
("GstRTSPServer", Layout {size: size_of::<GstRTSPServer>(), alignment: align_of::<GstRTSPServer>()}),
("GstRTSPServerClass", Layout {size: size_of::<GstRTSPServerClass>(), alignment: align_of::<GstRTSPServerClass>()}),
("GstRTSPSession", Layout {size: size_of::<GstRTSPSession>(), alignment: align_of::<GstRTSPSession>()}),
("GstRTSPSessionClass", Layout {size: size_of::<GstRTSPSessionClass>(), alignment: align_of::<GstRTSPSessionClass>()}),
("GstRTSPSessionMedia", Layout {size: size_of::<GstRTSPSessionMedia>(), alignment: align_of::<GstRTSPSessionMedia>()}),
("GstRTSPSessionMediaClass", Layout {size: size_of::<GstRTSPSessionMediaClass>(), alignment: align_of::<GstRTSPSessionMediaClass>()}),
("GstRTSPSessionPool", Layout {size: size_of::<GstRTSPSessionPool>(), alignment: align_of::<GstRTSPSessionPool>()}),
("GstRTSPSessionPoolClass", Layout {size: size_of::<GstRTSPSessionPoolClass>(), alignment: align_of::<GstRTSPSessionPoolClass>()}),
("GstRTSPStream", Layout {size: size_of::<GstRTSPStream>(), alignment: align_of::<GstRTSPStream>()}),
("GstRTSPStreamClass", Layout {size: size_of::<GstRTSPStreamClass>(), alignment: align_of::<GstRTSPStreamClass>()}),
("GstRTSPStreamTransport", Layout {size: size_of::<GstRTSPStreamTransport>(), alignment: align_of::<GstRTSPStreamTransport>()}),
("GstRTSPStreamTransportClass", Layout {size: size_of::<GstRTSPStreamTransportClass>(), alignment: align_of::<GstRTSPStreamTransportClass>()}),
("GstRTSPSuspendMode", Layout {size: size_of::<GstRTSPSuspendMode>(), alignment: align_of::<GstRTSPSuspendMode>()}),
("GstRTSPThread", Layout {size: size_of::<GstRTSPThread>(), alignment: align_of::<GstRTSPThread>()}),
("GstRTSPThreadPool", Layout {size: size_of::<GstRTSPThreadPool>(), alignment: align_of::<GstRTSPThreadPool>()}),
("GstRTSPThreadPoolClass", Layout {size: size_of::<GstRTSPThreadPoolClass>(), alignment: align_of::<GstRTSPThreadPoolClass>()}),
("GstRTSPThreadType", Layout {size: size_of::<GstRTSPThreadType>(), alignment: align_of::<GstRTSPThreadType>()}),
("GstRTSPToken", Layout {size: size_of::<GstRTSPToken>(), alignment: align_of::<GstRTSPToken>()}),
("GstRTSPTransportMode", Layout {size: size_of::<GstRTSPTransportMode>(), alignment: align_of::<GstRTSPTransportMode>()}),
("GstSDPInfo", Layout {size: size_of::<GstSDPInfo>(), alignment: align_of::<GstSDPInfo>()}),
(
"GstRTSPAddress",
Layout {
size: size_of::<GstRTSPAddress>(),
alignment: align_of::<GstRTSPAddress>(),
},
),
(
"GstRTSPAddressFlags",
Layout {
size: size_of::<GstRTSPAddressFlags>(),
alignment: align_of::<GstRTSPAddressFlags>(),
},
),
(
"GstRTSPAddressPool",
Layout {
size: size_of::<GstRTSPAddressPool>(),
alignment: align_of::<GstRTSPAddressPool>(),
},
),
(
"GstRTSPAddressPoolClass",
Layout {
size: size_of::<GstRTSPAddressPoolClass>(),
alignment: align_of::<GstRTSPAddressPoolClass>(),
},
),
(
"GstRTSPAddressPoolResult",
Layout {
size: size_of::<GstRTSPAddressPoolResult>(),
alignment: align_of::<GstRTSPAddressPoolResult>(),
},
),
(
"GstRTSPAuth",
Layout {
size: size_of::<GstRTSPAuth>(),
alignment: align_of::<GstRTSPAuth>(),
},
),
(
"GstRTSPAuthClass",
Layout {
size: size_of::<GstRTSPAuthClass>(),
alignment: align_of::<GstRTSPAuthClass>(),
},
),
(
"GstRTSPClient",
Layout {
size: size_of::<GstRTSPClient>(),
alignment: align_of::<GstRTSPClient>(),
},
),
(
"GstRTSPClientClass",
Layout {
size: size_of::<GstRTSPClientClass>(),
alignment: align_of::<GstRTSPClientClass>(),
},
),
(
"GstRTSPContext",
Layout {
size: size_of::<GstRTSPContext>(),
alignment: align_of::<GstRTSPContext>(),
},
),
(
"GstRTSPFilterResult",
Layout {
size: size_of::<GstRTSPFilterResult>(),
alignment: align_of::<GstRTSPFilterResult>(),
},
),
(
"GstRTSPMedia",
Layout {
size: size_of::<GstRTSPMedia>(),
alignment: align_of::<GstRTSPMedia>(),
},
),
(
"GstRTSPMediaClass",
Layout {
size: size_of::<GstRTSPMediaClass>(),
alignment: align_of::<GstRTSPMediaClass>(),
},
),
(
"GstRTSPMediaFactory",
Layout {
size: size_of::<GstRTSPMediaFactory>(),
alignment: align_of::<GstRTSPMediaFactory>(),
},
),
(
"GstRTSPMediaFactoryClass",
Layout {
size: size_of::<GstRTSPMediaFactoryClass>(),
alignment: align_of::<GstRTSPMediaFactoryClass>(),
},
),
(
"GstRTSPMediaFactoryURI",
Layout {
size: size_of::<GstRTSPMediaFactoryURI>(),
alignment: align_of::<GstRTSPMediaFactoryURI>(),
},
),
(
"GstRTSPMediaFactoryURIClass",
Layout {
size: size_of::<GstRTSPMediaFactoryURIClass>(),
alignment: align_of::<GstRTSPMediaFactoryURIClass>(),
},
),
(
"GstRTSPMediaStatus",
Layout {
size: size_of::<GstRTSPMediaStatus>(),
alignment: align_of::<GstRTSPMediaStatus>(),
},
),
(
"GstRTSPMountPoints",
Layout {
size: size_of::<GstRTSPMountPoints>(),
alignment: align_of::<GstRTSPMountPoints>(),
},
),
(
"GstRTSPMountPointsClass",
Layout {
size: size_of::<GstRTSPMountPointsClass>(),
alignment: align_of::<GstRTSPMountPointsClass>(),
},
),
(
"GstRTSPOnvifClient",
Layout {
size: size_of::<GstRTSPOnvifClient>(),
alignment: align_of::<GstRTSPOnvifClient>(),
},
),
(
"GstRTSPOnvifClientClass",
Layout {
size: size_of::<GstRTSPOnvifClientClass>(),
alignment: align_of::<GstRTSPOnvifClientClass>(),
},
),
(
"GstRTSPOnvifMedia",
Layout {
size: size_of::<GstRTSPOnvifMedia>(),
alignment: align_of::<GstRTSPOnvifMedia>(),
},
),
(
"GstRTSPOnvifMediaClass",
Layout {
size: size_of::<GstRTSPOnvifMediaClass>(),
alignment: align_of::<GstRTSPOnvifMediaClass>(),
},
),
(
"GstRTSPOnvifMediaFactory",
Layout {
size: size_of::<GstRTSPOnvifMediaFactory>(),
alignment: align_of::<GstRTSPOnvifMediaFactory>(),
},
),
(
"GstRTSPOnvifMediaFactoryClass",
Layout {
size: size_of::<GstRTSPOnvifMediaFactoryClass>(),
alignment: align_of::<GstRTSPOnvifMediaFactoryClass>(),
},
),
(
"GstRTSPOnvifServer",
Layout {
size: size_of::<GstRTSPOnvifServer>(),
alignment: align_of::<GstRTSPOnvifServer>(),
},
),
(
"GstRTSPOnvifServerClass",
Layout {
size: size_of::<GstRTSPOnvifServerClass>(),
alignment: align_of::<GstRTSPOnvifServerClass>(),
},
),
(
"GstRTSPPermissions",
Layout {
size: size_of::<GstRTSPPermissions>(),
alignment: align_of::<GstRTSPPermissions>(),
},
),
(
"GstRTSPPublishClockMode",
Layout {
size: size_of::<GstRTSPPublishClockMode>(),
alignment: align_of::<GstRTSPPublishClockMode>(),
},
),
(
"GstRTSPServer",
Layout {
size: size_of::<GstRTSPServer>(),
alignment: align_of::<GstRTSPServer>(),
},
),
(
"GstRTSPServerClass",
Layout {
size: size_of::<GstRTSPServerClass>(),
alignment: align_of::<GstRTSPServerClass>(),
},
),
(
"GstRTSPSession",
Layout {
size: size_of::<GstRTSPSession>(),
alignment: align_of::<GstRTSPSession>(),
},
),
(
"GstRTSPSessionClass",
Layout {
size: size_of::<GstRTSPSessionClass>(),
alignment: align_of::<GstRTSPSessionClass>(),
},
),
(
"GstRTSPSessionMedia",
Layout {
size: size_of::<GstRTSPSessionMedia>(),
alignment: align_of::<GstRTSPSessionMedia>(),
},
),
(
"GstRTSPSessionMediaClass",
Layout {
size: size_of::<GstRTSPSessionMediaClass>(),
alignment: align_of::<GstRTSPSessionMediaClass>(),
},
),
(
"GstRTSPSessionPool",
Layout {
size: size_of::<GstRTSPSessionPool>(),
alignment: align_of::<GstRTSPSessionPool>(),
},
),
(
"GstRTSPSessionPoolClass",
Layout {
size: size_of::<GstRTSPSessionPoolClass>(),
alignment: align_of::<GstRTSPSessionPoolClass>(),
},
),
(
"GstRTSPStream",
Layout {
size: size_of::<GstRTSPStream>(),
alignment: align_of::<GstRTSPStream>(),
},
),
(
"GstRTSPStreamClass",
Layout {
size: size_of::<GstRTSPStreamClass>(),
alignment: align_of::<GstRTSPStreamClass>(),
},
),
(
"GstRTSPStreamTransport",
Layout {
size: size_of::<GstRTSPStreamTransport>(),
alignment: align_of::<GstRTSPStreamTransport>(),
},
),
(
"GstRTSPStreamTransportClass",
Layout {
size: size_of::<GstRTSPStreamTransportClass>(),
alignment: align_of::<GstRTSPStreamTransportClass>(),
},
),
(
"GstRTSPSuspendMode",
Layout {
size: size_of::<GstRTSPSuspendMode>(),
alignment: align_of::<GstRTSPSuspendMode>(),
},
),
(
"GstRTSPThread",
Layout {
size: size_of::<GstRTSPThread>(),
alignment: align_of::<GstRTSPThread>(),
},
),
(
"GstRTSPThreadPool",
Layout {
size: size_of::<GstRTSPThreadPool>(),
alignment: align_of::<GstRTSPThreadPool>(),
},
),
(
"GstRTSPThreadPoolClass",
Layout {
size: size_of::<GstRTSPThreadPoolClass>(),
alignment: align_of::<GstRTSPThreadPoolClass>(),
},
),
(
"GstRTSPThreadType",
Layout {
size: size_of::<GstRTSPThreadType>(),
alignment: align_of::<GstRTSPThreadType>(),
},
),
(
"GstRTSPToken",
Layout {
size: size_of::<GstRTSPToken>(),
alignment: align_of::<GstRTSPToken>(),
},
),
(
"GstRTSPTransportMode",
Layout {
size: size_of::<GstRTSPTransportMode>(),
alignment: align_of::<GstRTSPTransportMode>(),
},
),
(
"GstSDPInfo",
Layout {
size: size_of::<GstSDPInfo>(),
alignment: align_of::<GstSDPInfo>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -305,9 +612,18 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_RTSP_ADDRESS_POOL_ERESERVED", "-2"),
("(gint) GST_RTSP_ADDRESS_POOL_OK", "0"),
("GST_RTSP_AUTH_CHECK_CONNECT", "auth.check.connect"),
("GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS", "auth.check.media.factory.access"),
("GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT", "auth.check.media.factory.construct"),
("GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS", "auth.check.transport.client-settings"),
(
"GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS",
"auth.check.media.factory.access",
),
(
"GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT",
"auth.check.media.factory.construct",
),
(
"GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS",
"auth.check.transport.client-settings",
),
("GST_RTSP_AUTH_CHECK_URL", "auth.check.url"),
("(gint) GST_RTSP_FILTER_KEEP", "1"),
("(gint) GST_RTSP_FILTER_REF", "2"),
@ -318,9 +634,15 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_RTSP_MEDIA_STATUS_SUSPENDED", "4"),
("(gint) GST_RTSP_MEDIA_STATUS_UNPREPARED", "0"),
("(gint) GST_RTSP_MEDIA_STATUS_UNPREPARING", "1"),
("GST_RTSP_ONVIF_BACKCHANNEL_REQUIREMENT", "www.onvif.org/ver20/backchannel"),
(
"GST_RTSP_ONVIF_BACKCHANNEL_REQUIREMENT",
"www.onvif.org/ver20/backchannel",
),
("GST_RTSP_PERM_MEDIA_FACTORY_ACCESS", "media.factory.access"),
("GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT", "media.factory.construct"),
(
"GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT",
"media.factory.construct",
),
("(gint) GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK", "1"),
("(gint) GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET", "2"),
("(gint) GST_RTSP_PUBLISH_CLOCK_MODE_NONE", "0"),
@ -330,9 +652,10 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_RTSP_THREAD_TYPE_CLIENT", "0"),
("(gint) GST_RTSP_THREAD_TYPE_MEDIA", "1"),
("GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE", "media.factory.role"),
("GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS", "transport.client-settings"),
(
"GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS",
"transport.client-settings",
),
("(guint) GST_RTSP_TRANSPORT_MODE_PLAY", "1"),
("(guint) GST_RTSP_TRANSPORT_MODE_RECORD", "2"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -50,7 +50,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -72,8 +72,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -87,4 +89,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

View file

@ -5,13 +5,13 @@
extern crate gstreamer_rtsp_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_rtsp_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_rtsp_sys::*;
static PACKAGES: &[&str] = &["gstreamer-rtsp-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,47 +229,204 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstRTSPAuthCredential", Layout {size: size_of::<GstRTSPAuthCredential>(), alignment: align_of::<GstRTSPAuthCredential>()}),
("GstRTSPAuthMethod", Layout {size: size_of::<GstRTSPAuthMethod>(), alignment: align_of::<GstRTSPAuthMethod>()}),
("GstRTSPAuthParam", Layout {size: size_of::<GstRTSPAuthParam>(), alignment: align_of::<GstRTSPAuthParam>()}),
("GstRTSPEvent", Layout {size: size_of::<GstRTSPEvent>(), alignment: align_of::<GstRTSPEvent>()}),
("GstRTSPExtensionInterface", Layout {size: size_of::<GstRTSPExtensionInterface>(), alignment: align_of::<GstRTSPExtensionInterface>()}),
("GstRTSPFamily", Layout {size: size_of::<GstRTSPFamily>(), alignment: align_of::<GstRTSPFamily>()}),
("GstRTSPHeaderField", Layout {size: size_of::<GstRTSPHeaderField>(), alignment: align_of::<GstRTSPHeaderField>()}),
("GstRTSPLowerTrans", Layout {size: size_of::<GstRTSPLowerTrans>(), alignment: align_of::<GstRTSPLowerTrans>()}),
("GstRTSPMessage", Layout {size: size_of::<GstRTSPMessage>(), alignment: align_of::<GstRTSPMessage>()}),
("GstRTSPMethod", Layout {size: size_of::<GstRTSPMethod>(), alignment: align_of::<GstRTSPMethod>()}),
("GstRTSPMsgType", Layout {size: size_of::<GstRTSPMsgType>(), alignment: align_of::<GstRTSPMsgType>()}),
("GstRTSPProfile", Layout {size: size_of::<GstRTSPProfile>(), alignment: align_of::<GstRTSPProfile>()}),
("GstRTSPRange", Layout {size: size_of::<GstRTSPRange>(), alignment: align_of::<GstRTSPRange>()}),
("GstRTSPRangeUnit", Layout {size: size_of::<GstRTSPRangeUnit>(), alignment: align_of::<GstRTSPRangeUnit>()}),
("GstRTSPResult", Layout {size: size_of::<GstRTSPResult>(), alignment: align_of::<GstRTSPResult>()}),
("GstRTSPState", Layout {size: size_of::<GstRTSPState>(), alignment: align_of::<GstRTSPState>()}),
("GstRTSPStatusCode", Layout {size: size_of::<GstRTSPStatusCode>(), alignment: align_of::<GstRTSPStatusCode>()}),
("GstRTSPTime", Layout {size: size_of::<GstRTSPTime>(), alignment: align_of::<GstRTSPTime>()}),
("GstRTSPTime2", Layout {size: size_of::<GstRTSPTime2>(), alignment: align_of::<GstRTSPTime2>()}),
("GstRTSPTimeRange", Layout {size: size_of::<GstRTSPTimeRange>(), alignment: align_of::<GstRTSPTimeRange>()}),
("GstRTSPTimeType", Layout {size: size_of::<GstRTSPTimeType>(), alignment: align_of::<GstRTSPTimeType>()}),
("GstRTSPTransMode", Layout {size: size_of::<GstRTSPTransMode>(), alignment: align_of::<GstRTSPTransMode>()}),
("GstRTSPTransport", Layout {size: size_of::<GstRTSPTransport>(), alignment: align_of::<GstRTSPTransport>()}),
("GstRTSPUrl", Layout {size: size_of::<GstRTSPUrl>(), alignment: align_of::<GstRTSPUrl>()}),
("GstRTSPVersion", Layout {size: size_of::<GstRTSPVersion>(), alignment: align_of::<GstRTSPVersion>()}),
("GstRTSPWatchFuncs", Layout {size: size_of::<GstRTSPWatchFuncs>(), alignment: align_of::<GstRTSPWatchFuncs>()}),
(
"GstRTSPAuthCredential",
Layout {
size: size_of::<GstRTSPAuthCredential>(),
alignment: align_of::<GstRTSPAuthCredential>(),
},
),
(
"GstRTSPAuthMethod",
Layout {
size: size_of::<GstRTSPAuthMethod>(),
alignment: align_of::<GstRTSPAuthMethod>(),
},
),
(
"GstRTSPAuthParam",
Layout {
size: size_of::<GstRTSPAuthParam>(),
alignment: align_of::<GstRTSPAuthParam>(),
},
),
(
"GstRTSPEvent",
Layout {
size: size_of::<GstRTSPEvent>(),
alignment: align_of::<GstRTSPEvent>(),
},
),
(
"GstRTSPExtensionInterface",
Layout {
size: size_of::<GstRTSPExtensionInterface>(),
alignment: align_of::<GstRTSPExtensionInterface>(),
},
),
(
"GstRTSPFamily",
Layout {
size: size_of::<GstRTSPFamily>(),
alignment: align_of::<GstRTSPFamily>(),
},
),
(
"GstRTSPHeaderField",
Layout {
size: size_of::<GstRTSPHeaderField>(),
alignment: align_of::<GstRTSPHeaderField>(),
},
),
(
"GstRTSPLowerTrans",
Layout {
size: size_of::<GstRTSPLowerTrans>(),
alignment: align_of::<GstRTSPLowerTrans>(),
},
),
(
"GstRTSPMessage",
Layout {
size: size_of::<GstRTSPMessage>(),
alignment: align_of::<GstRTSPMessage>(),
},
),
(
"GstRTSPMethod",
Layout {
size: size_of::<GstRTSPMethod>(),
alignment: align_of::<GstRTSPMethod>(),
},
),
(
"GstRTSPMsgType",
Layout {
size: size_of::<GstRTSPMsgType>(),
alignment: align_of::<GstRTSPMsgType>(),
},
),
(
"GstRTSPProfile",
Layout {
size: size_of::<GstRTSPProfile>(),
alignment: align_of::<GstRTSPProfile>(),
},
),
(
"GstRTSPRange",
Layout {
size: size_of::<GstRTSPRange>(),
alignment: align_of::<GstRTSPRange>(),
},
),
(
"GstRTSPRangeUnit",
Layout {
size: size_of::<GstRTSPRangeUnit>(),
alignment: align_of::<GstRTSPRangeUnit>(),
},
),
(
"GstRTSPResult",
Layout {
size: size_of::<GstRTSPResult>(),
alignment: align_of::<GstRTSPResult>(),
},
),
(
"GstRTSPState",
Layout {
size: size_of::<GstRTSPState>(),
alignment: align_of::<GstRTSPState>(),
},
),
(
"GstRTSPStatusCode",
Layout {
size: size_of::<GstRTSPStatusCode>(),
alignment: align_of::<GstRTSPStatusCode>(),
},
),
(
"GstRTSPTime",
Layout {
size: size_of::<GstRTSPTime>(),
alignment: align_of::<GstRTSPTime>(),
},
),
(
"GstRTSPTime2",
Layout {
size: size_of::<GstRTSPTime2>(),
alignment: align_of::<GstRTSPTime2>(),
},
),
(
"GstRTSPTimeRange",
Layout {
size: size_of::<GstRTSPTimeRange>(),
alignment: align_of::<GstRTSPTimeRange>(),
},
),
(
"GstRTSPTimeType",
Layout {
size: size_of::<GstRTSPTimeType>(),
alignment: align_of::<GstRTSPTimeType>(),
},
),
(
"GstRTSPTransMode",
Layout {
size: size_of::<GstRTSPTransMode>(),
alignment: align_of::<GstRTSPTransMode>(),
},
),
(
"GstRTSPTransport",
Layout {
size: size_of::<GstRTSPTransport>(),
alignment: align_of::<GstRTSPTransport>(),
},
),
(
"GstRTSPUrl",
Layout {
size: size_of::<GstRTSPUrl>(),
alignment: align_of::<GstRTSPUrl>(),
},
),
(
"GstRTSPVersion",
Layout {
size: size_of::<GstRTSPVersion>(),
alignment: align_of::<GstRTSPVersion>(),
},
),
(
"GstRTSPWatchFuncs",
Layout {
size: size_of::<GstRTSPWatchFuncs>(),
alignment: align_of::<GstRTSPWatchFuncs>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -435,7 +598,10 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_RTSP_STS_FORBIDDEN", "403"),
("(gint) GST_RTSP_STS_GATEWAY_TIMEOUT", "504"),
("(gint) GST_RTSP_STS_GONE", "410"),
("(gint) GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE", "456"),
(
"(gint) GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE",
"456",
),
("(gint) GST_RTSP_STS_INTERNAL_SERVER_ERROR", "500"),
("(gint) GST_RTSP_STS_INVALID", "0"),
("(gint) GST_RTSP_STS_INVALID_RANGE", "457"),
@ -453,7 +619,10 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_RTSP_STS_NOT_IMPLEMENTED", "501"),
("(gint) GST_RTSP_STS_NOT_MODIFIED", "304"),
("(gint) GST_RTSP_STS_OK", "200"),
("(gint) GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED", "460"),
(
"(gint) GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED",
"460",
),
("(gint) GST_RTSP_STS_OPTION_NOT_SUPPORTED", "551"),
("(gint) GST_RTSP_STS_PARAMETER_IS_READONLY", "458"),
("(gint) GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD", "451"),
@ -485,5 +654,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_RTSP_VERSION_2_0", "32"),
("(gint) GST_RTSP_VERSION_INVALID", "0"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

View file

@ -5,13 +5,13 @@
extern crate gstreamer_sdp_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_sdp_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_sdp_sys::*;
static PACKAGES: &[&str] = &["gstreamer-sdp-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,53 +229,246 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstMIKEYCacheType", Layout {size: size_of::<GstMIKEYCacheType>(), alignment: align_of::<GstMIKEYCacheType>()}),
("GstMIKEYEncAlg", Layout {size: size_of::<GstMIKEYEncAlg>(), alignment: align_of::<GstMIKEYEncAlg>()}),
("GstMIKEYKVType", Layout {size: size_of::<GstMIKEYKVType>(), alignment: align_of::<GstMIKEYKVType>()}),
("GstMIKEYKeyDataType", Layout {size: size_of::<GstMIKEYKeyDataType>(), alignment: align_of::<GstMIKEYKeyDataType>()}),
("GstMIKEYMacAlg", Layout {size: size_of::<GstMIKEYMacAlg>(), alignment: align_of::<GstMIKEYMacAlg>()}),
("GstMIKEYMapSRTP", Layout {size: size_of::<GstMIKEYMapSRTP>(), alignment: align_of::<GstMIKEYMapSRTP>()}),
("GstMIKEYMapType", Layout {size: size_of::<GstMIKEYMapType>(), alignment: align_of::<GstMIKEYMapType>()}),
("GstMIKEYMessage", Layout {size: size_of::<GstMIKEYMessage>(), alignment: align_of::<GstMIKEYMessage>()}),
("GstMIKEYPRFFunc", Layout {size: size_of::<GstMIKEYPRFFunc>(), alignment: align_of::<GstMIKEYPRFFunc>()}),
("GstMIKEYPayload", Layout {size: size_of::<GstMIKEYPayload>(), alignment: align_of::<GstMIKEYPayload>()}),
("GstMIKEYPayloadKEMAC", Layout {size: size_of::<GstMIKEYPayloadKEMAC>(), alignment: align_of::<GstMIKEYPayloadKEMAC>()}),
("GstMIKEYPayloadKeyData", Layout {size: size_of::<GstMIKEYPayloadKeyData>(), alignment: align_of::<GstMIKEYPayloadKeyData>()}),
("GstMIKEYPayloadPKE", Layout {size: size_of::<GstMIKEYPayloadPKE>(), alignment: align_of::<GstMIKEYPayloadPKE>()}),
("GstMIKEYPayloadRAND", Layout {size: size_of::<GstMIKEYPayloadRAND>(), alignment: align_of::<GstMIKEYPayloadRAND>()}),
("GstMIKEYPayloadSP", Layout {size: size_of::<GstMIKEYPayloadSP>(), alignment: align_of::<GstMIKEYPayloadSP>()}),
("GstMIKEYPayloadSPParam", Layout {size: size_of::<GstMIKEYPayloadSPParam>(), alignment: align_of::<GstMIKEYPayloadSPParam>()}),
("GstMIKEYPayloadT", Layout {size: size_of::<GstMIKEYPayloadT>(), alignment: align_of::<GstMIKEYPayloadT>()}),
("GstMIKEYPayloadType", Layout {size: size_of::<GstMIKEYPayloadType>(), alignment: align_of::<GstMIKEYPayloadType>()}),
("GstMIKEYSecProto", Layout {size: size_of::<GstMIKEYSecProto>(), alignment: align_of::<GstMIKEYSecProto>()}),
("GstMIKEYSecSRTP", Layout {size: size_of::<GstMIKEYSecSRTP>(), alignment: align_of::<GstMIKEYSecSRTP>()}),
("GstMIKEYTSType", Layout {size: size_of::<GstMIKEYTSType>(), alignment: align_of::<GstMIKEYTSType>()}),
("GstMIKEYType", Layout {size: size_of::<GstMIKEYType>(), alignment: align_of::<GstMIKEYType>()}),
("GstSDPAttribute", Layout {size: size_of::<GstSDPAttribute>(), alignment: align_of::<GstSDPAttribute>()}),
("GstSDPBandwidth", Layout {size: size_of::<GstSDPBandwidth>(), alignment: align_of::<GstSDPBandwidth>()}),
("GstSDPConnection", Layout {size: size_of::<GstSDPConnection>(), alignment: align_of::<GstSDPConnection>()}),
("GstSDPKey", Layout {size: size_of::<GstSDPKey>(), alignment: align_of::<GstSDPKey>()}),
("GstSDPMedia", Layout {size: size_of::<GstSDPMedia>(), alignment: align_of::<GstSDPMedia>()}),
("GstSDPMessage", Layout {size: size_of::<GstSDPMessage>(), alignment: align_of::<GstSDPMessage>()}),
("GstSDPOrigin", Layout {size: size_of::<GstSDPOrigin>(), alignment: align_of::<GstSDPOrigin>()}),
("GstSDPResult", Layout {size: size_of::<GstSDPResult>(), alignment: align_of::<GstSDPResult>()}),
("GstSDPTime", Layout {size: size_of::<GstSDPTime>(), alignment: align_of::<GstSDPTime>()}),
("GstSDPZone", Layout {size: size_of::<GstSDPZone>(), alignment: align_of::<GstSDPZone>()}),
(
"GstMIKEYCacheType",
Layout {
size: size_of::<GstMIKEYCacheType>(),
alignment: align_of::<GstMIKEYCacheType>(),
},
),
(
"GstMIKEYEncAlg",
Layout {
size: size_of::<GstMIKEYEncAlg>(),
alignment: align_of::<GstMIKEYEncAlg>(),
},
),
(
"GstMIKEYKVType",
Layout {
size: size_of::<GstMIKEYKVType>(),
alignment: align_of::<GstMIKEYKVType>(),
},
),
(
"GstMIKEYKeyDataType",
Layout {
size: size_of::<GstMIKEYKeyDataType>(),
alignment: align_of::<GstMIKEYKeyDataType>(),
},
),
(
"GstMIKEYMacAlg",
Layout {
size: size_of::<GstMIKEYMacAlg>(),
alignment: align_of::<GstMIKEYMacAlg>(),
},
),
(
"GstMIKEYMapSRTP",
Layout {
size: size_of::<GstMIKEYMapSRTP>(),
alignment: align_of::<GstMIKEYMapSRTP>(),
},
),
(
"GstMIKEYMapType",
Layout {
size: size_of::<GstMIKEYMapType>(),
alignment: align_of::<GstMIKEYMapType>(),
},
),
(
"GstMIKEYMessage",
Layout {
size: size_of::<GstMIKEYMessage>(),
alignment: align_of::<GstMIKEYMessage>(),
},
),
(
"GstMIKEYPRFFunc",
Layout {
size: size_of::<GstMIKEYPRFFunc>(),
alignment: align_of::<GstMIKEYPRFFunc>(),
},
),
(
"GstMIKEYPayload",
Layout {
size: size_of::<GstMIKEYPayload>(),
alignment: align_of::<GstMIKEYPayload>(),
},
),
(
"GstMIKEYPayloadKEMAC",
Layout {
size: size_of::<GstMIKEYPayloadKEMAC>(),
alignment: align_of::<GstMIKEYPayloadKEMAC>(),
},
),
(
"GstMIKEYPayloadKeyData",
Layout {
size: size_of::<GstMIKEYPayloadKeyData>(),
alignment: align_of::<GstMIKEYPayloadKeyData>(),
},
),
(
"GstMIKEYPayloadPKE",
Layout {
size: size_of::<GstMIKEYPayloadPKE>(),
alignment: align_of::<GstMIKEYPayloadPKE>(),
},
),
(
"GstMIKEYPayloadRAND",
Layout {
size: size_of::<GstMIKEYPayloadRAND>(),
alignment: align_of::<GstMIKEYPayloadRAND>(),
},
),
(
"GstMIKEYPayloadSP",
Layout {
size: size_of::<GstMIKEYPayloadSP>(),
alignment: align_of::<GstMIKEYPayloadSP>(),
},
),
(
"GstMIKEYPayloadSPParam",
Layout {
size: size_of::<GstMIKEYPayloadSPParam>(),
alignment: align_of::<GstMIKEYPayloadSPParam>(),
},
),
(
"GstMIKEYPayloadT",
Layout {
size: size_of::<GstMIKEYPayloadT>(),
alignment: align_of::<GstMIKEYPayloadT>(),
},
),
(
"GstMIKEYPayloadType",
Layout {
size: size_of::<GstMIKEYPayloadType>(),
alignment: align_of::<GstMIKEYPayloadType>(),
},
),
(
"GstMIKEYSecProto",
Layout {
size: size_of::<GstMIKEYSecProto>(),
alignment: align_of::<GstMIKEYSecProto>(),
},
),
(
"GstMIKEYSecSRTP",
Layout {
size: size_of::<GstMIKEYSecSRTP>(),
alignment: align_of::<GstMIKEYSecSRTP>(),
},
),
(
"GstMIKEYTSType",
Layout {
size: size_of::<GstMIKEYTSType>(),
alignment: align_of::<GstMIKEYTSType>(),
},
),
(
"GstMIKEYType",
Layout {
size: size_of::<GstMIKEYType>(),
alignment: align_of::<GstMIKEYType>(),
},
),
(
"GstSDPAttribute",
Layout {
size: size_of::<GstSDPAttribute>(),
alignment: align_of::<GstSDPAttribute>(),
},
),
(
"GstSDPBandwidth",
Layout {
size: size_of::<GstSDPBandwidth>(),
alignment: align_of::<GstSDPBandwidth>(),
},
),
(
"GstSDPConnection",
Layout {
size: size_of::<GstSDPConnection>(),
alignment: align_of::<GstSDPConnection>(),
},
),
(
"GstSDPKey",
Layout {
size: size_of::<GstSDPKey>(),
alignment: align_of::<GstSDPKey>(),
},
),
(
"GstSDPMedia",
Layout {
size: size_of::<GstSDPMedia>(),
alignment: align_of::<GstSDPMedia>(),
},
),
(
"GstSDPMessage",
Layout {
size: size_of::<GstSDPMessage>(),
alignment: align_of::<GstSDPMessage>(),
},
),
(
"GstSDPOrigin",
Layout {
size: size_of::<GstSDPOrigin>(),
alignment: align_of::<GstSDPOrigin>(),
},
),
(
"GstSDPResult",
Layout {
size: size_of::<GstSDPResult>(),
alignment: align_of::<GstSDPResult>(),
},
),
(
"GstSDPTime",
Layout {
size: size_of::<GstSDPTime>(),
alignment: align_of::<GstSDPTime>(),
},
),
(
"GstSDPZone",
Layout {
size: size_of::<GstSDPZone>(),
alignment: align_of::<GstSDPZone>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -340,5 +539,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_SDP_EINVAL", "-1"),
("(gint) GST_SDP_OK", "0"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -52,7 +52,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -74,8 +74,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -89,4 +91,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -48,7 +48,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -70,8 +70,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -85,4 +87,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

View file

@ -3,18 +3,23 @@
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
#![allow(
clippy::approx_constant,
clippy::type_complexity,
clippy::unreadable_literal
)]
extern crate libc;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
extern crate gstreamer_base_sys as gst_base;
extern crate gstreamer_sys as gst;
extern crate libc;
#[allow(unused_imports)]
use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
c_short, c_ushort, c_long, c_ulong,
c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
@ -48,41 +53,70 @@ pub const GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO: GstTagImageType = 17;
pub const GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO: GstTagImageType = 18;
// Constants
pub const GST_TAG_CAPTURING_CONTRAST: *const c_char = b"capturing-contrast\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO: *const c_char = b"capturing-digital-zoom-ratio\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_EXPOSURE_COMPENSATION: *const c_char = b"capturing-exposure-compensation\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_EXPOSURE_MODE: *const c_char = b"capturing-exposure-mode\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_EXPOSURE_PROGRAM: *const c_char = b"capturing-exposure-program\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FLASH_FIRED: *const c_char = b"capturing-flash-fired\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FLASH_MODE: *const c_char = b"capturing-flash-mode\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FOCAL_LENGTH: *const c_char = b"capturing-focal-length\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM: *const c_char = b"capturing-focal-length-35mm\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FOCAL_RATIO: *const c_char = b"capturing-focal-ratio\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_GAIN_ADJUSTMENT: *const c_char = b"capturing-gain-adjustment\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_ISO_SPEED: *const c_char = b"capturing-iso-speed\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_METERING_MODE: *const c_char = b"capturing-metering-mode\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SATURATION: *const c_char = b"capturing-saturation\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE: *const c_char = b"capturing-scene-capture-type\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SHARPNESS: *const c_char = b"capturing-sharpness\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SHUTTER_SPEED: *const c_char = b"capturing-shutter-speed\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SOURCE: *const c_char = b"capturing-source\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_WHITE_BALANCE: *const c_char = b"capturing-white-balance\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_CONTRAST: *const c_char =
b"capturing-contrast\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO: *const c_char =
b"capturing-digital-zoom-ratio\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_EXPOSURE_COMPENSATION: *const c_char =
b"capturing-exposure-compensation\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_EXPOSURE_MODE: *const c_char =
b"capturing-exposure-mode\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_EXPOSURE_PROGRAM: *const c_char =
b"capturing-exposure-program\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FLASH_FIRED: *const c_char =
b"capturing-flash-fired\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FLASH_MODE: *const c_char =
b"capturing-flash-mode\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FOCAL_LENGTH: *const c_char =
b"capturing-focal-length\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM: *const c_char =
b"capturing-focal-length-35mm\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_FOCAL_RATIO: *const c_char =
b"capturing-focal-ratio\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_GAIN_ADJUSTMENT: *const c_char =
b"capturing-gain-adjustment\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_ISO_SPEED: *const c_char =
b"capturing-iso-speed\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_METERING_MODE: *const c_char =
b"capturing-metering-mode\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SATURATION: *const c_char =
b"capturing-saturation\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE: *const c_char =
b"capturing-scene-capture-type\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SHARPNESS: *const c_char =
b"capturing-sharpness\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SHUTTER_SPEED: *const c_char =
b"capturing-shutter-speed\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_SOURCE: *const c_char =
b"capturing-source\0" as *const u8 as *const c_char;
pub const GST_TAG_CAPTURING_WHITE_BALANCE: *const c_char =
b"capturing-white-balance\0" as *const u8 as *const c_char;
pub const GST_TAG_CDDA_CDDB_DISCID: *const c_char = b"discid\0" as *const u8 as *const c_char;
pub const GST_TAG_CDDA_CDDB_DISCID_FULL: *const c_char = b"discid-full\0" as *const u8 as *const c_char;
pub const GST_TAG_CDDA_MUSICBRAINZ_DISCID: *const c_char = b"musicbrainz-discid\0" as *const u8 as *const c_char;
pub const GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL: *const c_char = b"musicbrainz-discid-full\0" as *const u8 as *const c_char;
pub const GST_TAG_CDDA_CDDB_DISCID_FULL: *const c_char =
b"discid-full\0" as *const u8 as *const c_char;
pub const GST_TAG_CDDA_MUSICBRAINZ_DISCID: *const c_char =
b"musicbrainz-discid\0" as *const u8 as *const c_char;
pub const GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL: *const c_char =
b"musicbrainz-discid-full\0" as *const u8 as *const c_char;
pub const GST_TAG_CMML_CLIP: *const c_char = b"cmml-clip\0" as *const u8 as *const c_char;
pub const GST_TAG_CMML_HEAD: *const c_char = b"cmml-head\0" as *const u8 as *const c_char;
pub const GST_TAG_CMML_STREAM: *const c_char = b"cmml-stream\0" as *const u8 as *const c_char;
pub const GST_TAG_ID3V2_HEADER_SIZE: c_int = 10;
pub const GST_TAG_IMAGE_HORIZONTAL_PPI: *const c_char = b"image-horizontal-ppi\0" as *const u8 as *const c_char;
pub const GST_TAG_IMAGE_VERTICAL_PPI: *const c_char = b"image-vertical-ppi\0" as *const u8 as *const c_char;
pub const GST_TAG_IMAGE_HORIZONTAL_PPI: *const c_char =
b"image-horizontal-ppi\0" as *const u8 as *const c_char;
pub const GST_TAG_IMAGE_VERTICAL_PPI: *const c_char =
b"image-vertical-ppi\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICAL_KEY: *const c_char = b"musical-key\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_ALBUMARTISTID: *const c_char = b"musicbrainz-albumartistid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_ALBUMID: *const c_char = b"musicbrainz-albumid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_ARTISTID: *const c_char = b"musicbrainz-artistid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_TRACKID: *const c_char = b"musicbrainz-trackid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_TRMID: *const c_char = b"musicbrainz-trmid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_ALBUMARTISTID: *const c_char =
b"musicbrainz-albumartistid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_ALBUMID: *const c_char =
b"musicbrainz-albumid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_ARTISTID: *const c_char =
b"musicbrainz-artistid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_TRACKID: *const c_char =
b"musicbrainz-trackid\0" as *const u8 as *const c_char;
pub const GST_TAG_MUSICBRAINZ_TRMID: *const c_char =
b"musicbrainz-trmid\0" as *const u8 as *const c_char;
// Flags
pub type GstTagLicenseFlags = c_uint;
@ -108,22 +142,43 @@ pub struct GstTagDemuxClass {
pub parent_class: gst::GstElementClass,
pub min_start_size: c_uint,
pub min_end_size: c_uint,
pub identify_tag: Option<unsafe extern "C" fn(*mut GstTagDemux, *mut gst::GstBuffer, gboolean, *mut c_uint) -> gboolean>,
pub parse_tag: Option<unsafe extern "C" fn(*mut GstTagDemux, *mut gst::GstBuffer, gboolean, *mut c_uint, *mut *mut gst::GstTagList) -> GstTagDemuxResult>,
pub merge_tags: Option<unsafe extern "C" fn(*mut GstTagDemux, *const gst::GstTagList, *const gst::GstTagList) -> *mut gst::GstTagList>,
pub identify_tag: Option<
unsafe extern "C" fn(
*mut GstTagDemux,
*mut gst::GstBuffer,
gboolean,
*mut c_uint,
) -> gboolean,
>,
pub parse_tag: Option<
unsafe extern "C" fn(
*mut GstTagDemux,
*mut gst::GstBuffer,
gboolean,
*mut c_uint,
*mut *mut gst::GstTagList,
) -> GstTagDemuxResult,
>,
pub merge_tags: Option<
unsafe extern "C" fn(
*mut GstTagDemux,
*const gst::GstTagList,
*const gst::GstTagList,
) -> *mut gst::GstTagList,
>,
pub reserved: [gpointer; 4],
}
impl ::std::fmt::Debug for GstTagDemuxClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstTagDemuxClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("min_start_size", &self.min_start_size)
.field("min_end_size", &self.min_end_size)
.field("identify_tag", &self.identify_tag)
.field("parse_tag", &self.parse_tag)
.field("merge_tags", &self.merge_tags)
.finish()
.field("parent_class", &self.parent_class)
.field("min_start_size", &self.min_start_size)
.field("min_end_size", &self.min_end_size)
.field("identify_tag", &self.identify_tag)
.field("parse_tag", &self.parse_tag)
.field("merge_tags", &self.merge_tags)
.finish()
}
}
@ -136,18 +191,20 @@ pub type GstTagDemuxPrivate = *mut _GstTagDemuxPrivate;
#[derive(Copy, Clone)]
pub struct GstTagMuxClass {
pub parent_class: gst::GstElementClass,
pub render_start_tag: Option<unsafe extern "C" fn(*mut GstTagMux, *const gst::GstTagList) -> *mut gst::GstBuffer>,
pub render_end_tag: Option<unsafe extern "C" fn(*mut GstTagMux, *const gst::GstTagList) -> *mut gst::GstBuffer>,
pub render_start_tag:
Option<unsafe extern "C" fn(*mut GstTagMux, *const gst::GstTagList) -> *mut gst::GstBuffer>,
pub render_end_tag:
Option<unsafe extern "C" fn(*mut GstTagMux, *const gst::GstTagList) -> *mut gst::GstBuffer>,
pub _gst_reserved: [gpointer; 4],
}
impl ::std::fmt::Debug for GstTagMuxClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstTagMuxClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("render_start_tag", &self.render_start_tag)
.field("render_end_tag", &self.render_end_tag)
.finish()
.field("parent_class", &self.parent_class)
.field("render_start_tag", &self.render_start_tag)
.field("render_end_tag", &self.render_end_tag)
.finish()
}
}
@ -164,9 +221,12 @@ pub struct GstTagXmpWriterInterface {
impl ::std::fmt::Debug for GstTagXmpWriterInterface {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstTagXmpWriterInterface @ {:?}", self as *const _))
.field("parent", &self.parent)
.finish()
f.debug_struct(&format!(
"GstTagXmpWriterInterface @ {:?}",
self as *const _
))
.field("parent", &self.parent)
.finish()
}
}
@ -182,8 +242,8 @@ pub struct GstTagDemux {
impl ::std::fmt::Debug for GstTagDemux {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstTagDemux @ {:?}", self as *const _))
.field("element", &self.element)
.finish()
.field("element", &self.element)
.finish()
}
}
@ -198,8 +258,8 @@ pub struct GstTagMux {
impl ::std::fmt::Debug for GstTagMux {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstTagMux @ {:?}", self as *const _))
.field("element", &self.element)
.finish()
.field("element", &self.element)
.finish()
}
}
@ -213,7 +273,6 @@ impl ::std::fmt::Debug for GstTagXmpWriter {
}
}
extern "C" {
//=========================================================================
@ -247,18 +306,32 @@ extern "C" {
pub fn gst_tag_xmp_writer_get_type() -> GType;
pub fn gst_tag_xmp_writer_add_all_schemas(config: *mut GstTagXmpWriter);
pub fn gst_tag_xmp_writer_add_schema(config: *mut GstTagXmpWriter, schema: *const c_char);
pub fn gst_tag_xmp_writer_has_schema(config: *mut GstTagXmpWriter, schema: *const c_char) -> gboolean;
pub fn gst_tag_xmp_writer_has_schema(
config: *mut GstTagXmpWriter,
schema: *const c_char,
) -> gboolean;
pub fn gst_tag_xmp_writer_remove_all_schemas(config: *mut GstTagXmpWriter);
pub fn gst_tag_xmp_writer_remove_schema(config: *mut GstTagXmpWriter, schema: *const c_char);
pub fn gst_tag_xmp_writer_tag_list_to_xmp_buffer(config: *mut GstTagXmpWriter, taglist: *const gst::GstTagList, read_only: gboolean) -> *mut gst::GstBuffer;
pub fn gst_tag_xmp_writer_tag_list_to_xmp_buffer(
config: *mut GstTagXmpWriter,
taglist: *const gst::GstTagList,
read_only: gboolean,
) -> *mut gst::GstBuffer;
//=========================================================================
// Other functions
//=========================================================================
pub fn gst_tag_check_language_code(lang_code: *const c_char) -> gboolean;
pub fn gst_tag_freeform_string_to_utf8(data: *const c_char, size: c_int, env_vars: *mut *const c_char) -> *mut c_char;
pub fn gst_tag_freeform_string_to_utf8(
data: *const c_char,
size: c_int,
env_vars: *mut *const c_char,
) -> *mut c_char;
pub fn gst_tag_from_id3_tag(id3_tag: *const c_char) -> *const c_char;
pub fn gst_tag_from_id3_user_tag(type_: *const c_char, id3_user_tag: *const c_char) -> *const c_char;
pub fn gst_tag_from_id3_user_tag(
type_: *const c_char,
id3_user_tag: *const c_char,
) -> *const c_char;
pub fn gst_tag_from_vorbis_tag(vorbis_tag: *const c_char) -> *const c_char;
pub fn gst_tag_get_id3v2_tag_size(buffer: *mut gst::GstBuffer) -> c_uint;
pub fn gst_tag_get_language_code_iso_639_1(lang_code: *const c_char) -> *const c_char;
@ -275,23 +348,73 @@ extern "C" {
pub fn gst_tag_get_licenses() -> *mut *mut c_char;
pub fn gst_tag_id3_genre_count() -> c_uint;
pub fn gst_tag_id3_genre_get(id: c_uint) -> *const c_char;
pub fn gst_tag_image_data_to_image_sample(image_data: *const u8, image_data_len: c_uint, image_type: GstTagImageType) -> *mut gst::GstSample;
pub fn gst_tag_list_add_id3_image(tag_list: *mut gst::GstTagList, image_data: *const u8, image_data_len: c_uint, id3_picture_type: c_uint) -> gboolean;
pub fn gst_tag_list_from_exif_buffer(buffer: *mut gst::GstBuffer, byte_order: c_int, base_offset: u32) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_exif_buffer_with_tiff_header(buffer: *mut gst::GstBuffer) -> *mut gst::GstTagList;
pub fn gst_tag_image_data_to_image_sample(
image_data: *const u8,
image_data_len: c_uint,
image_type: GstTagImageType,
) -> *mut gst::GstSample;
pub fn gst_tag_list_add_id3_image(
tag_list: *mut gst::GstTagList,
image_data: *const u8,
image_data_len: c_uint,
id3_picture_type: c_uint,
) -> gboolean;
pub fn gst_tag_list_from_exif_buffer(
buffer: *mut gst::GstBuffer,
byte_order: c_int,
base_offset: u32,
) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_exif_buffer_with_tiff_header(
buffer: *mut gst::GstBuffer,
) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_id3v2_tag(buffer: *mut gst::GstBuffer) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_vorbiscomment(data: *const u8, size: size_t, id_data: *const u8, id_data_length: c_uint, vendor_string: *mut *mut c_char) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_vorbiscomment_buffer(buffer: *mut gst::GstBuffer, id_data: *const u8, id_data_length: c_uint, vendor_string: *mut *mut c_char) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_vorbiscomment(
data: *const u8,
size: size_t,
id_data: *const u8,
id_data_length: c_uint,
vendor_string: *mut *mut c_char,
) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_vorbiscomment_buffer(
buffer: *mut gst::GstBuffer,
id_data: *const u8,
id_data_length: c_uint,
vendor_string: *mut *mut c_char,
) -> *mut gst::GstTagList;
pub fn gst_tag_list_from_xmp_buffer(buffer: *mut gst::GstBuffer) -> *mut gst::GstTagList;
pub fn gst_tag_list_new_from_id3v1(data: *const [u8; 128]) -> *mut gst::GstTagList;
pub fn gst_tag_list_to_exif_buffer(taglist: *const gst::GstTagList, byte_order: c_int, base_offset: u32) -> *mut gst::GstBuffer;
pub fn gst_tag_list_to_exif_buffer_with_tiff_header(taglist: *const gst::GstTagList) -> *mut gst::GstBuffer;
pub fn gst_tag_list_to_vorbiscomment_buffer(list: *const gst::GstTagList, id_data: *const u8, id_data_length: c_uint, vendor_string: *const c_char) -> *mut gst::GstBuffer;
pub fn gst_tag_list_to_xmp_buffer(list: *const gst::GstTagList, read_only: gboolean, schemas: *mut *const c_char) -> *mut gst::GstBuffer;
pub fn gst_tag_parse_extended_comment(ext_comment: *const c_char, key: *mut *mut c_char, lang: *mut *mut c_char, value: *mut *mut c_char, fail_if_no_key: gboolean) -> gboolean;
pub fn gst_tag_list_to_exif_buffer(
taglist: *const gst::GstTagList,
byte_order: c_int,
base_offset: u32,
) -> *mut gst::GstBuffer;
pub fn gst_tag_list_to_exif_buffer_with_tiff_header(
taglist: *const gst::GstTagList,
) -> *mut gst::GstBuffer;
pub fn gst_tag_list_to_vorbiscomment_buffer(
list: *const gst::GstTagList,
id_data: *const u8,
id_data_length: c_uint,
vendor_string: *const c_char,
) -> *mut gst::GstBuffer;
pub fn gst_tag_list_to_xmp_buffer(
list: *const gst::GstTagList,
read_only: gboolean,
schemas: *mut *const c_char,
) -> *mut gst::GstBuffer;
pub fn gst_tag_parse_extended_comment(
ext_comment: *const c_char,
key: *mut *mut c_char,
lang: *mut *mut c_char,
value: *mut *mut c_char,
fail_if_no_key: gboolean,
) -> gboolean;
pub fn gst_tag_register_musicbrainz_tags();
pub fn gst_tag_to_id3_tag(gst_tag: *const c_char) -> *const c_char;
pub fn gst_tag_to_vorbis_comments(list: *const gst::GstTagList, tag: *const c_char) -> *mut glib::GList;
pub fn gst_tag_to_vorbis_comments(
list: *const gst::GstTagList,
tag: *const c_char,
) -> *mut glib::GList;
pub fn gst_tag_to_vorbis_tag(gst_tag: *const c_char) -> *const c_char;
pub fn gst_tag_xmp_list_schemas() -> *mut *const c_char;
pub fn gst_vorbis_tag_add(list: *mut gst::GstTagList, tag: *const c_char, value: *const c_char);

View file

@ -5,13 +5,13 @@
extern crate gstreamer_tag_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_tag_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_tag_sys::*;
static PACKAGES: &[&str] = &["gstreamer-tag-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,47 +229,114 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstTagDemux", Layout {size: size_of::<GstTagDemux>(), alignment: align_of::<GstTagDemux>()}),
("GstTagDemuxClass", Layout {size: size_of::<GstTagDemuxClass>(), alignment: align_of::<GstTagDemuxClass>()}),
("GstTagDemuxResult", Layout {size: size_of::<GstTagDemuxResult>(), alignment: align_of::<GstTagDemuxResult>()}),
("GstTagImageType", Layout {size: size_of::<GstTagImageType>(), alignment: align_of::<GstTagImageType>()}),
("GstTagLicenseFlags", Layout {size: size_of::<GstTagLicenseFlags>(), alignment: align_of::<GstTagLicenseFlags>()}),
("GstTagMux", Layout {size: size_of::<GstTagMux>(), alignment: align_of::<GstTagMux>()}),
("GstTagMuxClass", Layout {size: size_of::<GstTagMuxClass>(), alignment: align_of::<GstTagMuxClass>()}),
("GstTagXmpWriterInterface", Layout {size: size_of::<GstTagXmpWriterInterface>(), alignment: align_of::<GstTagXmpWriterInterface>()}),
(
"GstTagDemux",
Layout {
size: size_of::<GstTagDemux>(),
alignment: align_of::<GstTagDemux>(),
},
),
(
"GstTagDemuxClass",
Layout {
size: size_of::<GstTagDemuxClass>(),
alignment: align_of::<GstTagDemuxClass>(),
},
),
(
"GstTagDemuxResult",
Layout {
size: size_of::<GstTagDemuxResult>(),
alignment: align_of::<GstTagDemuxResult>(),
},
),
(
"GstTagImageType",
Layout {
size: size_of::<GstTagImageType>(),
alignment: align_of::<GstTagImageType>(),
},
),
(
"GstTagLicenseFlags",
Layout {
size: size_of::<GstTagLicenseFlags>(),
alignment: align_of::<GstTagLicenseFlags>(),
},
),
(
"GstTagMux",
Layout {
size: size_of::<GstTagMux>(),
alignment: align_of::<GstTagMux>(),
},
),
(
"GstTagMuxClass",
Layout {
size: size_of::<GstTagMuxClass>(),
alignment: align_of::<GstTagMuxClass>(),
},
),
(
"GstTagXmpWriterInterface",
Layout {
size: size_of::<GstTagXmpWriterInterface>(),
alignment: align_of::<GstTagXmpWriterInterface>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_TAG_CAPTURING_CONTRAST", "capturing-contrast"),
("GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO", "capturing-digital-zoom-ratio"),
("GST_TAG_CAPTURING_EXPOSURE_COMPENSATION", "capturing-exposure-compensation"),
(
"GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO",
"capturing-digital-zoom-ratio",
),
(
"GST_TAG_CAPTURING_EXPOSURE_COMPENSATION",
"capturing-exposure-compensation",
),
("GST_TAG_CAPTURING_EXPOSURE_MODE", "capturing-exposure-mode"),
("GST_TAG_CAPTURING_EXPOSURE_PROGRAM", "capturing-exposure-program"),
(
"GST_TAG_CAPTURING_EXPOSURE_PROGRAM",
"capturing-exposure-program",
),
("GST_TAG_CAPTURING_FLASH_FIRED", "capturing-flash-fired"),
("GST_TAG_CAPTURING_FLASH_MODE", "capturing-flash-mode"),
("GST_TAG_CAPTURING_FOCAL_LENGTH", "capturing-focal-length"),
("GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM", "capturing-focal-length-35mm"),
(
"GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM",
"capturing-focal-length-35mm",
),
("GST_TAG_CAPTURING_FOCAL_RATIO", "capturing-focal-ratio"),
("GST_TAG_CAPTURING_GAIN_ADJUSTMENT", "capturing-gain-adjustment"),
(
"GST_TAG_CAPTURING_GAIN_ADJUSTMENT",
"capturing-gain-adjustment",
),
("GST_TAG_CAPTURING_ISO_SPEED", "capturing-iso-speed"),
("GST_TAG_CAPTURING_METERING_MODE", "capturing-metering-mode"),
("GST_TAG_CAPTURING_SATURATION", "capturing-saturation"),
("GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE", "capturing-scene-capture-type"),
(
"GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE",
"capturing-scene-capture-type",
),
("GST_TAG_CAPTURING_SHARPNESS", "capturing-sharpness"),
("GST_TAG_CAPTURING_SHUTTER_SPEED", "capturing-shutter-speed"),
("GST_TAG_CAPTURING_SOURCE", "capturing-source"),
@ -271,7 +344,10 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_TAG_CDDA_CDDB_DISCID", "discid"),
("GST_TAG_CDDA_CDDB_DISCID_FULL", "discid-full"),
("GST_TAG_CDDA_MUSICBRAINZ_DISCID", "musicbrainz-discid"),
("GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL", "musicbrainz-discid-full"),
(
"GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL",
"musicbrainz-discid-full",
),
("GST_TAG_CMML_CLIP", "cmml-clip"),
("GST_TAG_CMML_HEAD", "cmml-head"),
("GST_TAG_CMML_STREAM", "cmml-stream"),
@ -301,14 +377,23 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_TAG_IMAGE_TYPE_UNDEFINED", "0"),
("(gint) GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE", "14"),
("GST_TAG_IMAGE_VERTICAL_PPI", "image-vertical-ppi"),
("(guint) GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE", "16777216"),
("(guint) GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE", "33554432"),
(
"(guint) GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE",
"16777216",
),
(
"(guint) GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE",
"33554432",
),
("(guint) GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS", "4"),
("(guint) GST_TAG_LICENSE_PERMITS_DISTRIBUTION", "2"),
("(guint) GST_TAG_LICENSE_PERMITS_REPRODUCTION", "1"),
("(guint) GST_TAG_LICENSE_PERMITS_SHARING", "8"),
("(guint) GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE", "65536"),
("(guint) GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE", "131072"),
(
"(guint) GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE",
"131072",
),
("(guint) GST_TAG_LICENSE_REQUIRES_ATTRIBUTION", "512"),
("(guint) GST_TAG_LICENSE_REQUIRES_COPYLEFT", "4096"),
("(guint) GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT", "8192"),
@ -316,11 +401,12 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(guint) GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE", "1024"),
("(guint) GST_TAG_LICENSE_REQUIRES_SOURCE_CODE", "2048"),
("GST_TAG_MUSICAL_KEY", "musical-key"),
("GST_TAG_MUSICBRAINZ_ALBUMARTISTID", "musicbrainz-albumartistid"),
(
"GST_TAG_MUSICBRAINZ_ALBUMARTISTID",
"musicbrainz-albumartistid",
),
("GST_TAG_MUSICBRAINZ_ALBUMID", "musicbrainz-albumid"),
("GST_TAG_MUSICBRAINZ_ARTISTID", "musicbrainz-artistid"),
("GST_TAG_MUSICBRAINZ_TRACKID", "musicbrainz-trackid"),
("GST_TAG_MUSICBRAINZ_TRMID", "musicbrainz-trmid"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -52,7 +52,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -74,8 +74,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -89,4 +91,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

File diff suppressed because it is too large Load diff

View file

@ -5,13 +5,13 @@
extern crate gstreamer_video_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_video_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_video_sys::*;
static PACKAGES: &[&str] = &["gstreamer-video-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,113 +229,666 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstColorBalanceChannel", Layout {size: size_of::<GstColorBalanceChannel>(), alignment: align_of::<GstColorBalanceChannel>()}),
("GstColorBalanceChannelClass", Layout {size: size_of::<GstColorBalanceChannelClass>(), alignment: align_of::<GstColorBalanceChannelClass>()}),
("GstColorBalanceInterface", Layout {size: size_of::<GstColorBalanceInterface>(), alignment: align_of::<GstColorBalanceInterface>()}),
("GstColorBalanceType", Layout {size: size_of::<GstColorBalanceType>(), alignment: align_of::<GstColorBalanceType>()}),
("GstNavigationCommand", Layout {size: size_of::<GstNavigationCommand>(), alignment: align_of::<GstNavigationCommand>()}),
("GstNavigationEventType", Layout {size: size_of::<GstNavigationEventType>(), alignment: align_of::<GstNavigationEventType>()}),
("GstNavigationInterface", Layout {size: size_of::<GstNavigationInterface>(), alignment: align_of::<GstNavigationInterface>()}),
("GstNavigationMessageType", Layout {size: size_of::<GstNavigationMessageType>(), alignment: align_of::<GstNavigationMessageType>()}),
("GstNavigationQueryType", Layout {size: size_of::<GstNavigationQueryType>(), alignment: align_of::<GstNavigationQueryType>()}),
("GstVideoAffineTransformationMeta", Layout {size: size_of::<GstVideoAffineTransformationMeta>(), alignment: align_of::<GstVideoAffineTransformationMeta>()}),
("GstVideoAggregator", Layout {size: size_of::<GstVideoAggregator>(), alignment: align_of::<GstVideoAggregator>()}),
("GstVideoAggregatorClass", Layout {size: size_of::<GstVideoAggregatorClass>(), alignment: align_of::<GstVideoAggregatorClass>()}),
("GstVideoAggregatorConvertPad", Layout {size: size_of::<GstVideoAggregatorConvertPad>(), alignment: align_of::<GstVideoAggregatorConvertPad>()}),
("GstVideoAggregatorConvertPadClass", Layout {size: size_of::<GstVideoAggregatorConvertPadClass>(), alignment: align_of::<GstVideoAggregatorConvertPadClass>()}),
("GstVideoAggregatorPad", Layout {size: size_of::<GstVideoAggregatorPad>(), alignment: align_of::<GstVideoAggregatorPad>()}),
("GstVideoAggregatorPadClass", Layout {size: size_of::<GstVideoAggregatorPadClass>(), alignment: align_of::<GstVideoAggregatorPadClass>()}),
("GstVideoAlignment", Layout {size: size_of::<GstVideoAlignment>(), alignment: align_of::<GstVideoAlignment>()}),
("GstVideoAlphaMode", Layout {size: size_of::<GstVideoAlphaMode>(), alignment: align_of::<GstVideoAlphaMode>()}),
("GstVideoAncillary", Layout {size: size_of::<GstVideoAncillary>(), alignment: align_of::<GstVideoAncillary>()}),
("GstVideoAncillaryDID", Layout {size: size_of::<GstVideoAncillaryDID>(), alignment: align_of::<GstVideoAncillaryDID>()}),
("GstVideoAncillaryDID16", Layout {size: size_of::<GstVideoAncillaryDID16>(), alignment: align_of::<GstVideoAncillaryDID16>()}),
("GstVideoBufferFlags", Layout {size: size_of::<GstVideoBufferFlags>(), alignment: align_of::<GstVideoBufferFlags>()}),
("GstVideoBufferPool", Layout {size: size_of::<GstVideoBufferPool>(), alignment: align_of::<GstVideoBufferPool>()}),
("GstVideoBufferPoolClass", Layout {size: size_of::<GstVideoBufferPoolClass>(), alignment: align_of::<GstVideoBufferPoolClass>()}),
("GstVideoCaptionMeta", Layout {size: size_of::<GstVideoCaptionMeta>(), alignment: align_of::<GstVideoCaptionMeta>()}),
("GstVideoCaptionType", Layout {size: size_of::<GstVideoCaptionType>(), alignment: align_of::<GstVideoCaptionType>()}),
("GstVideoChromaFlags", Layout {size: size_of::<GstVideoChromaFlags>(), alignment: align_of::<GstVideoChromaFlags>()}),
("GstVideoChromaMethod", Layout {size: size_of::<GstVideoChromaMethod>(), alignment: align_of::<GstVideoChromaMethod>()}),
("GstVideoChromaMode", Layout {size: size_of::<GstVideoChromaMode>(), alignment: align_of::<GstVideoChromaMode>()}),
("GstVideoChromaSite", Layout {size: size_of::<GstVideoChromaSite>(), alignment: align_of::<GstVideoChromaSite>()}),
("GstVideoCodecFrame", Layout {size: size_of::<GstVideoCodecFrame>(), alignment: align_of::<GstVideoCodecFrame>()}),
("GstVideoCodecFrameFlags", Layout {size: size_of::<GstVideoCodecFrameFlags>(), alignment: align_of::<GstVideoCodecFrameFlags>()}),
("GstVideoCodecState", Layout {size: size_of::<GstVideoCodecState>(), alignment: align_of::<GstVideoCodecState>()}),
("GstVideoColorMatrix", Layout {size: size_of::<GstVideoColorMatrix>(), alignment: align_of::<GstVideoColorMatrix>()}),
("GstVideoColorPrimaries", Layout {size: size_of::<GstVideoColorPrimaries>(), alignment: align_of::<GstVideoColorPrimaries>()}),
("GstVideoColorPrimariesInfo", Layout {size: size_of::<GstVideoColorPrimariesInfo>(), alignment: align_of::<GstVideoColorPrimariesInfo>()}),
("GstVideoColorRange", Layout {size: size_of::<GstVideoColorRange>(), alignment: align_of::<GstVideoColorRange>()}),
("GstVideoColorimetry", Layout {size: size_of::<GstVideoColorimetry>(), alignment: align_of::<GstVideoColorimetry>()}),
("GstVideoCropMeta", Layout {size: size_of::<GstVideoCropMeta>(), alignment: align_of::<GstVideoCropMeta>()}),
("GstVideoDecoder", Layout {size: size_of::<GstVideoDecoder>(), alignment: align_of::<GstVideoDecoder>()}),
("GstVideoDecoderClass", Layout {size: size_of::<GstVideoDecoderClass>(), alignment: align_of::<GstVideoDecoderClass>()}),
("GstVideoDirectionInterface", Layout {size: size_of::<GstVideoDirectionInterface>(), alignment: align_of::<GstVideoDirectionInterface>()}),
("GstVideoDitherFlags", Layout {size: size_of::<GstVideoDitherFlags>(), alignment: align_of::<GstVideoDitherFlags>()}),
("GstVideoDitherMethod", Layout {size: size_of::<GstVideoDitherMethod>(), alignment: align_of::<GstVideoDitherMethod>()}),
("GstVideoEncoder", Layout {size: size_of::<GstVideoEncoder>(), alignment: align_of::<GstVideoEncoder>()}),
("GstVideoEncoderClass", Layout {size: size_of::<GstVideoEncoderClass>(), alignment: align_of::<GstVideoEncoderClass>()}),
("GstVideoFieldOrder", Layout {size: size_of::<GstVideoFieldOrder>(), alignment: align_of::<GstVideoFieldOrder>()}),
("GstVideoFilter", Layout {size: size_of::<GstVideoFilter>(), alignment: align_of::<GstVideoFilter>()}),
("GstVideoFilterClass", Layout {size: size_of::<GstVideoFilterClass>(), alignment: align_of::<GstVideoFilterClass>()}),
("GstVideoFlags", Layout {size: size_of::<GstVideoFlags>(), alignment: align_of::<GstVideoFlags>()}),
("GstVideoFormat", Layout {size: size_of::<GstVideoFormat>(), alignment: align_of::<GstVideoFormat>()}),
("GstVideoFormatFlags", Layout {size: size_of::<GstVideoFormatFlags>(), alignment: align_of::<GstVideoFormatFlags>()}),
("GstVideoFormatInfo", Layout {size: size_of::<GstVideoFormatInfo>(), alignment: align_of::<GstVideoFormatInfo>()}),
("GstVideoFrame", Layout {size: size_of::<GstVideoFrame>(), alignment: align_of::<GstVideoFrame>()}),
("GstVideoFrameFlags", Layout {size: size_of::<GstVideoFrameFlags>(), alignment: align_of::<GstVideoFrameFlags>()}),
("GstVideoFrameMapFlags", Layout {size: size_of::<GstVideoFrameMapFlags>(), alignment: align_of::<GstVideoFrameMapFlags>()}),
("GstVideoGLTextureOrientation", Layout {size: size_of::<GstVideoGLTextureOrientation>(), alignment: align_of::<GstVideoGLTextureOrientation>()}),
("GstVideoGLTextureType", Layout {size: size_of::<GstVideoGLTextureType>(), alignment: align_of::<GstVideoGLTextureType>()}),
("GstVideoGLTextureUploadMeta", Layout {size: size_of::<GstVideoGLTextureUploadMeta>(), alignment: align_of::<GstVideoGLTextureUploadMeta>()}),
("GstVideoGammaMode", Layout {size: size_of::<GstVideoGammaMode>(), alignment: align_of::<GstVideoGammaMode>()}),
("GstVideoInfo", Layout {size: size_of::<GstVideoInfo>(), alignment: align_of::<GstVideoInfo>()}),
("GstVideoInterlaceMode", Layout {size: size_of::<GstVideoInterlaceMode>(), alignment: align_of::<GstVideoInterlaceMode>()}),
("GstVideoMatrixMode", Layout {size: size_of::<GstVideoMatrixMode>(), alignment: align_of::<GstVideoMatrixMode>()}),
("GstVideoMeta", Layout {size: size_of::<GstVideoMeta>(), alignment: align_of::<GstVideoMeta>()}),
("GstVideoMetaTransform", Layout {size: size_of::<GstVideoMetaTransform>(), alignment: align_of::<GstVideoMetaTransform>()}),
("GstVideoMultiviewFlags", Layout {size: size_of::<GstVideoMultiviewFlags>(), alignment: align_of::<GstVideoMultiviewFlags>()}),
("GstVideoMultiviewFramePacking", Layout {size: size_of::<GstVideoMultiviewFramePacking>(), alignment: align_of::<GstVideoMultiviewFramePacking>()}),
("GstVideoMultiviewMode", Layout {size: size_of::<GstVideoMultiviewMode>(), alignment: align_of::<GstVideoMultiviewMode>()}),
("GstVideoOrientationInterface", Layout {size: size_of::<GstVideoOrientationInterface>(), alignment: align_of::<GstVideoOrientationInterface>()}),
("GstVideoOrientationMethod", Layout {size: size_of::<GstVideoOrientationMethod>(), alignment: align_of::<GstVideoOrientationMethod>()}),
("GstVideoOverlayCompositionMeta", Layout {size: size_of::<GstVideoOverlayCompositionMeta>(), alignment: align_of::<GstVideoOverlayCompositionMeta>()}),
("GstVideoOverlayFormatFlags", Layout {size: size_of::<GstVideoOverlayFormatFlags>(), alignment: align_of::<GstVideoOverlayFormatFlags>()}),
("GstVideoOverlayInterface", Layout {size: size_of::<GstVideoOverlayInterface>(), alignment: align_of::<GstVideoOverlayInterface>()}),
("GstVideoPackFlags", Layout {size: size_of::<GstVideoPackFlags>(), alignment: align_of::<GstVideoPackFlags>()}),
("GstVideoPrimariesMode", Layout {size: size_of::<GstVideoPrimariesMode>(), alignment: align_of::<GstVideoPrimariesMode>()}),
("GstVideoRectangle", Layout {size: size_of::<GstVideoRectangle>(), alignment: align_of::<GstVideoRectangle>()}),
("GstVideoRegionOfInterestMeta", Layout {size: size_of::<GstVideoRegionOfInterestMeta>(), alignment: align_of::<GstVideoRegionOfInterestMeta>()}),
("GstVideoResampler", Layout {size: size_of::<GstVideoResampler>(), alignment: align_of::<GstVideoResampler>()}),
("GstVideoResamplerFlags", Layout {size: size_of::<GstVideoResamplerFlags>(), alignment: align_of::<GstVideoResamplerFlags>()}),
("GstVideoResamplerMethod", Layout {size: size_of::<GstVideoResamplerMethod>(), alignment: align_of::<GstVideoResamplerMethod>()}),
("GstVideoScalerFlags", Layout {size: size_of::<GstVideoScalerFlags>(), alignment: align_of::<GstVideoScalerFlags>()}),
("GstVideoSink", Layout {size: size_of::<GstVideoSink>(), alignment: align_of::<GstVideoSink>()}),
("GstVideoSinkClass", Layout {size: size_of::<GstVideoSinkClass>(), alignment: align_of::<GstVideoSinkClass>()}),
("GstVideoTileMode", Layout {size: size_of::<GstVideoTileMode>(), alignment: align_of::<GstVideoTileMode>()}),
("GstVideoTileType", Layout {size: size_of::<GstVideoTileType>(), alignment: align_of::<GstVideoTileType>()}),
("GstVideoTimeCode", Layout {size: size_of::<GstVideoTimeCode>(), alignment: align_of::<GstVideoTimeCode>()}),
("GstVideoTimeCodeConfig", Layout {size: size_of::<GstVideoTimeCodeConfig>(), alignment: align_of::<GstVideoTimeCodeConfig>()}),
("GstVideoTimeCodeFlags", Layout {size: size_of::<GstVideoTimeCodeFlags>(), alignment: align_of::<GstVideoTimeCodeFlags>()}),
("GstVideoTimeCodeInterval", Layout {size: size_of::<GstVideoTimeCodeInterval>(), alignment: align_of::<GstVideoTimeCodeInterval>()}),
("GstVideoTimeCodeMeta", Layout {size: size_of::<GstVideoTimeCodeMeta>(), alignment: align_of::<GstVideoTimeCodeMeta>()}),
("GstVideoTransferFunction", Layout {size: size_of::<GstVideoTransferFunction>(), alignment: align_of::<GstVideoTransferFunction>()}),
("GstVideoVBIParserResult", Layout {size: size_of::<GstVideoVBIParserResult>(), alignment: align_of::<GstVideoVBIParserResult>()}),
(
"GstColorBalanceChannel",
Layout {
size: size_of::<GstColorBalanceChannel>(),
alignment: align_of::<GstColorBalanceChannel>(),
},
),
(
"GstColorBalanceChannelClass",
Layout {
size: size_of::<GstColorBalanceChannelClass>(),
alignment: align_of::<GstColorBalanceChannelClass>(),
},
),
(
"GstColorBalanceInterface",
Layout {
size: size_of::<GstColorBalanceInterface>(),
alignment: align_of::<GstColorBalanceInterface>(),
},
),
(
"GstColorBalanceType",
Layout {
size: size_of::<GstColorBalanceType>(),
alignment: align_of::<GstColorBalanceType>(),
},
),
(
"GstNavigationCommand",
Layout {
size: size_of::<GstNavigationCommand>(),
alignment: align_of::<GstNavigationCommand>(),
},
),
(
"GstNavigationEventType",
Layout {
size: size_of::<GstNavigationEventType>(),
alignment: align_of::<GstNavigationEventType>(),
},
),
(
"GstNavigationInterface",
Layout {
size: size_of::<GstNavigationInterface>(),
alignment: align_of::<GstNavigationInterface>(),
},
),
(
"GstNavigationMessageType",
Layout {
size: size_of::<GstNavigationMessageType>(),
alignment: align_of::<GstNavigationMessageType>(),
},
),
(
"GstNavigationQueryType",
Layout {
size: size_of::<GstNavigationQueryType>(),
alignment: align_of::<GstNavigationQueryType>(),
},
),
(
"GstVideoAffineTransformationMeta",
Layout {
size: size_of::<GstVideoAffineTransformationMeta>(),
alignment: align_of::<GstVideoAffineTransformationMeta>(),
},
),
(
"GstVideoAggregator",
Layout {
size: size_of::<GstVideoAggregator>(),
alignment: align_of::<GstVideoAggregator>(),
},
),
(
"GstVideoAggregatorClass",
Layout {
size: size_of::<GstVideoAggregatorClass>(),
alignment: align_of::<GstVideoAggregatorClass>(),
},
),
(
"GstVideoAggregatorConvertPad",
Layout {
size: size_of::<GstVideoAggregatorConvertPad>(),
alignment: align_of::<GstVideoAggregatorConvertPad>(),
},
),
(
"GstVideoAggregatorConvertPadClass",
Layout {
size: size_of::<GstVideoAggregatorConvertPadClass>(),
alignment: align_of::<GstVideoAggregatorConvertPadClass>(),
},
),
(
"GstVideoAggregatorPad",
Layout {
size: size_of::<GstVideoAggregatorPad>(),
alignment: align_of::<GstVideoAggregatorPad>(),
},
),
(
"GstVideoAggregatorPadClass",
Layout {
size: size_of::<GstVideoAggregatorPadClass>(),
alignment: align_of::<GstVideoAggregatorPadClass>(),
},
),
(
"GstVideoAlignment",
Layout {
size: size_of::<GstVideoAlignment>(),
alignment: align_of::<GstVideoAlignment>(),
},
),
(
"GstVideoAlphaMode",
Layout {
size: size_of::<GstVideoAlphaMode>(),
alignment: align_of::<GstVideoAlphaMode>(),
},
),
(
"GstVideoAncillary",
Layout {
size: size_of::<GstVideoAncillary>(),
alignment: align_of::<GstVideoAncillary>(),
},
),
(
"GstVideoAncillaryDID",
Layout {
size: size_of::<GstVideoAncillaryDID>(),
alignment: align_of::<GstVideoAncillaryDID>(),
},
),
(
"GstVideoAncillaryDID16",
Layout {
size: size_of::<GstVideoAncillaryDID16>(),
alignment: align_of::<GstVideoAncillaryDID16>(),
},
),
(
"GstVideoBufferFlags",
Layout {
size: size_of::<GstVideoBufferFlags>(),
alignment: align_of::<GstVideoBufferFlags>(),
},
),
(
"GstVideoBufferPool",
Layout {
size: size_of::<GstVideoBufferPool>(),
alignment: align_of::<GstVideoBufferPool>(),
},
),
(
"GstVideoBufferPoolClass",
Layout {
size: size_of::<GstVideoBufferPoolClass>(),
alignment: align_of::<GstVideoBufferPoolClass>(),
},
),
(
"GstVideoCaptionMeta",
Layout {
size: size_of::<GstVideoCaptionMeta>(),
alignment: align_of::<GstVideoCaptionMeta>(),
},
),
(
"GstVideoCaptionType",
Layout {
size: size_of::<GstVideoCaptionType>(),
alignment: align_of::<GstVideoCaptionType>(),
},
),
(
"GstVideoChromaFlags",
Layout {
size: size_of::<GstVideoChromaFlags>(),
alignment: align_of::<GstVideoChromaFlags>(),
},
),
(
"GstVideoChromaMethod",
Layout {
size: size_of::<GstVideoChromaMethod>(),
alignment: align_of::<GstVideoChromaMethod>(),
},
),
(
"GstVideoChromaMode",
Layout {
size: size_of::<GstVideoChromaMode>(),
alignment: align_of::<GstVideoChromaMode>(),
},
),
(
"GstVideoChromaSite",
Layout {
size: size_of::<GstVideoChromaSite>(),
alignment: align_of::<GstVideoChromaSite>(),
},
),
(
"GstVideoCodecFrame",
Layout {
size: size_of::<GstVideoCodecFrame>(),
alignment: align_of::<GstVideoCodecFrame>(),
},
),
(
"GstVideoCodecFrameFlags",
Layout {
size: size_of::<GstVideoCodecFrameFlags>(),
alignment: align_of::<GstVideoCodecFrameFlags>(),
},
),
(
"GstVideoCodecState",
Layout {
size: size_of::<GstVideoCodecState>(),
alignment: align_of::<GstVideoCodecState>(),
},
),
(
"GstVideoColorMatrix",
Layout {
size: size_of::<GstVideoColorMatrix>(),
alignment: align_of::<GstVideoColorMatrix>(),
},
),
(
"GstVideoColorPrimaries",
Layout {
size: size_of::<GstVideoColorPrimaries>(),
alignment: align_of::<GstVideoColorPrimaries>(),
},
),
(
"GstVideoColorPrimariesInfo",
Layout {
size: size_of::<GstVideoColorPrimariesInfo>(),
alignment: align_of::<GstVideoColorPrimariesInfo>(),
},
),
(
"GstVideoColorRange",
Layout {
size: size_of::<GstVideoColorRange>(),
alignment: align_of::<GstVideoColorRange>(),
},
),
(
"GstVideoColorimetry",
Layout {
size: size_of::<GstVideoColorimetry>(),
alignment: align_of::<GstVideoColorimetry>(),
},
),
(
"GstVideoCropMeta",
Layout {
size: size_of::<GstVideoCropMeta>(),
alignment: align_of::<GstVideoCropMeta>(),
},
),
(
"GstVideoDecoder",
Layout {
size: size_of::<GstVideoDecoder>(),
alignment: align_of::<GstVideoDecoder>(),
},
),
(
"GstVideoDecoderClass",
Layout {
size: size_of::<GstVideoDecoderClass>(),
alignment: align_of::<GstVideoDecoderClass>(),
},
),
(
"GstVideoDirectionInterface",
Layout {
size: size_of::<GstVideoDirectionInterface>(),
alignment: align_of::<GstVideoDirectionInterface>(),
},
),
(
"GstVideoDitherFlags",
Layout {
size: size_of::<GstVideoDitherFlags>(),
alignment: align_of::<GstVideoDitherFlags>(),
},
),
(
"GstVideoDitherMethod",
Layout {
size: size_of::<GstVideoDitherMethod>(),
alignment: align_of::<GstVideoDitherMethod>(),
},
),
(
"GstVideoEncoder",
Layout {
size: size_of::<GstVideoEncoder>(),
alignment: align_of::<GstVideoEncoder>(),
},
),
(
"GstVideoEncoderClass",
Layout {
size: size_of::<GstVideoEncoderClass>(),
alignment: align_of::<GstVideoEncoderClass>(),
},
),
(
"GstVideoFieldOrder",
Layout {
size: size_of::<GstVideoFieldOrder>(),
alignment: align_of::<GstVideoFieldOrder>(),
},
),
(
"GstVideoFilter",
Layout {
size: size_of::<GstVideoFilter>(),
alignment: align_of::<GstVideoFilter>(),
},
),
(
"GstVideoFilterClass",
Layout {
size: size_of::<GstVideoFilterClass>(),
alignment: align_of::<GstVideoFilterClass>(),
},
),
(
"GstVideoFlags",
Layout {
size: size_of::<GstVideoFlags>(),
alignment: align_of::<GstVideoFlags>(),
},
),
(
"GstVideoFormat",
Layout {
size: size_of::<GstVideoFormat>(),
alignment: align_of::<GstVideoFormat>(),
},
),
(
"GstVideoFormatFlags",
Layout {
size: size_of::<GstVideoFormatFlags>(),
alignment: align_of::<GstVideoFormatFlags>(),
},
),
(
"GstVideoFormatInfo",
Layout {
size: size_of::<GstVideoFormatInfo>(),
alignment: align_of::<GstVideoFormatInfo>(),
},
),
(
"GstVideoFrame",
Layout {
size: size_of::<GstVideoFrame>(),
alignment: align_of::<GstVideoFrame>(),
},
),
(
"GstVideoFrameFlags",
Layout {
size: size_of::<GstVideoFrameFlags>(),
alignment: align_of::<GstVideoFrameFlags>(),
},
),
(
"GstVideoFrameMapFlags",
Layout {
size: size_of::<GstVideoFrameMapFlags>(),
alignment: align_of::<GstVideoFrameMapFlags>(),
},
),
(
"GstVideoGLTextureOrientation",
Layout {
size: size_of::<GstVideoGLTextureOrientation>(),
alignment: align_of::<GstVideoGLTextureOrientation>(),
},
),
(
"GstVideoGLTextureType",
Layout {
size: size_of::<GstVideoGLTextureType>(),
alignment: align_of::<GstVideoGLTextureType>(),
},
),
(
"GstVideoGLTextureUploadMeta",
Layout {
size: size_of::<GstVideoGLTextureUploadMeta>(),
alignment: align_of::<GstVideoGLTextureUploadMeta>(),
},
),
(
"GstVideoGammaMode",
Layout {
size: size_of::<GstVideoGammaMode>(),
alignment: align_of::<GstVideoGammaMode>(),
},
),
(
"GstVideoInfo",
Layout {
size: size_of::<GstVideoInfo>(),
alignment: align_of::<GstVideoInfo>(),
},
),
(
"GstVideoInterlaceMode",
Layout {
size: size_of::<GstVideoInterlaceMode>(),
alignment: align_of::<GstVideoInterlaceMode>(),
},
),
(
"GstVideoMatrixMode",
Layout {
size: size_of::<GstVideoMatrixMode>(),
alignment: align_of::<GstVideoMatrixMode>(),
},
),
(
"GstVideoMeta",
Layout {
size: size_of::<GstVideoMeta>(),
alignment: align_of::<GstVideoMeta>(),
},
),
(
"GstVideoMetaTransform",
Layout {
size: size_of::<GstVideoMetaTransform>(),
alignment: align_of::<GstVideoMetaTransform>(),
},
),
(
"GstVideoMultiviewFlags",
Layout {
size: size_of::<GstVideoMultiviewFlags>(),
alignment: align_of::<GstVideoMultiviewFlags>(),
},
),
(
"GstVideoMultiviewFramePacking",
Layout {
size: size_of::<GstVideoMultiviewFramePacking>(),
alignment: align_of::<GstVideoMultiviewFramePacking>(),
},
),
(
"GstVideoMultiviewMode",
Layout {
size: size_of::<GstVideoMultiviewMode>(),
alignment: align_of::<GstVideoMultiviewMode>(),
},
),
(
"GstVideoOrientationInterface",
Layout {
size: size_of::<GstVideoOrientationInterface>(),
alignment: align_of::<GstVideoOrientationInterface>(),
},
),
(
"GstVideoOrientationMethod",
Layout {
size: size_of::<GstVideoOrientationMethod>(),
alignment: align_of::<GstVideoOrientationMethod>(),
},
),
(
"GstVideoOverlayCompositionMeta",
Layout {
size: size_of::<GstVideoOverlayCompositionMeta>(),
alignment: align_of::<GstVideoOverlayCompositionMeta>(),
},
),
(
"GstVideoOverlayFormatFlags",
Layout {
size: size_of::<GstVideoOverlayFormatFlags>(),
alignment: align_of::<GstVideoOverlayFormatFlags>(),
},
),
(
"GstVideoOverlayInterface",
Layout {
size: size_of::<GstVideoOverlayInterface>(),
alignment: align_of::<GstVideoOverlayInterface>(),
},
),
(
"GstVideoPackFlags",
Layout {
size: size_of::<GstVideoPackFlags>(),
alignment: align_of::<GstVideoPackFlags>(),
},
),
(
"GstVideoPrimariesMode",
Layout {
size: size_of::<GstVideoPrimariesMode>(),
alignment: align_of::<GstVideoPrimariesMode>(),
},
),
(
"GstVideoRectangle",
Layout {
size: size_of::<GstVideoRectangle>(),
alignment: align_of::<GstVideoRectangle>(),
},
),
(
"GstVideoRegionOfInterestMeta",
Layout {
size: size_of::<GstVideoRegionOfInterestMeta>(),
alignment: align_of::<GstVideoRegionOfInterestMeta>(),
},
),
(
"GstVideoResampler",
Layout {
size: size_of::<GstVideoResampler>(),
alignment: align_of::<GstVideoResampler>(),
},
),
(
"GstVideoResamplerFlags",
Layout {
size: size_of::<GstVideoResamplerFlags>(),
alignment: align_of::<GstVideoResamplerFlags>(),
},
),
(
"GstVideoResamplerMethod",
Layout {
size: size_of::<GstVideoResamplerMethod>(),
alignment: align_of::<GstVideoResamplerMethod>(),
},
),
(
"GstVideoScalerFlags",
Layout {
size: size_of::<GstVideoScalerFlags>(),
alignment: align_of::<GstVideoScalerFlags>(),
},
),
(
"GstVideoSink",
Layout {
size: size_of::<GstVideoSink>(),
alignment: align_of::<GstVideoSink>(),
},
),
(
"GstVideoSinkClass",
Layout {
size: size_of::<GstVideoSinkClass>(),
alignment: align_of::<GstVideoSinkClass>(),
},
),
(
"GstVideoTileMode",
Layout {
size: size_of::<GstVideoTileMode>(),
alignment: align_of::<GstVideoTileMode>(),
},
),
(
"GstVideoTileType",
Layout {
size: size_of::<GstVideoTileType>(),
alignment: align_of::<GstVideoTileType>(),
},
),
(
"GstVideoTimeCode",
Layout {
size: size_of::<GstVideoTimeCode>(),
alignment: align_of::<GstVideoTimeCode>(),
},
),
(
"GstVideoTimeCodeConfig",
Layout {
size: size_of::<GstVideoTimeCodeConfig>(),
alignment: align_of::<GstVideoTimeCodeConfig>(),
},
),
(
"GstVideoTimeCodeFlags",
Layout {
size: size_of::<GstVideoTimeCodeFlags>(),
alignment: align_of::<GstVideoTimeCodeFlags>(),
},
),
(
"GstVideoTimeCodeInterval",
Layout {
size: size_of::<GstVideoTimeCodeInterval>(),
alignment: align_of::<GstVideoTimeCodeInterval>(),
},
),
(
"GstVideoTimeCodeMeta",
Layout {
size: size_of::<GstVideoTimeCodeMeta>(),
alignment: align_of::<GstVideoTimeCodeMeta>(),
},
),
(
"GstVideoTransferFunction",
Layout {
size: size_of::<GstVideoTransferFunction>(),
alignment: align_of::<GstVideoTransferFunction>(),
},
),
(
"GstVideoVBIParserResult",
Layout {
size: size_of::<GstVideoVBIParserResult>(),
alignment: align_of::<GstVideoVBIParserResult>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -735,5 +1294,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_VIDEO_VBI_PARSER_RESULT_ERROR", "2"),
("(gint) GST_VIDEO_VBI_PARSER_RESULT_OK", "1"),
];

View file

@ -6,8 +6,8 @@ extern crate pkg_config;
use pkg_config::{Config, Error};
use std::env;
use std::io::prelude::*;
use std::io;
use std::io::prelude::*;
use std::process;
fn main() {
@ -34,7 +34,7 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
println!("cargo:rustc-link-search=native={}", lib_dir);
return Ok(())
return Ok(());
}
let target = env::var("TARGET").expect("TARGET environment variable doesn't exist");
@ -56,8 +56,10 @@ fn find() -> Result<(), Error> {
println!("cargo:rustc-link-lib=dylib={}", lib_);
}
for path in library.link_paths.iter() {
println!("cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist"));
println!(
"cargo:rustc-link-search=native={}",
path.to_str().expect("library path doesn't exist")
);
}
}
Ok(())
@ -71,4 +73,3 @@ fn find() -> Result<(), Error> {
Err(err) => Err(err),
}
}

View file

@ -3,18 +3,23 @@
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(clippy::approx_constant, clippy::type_complexity, clippy::unreadable_literal)]
#![allow(
clippy::approx_constant,
clippy::type_complexity,
clippy::unreadable_literal
)]
extern crate libc;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
extern crate gstreamer_sdp_sys as gst_sdp;
extern crate gstreamer_sys as gst;
extern crate libc;
#[allow(unused_imports)]
use libc::{c_int, c_char, c_uchar, c_float, c_uint, c_double,
c_short, c_ushort, c_long, c_ulong,
c_void, size_t, ssize_t, intptr_t, uintptr_t, time_t, FILE};
use libc::{
c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void,
intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE,
};
#[allow(unused_imports)]
use glib::{gboolean, gconstpointer, gpointer, GType};
@ -143,10 +148,13 @@ pub struct GstWebRTCDTLSTransportClass {
impl ::std::fmt::Debug for GstWebRTCDTLSTransportClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCDTLSTransportClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
f.debug_struct(&format!(
"GstWebRTCDTLSTransportClass @ {:?}",
self as *const _
))
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
}
}
@ -160,11 +168,14 @@ pub struct GstWebRTCICETransportClass {
impl ::std::fmt::Debug for GstWebRTCICETransportClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCICETransportClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("gather_candidates", &self.gather_candidates)
.field("_padding", &self._padding)
.finish()
f.debug_struct(&format!(
"GstWebRTCICETransportClass @ {:?}",
self as *const _
))
.field("parent_class", &self.parent_class)
.field("gather_candidates", &self.gather_candidates)
.field("_padding", &self._padding)
.finish()
}
}
@ -177,10 +188,13 @@ pub struct GstWebRTCRTPReceiverClass {
impl ::std::fmt::Debug for GstWebRTCRTPReceiverClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCRTPReceiverClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
f.debug_struct(&format!(
"GstWebRTCRTPReceiverClass @ {:?}",
self as *const _
))
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
}
}
@ -194,9 +208,9 @@ pub struct GstWebRTCRTPSenderClass {
impl ::std::fmt::Debug for GstWebRTCRTPSenderClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCRTPSenderClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
}
}
@ -209,10 +223,13 @@ pub struct GstWebRTCRTPTransceiverClass {
impl ::std::fmt::Debug for GstWebRTCRTPTransceiverClass {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCRTPTransceiverClass @ {:?}", self as *const _))
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
f.debug_struct(&format!(
"GstWebRTCRTPTransceiverClass @ {:?}",
self as *const _
))
.field("parent_class", &self.parent_class)
.field("_padding", &self._padding)
.finish()
}
}
@ -225,10 +242,13 @@ pub struct GstWebRTCSessionDescription {
impl ::std::fmt::Debug for GstWebRTCSessionDescription {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCSessionDescription @ {:?}", self as *const _))
.field("type_", &self.type_)
.field("sdp", &self.sdp)
.finish()
f.debug_struct(&format!(
"GstWebRTCSessionDescription @ {:?}",
self as *const _
))
.field("type_", &self.type_)
.field("sdp", &self.sdp)
.finish()
}
}
@ -250,16 +270,16 @@ pub struct GstWebRTCDTLSTransport {
impl ::std::fmt::Debug for GstWebRTCDTLSTransport {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCDTLSTransport @ {:?}", self as *const _))
.field("parent", &self.parent)
.field("transport", &self.transport)
.field("state", &self.state)
.field("is_rtcp", &self.is_rtcp)
.field("client", &self.client)
.field("session_id", &self.session_id)
.field("dtlssrtpenc", &self.dtlssrtpenc)
.field("dtlssrtpdec", &self.dtlssrtpdec)
.field("_padding", &self._padding)
.finish()
.field("parent", &self.parent)
.field("transport", &self.transport)
.field("state", &self.state)
.field("is_rtcp", &self.is_rtcp)
.field("client", &self.client)
.field("session_id", &self.session_id)
.field("dtlssrtpenc", &self.dtlssrtpenc)
.field("dtlssrtpdec", &self.dtlssrtpdec)
.field("_padding", &self._padding)
.finish()
}
}
@ -279,15 +299,15 @@ pub struct GstWebRTCICETransport {
impl ::std::fmt::Debug for GstWebRTCICETransport {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCICETransport @ {:?}", self as *const _))
.field("parent", &self.parent)
.field("role", &self.role)
.field("component", &self.component)
.field("state", &self.state)
.field("gathering_state", &self.gathering_state)
.field("src", &self.src)
.field("sink", &self.sink)
.field("_padding", &self._padding)
.finish()
.field("parent", &self.parent)
.field("role", &self.role)
.field("component", &self.component)
.field("state", &self.state)
.field("gathering_state", &self.gathering_state)
.field("src", &self.src)
.field("sink", &self.sink)
.field("_padding", &self._padding)
.finish()
}
}
@ -303,11 +323,11 @@ pub struct GstWebRTCRTPReceiver {
impl ::std::fmt::Debug for GstWebRTCRTPReceiver {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCRTPReceiver @ {:?}", self as *const _))
.field("parent", &self.parent)
.field("transport", &self.transport)
.field("rtcp_transport", &self.rtcp_transport)
.field("_padding", &self._padding)
.finish()
.field("parent", &self.parent)
.field("transport", &self.transport)
.field("rtcp_transport", &self.rtcp_transport)
.field("_padding", &self._padding)
.finish()
}
}
@ -324,12 +344,12 @@ pub struct GstWebRTCRTPSender {
impl ::std::fmt::Debug for GstWebRTCRTPSender {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCRTPSender @ {:?}", self as *const _))
.field("parent", &self.parent)
.field("transport", &self.transport)
.field("rtcp_transport", &self.rtcp_transport)
.field("send_encodings", &self.send_encodings)
.field("_padding", &self._padding)
.finish()
.field("parent", &self.parent)
.field("transport", &self.transport)
.field("rtcp_transport", &self.rtcp_transport)
.field("send_encodings", &self.send_encodings)
.field("_padding", &self._padding)
.finish()
}
}
@ -351,17 +371,17 @@ pub struct GstWebRTCRTPTransceiver {
impl ::std::fmt::Debug for GstWebRTCRTPTransceiver {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
f.debug_struct(&format!("GstWebRTCRTPTransceiver @ {:?}", self as *const _))
.field("parent", &self.parent)
.field("mline", &self.mline)
.field("mid", &self.mid)
.field("stopped", &self.stopped)
.field("sender", &self.sender)
.field("receiver", &self.receiver)
.field("direction", &self.direction)
.field("current_direction", &self.current_direction)
.field("codec_preferences", &self.codec_preferences)
.field("_padding", &self._padding)
.finish()
.field("parent", &self.parent)
.field("mline", &self.mline)
.field("mid", &self.mid)
.field("stopped", &self.stopped)
.field("sender", &self.sender)
.field("receiver", &self.receiver)
.field("direction", &self.direction)
.field("current_direction", &self.current_direction)
.field("codec_preferences", &self.codec_preferences)
.field("_padding", &self._padding)
.finish()
}
}
@ -457,24 +477,46 @@ extern "C" {
// GstWebRTCSessionDescription
//=========================================================================
pub fn gst_webrtc_session_description_get_type() -> GType;
pub fn gst_webrtc_session_description_new(type_: GstWebRTCSDPType, sdp: *mut gst_sdp::GstSDPMessage) -> *mut GstWebRTCSessionDescription;
pub fn gst_webrtc_session_description_copy(src: *const GstWebRTCSessionDescription) -> *mut GstWebRTCSessionDescription;
pub fn gst_webrtc_session_description_new(
type_: GstWebRTCSDPType,
sdp: *mut gst_sdp::GstSDPMessage,
) -> *mut GstWebRTCSessionDescription;
pub fn gst_webrtc_session_description_copy(
src: *const GstWebRTCSessionDescription,
) -> *mut GstWebRTCSessionDescription;
pub fn gst_webrtc_session_description_free(desc: *mut GstWebRTCSessionDescription);
//=========================================================================
// GstWebRTCDTLSTransport
//=========================================================================
pub fn gst_webrtc_dtls_transport_get_type() -> GType;
pub fn gst_webrtc_dtls_transport_new(session_id: c_uint, rtcp: gboolean) -> *mut GstWebRTCDTLSTransport;
pub fn gst_webrtc_dtls_transport_set_transport(transport: *mut GstWebRTCDTLSTransport, ice: *mut GstWebRTCICETransport);
pub fn gst_webrtc_dtls_transport_new(
session_id: c_uint,
rtcp: gboolean,
) -> *mut GstWebRTCDTLSTransport;
pub fn gst_webrtc_dtls_transport_set_transport(
transport: *mut GstWebRTCDTLSTransport,
ice: *mut GstWebRTCICETransport,
);
//=========================================================================
// GstWebRTCICETransport
//=========================================================================
pub fn gst_webrtc_ice_transport_get_type() -> GType;
pub fn gst_webrtc_ice_transport_connection_state_change(ice: *mut GstWebRTCICETransport, new_state: GstWebRTCICEConnectionState);
pub fn gst_webrtc_ice_transport_gathering_state_change(ice: *mut GstWebRTCICETransport, new_state: GstWebRTCICEGatheringState);
pub fn gst_webrtc_ice_transport_new_candidate(ice: *mut GstWebRTCICETransport, stream_id: c_uint, component: GstWebRTCICEComponent, attr: *mut c_char);
pub fn gst_webrtc_ice_transport_connection_state_change(
ice: *mut GstWebRTCICETransport,
new_state: GstWebRTCICEConnectionState,
);
pub fn gst_webrtc_ice_transport_gathering_state_change(
ice: *mut GstWebRTCICETransport,
new_state: GstWebRTCICEGatheringState,
);
pub fn gst_webrtc_ice_transport_new_candidate(
ice: *mut GstWebRTCICETransport,
stream_id: c_uint,
component: GstWebRTCICEComponent,
attr: *mut c_char,
);
pub fn gst_webrtc_ice_transport_selected_pair_change(ice: *mut GstWebRTCICETransport);
//=========================================================================
@ -482,16 +524,28 @@ extern "C" {
//=========================================================================
pub fn gst_webrtc_rtp_receiver_get_type() -> GType;
pub fn gst_webrtc_rtp_receiver_new() -> *mut GstWebRTCRTPReceiver;
pub fn gst_webrtc_rtp_receiver_set_rtcp_transport(receiver: *mut GstWebRTCRTPReceiver, transport: *mut GstWebRTCDTLSTransport);
pub fn gst_webrtc_rtp_receiver_set_transport(receiver: *mut GstWebRTCRTPReceiver, transport: *mut GstWebRTCDTLSTransport);
pub fn gst_webrtc_rtp_receiver_set_rtcp_transport(
receiver: *mut GstWebRTCRTPReceiver,
transport: *mut GstWebRTCDTLSTransport,
);
pub fn gst_webrtc_rtp_receiver_set_transport(
receiver: *mut GstWebRTCRTPReceiver,
transport: *mut GstWebRTCDTLSTransport,
);
//=========================================================================
// GstWebRTCRTPSender
//=========================================================================
pub fn gst_webrtc_rtp_sender_get_type() -> GType;
pub fn gst_webrtc_rtp_sender_new() -> *mut GstWebRTCRTPSender;
pub fn gst_webrtc_rtp_sender_set_rtcp_transport(sender: *mut GstWebRTCRTPSender, transport: *mut GstWebRTCDTLSTransport);
pub fn gst_webrtc_rtp_sender_set_transport(sender: *mut GstWebRTCRTPSender, transport: *mut GstWebRTCDTLSTransport);
pub fn gst_webrtc_rtp_sender_set_rtcp_transport(
sender: *mut GstWebRTCRTPSender,
transport: *mut GstWebRTCDTLSTransport,
);
pub fn gst_webrtc_rtp_sender_set_transport(
sender: *mut GstWebRTCRTPSender,
transport: *mut GstWebRTCDTLSTransport,
);
//=========================================================================
// GstWebRTCRTPTransceiver

View file

@ -5,13 +5,13 @@
extern crate gstreamer_webrtc_sys;
extern crate shell_words;
extern crate tempdir;
use gstreamer_webrtc_sys::*;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::path::Path;
use std::process::Command;
use std::str;
use gstreamer_webrtc_sys::*;
static PACKAGES: &[&str] = &["gstreamer-webrtc-1.0"];
@ -47,8 +47,7 @@ impl Compiler {
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
return Err(format!("compilation command {:?} failed, {}", &cmd, status).into());
}
Ok(())
}
@ -77,14 +76,12 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
return Err(format!("command {:?} returned {}",
&cmd, out.status).into());
return Err(format!("command {:?} returned {}", &cmd, out.status).into());
}
let stdout = str::from_utf8(&out.stdout)?;
Ok(shell_words::split(stdout.trim())?)
}
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
struct Layout {
size: usize,
@ -115,9 +112,8 @@ impl Results {
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
self.passed, self.failed, self.failed_to_compile
)
}
fn expect_total_success(&self) {
if self.failed == 0 {
@ -133,24 +129,28 @@ fn cross_validate_constants_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!("1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1");
assert_eq!(
"1",
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"),
"failed to obtain correct constant value for 1"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() {
match get_c_value(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(ref c_value) => {
if rust_value == c_value {
results.record_passed();
} else {
results.record_failed();
eprintln!("Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value);
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_value, c_value
);
}
}
};
@ -166,24 +166,31 @@ fn cross_validate_layout_with_c() {
let tmpdir = tempdir::TempDir::new("abi").expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!(Layout {size: 1, alignment: 1},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type");
assert_eq!(
Layout {
size: 1,
alignment: 1
},
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"),
"failed to obtain correct layout for char type"
);
let mut results : Results = Default::default();
let mut results: Results = Default::default();
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() {
match get_c_layout(tmpdir.path(), &cc, name) {
Err(e) => {
results.record_failed_to_compile();
eprintln!("{}", e);
},
}
Ok(c_layout) => {
if rust_layout == c_layout {
results.record_passed();
} else {
results.record_failed();
eprintln!("Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout);
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
name, rust_layout, &c_layout
);
}
}
};
@ -203,15 +210,14 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Err
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let stdout = str::from_utf8(&output.stdout)?;
let mut words = stdout.trim().split_whitespace();
let size = words.next().unwrap().parse().unwrap();
let alignment = words.next().unwrap().parse().unwrap();
Ok(Layout {size, alignment})
Ok(Layout { size, alignment })
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
@ -223,49 +229,218 @@ fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Erro
let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?;
if !output.status.success() {
return Err(format!("command {:?} failed, {:?}",
&abi_cmd, &output).into());
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") ||
!output.ends_with("###gir test###") {
return Err(format!("command {:?} return invalid output, {:?}",
&abi_cmd, &output).into());
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstWebRTCBundlePolicy", Layout {size: size_of::<GstWebRTCBundlePolicy>(), alignment: align_of::<GstWebRTCBundlePolicy>()}),
("GstWebRTCDTLSSetup", Layout {size: size_of::<GstWebRTCDTLSSetup>(), alignment: align_of::<GstWebRTCDTLSSetup>()}),
("GstWebRTCDTLSTransport", Layout {size: size_of::<GstWebRTCDTLSTransport>(), alignment: align_of::<GstWebRTCDTLSTransport>()}),
("GstWebRTCDTLSTransportClass", Layout {size: size_of::<GstWebRTCDTLSTransportClass>(), alignment: align_of::<GstWebRTCDTLSTransportClass>()}),
("GstWebRTCDTLSTransportState", Layout {size: size_of::<GstWebRTCDTLSTransportState>(), alignment: align_of::<GstWebRTCDTLSTransportState>()}),
("GstWebRTCDataChannelState", Layout {size: size_of::<GstWebRTCDataChannelState>(), alignment: align_of::<GstWebRTCDataChannelState>()}),
("GstWebRTCFECType", Layout {size: size_of::<GstWebRTCFECType>(), alignment: align_of::<GstWebRTCFECType>()}),
("GstWebRTCICEComponent", Layout {size: size_of::<GstWebRTCICEComponent>(), alignment: align_of::<GstWebRTCICEComponent>()}),
("GstWebRTCICEConnectionState", Layout {size: size_of::<GstWebRTCICEConnectionState>(), alignment: align_of::<GstWebRTCICEConnectionState>()}),
("GstWebRTCICEGatheringState", Layout {size: size_of::<GstWebRTCICEGatheringState>(), alignment: align_of::<GstWebRTCICEGatheringState>()}),
("GstWebRTCICERole", Layout {size: size_of::<GstWebRTCICERole>(), alignment: align_of::<GstWebRTCICERole>()}),
("GstWebRTCICETransport", Layout {size: size_of::<GstWebRTCICETransport>(), alignment: align_of::<GstWebRTCICETransport>()}),
("GstWebRTCICETransportClass", Layout {size: size_of::<GstWebRTCICETransportClass>(), alignment: align_of::<GstWebRTCICETransportClass>()}),
("GstWebRTCICETransportPolicy", Layout {size: size_of::<GstWebRTCICETransportPolicy>(), alignment: align_of::<GstWebRTCICETransportPolicy>()}),
("GstWebRTCPeerConnectionState", Layout {size: size_of::<GstWebRTCPeerConnectionState>(), alignment: align_of::<GstWebRTCPeerConnectionState>()}),
("GstWebRTCPriorityType", Layout {size: size_of::<GstWebRTCPriorityType>(), alignment: align_of::<GstWebRTCPriorityType>()}),
("GstWebRTCRTPReceiver", Layout {size: size_of::<GstWebRTCRTPReceiver>(), alignment: align_of::<GstWebRTCRTPReceiver>()}),
("GstWebRTCRTPReceiverClass", Layout {size: size_of::<GstWebRTCRTPReceiverClass>(), alignment: align_of::<GstWebRTCRTPReceiverClass>()}),
("GstWebRTCRTPSender", Layout {size: size_of::<GstWebRTCRTPSender>(), alignment: align_of::<GstWebRTCRTPSender>()}),
("GstWebRTCRTPSenderClass", Layout {size: size_of::<GstWebRTCRTPSenderClass>(), alignment: align_of::<GstWebRTCRTPSenderClass>()}),
("GstWebRTCRTPTransceiver", Layout {size: size_of::<GstWebRTCRTPTransceiver>(), alignment: align_of::<GstWebRTCRTPTransceiver>()}),
("GstWebRTCRTPTransceiverClass", Layout {size: size_of::<GstWebRTCRTPTransceiverClass>(), alignment: align_of::<GstWebRTCRTPTransceiverClass>()}),
("GstWebRTCRTPTransceiverDirection", Layout {size: size_of::<GstWebRTCRTPTransceiverDirection>(), alignment: align_of::<GstWebRTCRTPTransceiverDirection>()}),
("GstWebRTCSCTPTransportState", Layout {size: size_of::<GstWebRTCSCTPTransportState>(), alignment: align_of::<GstWebRTCSCTPTransportState>()}),
("GstWebRTCSDPType", Layout {size: size_of::<GstWebRTCSDPType>(), alignment: align_of::<GstWebRTCSDPType>()}),
("GstWebRTCSessionDescription", Layout {size: size_of::<GstWebRTCSessionDescription>(), alignment: align_of::<GstWebRTCSessionDescription>()}),
("GstWebRTCSignalingState", Layout {size: size_of::<GstWebRTCSignalingState>(), alignment: align_of::<GstWebRTCSignalingState>()}),
("GstWebRTCStatsType", Layout {size: size_of::<GstWebRTCStatsType>(), alignment: align_of::<GstWebRTCStatsType>()}),
(
"GstWebRTCBundlePolicy",
Layout {
size: size_of::<GstWebRTCBundlePolicy>(),
alignment: align_of::<GstWebRTCBundlePolicy>(),
},
),
(
"GstWebRTCDTLSSetup",
Layout {
size: size_of::<GstWebRTCDTLSSetup>(),
alignment: align_of::<GstWebRTCDTLSSetup>(),
},
),
(
"GstWebRTCDTLSTransport",
Layout {
size: size_of::<GstWebRTCDTLSTransport>(),
alignment: align_of::<GstWebRTCDTLSTransport>(),
},
),
(
"GstWebRTCDTLSTransportClass",
Layout {
size: size_of::<GstWebRTCDTLSTransportClass>(),
alignment: align_of::<GstWebRTCDTLSTransportClass>(),
},
),
(
"GstWebRTCDTLSTransportState",
Layout {
size: size_of::<GstWebRTCDTLSTransportState>(),
alignment: align_of::<GstWebRTCDTLSTransportState>(),
},
),
(
"GstWebRTCDataChannelState",
Layout {
size: size_of::<GstWebRTCDataChannelState>(),
alignment: align_of::<GstWebRTCDataChannelState>(),
},
),
(
"GstWebRTCFECType",
Layout {
size: size_of::<GstWebRTCFECType>(),
alignment: align_of::<GstWebRTCFECType>(),
},
),
(
"GstWebRTCICEComponent",
Layout {
size: size_of::<GstWebRTCICEComponent>(),
alignment: align_of::<GstWebRTCICEComponent>(),
},
),
(
"GstWebRTCICEConnectionState",
Layout {
size: size_of::<GstWebRTCICEConnectionState>(),
alignment: align_of::<GstWebRTCICEConnectionState>(),
},
),
(
"GstWebRTCICEGatheringState",
Layout {
size: size_of::<GstWebRTCICEGatheringState>(),
alignment: align_of::<GstWebRTCICEGatheringState>(),
},
),
(
"GstWebRTCICERole",
Layout {
size: size_of::<GstWebRTCICERole>(),
alignment: align_of::<GstWebRTCICERole>(),
},
),
(
"GstWebRTCICETransport",
Layout {
size: size_of::<GstWebRTCICETransport>(),
alignment: align_of::<GstWebRTCICETransport>(),
},
),
(
"GstWebRTCICETransportClass",
Layout {
size: size_of::<GstWebRTCICETransportClass>(),
alignment: align_of::<GstWebRTCICETransportClass>(),
},
),
(
"GstWebRTCICETransportPolicy",
Layout {
size: size_of::<GstWebRTCICETransportPolicy>(),
alignment: align_of::<GstWebRTCICETransportPolicy>(),
},
),
(
"GstWebRTCPeerConnectionState",
Layout {
size: size_of::<GstWebRTCPeerConnectionState>(),
alignment: align_of::<GstWebRTCPeerConnectionState>(),
},
),
(
"GstWebRTCPriorityType",
Layout {
size: size_of::<GstWebRTCPriorityType>(),
alignment: align_of::<GstWebRTCPriorityType>(),
},
),
(
"GstWebRTCRTPReceiver",
Layout {
size: size_of::<GstWebRTCRTPReceiver>(),
alignment: align_of::<GstWebRTCRTPReceiver>(),
},
),
(
"GstWebRTCRTPReceiverClass",
Layout {
size: size_of::<GstWebRTCRTPReceiverClass>(),
alignment: align_of::<GstWebRTCRTPReceiverClass>(),
},
),
(
"GstWebRTCRTPSender",
Layout {
size: size_of::<GstWebRTCRTPSender>(),
alignment: align_of::<GstWebRTCRTPSender>(),
},
),
(
"GstWebRTCRTPSenderClass",
Layout {
size: size_of::<GstWebRTCRTPSenderClass>(),
alignment: align_of::<GstWebRTCRTPSenderClass>(),
},
),
(
"GstWebRTCRTPTransceiver",
Layout {
size: size_of::<GstWebRTCRTPTransceiver>(),
alignment: align_of::<GstWebRTCRTPTransceiver>(),
},
),
(
"GstWebRTCRTPTransceiverClass",
Layout {
size: size_of::<GstWebRTCRTPTransceiverClass>(),
alignment: align_of::<GstWebRTCRTPTransceiverClass>(),
},
),
(
"GstWebRTCRTPTransceiverDirection",
Layout {
size: size_of::<GstWebRTCRTPTransceiverDirection>(),
alignment: align_of::<GstWebRTCRTPTransceiverDirection>(),
},
),
(
"GstWebRTCSCTPTransportState",
Layout {
size: size_of::<GstWebRTCSCTPTransportState>(),
alignment: align_of::<GstWebRTCSCTPTransportState>(),
},
),
(
"GstWebRTCSDPType",
Layout {
size: size_of::<GstWebRTCSDPType>(),
alignment: align_of::<GstWebRTCSDPType>(),
},
),
(
"GstWebRTCSessionDescription",
Layout {
size: size_of::<GstWebRTCSessionDescription>(),
alignment: align_of::<GstWebRTCSessionDescription>(),
},
),
(
"GstWebRTCSignalingState",
Layout {
size: size_of::<GstWebRTCSignalingState>(),
alignment: align_of::<GstWebRTCSignalingState>(),
},
),
(
"GstWebRTCStatsType",
Layout {
size: size_of::<GstWebRTCStatsType>(),
alignment: align_of::<GstWebRTCStatsType>(),
},
),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
@ -332,7 +507,10 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER", "2"),
("(gint) GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER", "4"),
("(gint) GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER", "3"),
("(gint) GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER", "5"),
(
"(gint) GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER",
"5",
),
("(gint) GST_WEBRTC_SIGNALING_STATE_STABLE", "0"),
("(gint) GST_WEBRTC_STATS_CANDIDATE_PAIR", "11"),
("(gint) GST_WEBRTC_STATS_CERTIFICATE", "14"),
@ -349,5 +527,3 @@ const RUST_CONSTANTS: &[(&str, &str)] = &[
("(gint) GST_WEBRTC_STATS_STREAM", "9"),
("(gint) GST_WEBRTC_STATS_TRANSPORT", "10"),
];