Add ABI tests and generate with latest GIR

This is also getting us rid of bitflags.

The ABI tests are not all succeeding yet.
This commit is contained in:
Sebastian Dröge 2018-03-20 11:46:03 +02:00
parent 0d33dfdcff
commit c1ae289fe8
84 changed files with 7379 additions and 1188 deletions

View file

@ -11,6 +11,10 @@ path = "../gstreamer-sys"
[dependencies.gstreamer-base-sys]
path = "../gstreamer-base-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_2 = []
v1_4 = ["v1_2"]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT

View file

@ -0,0 +1,249 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_app_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_app_sys::*;
static PACKAGES: &[&str] = &["gstreamer-app-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_APP_STREAM_TYPE_RANDOM_ACCESS", "2"),
("GST_APP_STREAM_TYPE_SEEKABLE", "1"),
("GST_APP_STREAM_TYPE_STREAM", "0"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/app/app.h>

View file

@ -2,7 +2,6 @@
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
@ -13,6 +12,10 @@ path = "../gstreamer-sys"
[dependencies.gstreamer-base-sys]
path = "../gstreamer-base-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_2 = []
v1_4 = ["v1_2"]

View file

@ -1,11 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[macro_use] extern crate bitflags;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
@ -209,93 +208,42 @@ pub const GST_META_TAG_AUDIO_RATE_STR: *const c_char = b"rate\0" as *const u8 as
pub const GST_META_TAG_AUDIO_STR: *const c_char = b"audio\0" as *const u8 as *const c_char;
// Flags
bitflags! {
#[repr(C)]
pub struct GstAudioChannelMixerFlags: c_uint {
const NONE = 0;
const NON_INTERLEAVED_IN = 1;
const NON_INTERLEAVED_OUT = 2;
const UNPOSITIONED_IN = 4;
const UNPOSITIONED_OUT = 8;
}
}
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE: GstAudioChannelMixerFlags = GstAudioChannelMixerFlags::NONE;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN: GstAudioChannelMixerFlags = GstAudioChannelMixerFlags::NON_INTERLEAVED_IN;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT: GstAudioChannelMixerFlags = GstAudioChannelMixerFlags::NON_INTERLEAVED_OUT;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN: GstAudioChannelMixerFlags = GstAudioChannelMixerFlags::UNPOSITIONED_IN;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT: GstAudioChannelMixerFlags = GstAudioChannelMixerFlags::UNPOSITIONED_OUT;
pub type GstAudioChannelMixerFlags = c_uint;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE: GstAudioChannelMixerFlags = 0;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN: GstAudioChannelMixerFlags = 1;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT: GstAudioChannelMixerFlags = 2;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN: GstAudioChannelMixerFlags = 4;
pub const GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT: GstAudioChannelMixerFlags = 8;
bitflags! {
#[repr(C)]
pub struct GstAudioConverterFlags: c_uint {
const NONE = 0;
const IN_WRITABLE = 1;
const VARIABLE_RATE = 2;
}
}
pub const GST_AUDIO_CONVERTER_FLAG_NONE: GstAudioConverterFlags = GstAudioConverterFlags::NONE;
pub const GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE: GstAudioConverterFlags = GstAudioConverterFlags::IN_WRITABLE;
pub const GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE: GstAudioConverterFlags = GstAudioConverterFlags::VARIABLE_RATE;
pub type GstAudioConverterFlags = c_uint;
pub const GST_AUDIO_CONVERTER_FLAG_NONE: GstAudioConverterFlags = 0;
pub const GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE: GstAudioConverterFlags = 1;
pub const GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE: GstAudioConverterFlags = 2;
bitflags! {
#[repr(C)]
pub struct GstAudioFlags: c_uint {
const NONE = 0;
const UNPOSITIONED = 1;
}
}
pub const GST_AUDIO_FLAG_NONE: GstAudioFlags = GstAudioFlags::NONE;
pub const GST_AUDIO_FLAG_UNPOSITIONED: GstAudioFlags = GstAudioFlags::UNPOSITIONED;
pub type GstAudioFlags = c_uint;
pub const GST_AUDIO_FLAG_NONE: GstAudioFlags = 0;
pub const GST_AUDIO_FLAG_UNPOSITIONED: GstAudioFlags = 1;
bitflags! {
#[repr(C)]
pub struct GstAudioFormatFlags: c_uint {
const INTEGER = 1;
const FLOAT = 2;
const SIGNED = 4;
const COMPLEX = 16;
const UNPACK = 32;
}
}
pub const GST_AUDIO_FORMAT_FLAG_INTEGER: GstAudioFormatFlags = GstAudioFormatFlags::INTEGER;
pub const GST_AUDIO_FORMAT_FLAG_FLOAT: GstAudioFormatFlags = GstAudioFormatFlags::FLOAT;
pub const GST_AUDIO_FORMAT_FLAG_SIGNED: GstAudioFormatFlags = GstAudioFormatFlags::SIGNED;
pub const GST_AUDIO_FORMAT_FLAG_COMPLEX: GstAudioFormatFlags = GstAudioFormatFlags::COMPLEX;
pub const GST_AUDIO_FORMAT_FLAG_UNPACK: GstAudioFormatFlags = GstAudioFormatFlags::UNPACK;
pub type GstAudioFormatFlags = c_uint;
pub const GST_AUDIO_FORMAT_FLAG_INTEGER: GstAudioFormatFlags = 1;
pub const GST_AUDIO_FORMAT_FLAG_FLOAT: GstAudioFormatFlags = 2;
pub const GST_AUDIO_FORMAT_FLAG_SIGNED: GstAudioFormatFlags = 4;
pub const GST_AUDIO_FORMAT_FLAG_COMPLEX: GstAudioFormatFlags = 16;
pub const GST_AUDIO_FORMAT_FLAG_UNPACK: GstAudioFormatFlags = 32;
bitflags! {
#[repr(C)]
pub struct GstAudioPackFlags: c_uint {
const NONE = 0;
const TRUNCATE_RANGE = 1;
}
}
pub const GST_AUDIO_PACK_FLAG_NONE: GstAudioPackFlags = GstAudioPackFlags::NONE;
pub const GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE: GstAudioPackFlags = GstAudioPackFlags::TRUNCATE_RANGE;
pub type GstAudioPackFlags = c_uint;
pub const GST_AUDIO_PACK_FLAG_NONE: GstAudioPackFlags = 0;
pub const GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE: GstAudioPackFlags = 1;
bitflags! {
#[repr(C)]
pub struct GstAudioQuantizeFlags: c_uint {
const NONE = 0;
const NON_INTERLEAVED = 1;
}
}
pub const GST_AUDIO_QUANTIZE_FLAG_NONE: GstAudioQuantizeFlags = GstAudioQuantizeFlags::NONE;
pub const GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED: GstAudioQuantizeFlags = GstAudioQuantizeFlags::NON_INTERLEAVED;
pub type GstAudioQuantizeFlags = c_uint;
pub const GST_AUDIO_QUANTIZE_FLAG_NONE: GstAudioQuantizeFlags = 0;
pub const GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED: GstAudioQuantizeFlags = 1;
bitflags! {
#[repr(C)]
pub struct GstAudioResamplerFlags: c_uint {
const NONE = 0;
const NON_INTERLEAVED_IN = 1;
const NON_INTERLEAVED_OUT = 2;
const VARIABLE_RATE = 4;
}
}
pub const GST_AUDIO_RESAMPLER_FLAG_NONE: GstAudioResamplerFlags = GstAudioResamplerFlags::NONE;
pub const GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN: GstAudioResamplerFlags = GstAudioResamplerFlags::NON_INTERLEAVED_IN;
pub const GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT: GstAudioResamplerFlags = GstAudioResamplerFlags::NON_INTERLEAVED_OUT;
pub const GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE: GstAudioResamplerFlags = GstAudioResamplerFlags::VARIABLE_RATE;
pub type GstAudioResamplerFlags = c_uint;
pub const GST_AUDIO_RESAMPLER_FLAG_NONE: GstAudioResamplerFlags = 0;
pub const GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN: GstAudioResamplerFlags = 1;
pub const GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT: GstAudioResamplerFlags = 2;
pub const GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE: GstAudioResamplerFlags = 4;
// Callbacks
pub type GstAudioBaseSinkCustomSlavingCallback = Option<unsafe extern "C" fn(*mut GstAudioBaseSink, gst::GstClockTime, gst::GstClockTime, *mut gst::GstClockTimeDiff, GstAudioBaseSinkDiscontReason, gpointer)>;

View file

@ -0,0 +1,487 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_audio_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_audio_sys::*;
static PACKAGES: &[&str] = &["gstreamer-audio-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
("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>()}),
("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)] = &[
("GST_AUDIO_BASE_SINK_DISCONT_REASON_ALIGNMENT", "4"),
("GST_AUDIO_BASE_SINK_DISCONT_REASON_DEVICE_FAILURE", "5"),
("GST_AUDIO_BASE_SINK_DISCONT_REASON_FLUSH", "2"),
("GST_AUDIO_BASE_SINK_DISCONT_REASON_NEW_CAPS", "1"),
("GST_AUDIO_BASE_SINK_DISCONT_REASON_NO_DISCONT", "0"),
("GST_AUDIO_BASE_SINK_DISCONT_REASON_SYNC_LATENCY", "3"),
("GST_AUDIO_BASE_SINK_SLAVE_CUSTOM", "3"),
("GST_AUDIO_BASE_SINK_SLAVE_NONE", "2"),
("GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE", "0"),
("GST_AUDIO_BASE_SINK_SLAVE_SKEW", "1"),
("GST_AUDIO_BASE_SRC_SLAVE_NONE", "3"),
("GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE", "0"),
("GST_AUDIO_BASE_SRC_SLAVE_RE_TIMESTAMP", "1"),
("GST_AUDIO_BASE_SRC_SLAVE_SKEW", "2"),
("GST_AUDIO_CD_SRC_MODE_CONTINUOUS", "1"),
("GST_AUDIO_CD_SRC_MODE_NORMAL", "0"),
("GST_AUDIO_CHANNELS_RANGE", "(int) [ 1, max ]"),
("GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE", "0"),
("GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN", "1"),
("GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT", "2"),
("GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN", "4"),
("GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT", "8"),
("GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER", "21"),
("GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT", "22"),
("GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT", "23"),
("GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER", "2"),
("GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT", "0"),
("GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER", "6"),
("GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT", "1"),
("GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER", "7"),
("GST_AUDIO_CHANNEL_POSITION_INVALID", "-1"),
("GST_AUDIO_CHANNEL_POSITION_LFE1", "3"),
("GST_AUDIO_CHANNEL_POSITION_LFE2", "9"),
("GST_AUDIO_CHANNEL_POSITION_MONO", "-2"),
("GST_AUDIO_CHANNEL_POSITION_NONE", "-3"),
("GST_AUDIO_CHANNEL_POSITION_REAR_CENTER", "8"),
("GST_AUDIO_CHANNEL_POSITION_REAR_LEFT", "4"),
("GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT", "5"),
("GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT", "10"),
("GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT", "11"),
("GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT", "26"),
("GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT", "27"),
("GST_AUDIO_CHANNEL_POSITION_TOP_CENTER", "15"),
("GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER", "14"),
("GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT", "12"),
("GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT", "13"),
("GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER", "20"),
("GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT", "16"),
("GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT", "17"),
("GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT", "18"),
("GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT", "19"),
("GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT", "24"),
("GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT", "25"),
("GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE", "1"),
("GST_AUDIO_CONVERTER_FLAG_NONE", "0"),
("GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE", "2"),
("GST_AUDIO_CONVERTER_OPT_DITHER_METHOD", "GstAudioConverter.dither-method"),
("GST_AUDIO_CONVERTER_OPT_MIX_MATRIX", "GstAudioConverter.mix-matrix"),
("GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD", "GstAudioConverter.noise-shaping-method"),
("GST_AUDIO_CONVERTER_OPT_QUANTIZATION", "GstAudioConverter.quantization"),
("GST_AUDIO_CONVERTER_OPT_RESAMPLER_METHOD", "GstAudioConverter.resampler-method"),
("GST_AUDIO_DECODER_MAX_ERRORS", "10"),
("GST_AUDIO_DECODER_SINK_NAME", "sink"),
("GST_AUDIO_DECODER_SRC_NAME", "src"),
("GST_AUDIO_DEF_CHANNELS", "2"),
("GST_AUDIO_DEF_FORMAT", "S16LE"),
("GST_AUDIO_DEF_RATE", "44100"),
("GST_AUDIO_DITHER_NONE", "0"),
("GST_AUDIO_DITHER_RPDF", "1"),
("GST_AUDIO_DITHER_TPDF", "2"),
("GST_AUDIO_DITHER_TPDF_HF", "3"),
("GST_AUDIO_ENCODER_SINK_NAME", "sink"),
("GST_AUDIO_ENCODER_SRC_NAME", "src"),
("GST_AUDIO_FLAG_NONE", "0"),
("GST_AUDIO_FLAG_UNPOSITIONED", "1"),
("GST_AUDIO_FORMATS_ALL", " { S8, U8, S16LE, S16BE, U16LE, U16BE, S24_32LE, S24_32BE, U24_32LE, U24_32BE, S32LE, S32BE, U32LE, U32BE, S24LE, S24BE, U24LE, U24BE, S20LE, S20BE, U20LE, U20BE, S18LE, S18BE, U18LE, U18BE, F32LE, F32BE, F64LE, F64BE }"),
("GST_AUDIO_FORMAT_ENCODED", "1"),
("GST_AUDIO_FORMAT_F32", "28"),
("GST_AUDIO_FORMAT_F32BE", "29"),
("GST_AUDIO_FORMAT_F32LE", "28"),
("GST_AUDIO_FORMAT_F64", "30"),
("GST_AUDIO_FORMAT_F64BE", "31"),
("GST_AUDIO_FORMAT_F64LE", "30"),
("GST_AUDIO_FORMAT_FLAG_COMPLEX", "16"),
("GST_AUDIO_FORMAT_FLAG_FLOAT", "2"),
("GST_AUDIO_FORMAT_FLAG_INTEGER", "1"),
("GST_AUDIO_FORMAT_FLAG_SIGNED", "4"),
("GST_AUDIO_FORMAT_FLAG_UNPACK", "32"),
("GST_AUDIO_FORMAT_S16", "4"),
("GST_AUDIO_FORMAT_S16BE", "5"),
("GST_AUDIO_FORMAT_S16LE", "4"),
("GST_AUDIO_FORMAT_S18", "24"),
("GST_AUDIO_FORMAT_S18BE", "25"),
("GST_AUDIO_FORMAT_S18LE", "24"),
("GST_AUDIO_FORMAT_S20", "20"),
("GST_AUDIO_FORMAT_S20BE", "21"),
("GST_AUDIO_FORMAT_S20LE", "20"),
("GST_AUDIO_FORMAT_S24", "16"),
("GST_AUDIO_FORMAT_S24BE", "17"),
("GST_AUDIO_FORMAT_S24LE", "16"),
("GST_AUDIO_FORMAT_S24_32", "8"),
("GST_AUDIO_FORMAT_S24_32BE", "9"),
("GST_AUDIO_FORMAT_S24_32LE", "8"),
("GST_AUDIO_FORMAT_S32", "12"),
("GST_AUDIO_FORMAT_S32BE", "13"),
("GST_AUDIO_FORMAT_S32LE", "12"),
("GST_AUDIO_FORMAT_S8", "2"),
("GST_AUDIO_FORMAT_U16", "6"),
("GST_AUDIO_FORMAT_U16BE", "7"),
("GST_AUDIO_FORMAT_U16LE", "6"),
("GST_AUDIO_FORMAT_U18", "26"),
("GST_AUDIO_FORMAT_U18BE", "27"),
("GST_AUDIO_FORMAT_U18LE", "26"),
("GST_AUDIO_FORMAT_U20", "22"),
("GST_AUDIO_FORMAT_U20BE", "23"),
("GST_AUDIO_FORMAT_U20LE", "22"),
("GST_AUDIO_FORMAT_U24", "18"),
("GST_AUDIO_FORMAT_U24BE", "19"),
("GST_AUDIO_FORMAT_U24LE", "18"),
("GST_AUDIO_FORMAT_U24_32", "10"),
("GST_AUDIO_FORMAT_U24_32BE", "11"),
("GST_AUDIO_FORMAT_U24_32LE", "10"),
("GST_AUDIO_FORMAT_U32", "14"),
("GST_AUDIO_FORMAT_U32BE", "15"),
("GST_AUDIO_FORMAT_U32LE", "14"),
("GST_AUDIO_FORMAT_U8", "3"),
("GST_AUDIO_FORMAT_UNKNOWN", "0"),
("GST_AUDIO_LAYOUT_INTERLEAVED", "0"),
("GST_AUDIO_LAYOUT_NON_INTERLEAVED", "1"),
("GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK", "1"),
("GST_AUDIO_NOISE_SHAPING_HIGH", "4"),
("GST_AUDIO_NOISE_SHAPING_MEDIUM", "3"),
("GST_AUDIO_NOISE_SHAPING_NONE", "0"),
("GST_AUDIO_NOISE_SHAPING_SIMPLE", "2"),
("GST_AUDIO_PACK_FLAG_NONE", "0"),
("GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE", "1"),
("GST_AUDIO_QUANTIZE_FLAG_NONE", "0"),
("GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED", "1"),
("GST_AUDIO_RATE_RANGE", "(int) [ 1, max ]"),
("GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC", "2"),
("GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_LINEAR", "1"),
("GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_NONE", "0"),
("GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO", "2"),
("GST_AUDIO_RESAMPLER_FILTER_MODE_FULL", "1"),
("GST_AUDIO_RESAMPLER_FILTER_MODE_INTERPOLATED", "0"),
("GST_AUDIO_RESAMPLER_FLAG_NONE", "0"),
("GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN", "1"),
("GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT", "2"),
("GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE", "4"),
("GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL", "3"),
("GST_AUDIO_RESAMPLER_METHOD_CUBIC", "2"),
("GST_AUDIO_RESAMPLER_METHOD_KAISER", "4"),
("GST_AUDIO_RESAMPLER_METHOD_LINEAR", "1"),
("GST_AUDIO_RESAMPLER_METHOD_NEAREST", "0"),
("GST_AUDIO_RESAMPLER_OPT_CUBIC_B", "GstAudioResampler.cubic-b"),
("GST_AUDIO_RESAMPLER_OPT_CUBIC_C", "GstAudioResampler.cubic-c"),
("GST_AUDIO_RESAMPLER_OPT_CUTOFF", "GstAudioResampler.cutoff"),
("GST_AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION", "GstAudioResampler.filter-interpolation"),
("GST_AUDIO_RESAMPLER_OPT_FILTER_MODE", "GstAudioResampler.filter-mode"),
("GST_AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD", "GstAudioResampler.filter-mode-threshold"),
("GST_AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE", "GstAudioResampler.filter-oversample"),
("GST_AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR", "GstAudioResampler.max-phase-error"),
("GST_AUDIO_RESAMPLER_OPT_N_TAPS", "GstAudioResampler.n-taps"),
("GST_AUDIO_RESAMPLER_OPT_STOP_ATTENUATION", "GstAudioResampler.stop-attenutation"),
("GST_AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH", "GstAudioResampler.transition-bandwidth"),
("GST_AUDIO_RESAMPLER_QUALITY_DEFAULT", "4"),
("GST_AUDIO_RESAMPLER_QUALITY_MAX", "10"),
("GST_AUDIO_RESAMPLER_QUALITY_MIN", "0"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3", "7"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW", "2"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS", "9"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3", "8"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC", "14"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM", "5"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958", "6"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM", "3"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG", "4"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC", "10"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW", "12"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC", "11"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW", "13"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW", "1"),
("GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW", "0"),
("GST_AUDIO_RING_BUFFER_STATE_ERROR", "3"),
("GST_AUDIO_RING_BUFFER_STATE_PAUSED", "1"),
("GST_AUDIO_RING_BUFFER_STATE_STARTED", "2"),
("GST_AUDIO_RING_BUFFER_STATE_STOPPED", "0"),
("GST_META_TAG_AUDIO_CHANNELS_STR", "channels"),
("GST_META_TAG_AUDIO_RATE_STR", "rate"),
("GST_META_TAG_AUDIO_STR", "audio"),
("GST_STREAM_VOLUME_FORMAT_CUBIC", "1"),
("GST_STREAM_VOLUME_FORMAT_DB", "2"),
("GST_STREAM_VOLUME_FORMAT_LINEAR", "0"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/audio/audio.h>

View file

@ -2,7 +2,6 @@
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
@ -10,6 +9,10 @@ gobject-sys = { git = "https://github.com/gtk-rs/sys" }
[dependencies.gstreamer-sys]
path = "../gstreamer-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_0_1 = []
v1_2 = ["v1_0_1"]

View file

@ -1,11 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[macro_use] extern crate bitflags;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
@ -25,51 +24,25 @@ pub const GST_BASE_TRANSFORM_SINK_NAME: *const c_char = b"sink\0" as *const u8 a
pub const GST_BASE_TRANSFORM_SRC_NAME: *const c_char = b"src\0" as *const u8 as *const c_char;
// Flags
bitflags! {
#[repr(C)]
pub struct GstBaseParseFrameFlags: c_uint {
const NONE = 0;
const NEW_FRAME = 1;
const NO_FRAME = 2;
const CLIP = 4;
const DROP = 8;
const QUEUE = 16;
}
}
pub const GST_BASE_PARSE_FRAME_FLAG_NONE: GstBaseParseFrameFlags = GstBaseParseFrameFlags::NONE;
pub const GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME: GstBaseParseFrameFlags = GstBaseParseFrameFlags::NEW_FRAME;
pub const GST_BASE_PARSE_FRAME_FLAG_NO_FRAME: GstBaseParseFrameFlags = GstBaseParseFrameFlags::NO_FRAME;
pub const GST_BASE_PARSE_FRAME_FLAG_CLIP: GstBaseParseFrameFlags = GstBaseParseFrameFlags::CLIP;
pub const GST_BASE_PARSE_FRAME_FLAG_DROP: GstBaseParseFrameFlags = GstBaseParseFrameFlags::DROP;
pub const GST_BASE_PARSE_FRAME_FLAG_QUEUE: GstBaseParseFrameFlags = GstBaseParseFrameFlags::QUEUE;
pub type GstBaseParseFrameFlags = c_uint;
pub const GST_BASE_PARSE_FRAME_FLAG_NONE: GstBaseParseFrameFlags = 0;
pub const GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME: GstBaseParseFrameFlags = 1;
pub const GST_BASE_PARSE_FRAME_FLAG_NO_FRAME: GstBaseParseFrameFlags = 2;
pub const GST_BASE_PARSE_FRAME_FLAG_CLIP: GstBaseParseFrameFlags = 4;
pub const GST_BASE_PARSE_FRAME_FLAG_DROP: GstBaseParseFrameFlags = 8;
pub const GST_BASE_PARSE_FRAME_FLAG_QUEUE: GstBaseParseFrameFlags = 16;
bitflags! {
#[repr(C)]
pub struct GstBaseSrcFlags: c_uint {
const STARTING = 16384;
const STARTED = 32768;
const LAST = 1048576;
}
}
pub const GST_BASE_SRC_FLAG_STARTING: GstBaseSrcFlags = GstBaseSrcFlags::STARTING;
pub const GST_BASE_SRC_FLAG_STARTED: GstBaseSrcFlags = GstBaseSrcFlags::STARTED;
pub const GST_BASE_SRC_FLAG_LAST: GstBaseSrcFlags = GstBaseSrcFlags::LAST;
pub type GstBaseSrcFlags = c_uint;
pub const GST_BASE_SRC_FLAG_STARTING: GstBaseSrcFlags = 16384;
pub const GST_BASE_SRC_FLAG_STARTED: GstBaseSrcFlags = 32768;
pub const GST_BASE_SRC_FLAG_LAST: GstBaseSrcFlags = 1048576;
bitflags! {
#[repr(C)]
pub struct GstCollectPadsStateFlags: c_uint {
const EOS = 1;
const FLUSHING = 2;
const NEW_SEGMENT = 4;
const WAITING = 8;
const LOCKED = 16;
}
}
pub const GST_COLLECT_PADS_STATE_EOS: GstCollectPadsStateFlags = GstCollectPadsStateFlags::EOS;
pub const GST_COLLECT_PADS_STATE_FLUSHING: GstCollectPadsStateFlags = GstCollectPadsStateFlags::FLUSHING;
pub const GST_COLLECT_PADS_STATE_NEW_SEGMENT: GstCollectPadsStateFlags = GstCollectPadsStateFlags::NEW_SEGMENT;
pub const GST_COLLECT_PADS_STATE_WAITING: GstCollectPadsStateFlags = GstCollectPadsStateFlags::WAITING;
pub const GST_COLLECT_PADS_STATE_LOCKED: GstCollectPadsStateFlags = GstCollectPadsStateFlags::LOCKED;
pub type GstCollectPadsStateFlags = c_uint;
pub const GST_COLLECT_PADS_STATE_EOS: GstCollectPadsStateFlags = 1;
pub const GST_COLLECT_PADS_STATE_FLUSHING: GstCollectPadsStateFlags = 2;
pub const GST_COLLECT_PADS_STATE_NEW_SEGMENT: GstCollectPadsStateFlags = 4;
pub const GST_COLLECT_PADS_STATE_WAITING: GstCollectPadsStateFlags = 8;
pub const GST_COLLECT_PADS_STATE_LOCKED: GstCollectPadsStateFlags = 16;
// Unions
#[repr(C)]

View file

@ -0,0 +1,285 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_base_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_base_sys::*;
static PACKAGES: &[&str] = &["gstreamer-base-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
("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)] = &[
("GST_BASE_PARSE_FLAG_DRAINING", "2"),
("GST_BASE_PARSE_FLAG_LOST_SYNC", "1"),
("GST_BASE_PARSE_FRAME_FLAG_CLIP", "4"),
("GST_BASE_PARSE_FRAME_FLAG_DROP", "8"),
("GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME", "1"),
("GST_BASE_PARSE_FRAME_FLAG_NONE", "0"),
("GST_BASE_PARSE_FRAME_FLAG_NO_FRAME", "2"),
("GST_BASE_PARSE_FRAME_FLAG_QUEUE", "16"),
("GST_BASE_SRC_FLAG_LAST", "1048576"),
("GST_BASE_SRC_FLAG_STARTED", "32768"),
("GST_BASE_SRC_FLAG_STARTING", "16384"),
("GST_BASE_TRANSFORM_SINK_NAME", "sink"),
("GST_BASE_TRANSFORM_SRC_NAME", "src"),
("GST_COLLECT_PADS_STATE_EOS", "1"),
("GST_COLLECT_PADS_STATE_FLUSHING", "2"),
("GST_COLLECT_PADS_STATE_LOCKED", "16"),
("GST_COLLECT_PADS_STATE_NEW_SEGMENT", "4"),
("GST_COLLECT_PADS_STATE_WAITING", "8"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/base/base.h>

View file

@ -16,6 +16,10 @@ path = "../gstreamer-base-sys"
[dependencies.gstreamer-sys]
path = "../gstreamer-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_2 = []
v1_4 = ["v1_2"]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT

View file

@ -0,0 +1,809 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_mpegts_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_mpegts_sys::*;
static PACKAGES: &[&str] = &["gstreamer-mpegts-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("GstMpegtsATSCDescriptorType", Layout {size: size_of::<GstMpegtsATSCDescriptorType>(), alignment: align_of::<GstMpegtsATSCDescriptorType>()}),
("GstMpegtsAtscEIT", Layout {size: size_of::<GstMpegtsAtscEIT>(), alignment: align_of::<GstMpegtsAtscEIT>()}),
("GstMpegtsAtscEITEvent", Layout {size: size_of::<GstMpegtsAtscEITEvent>(), alignment: align_of::<GstMpegtsAtscEITEvent>()}),
("GstMpegtsAtscETT", Layout {size: size_of::<GstMpegtsAtscETT>(), alignment: align_of::<GstMpegtsAtscETT>()}),
("GstMpegtsAtscMGT", Layout {size: size_of::<GstMpegtsAtscMGT>(), alignment: align_of::<GstMpegtsAtscMGT>()}),
("GstMpegtsAtscMGTTable", Layout {size: size_of::<GstMpegtsAtscMGTTable>(), alignment: align_of::<GstMpegtsAtscMGTTable>()}),
("GstMpegtsAtscMGTTableType", Layout {size: size_of::<GstMpegtsAtscMGTTableType>(), alignment: align_of::<GstMpegtsAtscMGTTableType>()}),
("GstMpegtsAtscMultString", Layout {size: size_of::<GstMpegtsAtscMultString>(), alignment: align_of::<GstMpegtsAtscMultString>()}),
("GstMpegtsAtscSTT", Layout {size: size_of::<GstMpegtsAtscSTT>(), alignment: align_of::<GstMpegtsAtscSTT>()}),
("GstMpegtsAtscStringSegment", Layout {size: size_of::<GstMpegtsAtscStringSegment>(), alignment: align_of::<GstMpegtsAtscStringSegment>()}),
("GstMpegtsAtscVCT", Layout {size: size_of::<GstMpegtsAtscVCT>(), alignment: align_of::<GstMpegtsAtscVCT>()}),
("GstMpegtsAtscVCTSource", Layout {size: size_of::<GstMpegtsAtscVCTSource>(), alignment: align_of::<GstMpegtsAtscVCTSource>()}),
("GstMpegtsBAT", Layout {size: size_of::<GstMpegtsBAT>(), alignment: align_of::<GstMpegtsBAT>()}),
("GstMpegtsBATStream", Layout {size: size_of::<GstMpegtsBATStream>(), alignment: align_of::<GstMpegtsBATStream>()}),
("GstMpegtsCableDeliverySystemDescriptor", Layout {size: size_of::<GstMpegtsCableDeliverySystemDescriptor>(), alignment: align_of::<GstMpegtsCableDeliverySystemDescriptor>()}),
("GstMpegtsCableOuterFECScheme", Layout {size: size_of::<GstMpegtsCableOuterFECScheme>(), alignment: align_of::<GstMpegtsCableOuterFECScheme>()}),
("GstMpegtsComponentDescriptor", Layout {size: size_of::<GstMpegtsComponentDescriptor>(), alignment: align_of::<GstMpegtsComponentDescriptor>()}),
("GstMpegtsComponentStreamContent", Layout {size: size_of::<GstMpegtsComponentStreamContent>(), alignment: align_of::<GstMpegtsComponentStreamContent>()}),
("GstMpegtsContent", Layout {size: size_of::<GstMpegtsContent>(), alignment: align_of::<GstMpegtsContent>()}),
("GstMpegtsContentNibbleHi", Layout {size: size_of::<GstMpegtsContentNibbleHi>(), alignment: align_of::<GstMpegtsContentNibbleHi>()}),
("GstMpegtsDVBCodeRate", Layout {size: size_of::<GstMpegtsDVBCodeRate>(), alignment: align_of::<GstMpegtsDVBCodeRate>()}),
("GstMpegtsDVBDescriptorType", Layout {size: size_of::<GstMpegtsDVBDescriptorType>(), alignment: align_of::<GstMpegtsDVBDescriptorType>()}),
("GstMpegtsDVBExtendedDescriptorType", Layout {size: size_of::<GstMpegtsDVBExtendedDescriptorType>(), alignment: align_of::<GstMpegtsDVBExtendedDescriptorType>()}),
("GstMpegtsDVBLinkageDescriptor", Layout {size: size_of::<GstMpegtsDVBLinkageDescriptor>(), alignment: align_of::<GstMpegtsDVBLinkageDescriptor>()}),
("GstMpegtsDVBLinkageEvent", Layout {size: size_of::<GstMpegtsDVBLinkageEvent>(), alignment: align_of::<GstMpegtsDVBLinkageEvent>()}),
("GstMpegtsDVBLinkageExtendedEvent", Layout {size: size_of::<GstMpegtsDVBLinkageExtendedEvent>(), alignment: align_of::<GstMpegtsDVBLinkageExtendedEvent>()}),
("GstMpegtsDVBLinkageHandOverType", Layout {size: size_of::<GstMpegtsDVBLinkageHandOverType>(), alignment: align_of::<GstMpegtsDVBLinkageHandOverType>()}),
("GstMpegtsDVBLinkageMobileHandOver", Layout {size: size_of::<GstMpegtsDVBLinkageMobileHandOver>(), alignment: align_of::<GstMpegtsDVBLinkageMobileHandOver>()}),
("GstMpegtsDVBLinkageType", Layout {size: size_of::<GstMpegtsDVBLinkageType>(), alignment: align_of::<GstMpegtsDVBLinkageType>()}),
("GstMpegtsDVBParentalRatingItem", Layout {size: size_of::<GstMpegtsDVBParentalRatingItem>(), alignment: align_of::<GstMpegtsDVBParentalRatingItem>()}),
("GstMpegtsDVBScramblingModeType", Layout {size: size_of::<GstMpegtsDVBScramblingModeType>(), alignment: align_of::<GstMpegtsDVBScramblingModeType>()}),
("GstMpegtsDVBServiceListItem", Layout {size: size_of::<GstMpegtsDVBServiceListItem>(), alignment: align_of::<GstMpegtsDVBServiceListItem>()}),
("GstMpegtsDVBServiceType", Layout {size: size_of::<GstMpegtsDVBServiceType>(), alignment: align_of::<GstMpegtsDVBServiceType>()}),
("GstMpegtsDVBTeletextType", Layout {size: size_of::<GstMpegtsDVBTeletextType>(), alignment: align_of::<GstMpegtsDVBTeletextType>()}),
("GstMpegtsDataBroadcastDescriptor", Layout {size: size_of::<GstMpegtsDataBroadcastDescriptor>(), alignment: align_of::<GstMpegtsDataBroadcastDescriptor>()}),
("GstMpegtsDescriptor", Layout {size: size_of::<GstMpegtsDescriptor>(), alignment: align_of::<GstMpegtsDescriptor>()}),
("GstMpegtsDescriptorType", Layout {size: size_of::<GstMpegtsDescriptorType>(), alignment: align_of::<GstMpegtsDescriptorType>()}),
("GstMpegtsDvbMultilingualBouquetNameItem", Layout {size: size_of::<GstMpegtsDvbMultilingualBouquetNameItem>(), alignment: align_of::<GstMpegtsDvbMultilingualBouquetNameItem>()}),
("GstMpegtsDvbMultilingualComponentItem", Layout {size: size_of::<GstMpegtsDvbMultilingualComponentItem>(), alignment: align_of::<GstMpegtsDvbMultilingualComponentItem>()}),
("GstMpegtsDvbMultilingualNetworkNameItem", Layout {size: size_of::<GstMpegtsDvbMultilingualNetworkNameItem>(), alignment: align_of::<GstMpegtsDvbMultilingualNetworkNameItem>()}),
("GstMpegtsDvbMultilingualServiceNameItem", Layout {size: size_of::<GstMpegtsDvbMultilingualServiceNameItem>(), alignment: align_of::<GstMpegtsDvbMultilingualServiceNameItem>()}),
("GstMpegtsEIT", Layout {size: size_of::<GstMpegtsEIT>(), alignment: align_of::<GstMpegtsEIT>()}),
("GstMpegtsEITEvent", Layout {size: size_of::<GstMpegtsEITEvent>(), alignment: align_of::<GstMpegtsEITEvent>()}),
("GstMpegtsExtendedEventDescriptor", Layout {size: size_of::<GstMpegtsExtendedEventDescriptor>(), alignment: align_of::<GstMpegtsExtendedEventDescriptor>()}),
("GstMpegtsExtendedEventItem", Layout {size: size_of::<GstMpegtsExtendedEventItem>(), alignment: align_of::<GstMpegtsExtendedEventItem>()}),
("GstMpegtsISDBDescriptorType", Layout {size: size_of::<GstMpegtsISDBDescriptorType>(), alignment: align_of::<GstMpegtsISDBDescriptorType>()}),
("GstMpegtsISO639LanguageDescriptor", Layout {size: size_of::<GstMpegtsISO639LanguageDescriptor>(), alignment: align_of::<GstMpegtsISO639LanguageDescriptor>()}),
("GstMpegtsIso639AudioType", Layout {size: size_of::<GstMpegtsIso639AudioType>(), alignment: align_of::<GstMpegtsIso639AudioType>()}),
("GstMpegtsLogicalChannel", Layout {size: size_of::<GstMpegtsLogicalChannel>(), alignment: align_of::<GstMpegtsLogicalChannel>()}),
("GstMpegtsLogicalChannelDescriptor", Layout {size: size_of::<GstMpegtsLogicalChannelDescriptor>(), alignment: align_of::<GstMpegtsLogicalChannelDescriptor>()}),
("GstMpegtsMiscDescriptorType", Layout {size: size_of::<GstMpegtsMiscDescriptorType>(), alignment: align_of::<GstMpegtsMiscDescriptorType>()}),
("GstMpegtsModulationType", Layout {size: size_of::<GstMpegtsModulationType>(), alignment: align_of::<GstMpegtsModulationType>()}),
("GstMpegtsNIT", Layout {size: size_of::<GstMpegtsNIT>(), alignment: align_of::<GstMpegtsNIT>()}),
("GstMpegtsNITStream", Layout {size: size_of::<GstMpegtsNITStream>(), alignment: align_of::<GstMpegtsNITStream>()}),
("GstMpegtsPMT", Layout {size: size_of::<GstMpegtsPMT>(), alignment: align_of::<GstMpegtsPMT>()}),
("GstMpegtsPMTStream", Layout {size: size_of::<GstMpegtsPMTStream>(), alignment: align_of::<GstMpegtsPMTStream>()}),
("GstMpegtsPatProgram", Layout {size: size_of::<GstMpegtsPatProgram>(), alignment: align_of::<GstMpegtsPatProgram>()}),
("GstMpegtsRunningStatus", Layout {size: size_of::<GstMpegtsRunningStatus>(), alignment: align_of::<GstMpegtsRunningStatus>()}),
("GstMpegtsSDT", Layout {size: size_of::<GstMpegtsSDT>(), alignment: align_of::<GstMpegtsSDT>()}),
("GstMpegtsSDTService", Layout {size: size_of::<GstMpegtsSDTService>(), alignment: align_of::<GstMpegtsSDTService>()}),
("GstMpegtsSatelliteDeliverySystemDescriptor", Layout {size: size_of::<GstMpegtsSatelliteDeliverySystemDescriptor>(), alignment: align_of::<GstMpegtsSatelliteDeliverySystemDescriptor>()}),
("GstMpegtsSatellitePolarizationType", Layout {size: size_of::<GstMpegtsSatellitePolarizationType>(), alignment: align_of::<GstMpegtsSatellitePolarizationType>()}),
("GstMpegtsSatelliteRolloff", Layout {size: size_of::<GstMpegtsSatelliteRolloff>(), alignment: align_of::<GstMpegtsSatelliteRolloff>()}),
("GstMpegtsScteStreamType", Layout {size: size_of::<GstMpegtsScteStreamType>(), alignment: align_of::<GstMpegtsScteStreamType>()}),
("GstMpegtsSection", Layout {size: size_of::<GstMpegtsSection>(), alignment: align_of::<GstMpegtsSection>()}),
("GstMpegtsSectionATSCTableID", Layout {size: size_of::<GstMpegtsSectionATSCTableID>(), alignment: align_of::<GstMpegtsSectionATSCTableID>()}),
("GstMpegtsSectionDVBTableID", Layout {size: size_of::<GstMpegtsSectionDVBTableID>(), alignment: align_of::<GstMpegtsSectionDVBTableID>()}),
("GstMpegtsSectionSCTETableID", Layout {size: size_of::<GstMpegtsSectionSCTETableID>(), alignment: align_of::<GstMpegtsSectionSCTETableID>()}),
("GstMpegtsSectionTableID", Layout {size: size_of::<GstMpegtsSectionTableID>(), alignment: align_of::<GstMpegtsSectionTableID>()}),
("GstMpegtsSectionType", Layout {size: size_of::<GstMpegtsSectionType>(), alignment: align_of::<GstMpegtsSectionType>()}),
("GstMpegtsStreamType", Layout {size: size_of::<GstMpegtsStreamType>(), alignment: align_of::<GstMpegtsStreamType>()}),
("GstMpegtsT2DeliverySystemCell", Layout {size: size_of::<GstMpegtsT2DeliverySystemCell>(), alignment: align_of::<GstMpegtsT2DeliverySystemCell>()}),
("GstMpegtsT2DeliverySystemCellExtension", Layout {size: size_of::<GstMpegtsT2DeliverySystemCellExtension>(), alignment: align_of::<GstMpegtsT2DeliverySystemCellExtension>()}),
("GstMpegtsT2DeliverySystemDescriptor", Layout {size: size_of::<GstMpegtsT2DeliverySystemDescriptor>(), alignment: align_of::<GstMpegtsT2DeliverySystemDescriptor>()}),
("GstMpegtsTOT", Layout {size: size_of::<GstMpegtsTOT>(), alignment: align_of::<GstMpegtsTOT>()}),
("GstMpegtsTerrestrialDeliverySystemDescriptor", Layout {size: size_of::<GstMpegtsTerrestrialDeliverySystemDescriptor>(), alignment: align_of::<GstMpegtsTerrestrialDeliverySystemDescriptor>()}),
("GstMpegtsTerrestrialGuardInterval", Layout {size: size_of::<GstMpegtsTerrestrialGuardInterval>(), alignment: align_of::<GstMpegtsTerrestrialGuardInterval>()}),
("GstMpegtsTerrestrialHierarchy", Layout {size: size_of::<GstMpegtsTerrestrialHierarchy>(), alignment: align_of::<GstMpegtsTerrestrialHierarchy>()}),
("GstMpegtsTerrestrialTransmissionMode", Layout {size: size_of::<GstMpegtsTerrestrialTransmissionMode>(), alignment: align_of::<GstMpegtsTerrestrialTransmissionMode>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("ADDITIONAL_INFO_PAGE", "3"),
("GST_DVB_SERVICE_ADVANCED_CODEC_DIGITAL_RADIO_SOUND", "10"),
("GST_DVB_SERVICE_ADVANCED_CODEC_HD_DIGITAL_TELEVISION", "25"),
("GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_REFERENCE", "27"),
("GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_TIME_SHIFTED", "26"),
("GST_DVB_SERVICE_ADVANCED_CODEC_MOSAIC", "11"),
("GST_DVB_SERVICE_ADVANCED_CODEC_SD_DIGITAL_TELEVISION", "22"),
("GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_REFERENCE", "24"),
("GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_TIME_SHIFTED", "23"),
("GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_DIGITAL_TELEVISION", "28"),
("GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_REFERENCE", "30"),
("GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_TIME_SHIFTED", "29"),
("GST_DVB_SERVICE_DATA_BROADCAST", "12"),
("GST_DVB_SERVICE_DIGITAL_RADIO_SOUND", "2"),
("GST_DVB_SERVICE_DIGITAL_TELEVISION", "1"),
("GST_DVB_SERVICE_DVB_MHP", "16"),
("GST_DVB_SERVICE_DVB_SRM", "8"),
("GST_DVB_SERVICE_FM_RADIO", "7"),
("GST_DVB_SERVICE_MOSAIC", "6"),
("GST_DVB_SERVICE_MPEG2_HD_DIGITAL_TELEVISION", "17"),
("GST_DVB_SERVICE_NVOD_REFERENCE", "4"),
("GST_DVB_SERVICE_NVOD_TIME_SHIFTED", "5"),
("GST_DVB_SERVICE_RCS_FLS", "15"),
("GST_DVB_SERVICE_RCS_MAP", "14"),
("GST_DVB_SERVICE_RESERVED_00", "0"),
("GST_DVB_SERVICE_RESERVED_09", "9"),
("GST_DVB_SERVICE_RESERVED_0D_COMMON_INTERFACE", "13"),
("GST_DVB_SERVICE_RESERVED_FF", "31"),
("GST_DVB_SERVICE_TELETEXT", "3"),
("GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT0", "256"),
("GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT127", "383"),
("GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT0", "512"),
("GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT127", "639"),
("GST_MPEGTS_AUDIO_TYPE_CLEAN_EFFECTS", "1"),
("GST_MPEGTS_AUDIO_TYPE_HEARING_IMPAIRED", "2"),
("GST_MPEGTS_AUDIO_TYPE_UNDEFINED", "0"),
("GST_MPEGTS_AUDIO_TYPE_VISUAL_IMPAIRED_COMMENTARY", "3"),
("GST_MPEGTS_CABLE_OUTER_FEC_NONE", "1"),
("GST_MPEGTS_CABLE_OUTER_FEC_RS_204_188", "2"),
("GST_MPEGTS_CABLE_OUTER_FEC_UNDEFINED", "0"),
("GST_MPEGTS_CONTENT_ARTS_CULTURE", "7"),
("GST_MPEGTS_CONTENT_CHILDREN_YOUTH_PROGRAM", "5"),
("GST_MPEGTS_CONTENT_EDUCATION_SCIENCE_FACTUAL", "9"),
("GST_MPEGTS_CONTENT_LEISURE_HOBBIES", "10"),
("GST_MPEGTS_CONTENT_MOVIE_DRAMA", "1"),
("GST_MPEGTS_CONTENT_MUSIC_BALLET_DANCE", "6"),
("GST_MPEGTS_CONTENT_NEWS_CURRENT_AFFAIRS", "2"),
("GST_MPEGTS_CONTENT_SHOW_GAME_SHOW", "3"),
("GST_MPEGTS_CONTENT_SOCIAL_POLITICAL_ECONOMICS", "8"),
("GST_MPEGTS_CONTENT_SPECIAL_CHARACTERISTICS", "11"),
("GST_MPEGTS_CONTENT_SPORTS", "4"),
("GST_MPEGTS_DVB_LINKAGE_CA_REPLACEMENT", "3"),
("GST_MPEGTS_DVB_LINKAGE_DATA_BROADCAST", "6"),
("GST_MPEGTS_DVB_LINKAGE_EPG", "2"),
("GST_MPEGTS_DVB_LINKAGE_EVENT", "13"),
("GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT", "14"),
("GST_MPEGTS_DVB_LINKAGE_HAND_OVER_ASSOCIATED", "3"),
("GST_MPEGTS_DVB_LINKAGE_HAND_OVER_IDENTICAL", "1"),
("GST_MPEGTS_DVB_LINKAGE_HAND_OVER_LOCAL_VARIATION", "2"),
("GST_MPEGTS_DVB_LINKAGE_HAND_OVER_RESERVED", "0"),
("GST_MPEGTS_DVB_LINKAGE_INFORMATION", "1"),
("GST_MPEGTS_DVB_LINKAGE_IP_MAC_NOTIFICATION", "11"),
("GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER", "8"),
("GST_MPEGTS_DVB_LINKAGE_RCS_MAP", "7"),
("GST_MPEGTS_DVB_LINKAGE_RESERVED_00", "0"),
("GST_MPEGTS_DVB_LINKAGE_SERVICE_REPLACEMENT", "5"),
("GST_MPEGTS_DVB_LINKAGE_SYSTEM_SOFTWARE_UPDATE", "9"),
("GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_COMPLETE_SI", "4"),
("GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_INT", "12"),
("GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_SSU", "10"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_0", "112"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_F", "127"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_CISSA", "16"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA1", "1"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA2", "2"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_FULL_ENHANCED", "5"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_MINIMAL_ENHANCED", "4"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_STANDARD", "3"),
("GST_MPEGTS_DVB_SCRAMBLING_MODE_RESERVED", "0"),
("GST_MPEGTS_FEC_1_2", "1"),
("GST_MPEGTS_FEC_2_3", "2"),
("GST_MPEGTS_FEC_2_5", "12"),
("GST_MPEGTS_FEC_3_4", "3"),
("GST_MPEGTS_FEC_3_5", "10"),
("GST_MPEGTS_FEC_4_5", "4"),
("GST_MPEGTS_FEC_5_6", "5"),
("GST_MPEGTS_FEC_6_7", "6"),
("GST_MPEGTS_FEC_7_8", "7"),
("GST_MPEGTS_FEC_8_9", "8"),
("GST_MPEGTS_FEC_9_10", "11"),
("GST_MPEGTS_FEC_AUTO", "9"),
("GST_MPEGTS_FEC_NONE", "0"),
("GST_MPEGTS_GUARD_INTERVAL_19_128", "6"),
("GST_MPEGTS_GUARD_INTERVAL_19_256", "7"),
("GST_MPEGTS_GUARD_INTERVAL_1_128", "5"),
("GST_MPEGTS_GUARD_INTERVAL_1_16", "1"),
("GST_MPEGTS_GUARD_INTERVAL_1_32", "0"),
("GST_MPEGTS_GUARD_INTERVAL_1_4", "3"),
("GST_MPEGTS_GUARD_INTERVAL_1_8", "2"),
("GST_MPEGTS_GUARD_INTERVAL_AUTO", "4"),
("GST_MPEGTS_GUARD_INTERVAL_PN420", "8"),
("GST_MPEGTS_GUARD_INTERVAL_PN595", "9"),
("GST_MPEGTS_GUARD_INTERVAL_PN945", "10"),
("GST_MPEGTS_HIERARCHY_1", "1"),
("GST_MPEGTS_HIERARCHY_2", "2"),
("GST_MPEGTS_HIERARCHY_4", "3"),
("GST_MPEGTS_HIERARCHY_AUTO", "4"),
("GST_MPEGTS_HIERARCHY_NONE", "0"),
("GST_MPEGTS_MODULATION_APSK_16", "10"),
("GST_MPEGTS_MODULATION_APSK_32", "11"),
("GST_MPEGTS_MODULATION_DQPSK", "12"),
("GST_MPEGTS_MODULATION_NONE", "14"),
("GST_MPEGTS_MODULATION_PSK_8", "9"),
("GST_MPEGTS_MODULATION_QAM_128", "4"),
("GST_MPEGTS_MODULATION_QAM_16", "1"),
("GST_MPEGTS_MODULATION_QAM_256", "5"),
("GST_MPEGTS_MODULATION_QAM_32", "2"),
("GST_MPEGTS_MODULATION_QAM_4_NR_", "13"),
("GST_MPEGTS_MODULATION_QAM_64", "3"),
("GST_MPEGTS_MODULATION_QAM_AUTO", "6"),
("GST_MPEGTS_MODULATION_QPSK", "0"),
("GST_MPEGTS_MODULATION_VSB_16", "8"),
("GST_MPEGTS_MODULATION_VSB_8", "7"),
("GST_MPEGTS_POLARIZATION_CIRCULAR_LEFT", "2"),
("GST_MPEGTS_POLARIZATION_CIRCULAR_RIGHT", "3"),
("GST_MPEGTS_POLARIZATION_LINEAR_HORIZONTAL", "0"),
("GST_MPEGTS_POLARIZATION_LINEAR_VERTICAL", "1"),
("GST_MPEGTS_ROLLOFF_20", "1"),
("GST_MPEGTS_ROLLOFF_25", "2"),
("GST_MPEGTS_ROLLOFF_35", "0"),
("GST_MPEGTS_ROLLOFF_AUTO", "4"),
("GST_MPEGTS_ROLLOFF_RESERVED", "3"),
("GST_MPEGTS_RUNNING_STATUS_NOT_RUNNING", "1"),
("GST_MPEGTS_RUNNING_STATUS_OFF_AIR", "5"),
("GST_MPEGTS_RUNNING_STATUS_PAUSING", "3"),
("GST_MPEGTS_RUNNING_STATUS_RUNNING", "4"),
("GST_MPEGTS_RUNNING_STATUS_STARTS_IN_FEW_SECONDS", "2"),
("GST_MPEGTS_RUNNING_STATUS_UNDEFINED", "0"),
("GST_MPEGTS_SECTION_ATSC_CVCT", "12"),
("GST_MPEGTS_SECTION_ATSC_EIT", "15"),
("GST_MPEGTS_SECTION_ATSC_ETT", "14"),
("GST_MPEGTS_SECTION_ATSC_MGT", "13"),
("GST_MPEGTS_SECTION_ATSC_STT", "16"),
("GST_MPEGTS_SECTION_ATSC_TVCT", "11"),
("GST_MPEGTS_SECTION_BAT", "7"),
("GST_MPEGTS_SECTION_CAT", "3"),
("GST_MPEGTS_SECTION_EIT", "5"),
("GST_MPEGTS_SECTION_NIT", "6"),
("GST_MPEGTS_SECTION_PAT", "1"),
("GST_MPEGTS_SECTION_PMT", "2"),
("GST_MPEGTS_SECTION_SDT", "8"),
("GST_MPEGTS_SECTION_TDT", "9"),
("GST_MPEGTS_SECTION_TOT", "10"),
("GST_MPEGTS_SECTION_TSDT", "4"),
("GST_MPEGTS_SECTION_UNKNOWN", "0"),
("GST_MPEGTS_STREAM_CONTENT_AAC", "6"),
("GST_MPEGTS_STREAM_CONTENT_AC_3", "4"),
("GST_MPEGTS_STREAM_CONTENT_AVC", "5"),
("GST_MPEGTS_STREAM_CONTENT_DTS", "7"),
("GST_MPEGTS_STREAM_CONTENT_MPEG1_LAYER2_AUDIO", "2"),
("GST_MPEGTS_STREAM_CONTENT_MPEG2_VIDEO", "1"),
("GST_MPEGTS_STREAM_CONTENT_SRM_CPCM", "8"),
("GST_MPEGTS_STREAM_CONTENT_TELETEXT_OR_SUBTITLE", "3"),
("GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_ADTS", "15"),
("GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_CLEAN", "28"),
("GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_LATM", "17"),
("GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG1", "3"),
("GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG2", "4"),
("GST_MPEGTS_STREAM_TYPE_AUXILIARY", "14"),
("GST_MPEGTS_STREAM_TYPE_DSMCC_A", "10"),
("GST_MPEGTS_STREAM_TYPE_DSMCC_B", "11"),
("GST_MPEGTS_STREAM_TYPE_DSMCC_C", "12"),
("GST_MPEGTS_STREAM_TYPE_DSMCC_D", "13"),
("GST_MPEGTS_STREAM_TYPE_DSM_CC", "8"),
("GST_MPEGTS_STREAM_TYPE_H_222_1", "9"),
("GST_MPEGTS_STREAM_TYPE_IPMP_STREAM", "127"),
("GST_MPEGTS_STREAM_TYPE_METADATA_DATA_CAROUSEL", "23"),
("GST_MPEGTS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL", "24"),
("GST_MPEGTS_STREAM_TYPE_METADATA_PES_PACKETS", "21"),
("GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS", "22"),
("GST_MPEGTS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD", "25"),
("GST_MPEGTS_STREAM_TYPE_MHEG", "7"),
("GST_MPEGTS_STREAM_TYPE_MPEG2_IPMP", "26"),
("GST_MPEGTS_STREAM_TYPE_MPEG4_TIMED_TEXT", "29"),
("GST_MPEGTS_STREAM_TYPE_PRIVATE_PES_PACKETS", "6"),
("GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS", "5"),
("GST_MPEGTS_STREAM_TYPE_RESERVED_00", "0"),
("GST_MPEGTS_STREAM_TYPE_SCTE_ASYNC_DATA", "195"),
("GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB", "176"),
("GST_MPEGTS_STREAM_TYPE_SCTE_DST_NRT", "149"),
("GST_MPEGTS_STREAM_TYPE_SCTE_ISOCH_DATA", "131"),
("GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING", "192"),
("GST_MPEGTS_STREAM_TYPE_SCTE_SUBTITLING", "130"),
("GST_MPEGTS_STREAM_TYPE_SCTE_SYNC_DATA", "194"),
("GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS", "18"),
("GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS", "19"),
("GST_MPEGTS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD", "20"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_H264", "27"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM", "32"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW", "35"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM", "31"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_HEVC", "36"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_JP2K", "33"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG1", "1"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2", "2"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW", "34"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG4", "16"),
("GST_MPEGTS_STREAM_TYPE_VIDEO_RVC", "30"),
("GST_MPEGTS_TRANSMISSION_MODE_16K", "5"),
("GST_MPEGTS_TRANSMISSION_MODE_1K", "4"),
("GST_MPEGTS_TRANSMISSION_MODE_2K", "0"),
("GST_MPEGTS_TRANSMISSION_MODE_32K", "6"),
("GST_MPEGTS_TRANSMISSION_MODE_4K", "3"),
("GST_MPEGTS_TRANSMISSION_MODE_8K", "1"),
("GST_MPEGTS_TRANSMISSION_MODE_AUTO", "2"),
("GST_MPEGTS_TRANSMISSION_MODE_C1", "7"),
("GST_MPEGTS_TRANSMISSION_MODE_C3780", "8"),
("GST_MTS_DESC_AC3_AUDIO_STREAM", "129"),
("GST_MTS_DESC_ATSC_AC3", "131"),
("GST_MTS_DESC_ATSC_CAPTION_SERVICE", "134"),
("GST_MTS_DESC_ATSC_COMPONENT_NAME", "163"),
("GST_MTS_DESC_ATSC_CONTENT_ADVISORY", "135"),
("GST_MTS_DESC_ATSC_CRC32", "181"),
("GST_MTS_DESC_ATSC_DATA_SERVICE", "164"),
("GST_MTS_DESC_ATSC_DCC_ARRIVING_REQUEST", "169"),
("GST_MTS_DESC_ATSC_DCC_DEPARTING_REQUEST", "168"),
("GST_MTS_DESC_ATSC_DOWNLOAD_DESCRIPTOR", "166"),
("GST_MTS_DESC_ATSC_EAC3", "204"),
("GST_MTS_DESC_ATSC_ENHANCED_SIGNALING", "178"),
("GST_MTS_DESC_ATSC_EXTENDED_CHANNEL_NAME", "160"),
("GST_MTS_DESC_ATSC_GENRE", "171"),
("GST_MTS_DESC_ATSC_GROUP_LINK", "184"),
("GST_MTS_DESC_ATSC_MODULE_LINK", "180"),
("GST_MTS_DESC_ATSC_MULTIPROTOCOL_ENCAPSULATION", "167"),
("GST_MTS_DESC_ATSC_PID_COUNT", "165"),
("GST_MTS_DESC_ATSC_PRIVATE_INFORMATION", "173"),
("GST_MTS_DESC_ATSC_REDISTRIBUTION_CONTROL", "170"),
("GST_MTS_DESC_ATSC_SERVICE_LOCATION", "161"),
("GST_MTS_DESC_ATSC_STUFFING", "128"),
("GST_MTS_DESC_ATSC_TIME_SHIFTED_SERVICE", "162"),
("GST_MTS_DESC_AUDIO_STREAM", "3"),
("GST_MTS_DESC_AUXILIARY_VIDEO_STREAM", "47"),
("GST_MTS_DESC_AVC_TIMING_AND_HRD", "42"),
("GST_MTS_DESC_AVC_VIDEO", "40"),
("GST_MTS_DESC_CA", "9"),
("GST_MTS_DESC_CONTENT_LABELING", "36"),
("GST_MTS_DESC_COPYRIGHT", "13"),
("GST_MTS_DESC_DATA_STREAM_ALIGNMENT", "6"),
("GST_MTS_DESC_DSMCC_ASSOCIATION_TAG", "20"),
("GST_MTS_DESC_DSMCC_CAROUSEL_IDENTIFIER", "19"),
("GST_MTS_DESC_DSMCC_DEFERRED_ASSOCIATION_TAG", "21"),
("GST_MTS_DESC_DSMCC_NPT_ENDPOINT", "24"),
("GST_MTS_DESC_DSMCC_NPT_REFERENCE", "23"),
("GST_MTS_DESC_DSMCC_STREAM_EVENT", "26"),
("GST_MTS_DESC_DSMCC_STREAM_MODE", "25"),
("GST_MTS_DESC_DTG_LOGICAL_CHANNEL", "131"),
("GST_MTS_DESC_DVB_AAC", "124"),
("GST_MTS_DESC_DVB_AC3", "106"),
("GST_MTS_DESC_DVB_ADAPTATION_FIELD_DATA", "112"),
("GST_MTS_DESC_DVB_ANCILLARY_DATA", "107"),
("GST_MTS_DESC_DVB_ANNOUNCEMENT_SUPPORT", "110"),
("GST_MTS_DESC_DVB_APPLICATION_SIGNALLING", "111"),
("GST_MTS_DESC_DVB_BOUQUET_NAME", "71"),
("GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM", "68"),
("GST_MTS_DESC_DVB_CA_IDENTIFIER", "83"),
("GST_MTS_DESC_DVB_CELL_FREQUENCY_LINK", "109"),
("GST_MTS_DESC_DVB_CELL_LIST", "108"),
("GST_MTS_DESC_DVB_COMPONENT", "80"),
("GST_MTS_DESC_DVB_CONTENT", "84"),
("GST_MTS_DESC_DVB_CONTENT_IDENTIFIER", "118"),
("GST_MTS_DESC_DVB_COUNTRY_AVAILABILITY", "73"),
("GST_MTS_DESC_DVB_DATA_BROADCAST", "100"),
("GST_MTS_DESC_DVB_DATA_BROADCAST_ID", "102"),
("GST_MTS_DESC_DVB_DEFAULT_AUTHORITY", "115"),
("GST_MTS_DESC_DVB_DSNG", "104"),
("GST_MTS_DESC_DVB_DTS", "123"),
("GST_MTS_DESC_DVB_ECM_REPETITION_RATE", "120"),
("GST_MTS_DESC_DVB_ENHANCED_AC3", "122"),
("GST_MTS_DESC_DVB_EXTENDED_EVENT", "78"),
("GST_MTS_DESC_DVB_EXTENSION", "127"),
("GST_MTS_DESC_DVB_FREQUENCY_LIST", "98"),
("GST_MTS_DESC_DVB_FTA_CONTENT_MANAGEMENT", "126"),
("GST_MTS_DESC_DVB_LINKAGE", "74"),
("GST_MTS_DESC_DVB_LOCAL_TIME_OFFSET", "88"),
("GST_MTS_DESC_DVB_MOSAIC", "81"),
("GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME", "92"),
("GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT", "94"),
("GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME", "91"),
("GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME", "93"),
("GST_MTS_DESC_DVB_NETWORK_NAME", "64"),
("GST_MTS_DESC_DVB_NVOD_REFERENCE", "75"),
("GST_MTS_DESC_DVB_PARENTAL_RATING", "85"),
("GST_MTS_DESC_DVB_PARTIAL_TRANSPORT_STREAM", "99"),
("GST_MTS_DESC_DVB_PDC", "105"),
("GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER", "95"),
("GST_MTS_DESC_DVB_RELATED_CONTENT", "116"),
("GST_MTS_DESC_DVB_S2_SATELLITE_DELIVERY_SYSTEM", "121"),
("GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM", "67"),
("GST_MTS_DESC_DVB_SCRAMBLING", "101"),
("GST_MTS_DESC_DVB_SERVICE", "72"),
("GST_MTS_DESC_DVB_SERVICE_AVAILABILITY", "114"),
("GST_MTS_DESC_DVB_SERVICE_IDENTIFIER", "113"),
("GST_MTS_DESC_DVB_SERVICE_LIST", "65"),
("GST_MTS_DESC_DVB_SERVICE_MOVE", "96"),
("GST_MTS_DESC_DVB_SHORT_EVENT", "77"),
("GST_MTS_DESC_DVB_SHORT_SMOOTHING_BUFFER", "97"),
("GST_MTS_DESC_DVB_STREAM_IDENTIFIER", "82"),
("GST_MTS_DESC_DVB_STUFFING", "66"),
("GST_MTS_DESC_DVB_SUBTITLING", "89"),
("GST_MTS_DESC_DVB_TELEPHONE", "87"),
("GST_MTS_DESC_DVB_TELETEXT", "86"),
("GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM", "90"),
("GST_MTS_DESC_DVB_TIMESLICE_FEC_IDENTIFIER", "119"),
("GST_MTS_DESC_DVB_TIME_SHIFTED_EVENT", "79"),
("GST_MTS_DESC_DVB_TIME_SHIFTED_SERVICE", "76"),
("GST_MTS_DESC_DVB_TRANSPORT_STREAM", "103"),
("GST_MTS_DESC_DVB_TVA_ID", "117"),
("GST_MTS_DESC_DVB_VBI_DATA", "69"),
("GST_MTS_DESC_DVB_VBI_TELETEXT", "70"),
("GST_MTS_DESC_DVB_XAIT_LOCATION", "125"),
("GST_MTS_DESC_EXTERNAL_ES_ID", "32"),
("GST_MTS_DESC_EXT_DVB_C2_DELIVERY_SYSTEM", "13"),
("GST_MTS_DESC_EXT_DVB_CP", "2"),
("GST_MTS_DESC_EXT_DVB_CPCM_DELIVERY_SIGNALLING", "1"),
("GST_MTS_DESC_EXT_DVB_CP_IDENTIFIER", "3"),
("GST_MTS_DESC_EXT_DVB_DTS_HD_AUDIO_STREAM", "14"),
("GST_MTS_DESC_EXT_DVB_DTS_NEUTRAL", "15"),
("GST_MTS_DESC_EXT_DVB_IMAGE_ICON", "0"),
("GST_MTS_DESC_EXT_DVB_MESSAGE", "8"),
("GST_MTS_DESC_EXT_DVB_NETWORK_CHANGE_NOTIFY", "7"),
("GST_MTS_DESC_EXT_DVB_SERVICE_RELOCATED", "11"),
("GST_MTS_DESC_EXT_DVB_SH_DELIVERY_SYSTEM", "5"),
("GST_MTS_DESC_EXT_DVB_SUPPLEMENTARY_AUDIO", "6"),
("GST_MTS_DESC_EXT_DVB_T2MI", "17"),
("GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM", "4"),
("GST_MTS_DESC_EXT_DVB_TARGET_REGION", "9"),
("GST_MTS_DESC_EXT_DVB_TARGET_REGION_NAME", "10"),
("GST_MTS_DESC_EXT_DVB_URI_LINKAGE", "19"),
("GST_MTS_DESC_EXT_DVB_VIDEO_DEPTH_RANGE", "16"),
("GST_MTS_DESC_EXT_DVB_XAIT_PID", "12"),
("GST_MTS_DESC_FLEX_MUX_TIMING", "44"),
("GST_MTS_DESC_FMC", "31"),
("GST_MTS_DESC_FMX_BUFFER_SIZE", "34"),
("GST_MTS_DESC_HIERARCHY", "4"),
("GST_MTS_DESC_IBP", "18"),
("GST_MTS_DESC_IOD", "29"),
("GST_MTS_DESC_IPMP", "41"),
("GST_MTS_DESC_ISDB_AUDIO_COMPONENT", "196"),
("GST_MTS_DESC_ISDB_BASIC_LOCAL_EVENT", "208"),
("GST_MTS_DESC_ISDB_BOARD_INFORMATION", "219"),
("GST_MTS_DESC_ISDB_BROADCASTER_NAME", "216"),
("GST_MTS_DESC_ISDB_CA_CONTRACT_INFORMATION", "203"),
("GST_MTS_DESC_ISDB_CA_EMM_TS", "202"),
("GST_MTS_DESC_ISDB_CA_SERVICE", "204"),
("GST_MTS_DESC_ISDB_COMPONENT_GROUP", "217"),
("GST_MTS_DESC_ISDB_CONNECTED_TRANSMISSION", "221"),
("GST_MTS_DESC_ISDB_CONTENT_AVAILABILITY", "222"),
("GST_MTS_DESC_ISDB_DATA_CONTENT", "199"),
("GST_MTS_DESC_ISDB_DIGITAL_COPY_CONTROL", "193"),
("GST_MTS_DESC_ISDB_DOWNLOAD_CONTENT", "201"),
("GST_MTS_DESC_ISDB_EVENT_GROUP", "214"),
("GST_MTS_DESC_ISDB_EXTENDED_BROADCASTER", "206"),
("GST_MTS_DESC_ISDB_HIERARCHICAL_TRANSMISSION", "192"),
("GST_MTS_DESC_ISDB_HYPERLINK", "197"),
("GST_MTS_DESC_ISDB_LDT_LINKAGE", "220"),
("GST_MTS_DESC_ISDB_LOGO_TRANSMISSION", "207"),
("GST_MTS_DESC_ISDB_NETWORK_IDENTIFICATION", "194"),
("GST_MTS_DESC_ISDB_NODE_RELATION", "210"),
("GST_MTS_DESC_ISDB_PARTIAL_TS_TIME", "195"),
("GST_MTS_DESC_ISDB_REFERENCE", "209"),
("GST_MTS_DESC_ISDB_SERIES", "213"),
("GST_MTS_DESC_ISDB_SERVICE_GROUP", "224"),
("GST_MTS_DESC_ISDB_SHORT_NODE_INFORMATION", "211"),
("GST_MTS_DESC_ISDB_SI_PARAMETER", "215"),
("GST_MTS_DESC_ISDB_SI_PRIME_TS", "218"),
("GST_MTS_DESC_ISDB_STC_REFERENCE", "212"),
("GST_MTS_DESC_ISDB_TARGET_REGION", "198"),
("GST_MTS_DESC_ISDB_TS_INFORMATION", "205"),
("GST_MTS_DESC_ISDB_VIDEO_DECODE_CONTROL", "200"),
("GST_MTS_DESC_ISO_639_LANGUAGE", "10"),
("GST_MTS_DESC_J2K_VIDEO", "50"),
("GST_MTS_DESC_MAXIMUM_BITRATE", "14"),
("GST_MTS_DESC_METADATA", "38"),
("GST_MTS_DESC_METADATA_POINTER", "37"),
("GST_MTS_DESC_METADATA_STD", "39"),
("GST_MTS_DESC_MPEG2_AAC_AUDIO", "43"),
("GST_MTS_DESC_MPEG2_STEREOSCOPIC_VIDEO_FORMAT", "52"),
("GST_MTS_DESC_MPEG4_AUDIO", "28"),
("GST_MTS_DESC_MPEG4_AUDIO_EXTENSION", "46"),
("GST_MTS_DESC_MPEG4_TEXT", "45"),
("GST_MTS_DESC_MPEG4_VIDEO", "27"),
("GST_MTS_DESC_MULTIPLEX_BUFFER", "35"),
("GST_MTS_DESC_MULTIPLEX_BUFFER_UTILISATION", "12"),
("GST_MTS_DESC_MUX_CODE", "33"),
("GST_MTS_DESC_MVC_EXTENSION", "49"),
("GST_MTS_DESC_MVC_OPERATION_POINT", "51"),
("GST_MTS_DESC_PRIVATE_DATA_INDICATOR", "15"),
("GST_MTS_DESC_REGISTRATION", "5"),
("GST_MTS_DESC_RESERVED_00", "0"),
("GST_MTS_DESC_RESERVED_01", "1"),
("GST_MTS_DESC_SL", "30"),
("GST_MTS_DESC_SMOOTHING_BUFFER", "16"),
("GST_MTS_DESC_STD", "17"),
("GST_MTS_DESC_STEREOSCOPIC_PROGRAM_INFO", "53"),
("GST_MTS_DESC_STEREOSCOPIC_VIDEO_INFO", "54"),
("GST_MTS_DESC_SVC_EXTENSION", "48"),
("GST_MTS_DESC_SYSTEM_CLOCK", "11"),
("GST_MTS_DESC_TARGET_BACKGROUND_GRID", "7"),
("GST_MTS_DESC_VIDEO_STREAM", "2"),
("GST_MTS_DESC_VIDEO_WINDOW", "8"),
("GST_MTS_TABLE_ID_14496_OBJET_DESCRIPTOR", "5"),
("GST_MTS_TABLE_ID_14496_SCENE_DESCRIPTION", "4"),
("GST_MTS_TABLE_ID_APPLICATION_INFORMATION_TABLE", "116"),
("GST_MTS_TABLE_ID_ATSC_AGGREGATE_DATA_EVENT", "217"),
("GST_MTS_TABLE_ID_ATSC_AGGREGATE_EVENT_INFORMATION", "214"),
("GST_MTS_TABLE_ID_ATSC_AGGREGATE_EXTENDED_TEXT", "215"),
("GST_MTS_TABLE_ID_ATSC_CABLE_VIRTUAL_CHANNEL", "201"),
("GST_MTS_TABLE_ID_ATSC_CHANNEL_OR_EVENT_EXTENDED_TEXT", "204"),
("GST_MTS_TABLE_ID_ATSC_DATA_EVENT", "206"),
("GST_MTS_TABLE_ID_ATSC_DATA_SERVICE", "207"),
("GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE", "211"),
("GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE_SECTION_CODE", "212"),
("GST_MTS_TABLE_ID_ATSC_EVENT_INFORMATION", "203"),
("GST_MTS_TABLE_ID_ATSC_LONG_TERM_SERVICE", "210"),
("GST_MTS_TABLE_ID_ATSC_MASTER_GUIDE", "199"),
("GST_MTS_TABLE_ID_ATSC_NETWORK_RESOURCE", "209"),
("GST_MTS_TABLE_ID_ATSC_RATING_REGION", "202"),
("GST_MTS_TABLE_ID_ATSC_SATELLITE_VIRTUAL_CHANNEL", "218"),
("GST_MTS_TABLE_ID_ATSC_SYSTEM_TIME", "205"),
("GST_MTS_TABLE_ID_ATSC_TERRESTRIAL_VIRTUAL_CHANNEL", "200"),
("GST_MTS_TABLE_ID_BOUQUET_ASSOCIATION", "74"),
("GST_MTS_TABLE_ID_CA_MESSAGE_ECM_0", "128"),
("GST_MTS_TABLE_ID_CA_MESSAGE_ECM_1", "129"),
("GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_1", "130"),
("GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_N", "143"),
("GST_MTS_TABLE_ID_CMT", "164"),
("GST_MTS_TABLE_ID_CONDITIONAL_ACCESS", "1"),
("GST_MTS_TABLE_ID_CONTAINER", "117"),
("GST_MTS_TABLE_ID_CONTENT_IDENTIFIER", "119"),
("GST_MTS_TABLE_ID_DISCONTINUITY_INFORMATION", "126"),
("GST_MTS_TABLE_ID_DSM_CC_ADDRESSABLE_SECTIONS", "63"),
("GST_MTS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGES", "60"),
("GST_MTS_TABLE_ID_DSM_CC_MULTIPROTO_ENCAPSULATED_DATA", "58"),
("GST_MTS_TABLE_ID_DSM_CC_PRIVATE_DATA", "62"),
("GST_MTS_TABLE_ID_DSM_CC_STREAM_DESCRIPTORS", "61"),
("GST_MTS_TABLE_ID_DSM_CC_U_N_MESSAGES", "59"),
("GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_PRESENT", "78"),
("GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_1", "80"),
("GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_N", "95"),
("GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_PRESENT", "79"),
("GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_1", "96"),
("GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_N", "111"),
("GST_MTS_TABLE_ID_FCT", "161"),
("GST_MTS_TABLE_ID_IPMP_CONTROL_INFORMATION", "7"),
("GST_MTS_TABLE_ID_LL_FEC_PARITY_DATA_TABLE", "177"),
("GST_MTS_TABLE_ID_METADATA", "6"),
("GST_MTS_TABLE_ID_MPE_FEC", "120"),
("GST_MTS_TABLE_ID_MPE_IFEC", "122"),
("GST_MTS_TABLE_ID_NETWORK_INFORMATION_ACTUAL_NETWORK", "64"),
("GST_MTS_TABLE_ID_NETWORK_INFORMATION_OTHER_NETWORK", "65"),
("GST_MTS_TABLE_ID_PCR_PACKET_PAYLOAD", "166"),
("GST_MTS_TABLE_ID_PROGRAM_ASSOCIATION", "0"),
("GST_MTS_TABLE_ID_RELATED_CONTENT", "118"),
("GST_MTS_TABLE_ID_RESOLUTION_NOTIFICATION", "121"),
("GST_MTS_TABLE_ID_RUNNING_STATUS", "113"),
("GST_MTS_TABLE_ID_SCT", "160"),
("GST_MTS_TABLE_ID_SCTE_DDB", "228"),
("GST_MTS_TABLE_ID_SCTE_DII", "227"),
("GST_MTS_TABLE_ID_SCTE_EAS", "216"),
("GST_MTS_TABLE_ID_SCTE_EBIF", "224"),
("GST_MTS_TABLE_ID_SCTE_EISS", "226"),
("GST_MTS_TABLE_ID_SCTE_RESERVED", "225"),
("GST_MTS_TABLE_ID_SCTE_SPLICE", "252"),
("GST_MTS_TABLE_ID_SELECTION_INFORMATION", "127"),
("GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_ACTUAL_TS", "66"),
("GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_OTHER_TS", "70"),
("GST_MTS_TABLE_ID_SPT", "163"),
("GST_MTS_TABLE_ID_STUFFING", "114"),
("GST_MTS_TABLE_ID_TBTP", "165"),
("GST_MTS_TABLE_ID_TCT", "162"),
("GST_MTS_TABLE_ID_TIM", "176"),
("GST_MTS_TABLE_ID_TIME_DATE", "112"),
("GST_MTS_TABLE_ID_TIME_OFFSET", "115"),
("GST_MTS_TABLE_ID_TRANSMISSION_MODE_SUPPORT_PAYLOAD", "170"),
("GST_MTS_TABLE_ID_TS_DESCRIPTION", "3"),
("GST_MTS_TABLE_ID_TS_PROGRAM_MAP", "2"),
("GST_MTS_TABLE_ID_UNSET", "255"),
("HEARING_IMPAIRED_PAGE", "5"),
("INITIAL_PAGE", "1"),
("PROGRAMME_SCHEDULE_PAGE", "4"),
("SUBTITLE_PAGE", "2"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/mpegts/mpegts.h>

View file

@ -10,6 +10,10 @@ gio-sys = { git = "https://github.com/gtk-rs/sys" }
[dependencies.gstreamer-sys]
path = "../gstreamer-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_2 = []
v1_4 = ["v1_2"]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT

View file

@ -0,0 +1,256 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_net_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_net_sys::*;
static PACKAGES: &[&str] = &["gstreamer-net-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
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"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/net/net.h>

View file

@ -2,7 +2,6 @@
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
@ -16,6 +15,10 @@ path = "../gstreamer-audio-sys"
[dependencies.gstreamer-video-sys]
path = "../gstreamer-video-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_2 = []
v1_4 = ["v1_2"]

View file

@ -1,11 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[macro_use] extern crate bitflags;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
@ -75,21 +74,12 @@ pub const GST_PLUGINS_BASE_VERSION_MINOR: c_int = 14;
pub const GST_PLUGINS_BASE_VERSION_NANO: c_int = 0;
// Flags
bitflags! {
#[repr(C)]
pub struct GstDiscovererSerializeFlags: c_uint {
const BASIC = 0;
const CAPS = 1;
const TAGS = 2;
const MISC = 4;
const ALL = 7;
}
}
pub const GST_DISCOVERER_SERIALIZE_BASIC: GstDiscovererSerializeFlags = GstDiscovererSerializeFlags::BASIC;
pub const GST_DISCOVERER_SERIALIZE_CAPS: GstDiscovererSerializeFlags = GstDiscovererSerializeFlags::CAPS;
pub const GST_DISCOVERER_SERIALIZE_TAGS: GstDiscovererSerializeFlags = GstDiscovererSerializeFlags::TAGS;
pub const GST_DISCOVERER_SERIALIZE_MISC: GstDiscovererSerializeFlags = GstDiscovererSerializeFlags::MISC;
pub const GST_DISCOVERER_SERIALIZE_ALL: GstDiscovererSerializeFlags = GstDiscovererSerializeFlags::ALL;
pub type GstDiscovererSerializeFlags = c_uint;
pub const GST_DISCOVERER_SERIALIZE_BASIC: GstDiscovererSerializeFlags = 0;
pub const GST_DISCOVERER_SERIALIZE_CAPS: GstDiscovererSerializeFlags = 1;
pub const GST_DISCOVERER_SERIALIZE_TAGS: GstDiscovererSerializeFlags = 2;
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)>;
@ -545,7 +535,7 @@ extern "C" {
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: *mut 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;
@ -553,7 +543,7 @@ extern "C" {
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: *mut c_char, 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

View file

@ -0,0 +1,295 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_pbutils_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_pbutils_sys::*;
static PACKAGES: &[&str] = &["gstreamer-pbutils-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_AUDIO_VISUALIZER_SHADER_FADE", "1"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN", "3"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN", "7"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT", "6"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT", "4"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT", "5"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP", "2"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN", "9"),
("GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT", "8"),
("GST_AUDIO_VISUALIZER_SHADER_NONE", "0"),
("GST_DISCOVERER_BUSY", "4"),
("GST_DISCOVERER_ERROR", "2"),
("GST_DISCOVERER_MISSING_PLUGINS", "5"),
("GST_DISCOVERER_OK", "0"),
("GST_DISCOVERER_SERIALIZE_ALL", "7"),
("GST_DISCOVERER_SERIALIZE_BASIC", "0"),
("GST_DISCOVERER_SERIALIZE_CAPS", "1"),
("GST_DISCOVERER_SERIALIZE_MISC", "4"),
("GST_DISCOVERER_SERIALIZE_TAGS", "2"),
("GST_DISCOVERER_TIMEOUT", "3"),
("GST_DISCOVERER_URI_INVALID", "1"),
("GST_ENCODING_CATEGORY_CAPTURE", "capture"),
("GST_ENCODING_CATEGORY_DEVICE", "device"),
("GST_ENCODING_CATEGORY_FILE_EXTENSION", "file-extension"),
("GST_ENCODING_CATEGORY_ONLINE_SERVICE", "online-service"),
("GST_ENCODING_CATEGORY_STORAGE_EDITING", "storage-editing"),
("GST_INSTALL_PLUGINS_CRASHED", "100"),
("GST_INSTALL_PLUGINS_ERROR", "2"),
("GST_INSTALL_PLUGINS_HELPER_MISSING", "202"),
("GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS", "203"),
("GST_INSTALL_PLUGINS_INTERNAL_FAILURE", "201"),
("GST_INSTALL_PLUGINS_INVALID", "101"),
("GST_INSTALL_PLUGINS_NOT_FOUND", "1"),
("GST_INSTALL_PLUGINS_PARTIAL_SUCCESS", "3"),
("GST_INSTALL_PLUGINS_STARTED_OK", "200"),
("GST_INSTALL_PLUGINS_SUCCESS", "0"),
("GST_INSTALL_PLUGINS_USER_ABORT", "4"),
("GST_PLUGINS_BASE_VERSION_MAJOR", "1"),
("GST_PLUGINS_BASE_VERSION_MICRO", "0"),
("GST_PLUGINS_BASE_VERSION_MINOR", "14"),
("GST_PLUGINS_BASE_VERSION_NANO", "0"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/pbutils/pbutils.h>

View file

@ -12,6 +12,10 @@ path = "../gstreamer-sys"
[dependencies.gstreamer-video-sys]
path = "../gstreamer-video-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_12 = []
v1_14 = ["v1_12"]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT

View file

@ -0,0 +1,260 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_player_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_player_sys::*;
static PACKAGES: &[&str] = &["gstreamer-player-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_PLAYER_COLOR_BALANCE_BRIGHTNESS", "0"),
("GST_PLAYER_COLOR_BALANCE_CONTRAST", "1"),
("GST_PLAYER_COLOR_BALANCE_HUE", "3"),
("GST_PLAYER_COLOR_BALANCE_SATURATION", "2"),
("GST_PLAYER_ERROR_FAILED", "0"),
("GST_PLAYER_STATE_BUFFERING", "1"),
("GST_PLAYER_STATE_PAUSED", "2"),
("GST_PLAYER_STATE_PLAYING", "3"),
("GST_PLAYER_STATE_STOPPED", "0"),
("GST_PLAYER_THUMBNAIL_JPG", "3"),
("GST_PLAYER_THUMBNAIL_PNG", "4"),
("GST_PLAYER_THUMBNAIL_RAW_BGRx", "2"),
("GST_PLAYER_THUMBNAIL_RAW_NATIVE", "0"),
("GST_PLAYER_THUMBNAIL_RAW_xRGB", "1"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/player/player.h>

View file

@ -6,7 +6,6 @@ repository = "sdroege/gstreamer-sys"
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
@ -24,6 +23,10 @@ path = "../gstreamer-sdp-sys"
[dependencies.gstreamer-sys]
path = "../gstreamer-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
dox = []
v1_4 = []

View file

@ -1,11 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[macro_use] extern crate bitflags;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gio_sys as gio;
@ -72,33 +71,17 @@ pub const GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE: *const c_char = b"media.factory.rol
pub const GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS: *const c_char = b"transport.client-settings\0" as *const u8 as *const c_char;
// Flags
bitflags! {
#[repr(C)]
pub struct GstRTSPAddressFlags: c_uint {
const NONE = 0;
const IPV4 = 1;
const IPV6 = 2;
const EVEN_PORT = 4;
const MULTICAST = 8;
const UNICAST = 16;
}
}
pub const GST_RTSP_ADDRESS_FLAG_NONE: GstRTSPAddressFlags = GstRTSPAddressFlags::NONE;
pub const GST_RTSP_ADDRESS_FLAG_IPV4: GstRTSPAddressFlags = GstRTSPAddressFlags::IPV4;
pub const GST_RTSP_ADDRESS_FLAG_IPV6: GstRTSPAddressFlags = GstRTSPAddressFlags::IPV6;
pub const GST_RTSP_ADDRESS_FLAG_EVEN_PORT: GstRTSPAddressFlags = GstRTSPAddressFlags::EVEN_PORT;
pub const GST_RTSP_ADDRESS_FLAG_MULTICAST: GstRTSPAddressFlags = GstRTSPAddressFlags::MULTICAST;
pub const GST_RTSP_ADDRESS_FLAG_UNICAST: GstRTSPAddressFlags = GstRTSPAddressFlags::UNICAST;
pub type GstRTSPAddressFlags = c_uint;
pub const GST_RTSP_ADDRESS_FLAG_NONE: GstRTSPAddressFlags = 0;
pub const GST_RTSP_ADDRESS_FLAG_IPV4: GstRTSPAddressFlags = 1;
pub const GST_RTSP_ADDRESS_FLAG_IPV6: GstRTSPAddressFlags = 2;
pub const GST_RTSP_ADDRESS_FLAG_EVEN_PORT: GstRTSPAddressFlags = 4;
pub const GST_RTSP_ADDRESS_FLAG_MULTICAST: GstRTSPAddressFlags = 8;
pub const GST_RTSP_ADDRESS_FLAG_UNICAST: GstRTSPAddressFlags = 16;
bitflags! {
#[repr(C)]
pub struct GstRTSPTransportMode: c_uint {
const PLAY = 1;
const RECORD = 2;
}
}
pub const GST_RTSP_TRANSPORT_MODE_PLAY: GstRTSPTransportMode = GstRTSPTransportMode::PLAY;
pub const GST_RTSP_TRANSPORT_MODE_RECORD: GstRTSPTransportMode = GstRTSPTransportMode::RECORD;
pub type GstRTSPTransportMode = c_uint;
pub const GST_RTSP_TRANSPORT_MODE_PLAY: GstRTSPTransportMode = 1;
pub const GST_RTSP_TRANSPORT_MODE_RECORD: GstRTSPTransportMode = 2;
// Callbacks
pub type GstRTSPClientSendFunc = Option<unsafe extern "C" fn(*mut GstRTSPClient, *mut gst_rtsp::GstRTSPMessage, gboolean, gpointer) -> gboolean>;

View file

@ -0,0 +1,331 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_rtsp_server_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_rtsp_server_sys::*;
static PACKAGES: &[&str] = &["gstreamer-rtsp-server-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_RTSP_ADDRESS_FLAG_EVEN_PORT", "4"),
("GST_RTSP_ADDRESS_FLAG_IPV4", "1"),
("GST_RTSP_ADDRESS_FLAG_IPV6", "2"),
("GST_RTSP_ADDRESS_FLAG_MULTICAST", "8"),
("GST_RTSP_ADDRESS_FLAG_NONE", "0"),
("GST_RTSP_ADDRESS_FLAG_UNICAST", "16"),
("GST_RTSP_ADDRESS_POOL_ANY_IPV4", "0.0.0.0"),
("GST_RTSP_ADDRESS_POOL_ANY_IPV6", "::"),
("GST_RTSP_ADDRESS_POOL_EINVAL", "-1"),
("GST_RTSP_ADDRESS_POOL_ELAST", "-4"),
("GST_RTSP_ADDRESS_POOL_ERANGE", "-3"),
("GST_RTSP_ADDRESS_POOL_ERESERVED", "-2"),
("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_URL", "auth.check.url"),
("GST_RTSP_FILTER_KEEP", "1"),
("GST_RTSP_FILTER_REF", "2"),
("GST_RTSP_FILTER_REMOVE", "0"),
("GST_RTSP_MEDIA_STATUS_ERROR", "5"),
("GST_RTSP_MEDIA_STATUS_PREPARED", "3"),
("GST_RTSP_MEDIA_STATUS_PREPARING", "2"),
("GST_RTSP_MEDIA_STATUS_SUSPENDED", "4"),
("GST_RTSP_MEDIA_STATUS_UNPREPARED", "0"),
("GST_RTSP_MEDIA_STATUS_UNPREPARING", "1"),
("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_PUBLISH_CLOCK_MODE_CLOCK", "1"),
("GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET", "2"),
("GST_RTSP_PUBLISH_CLOCK_MODE_NONE", "0"),
("GST_RTSP_SUSPEND_MODE_NONE", "0"),
("GST_RTSP_SUSPEND_MODE_PAUSE", "1"),
("GST_RTSP_SUSPEND_MODE_RESET", "2"),
("GST_RTSP_THREAD_TYPE_CLIENT", "0"),
("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_TRANSPORT_MODE_PLAY", "1"),
("GST_RTSP_TRANSPORT_MODE_RECORD", "2"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/rtsp-server/rtsp-server.h>

View file

@ -2,7 +2,6 @@
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
@ -14,6 +13,10 @@ path = "../gstreamer-sdp-sys"
[dependencies.gstreamer-sys]
path = "../gstreamer-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
dox = []
v1_2 = []

View file

@ -1,11 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[macro_use] extern crate bitflags;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gio_sys as gio;
@ -229,95 +228,45 @@ pub const GST_RTSP_VERSION_2_0: GstRTSPVersion = 32;
pub const GST_RTSP_DEFAULT_PORT: c_int = 554;
// Flags
bitflags! {
#[repr(C)]
pub struct GstRTSPEvent: c_uint {
const READ = 1;
const WRITE = 2;
}
}
pub const GST_RTSP_EV_READ: GstRTSPEvent = GstRTSPEvent::READ;
pub const GST_RTSP_EV_WRITE: GstRTSPEvent = GstRTSPEvent::WRITE;
pub type GstRTSPEvent = c_uint;
pub const GST_RTSP_EV_READ: GstRTSPEvent = 1;
pub const GST_RTSP_EV_WRITE: GstRTSPEvent = 2;
bitflags! {
#[repr(C)]
pub struct GstRTSPLowerTrans: c_uint {
const UNKNOWN = 0;
const UDP = 1;
const UDP_MCAST = 2;
const TCP = 4;
const HTTP = 16;
const TLS = 32;
}
}
pub const GST_RTSP_LOWER_TRANS_UNKNOWN: GstRTSPLowerTrans = GstRTSPLowerTrans::UNKNOWN;
pub const GST_RTSP_LOWER_TRANS_UDP: GstRTSPLowerTrans = GstRTSPLowerTrans::UDP;
pub const GST_RTSP_LOWER_TRANS_UDP_MCAST: GstRTSPLowerTrans = GstRTSPLowerTrans::UDP_MCAST;
pub const GST_RTSP_LOWER_TRANS_TCP: GstRTSPLowerTrans = GstRTSPLowerTrans::TCP;
pub const GST_RTSP_LOWER_TRANS_HTTP: GstRTSPLowerTrans = GstRTSPLowerTrans::HTTP;
pub const GST_RTSP_LOWER_TRANS_TLS: GstRTSPLowerTrans = GstRTSPLowerTrans::TLS;
pub type GstRTSPLowerTrans = c_uint;
pub const GST_RTSP_LOWER_TRANS_UNKNOWN: GstRTSPLowerTrans = 0;
pub const GST_RTSP_LOWER_TRANS_UDP: GstRTSPLowerTrans = 1;
pub const GST_RTSP_LOWER_TRANS_UDP_MCAST: GstRTSPLowerTrans = 2;
pub const GST_RTSP_LOWER_TRANS_TCP: GstRTSPLowerTrans = 4;
pub const GST_RTSP_LOWER_TRANS_HTTP: GstRTSPLowerTrans = 16;
pub const GST_RTSP_LOWER_TRANS_TLS: GstRTSPLowerTrans = 32;
bitflags! {
#[repr(C)]
pub struct GstRTSPMethod: c_uint {
const INVALID = 0;
const DESCRIBE = 1;
const ANNOUNCE = 2;
const GET_PARAMETER = 4;
const OPTIONS = 8;
const PAUSE = 16;
const PLAY = 32;
const RECORD = 64;
const REDIRECT = 128;
const SETUP = 256;
const SET_PARAMETER = 512;
const TEARDOWN = 1024;
const GET = 2048;
const POST = 4096;
}
}
pub const GST_RTSP_INVALID: GstRTSPMethod = GstRTSPMethod::INVALID;
pub const GST_RTSP_DESCRIBE: GstRTSPMethod = GstRTSPMethod::DESCRIBE;
pub const GST_RTSP_ANNOUNCE: GstRTSPMethod = GstRTSPMethod::ANNOUNCE;
pub const GST_RTSP_GET_PARAMETER: GstRTSPMethod = GstRTSPMethod::GET_PARAMETER;
pub const GST_RTSP_OPTIONS: GstRTSPMethod = GstRTSPMethod::OPTIONS;
pub const GST_RTSP_PAUSE: GstRTSPMethod = GstRTSPMethod::PAUSE;
pub const GST_RTSP_PLAY: GstRTSPMethod = GstRTSPMethod::PLAY;
pub const GST_RTSP_RECORD: GstRTSPMethod = GstRTSPMethod::RECORD;
pub const GST_RTSP_REDIRECT: GstRTSPMethod = GstRTSPMethod::REDIRECT;
pub const GST_RTSP_SETUP: GstRTSPMethod = GstRTSPMethod::SETUP;
pub const GST_RTSP_SET_PARAMETER: GstRTSPMethod = GstRTSPMethod::SET_PARAMETER;
pub const GST_RTSP_TEARDOWN: GstRTSPMethod = GstRTSPMethod::TEARDOWN;
pub const GST_RTSP_GET: GstRTSPMethod = GstRTSPMethod::GET;
pub const GST_RTSP_POST: GstRTSPMethod = GstRTSPMethod::POST;
pub type GstRTSPMethod = c_uint;
pub const GST_RTSP_INVALID: GstRTSPMethod = 0;
pub const GST_RTSP_DESCRIBE: GstRTSPMethod = 1;
pub const GST_RTSP_ANNOUNCE: GstRTSPMethod = 2;
pub const GST_RTSP_GET_PARAMETER: GstRTSPMethod = 4;
pub const GST_RTSP_OPTIONS: GstRTSPMethod = 8;
pub const GST_RTSP_PAUSE: GstRTSPMethod = 16;
pub const GST_RTSP_PLAY: GstRTSPMethod = 32;
pub const GST_RTSP_RECORD: GstRTSPMethod = 64;
pub const GST_RTSP_REDIRECT: GstRTSPMethod = 128;
pub const GST_RTSP_SETUP: GstRTSPMethod = 256;
pub const GST_RTSP_SET_PARAMETER: GstRTSPMethod = 512;
pub const GST_RTSP_TEARDOWN: GstRTSPMethod = 1024;
pub const GST_RTSP_GET: GstRTSPMethod = 2048;
pub const GST_RTSP_POST: GstRTSPMethod = 4096;
bitflags! {
#[repr(C)]
pub struct GstRTSPProfile: c_uint {
const UNKNOWN = 0;
const AVP = 1;
const SAVP = 2;
const AVPF = 4;
const SAVPF = 8;
}
}
pub const GST_RTSP_PROFILE_UNKNOWN: GstRTSPProfile = GstRTSPProfile::UNKNOWN;
pub const GST_RTSP_PROFILE_AVP: GstRTSPProfile = GstRTSPProfile::AVP;
pub const GST_RTSP_PROFILE_SAVP: GstRTSPProfile = GstRTSPProfile::SAVP;
pub const GST_RTSP_PROFILE_AVPF: GstRTSPProfile = GstRTSPProfile::AVPF;
pub const GST_RTSP_PROFILE_SAVPF: GstRTSPProfile = GstRTSPProfile::SAVPF;
pub type GstRTSPProfile = c_uint;
pub const GST_RTSP_PROFILE_UNKNOWN: GstRTSPProfile = 0;
pub const GST_RTSP_PROFILE_AVP: GstRTSPProfile = 1;
pub const GST_RTSP_PROFILE_SAVP: GstRTSPProfile = 2;
pub const GST_RTSP_PROFILE_AVPF: GstRTSPProfile = 4;
pub const GST_RTSP_PROFILE_SAVPF: GstRTSPProfile = 8;
bitflags! {
#[repr(C)]
pub struct GstRTSPTransMode: c_uint {
const UNKNOWN = 0;
const RTP = 1;
const RDT = 2;
}
}
pub const GST_RTSP_TRANS_UNKNOWN: GstRTSPTransMode = GstRTSPTransMode::UNKNOWN;
pub const GST_RTSP_TRANS_RTP: GstRTSPTransMode = GstRTSPTransMode::RTP;
pub const GST_RTSP_TRANS_RDT: GstRTSPTransMode = GstRTSPTransMode::RDT;
pub type GstRTSPTransMode = c_uint;
pub const GST_RTSP_TRANS_UNKNOWN: GstRTSPTransMode = 0;
pub const GST_RTSP_TRANS_RTP: GstRTSPTransMode = 1;
pub const GST_RTSP_TRANS_RDT: GstRTSPTransMode = 2;
// Unions
#[repr(C)]

View file

@ -0,0 +1,480 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_rtsp_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_rtsp_sys::*;
static PACKAGES: &[&str] = &["gstreamer-rtsp-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_RTSP_ANNOUNCE", "2"),
("GST_RTSP_AUTH_BASIC", "1"),
("GST_RTSP_AUTH_DIGEST", "2"),
("GST_RTSP_AUTH_NONE", "0"),
("GST_RTSP_DEFAULT_PORT", "554"),
("GST_RTSP_DESCRIBE", "1"),
("GST_RTSP_EEOF", "-11"),
("GST_RTSP_EINTR", "-3"),
("GST_RTSP_EINVAL", "-2"),
("GST_RTSP_ELAST", "-17"),
("GST_RTSP_ENET", "-12"),
("GST_RTSP_ENOMEM", "-4"),
("GST_RTSP_ENOTIMPL", "-6"),
("GST_RTSP_ENOTIP", "-13"),
("GST_RTSP_EPARSE", "-8"),
("GST_RTSP_ERESOLV", "-5"),
("GST_RTSP_ERROR", "-1"),
("GST_RTSP_ESYS", "-7"),
("GST_RTSP_ETGET", "-15"),
("GST_RTSP_ETIMEOUT", "-14"),
("GST_RTSP_ETPOST", "-16"),
("GST_RTSP_EV_READ", "1"),
("GST_RTSP_EV_WRITE", "2"),
("GST_RTSP_EWSASTART", "-9"),
("GST_RTSP_EWSAVERSION", "-10"),
("GST_RTSP_FAM_INET", "1"),
("GST_RTSP_FAM_INET6", "2"),
("GST_RTSP_FAM_NONE", "0"),
("GST_RTSP_GET", "2048"),
("GST_RTSP_GET_PARAMETER", "4"),
("GST_RTSP_HDR_ACCEPT", "1"),
("GST_RTSP_HDR_ACCEPT_CHARSET", "56"),
("GST_RTSP_HDR_ACCEPT_ENCODING", "2"),
("GST_RTSP_HDR_ACCEPT_LANGUAGE", "3"),
("GST_RTSP_HDR_ACCEPT_RANGES", "86"),
("GST_RTSP_HDR_ALERT", "45"),
("GST_RTSP_HDR_ALLOW", "4"),
("GST_RTSP_HDR_AUTHENTICATION_INFO", "76"),
("GST_RTSP_HDR_AUTHORIZATION", "5"),
("GST_RTSP_HDR_BANDWIDTH", "6"),
("GST_RTSP_HDR_BLOCKSIZE", "7"),
("GST_RTSP_HDR_CACHE_CONTROL", "8"),
("GST_RTSP_HDR_CLIENT_CHALLENGE", "40"),
("GST_RTSP_HDR_CLIENT_ID", "46"),
("GST_RTSP_HDR_COMPANY_ID", "47"),
("GST_RTSP_HDR_CONFERENCE", "9"),
("GST_RTSP_HDR_CONNECTION", "10"),
("GST_RTSP_HDR_CONTENT_BASE", "11"),
("GST_RTSP_HDR_CONTENT_ENCODING", "12"),
("GST_RTSP_HDR_CONTENT_LANGUAGE", "13"),
("GST_RTSP_HDR_CONTENT_LENGTH", "14"),
("GST_RTSP_HDR_CONTENT_LOCATION", "15"),
("GST_RTSP_HDR_CONTENT_TYPE", "16"),
("GST_RTSP_HDR_CSEQ", "17"),
("GST_RTSP_HDR_DATE", "18"),
("GST_RTSP_HDR_ETAG", "54"),
("GST_RTSP_HDR_EXPIRES", "19"),
("GST_RTSP_HDR_FROM", "20"),
("GST_RTSP_HDR_GUID", "48"),
("GST_RTSP_HDR_HOST", "77"),
("GST_RTSP_HDR_IF_MATCH", "55"),
("GST_RTSP_HDR_IF_MODIFIED_SINCE", "21"),
("GST_RTSP_HDR_INVALID", "0"),
("GST_RTSP_HDR_KEYMGMT", "82"),
("GST_RTSP_HDR_LANGUAGE", "51"),
("GST_RTSP_HDR_LAST", "87"),
("GST_RTSP_HDR_LAST_MODIFIED", "22"),
("GST_RTSP_HDR_LOCATION", "53"),
("GST_RTSP_HDR_MAX_ASM_WIDTH", "50"),
("GST_RTSP_HDR_MEDIA_PROPERTIES", "84"),
("GST_RTSP_HDR_PIPELINED_REQUESTS", "83"),
("GST_RTSP_HDR_PLAYER_START_TIME", "52"),
("GST_RTSP_HDR_PRAGMA", "78"),
("GST_RTSP_HDR_PROXY_AUTHENTICATE", "23"),
("GST_RTSP_HDR_PROXY_REQUIRE", "24"),
("GST_RTSP_HDR_PUBLIC", "25"),
("GST_RTSP_HDR_RANGE", "26"),
("GST_RTSP_HDR_REAL_CHALLENGE1", "41"),
("GST_RTSP_HDR_REAL_CHALLENGE2", "42"),
("GST_RTSP_HDR_REAL_CHALLENGE3", "43"),
("GST_RTSP_HDR_REFERER", "27"),
("GST_RTSP_HDR_REGION_DATA", "49"),
("GST_RTSP_HDR_REQUIRE", "28"),
("GST_RTSP_HDR_RETRY_AFTER", "29"),
("GST_RTSP_HDR_RTCP_INTERVAL", "81"),
("GST_RTSP_HDR_RTP_INFO", "30"),
("GST_RTSP_HDR_SCALE", "31"),
("GST_RTSP_HDR_SEEK_STYLE", "85"),
("GST_RTSP_HDR_SERVER", "33"),
("GST_RTSP_HDR_SESSION", "32"),
("GST_RTSP_HDR_SPEED", "34"),
("GST_RTSP_HDR_SUBSCRIBE", "44"),
("GST_RTSP_HDR_SUPPORTED", "57"),
("GST_RTSP_HDR_TIMESTAMP", "75"),
("GST_RTSP_HDR_TRANSPORT", "35"),
("GST_RTSP_HDR_UNSUPPORTED", "36"),
("GST_RTSP_HDR_USER_AGENT", "37"),
("GST_RTSP_HDR_VARY", "58"),
("GST_RTSP_HDR_VIA", "38"),
("GST_RTSP_HDR_WWW_AUTHENTICATE", "39"),
("GST_RTSP_HDR_X_ACCELERATE_STREAMING", "59"),
("GST_RTSP_HDR_X_ACCEPT_AUTHENT", "60"),
("GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT", "61"),
("GST_RTSP_HDR_X_BROADCAST_ID", "62"),
("GST_RTSP_HDR_X_BURST_STREAMING", "63"),
("GST_RTSP_HDR_X_NOTICE", "64"),
("GST_RTSP_HDR_X_PLAYER_LAG_TIME", "65"),
("GST_RTSP_HDR_X_PLAYLIST", "66"),
("GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE", "67"),
("GST_RTSP_HDR_X_PLAYLIST_GEN_ID", "68"),
("GST_RTSP_HDR_X_PLAYLIST_SEEK_ID", "69"),
("GST_RTSP_HDR_X_PROXY_CLIENT_AGENT", "70"),
("GST_RTSP_HDR_X_PROXY_CLIENT_VERB", "71"),
("GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE", "72"),
("GST_RTSP_HDR_X_RTP_INFO", "73"),
("GST_RTSP_HDR_X_SERVER_IP_ADDRESS", "79"),
("GST_RTSP_HDR_X_SESSIONCOOKIE", "80"),
("GST_RTSP_HDR_X_STARTUPPROFILE", "74"),
("GST_RTSP_INVALID", "0"),
("GST_RTSP_LOWER_TRANS_HTTP", "16"),
("GST_RTSP_LOWER_TRANS_TCP", "4"),
("GST_RTSP_LOWER_TRANS_TLS", "32"),
("GST_RTSP_LOWER_TRANS_UDP", "1"),
("GST_RTSP_LOWER_TRANS_UDP_MCAST", "2"),
("GST_RTSP_LOWER_TRANS_UNKNOWN", "0"),
("GST_RTSP_MESSAGE_DATA", "5"),
("GST_RTSP_MESSAGE_HTTP_REQUEST", "3"),
("GST_RTSP_MESSAGE_HTTP_RESPONSE", "4"),
("GST_RTSP_MESSAGE_INVALID", "0"),
("GST_RTSP_MESSAGE_REQUEST", "1"),
("GST_RTSP_MESSAGE_RESPONSE", "2"),
("GST_RTSP_OK", "0"),
("GST_RTSP_OPTIONS", "8"),
("GST_RTSP_PAUSE", "16"),
("GST_RTSP_PLAY", "32"),
("GST_RTSP_POST", "4096"),
("GST_RTSP_PROFILE_AVP", "1"),
("GST_RTSP_PROFILE_AVPF", "4"),
("GST_RTSP_PROFILE_SAVP", "2"),
("GST_RTSP_PROFILE_SAVPF", "8"),
("GST_RTSP_PROFILE_UNKNOWN", "0"),
("GST_RTSP_RANGE_CLOCK", "4"),
("GST_RTSP_RANGE_NPT", "3"),
("GST_RTSP_RANGE_SMPTE", "0"),
("GST_RTSP_RANGE_SMPTE_25", "2"),
("GST_RTSP_RANGE_SMPTE_30_DROP", "1"),
("GST_RTSP_RECORD", "64"),
("GST_RTSP_REDIRECT", "128"),
("GST_RTSP_SETUP", "256"),
("GST_RTSP_SET_PARAMETER", "512"),
("GST_RTSP_STATE_INIT", "1"),
("GST_RTSP_STATE_INVALID", "0"),
("GST_RTSP_STATE_PLAYING", "4"),
("GST_RTSP_STATE_READY", "2"),
("GST_RTSP_STATE_RECORDING", "5"),
("GST_RTSP_STATE_SEEKING", "3"),
("GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED", "459"),
("GST_RTSP_STS_BAD_GATEWAY", "502"),
("GST_RTSP_STS_BAD_REQUEST", "400"),
("GST_RTSP_STS_CONFERENCE_NOT_FOUND", "452"),
("GST_RTSP_STS_CONTINUE", "100"),
("GST_RTSP_STS_CREATED", "201"),
("GST_RTSP_STS_DESTINATION_UNREACHABLE", "462"),
("GST_RTSP_STS_FORBIDDEN", "403"),
("GST_RTSP_STS_GATEWAY_TIMEOUT", "504"),
("GST_RTSP_STS_GONE", "410"),
("GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE", "456"),
("GST_RTSP_STS_INTERNAL_SERVER_ERROR", "500"),
("GST_RTSP_STS_INVALID", "0"),
("GST_RTSP_STS_INVALID_RANGE", "457"),
("GST_RTSP_STS_KEY_MANAGEMENT_FAILURE", "463"),
("GST_RTSP_STS_LENGTH_REQUIRED", "411"),
("GST_RTSP_STS_LOW_ON_STORAGE", "250"),
("GST_RTSP_STS_METHOD_NOT_ALLOWED", "405"),
("GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE", "455"),
("GST_RTSP_STS_MOVED_PERMANENTLY", "301"),
("GST_RTSP_STS_MOVE_TEMPORARILY", "302"),
("GST_RTSP_STS_MULTIPLE_CHOICES", "300"),
("GST_RTSP_STS_NOT_ACCEPTABLE", "406"),
("GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH", "453"),
("GST_RTSP_STS_NOT_FOUND", "404"),
("GST_RTSP_STS_NOT_IMPLEMENTED", "501"),
("GST_RTSP_STS_NOT_MODIFIED", "304"),
("GST_RTSP_STS_OK", "200"),
("GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED", "460"),
("GST_RTSP_STS_OPTION_NOT_SUPPORTED", "551"),
("GST_RTSP_STS_PARAMETER_IS_READONLY", "458"),
("GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD", "451"),
("GST_RTSP_STS_PAYMENT_REQUIRED", "402"),
("GST_RTSP_STS_PRECONDITION_FAILED", "412"),
("GST_RTSP_STS_PROXY_AUTH_REQUIRED", "407"),
("GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE", "413"),
("GST_RTSP_STS_REQUEST_TIMEOUT", "408"),
("GST_RTSP_STS_REQUEST_URI_TOO_LARGE", "414"),
("GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED", "505"),
("GST_RTSP_STS_SEE_OTHER", "303"),
("GST_RTSP_STS_SERVICE_UNAVAILABLE", "503"),
("GST_RTSP_STS_SESSION_NOT_FOUND", "454"),
("GST_RTSP_STS_UNAUTHORIZED", "401"),
("GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE", "415"),
("GST_RTSP_STS_UNSUPPORTED_TRANSPORT", "461"),
("GST_RTSP_STS_USE_PROXY", "305"),
("GST_RTSP_TEARDOWN", "1024"),
("GST_RTSP_TIME_END", "2"),
("GST_RTSP_TIME_FRAMES", "3"),
("GST_RTSP_TIME_NOW", "1"),
("GST_RTSP_TIME_SECONDS", "0"),
("GST_RTSP_TIME_UTC", "4"),
("GST_RTSP_TRANS_RDT", "2"),
("GST_RTSP_TRANS_RTP", "1"),
("GST_RTSP_TRANS_UNKNOWN", "0"),
("GST_RTSP_VERSION_1_0", "16"),
("GST_RTSP_VERSION_1_1", "17"),
("GST_RTSP_VERSION_2_0", "32"),
("GST_RTSP_VERSION_INVALID", "0"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/rtsp/rtsp.h>

View file

@ -9,6 +9,10 @@ gobject-sys = { git = "https://github.com/gtk-rs/sys" }
[dependencies.gstreamer-sys]
path = "../gstreamer-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
dox = []
v1_2 = []

View file

@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT

View file

@ -0,0 +1,335 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_sdp_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_sdp_sys::*;
static PACKAGES: &[&str] = &["gstreamer-sdp-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_MIKEY_CACHE_ALWAYS", "1"),
("GST_MIKEY_CACHE_FOR_CSB", "2"),
("GST_MIKEY_CACHE_NONE", "0"),
("GST_MIKEY_ENC_AES_CM_128", "1"),
("GST_MIKEY_ENC_AES_KW_128", "2"),
("GST_MIKEY_ENC_NULL", "0"),
("GST_MIKEY_KD_TEK", "2"),
("GST_MIKEY_KD_TGK", "0"),
("GST_MIKEY_KV_INTERVAL", "2"),
("GST_MIKEY_KV_NULL", "0"),
("GST_MIKEY_KV_SPI", "1"),
("GST_MIKEY_MAC_HMAC_SHA_1_160", "1"),
("GST_MIKEY_MAC_NULL", "0"),
("GST_MIKEY_MAP_TYPE_SRTP", "0"),
("GST_MIKEY_PRF_MIKEY_1", "0"),
("GST_MIKEY_PT_CERT", "7"),
("GST_MIKEY_PT_CHASH", "8"),
("GST_MIKEY_PT_DH", "3"),
("GST_MIKEY_PT_ERR", "12"),
("GST_MIKEY_PT_GEN_EXT", "21"),
("GST_MIKEY_PT_ID", "6"),
("GST_MIKEY_PT_KEMAC", "1"),
("GST_MIKEY_PT_KEY_DATA", "20"),
("GST_MIKEY_PT_LAST", "0"),
("GST_MIKEY_PT_PKE", "2"),
("GST_MIKEY_PT_RAND", "11"),
("GST_MIKEY_PT_SIGN", "4"),
("GST_MIKEY_PT_SP", "10"),
("GST_MIKEY_PT_T", "5"),
("GST_MIKEY_PT_V", "9"),
("GST_MIKEY_SEC_PROTO_SRTP", "0"),
("GST_MIKEY_SP_SRTP_AUTH_ALG", "2"),
("GST_MIKEY_SP_SRTP_AUTH_KEY_LEN", "3"),
("GST_MIKEY_SP_SRTP_AUTH_TAG_LEN", "11"),
("GST_MIKEY_SP_SRTP_ENC_ALG", "0"),
("GST_MIKEY_SP_SRTP_ENC_KEY_LEN", "1"),
("GST_MIKEY_SP_SRTP_FEC_ORDER", "9"),
("GST_MIKEY_SP_SRTP_KEY_DERIV_RATE", "6"),
("GST_MIKEY_SP_SRTP_PRF", "5"),
("GST_MIKEY_SP_SRTP_SALT_KEY_LEN", "4"),
("GST_MIKEY_SP_SRTP_SRTCP_ENC", "8"),
("GST_MIKEY_SP_SRTP_SRTP_AUTH", "10"),
("GST_MIKEY_SP_SRTP_SRTP_ENC", "7"),
("GST_MIKEY_SP_SRTP_SRTP_PREFIX_LEN", "12"),
("GST_MIKEY_TS_TYPE_COUNTER", "2"),
("GST_MIKEY_TS_TYPE_NTP", "1"),
("GST_MIKEY_TS_TYPE_NTP_UTC", "0"),
("GST_MIKEY_TYPE_DH_INIT", "4"),
("GST_MIKEY_TYPE_DH_RESP", "5"),
("GST_MIKEY_TYPE_ERROR", "6"),
("GST_MIKEY_TYPE_INVALID", "-1"),
("GST_MIKEY_TYPE_PK_INIT", "2"),
("GST_MIKEY_TYPE_PK_VERIFY", "3"),
("GST_MIKEY_TYPE_PSK_INIT", "0"),
("GST_MIKEY_TYPE_PSK_VERIFY", "1"),
("GST_MIKEY_VERSION", "1"),
("GST_SDP_BWTYPE_AS", "AS"),
("GST_SDP_BWTYPE_CT", "CT"),
("GST_SDP_BWTYPE_EXT_PREFIX", "X-"),
("GST_SDP_BWTYPE_RR", "RR"),
("GST_SDP_BWTYPE_RS", "RS"),
("GST_SDP_BWTYPE_TIAS", "TIAS"),
("GST_SDP_EINVAL", "-1"),
("GST_SDP_OK", "0"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/sdp/sdp.h>

View file

@ -2,11 +2,14 @@
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_0_10 = []
v1_2 = ["v1_0_10"]

File diff suppressed because it is too large Load diff

1124
gstreamer-sys/tests/abi.rs Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/gst.h>

View file

@ -2,7 +2,6 @@
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
@ -12,6 +11,10 @@ path = "../gstreamer-sys"
[dependencies.gstreamer-base-sys]
path = "../gstreamer-base-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_2 = []
v1_4 = ["v1_2"]

View file

@ -1,11 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[macro_use] extern crate bitflags;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
@ -85,39 +84,21 @@ pub const GST_TAG_MUSICBRAINZ_TRACKID: *const c_char = b"musicbrainz-trackid\0"
pub const GST_TAG_MUSICBRAINZ_TRMID: *const c_char = b"musicbrainz-trmid\0" as *const u8 as *const c_char;
// Flags
bitflags! {
#[repr(C)]
pub struct GstTagLicenseFlags: c_uint {
const PERMITS_REPRODUCTION = 1;
const PERMITS_DISTRIBUTION = 2;
const PERMITS_DERIVATIVE_WORKS = 4;
const PERMITS_SHARING = 8;
const REQUIRES_NOTICE = 256;
const REQUIRES_ATTRIBUTION = 512;
const REQUIRES_SHARE_ALIKE = 1024;
const REQUIRES_SOURCE_CODE = 2048;
const REQUIRES_COPYLEFT = 4096;
const REQUIRES_LESSER_COPYLEFT = 8192;
const PROHIBITS_COMMERCIAL_USE = 65536;
const PROHIBITS_HIGH_INCOME_NATION_USE = 131072;
const CREATIVE_COMMONS_LICENSE = 16777216;
const FREE_SOFTWARE_FOUNDATION_LICENSE = 33554432;
}
}
pub const GST_TAG_LICENSE_PERMITS_REPRODUCTION: GstTagLicenseFlags = GstTagLicenseFlags::PERMITS_REPRODUCTION;
pub const GST_TAG_LICENSE_PERMITS_DISTRIBUTION: GstTagLicenseFlags = GstTagLicenseFlags::PERMITS_DISTRIBUTION;
pub const GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS: GstTagLicenseFlags = GstTagLicenseFlags::PERMITS_DERIVATIVE_WORKS;
pub const GST_TAG_LICENSE_PERMITS_SHARING: GstTagLicenseFlags = GstTagLicenseFlags::PERMITS_SHARING;
pub const GST_TAG_LICENSE_REQUIRES_NOTICE: GstTagLicenseFlags = GstTagLicenseFlags::REQUIRES_NOTICE;
pub const GST_TAG_LICENSE_REQUIRES_ATTRIBUTION: GstTagLicenseFlags = GstTagLicenseFlags::REQUIRES_ATTRIBUTION;
pub const GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE: GstTagLicenseFlags = GstTagLicenseFlags::REQUIRES_SHARE_ALIKE;
pub const GST_TAG_LICENSE_REQUIRES_SOURCE_CODE: GstTagLicenseFlags = GstTagLicenseFlags::REQUIRES_SOURCE_CODE;
pub const GST_TAG_LICENSE_REQUIRES_COPYLEFT: GstTagLicenseFlags = GstTagLicenseFlags::REQUIRES_COPYLEFT;
pub const GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT: GstTagLicenseFlags = GstTagLicenseFlags::REQUIRES_LESSER_COPYLEFT;
pub const GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE: GstTagLicenseFlags = GstTagLicenseFlags::PROHIBITS_COMMERCIAL_USE;
pub const GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE: GstTagLicenseFlags = GstTagLicenseFlags::PROHIBITS_HIGH_INCOME_NATION_USE;
pub const GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE: GstTagLicenseFlags = GstTagLicenseFlags::CREATIVE_COMMONS_LICENSE;
pub const GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE: GstTagLicenseFlags = GstTagLicenseFlags::FREE_SOFTWARE_FOUNDATION_LICENSE;
pub type GstTagLicenseFlags = c_uint;
pub const GST_TAG_LICENSE_PERMITS_REPRODUCTION: GstTagLicenseFlags = 1;
pub const GST_TAG_LICENSE_PERMITS_DISTRIBUTION: GstTagLicenseFlags = 2;
pub const GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS: GstTagLicenseFlags = 4;
pub const GST_TAG_LICENSE_PERMITS_SHARING: GstTagLicenseFlags = 8;
pub const GST_TAG_LICENSE_REQUIRES_NOTICE: GstTagLicenseFlags = 256;
pub const GST_TAG_LICENSE_REQUIRES_ATTRIBUTION: GstTagLicenseFlags = 512;
pub const GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE: GstTagLicenseFlags = 1024;
pub const GST_TAG_LICENSE_REQUIRES_SOURCE_CODE: GstTagLicenseFlags = 2048;
pub const GST_TAG_LICENSE_REQUIRES_COPYLEFT: GstTagLicenseFlags = 4096;
pub const GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT: GstTagLicenseFlags = 8192;
pub const GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE: GstTagLicenseFlags = 65536;
pub const GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE: GstTagLicenseFlags = 131072;
pub const GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE: GstTagLicenseFlags = 16777216;
pub const GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE: GstTagLicenseFlags = 33554432;
// Records
#[repr(C)]

View file

@ -0,0 +1,319 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_tag_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_tag_sys::*;
static PACKAGES: &[&str] = &["gstreamer-tag-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
];
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_EXPOSURE_MODE", "capturing-exposure-mode"),
("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_RATIO", "capturing-focal-ratio"),
("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_SHARPNESS", "capturing-sharpness"),
("GST_TAG_CAPTURING_SHUTTER_SPEED", "capturing-shutter-speed"),
("GST_TAG_CAPTURING_SOURCE", "capturing-source"),
("GST_TAG_CAPTURING_WHITE_BALANCE", "capturing-white-balance"),
("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_CMML_CLIP", "cmml-clip"),
("GST_TAG_CMML_HEAD", "cmml-head"),
("GST_TAG_CMML_STREAM", "cmml-stream"),
("GST_TAG_DEMUX_RESULT_AGAIN", "1"),
("GST_TAG_DEMUX_RESULT_BROKEN_TAG", "0"),
("GST_TAG_DEMUX_RESULT_OK", "2"),
("GST_TAG_ID3V2_HEADER_SIZE", "10"),
("GST_TAG_IMAGE_HORIZONTAL_PPI", "image-horizontal-ppi"),
("GST_TAG_IMAGE_TYPE_ARTIST", "6"),
("GST_TAG_IMAGE_TYPE_BACK_COVER", "2"),
("GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO", "17"),
("GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA", "8"),
("GST_TAG_IMAGE_TYPE_COMPOSER", "9"),
("GST_TAG_IMAGE_TYPE_CONDUCTOR", "7"),
("GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE", "13"),
("GST_TAG_IMAGE_TYPE_DURING_RECORDING", "12"),
("GST_TAG_IMAGE_TYPE_FISH", "15"),
("GST_TAG_IMAGE_TYPE_FRONT_COVER", "1"),
("GST_TAG_IMAGE_TYPE_ILLUSTRATION", "16"),
("GST_TAG_IMAGE_TYPE_LEAD_ARTIST", "5"),
("GST_TAG_IMAGE_TYPE_LEAFLET_PAGE", "3"),
("GST_TAG_IMAGE_TYPE_LYRICIST", "10"),
("GST_TAG_IMAGE_TYPE_MEDIUM", "4"),
("GST_TAG_IMAGE_TYPE_NONE", "-1"),
("GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO", "18"),
("GST_TAG_IMAGE_TYPE_RECORDING_LOCATION", "11"),
("GST_TAG_IMAGE_TYPE_UNDEFINED", "0"),
("GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE", "14"),
("GST_TAG_IMAGE_VERTICAL_PPI", "image-vertical-ppi"),
("GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE", "16777216"),
("GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE", "33554432"),
("GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS", "4"),
("GST_TAG_LICENSE_PERMITS_DISTRIBUTION", "2"),
("GST_TAG_LICENSE_PERMITS_REPRODUCTION", "1"),
("GST_TAG_LICENSE_PERMITS_SHARING", "8"),
("GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE", "65536"),
("GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE", "131072"),
("GST_TAG_LICENSE_REQUIRES_ATTRIBUTION", "512"),
("GST_TAG_LICENSE_REQUIRES_COPYLEFT", "4096"),
("GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT", "8192"),
("GST_TAG_LICENSE_REQUIRES_NOTICE", "256"),
("GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE", "1024"),
("GST_TAG_LICENSE_REQUIRES_SOURCE_CODE", "2048"),
("GST_TAG_MUSICAL_KEY", "musical-key"),
("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

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/tag/tag.h>

View file

@ -2,7 +2,6 @@
pkg-config = "0.3.7"
[dependencies]
bitflags = "1.0"
libc = "0.2"
glib-sys = { git = "https://github.com/gtk-rs/sys" }
gobject-sys = { git = "https://github.com/gtk-rs/sys" }
@ -13,6 +12,10 @@ path = "../gstreamer-sys"
[dependencies.gstreamer-base-sys]
path = "../gstreamer-base-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
v1_0_3 = []
v1_2 = ["v1_0_3"]

View file

@ -1,11 +1,10 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[macro_use] extern crate bitflags;
extern crate glib_sys as glib;
extern crate gobject_sys as gobject;
extern crate gstreamer_sys as gst;
@ -374,223 +373,103 @@ pub const GST_VIDEO_RESAMPLER_OPT_SHARPEN: *const c_char = b"GstVideoResampler.s
pub const GST_VIDEO_RESAMPLER_OPT_SHARPNESS: *const c_char = b"GstVideoResampler.sharpness\0" as *const u8 as *const c_char;
pub const GST_VIDEO_SCALER_OPT_DITHER_METHOD: *const c_char = b"GstVideoScaler.dither-method\0" as *const u8 as *const c_char;
pub const GST_VIDEO_SIZE_RANGE: *const c_char = b"(int) [ 1, max ]\0" as *const u8 as *const c_char;
pub const GST_VIDEO_TILE_TYPE_MASK: c_int = 0;
pub const GST_VIDEO_TILE_TYPE_MASK: c_int = 65535;
pub const GST_VIDEO_TILE_TYPE_SHIFT: c_int = 16;
pub const GST_VIDEO_TILE_X_TILES_MASK: c_int = 0;
pub const GST_VIDEO_TILE_X_TILES_MASK: c_int = 65535;
pub const GST_VIDEO_TILE_Y_TILES_SHIFT: c_int = 16;
// Flags
bitflags! {
#[repr(C)]
pub struct GstVideoBufferFlags: c_uint {
const INTERLACED = 1048576;
const TFF = 2097152;
const RFF = 4194304;
const ONEFIELD = 8388608;
const MULTIPLE_VIEW = 16777216;
const FIRST_IN_BUNDLE = 33554432;
const LAST = 268435456;
}
}
pub const GST_VIDEO_BUFFER_FLAG_INTERLACED: GstVideoBufferFlags = GstVideoBufferFlags::INTERLACED;
pub const GST_VIDEO_BUFFER_FLAG_TFF: GstVideoBufferFlags = GstVideoBufferFlags::TFF;
pub const GST_VIDEO_BUFFER_FLAG_RFF: GstVideoBufferFlags = GstVideoBufferFlags::RFF;
pub const GST_VIDEO_BUFFER_FLAG_ONEFIELD: GstVideoBufferFlags = GstVideoBufferFlags::ONEFIELD;
pub const GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW: GstVideoBufferFlags = GstVideoBufferFlags::MULTIPLE_VIEW;
pub const GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE: GstVideoBufferFlags = GstVideoBufferFlags::FIRST_IN_BUNDLE;
pub const GST_VIDEO_BUFFER_FLAG_LAST: GstVideoBufferFlags = GstVideoBufferFlags::LAST;
pub type GstVideoBufferFlags = c_uint;
pub const GST_VIDEO_BUFFER_FLAG_INTERLACED: GstVideoBufferFlags = 1048576;
pub const GST_VIDEO_BUFFER_FLAG_TFF: GstVideoBufferFlags = 2097152;
pub const GST_VIDEO_BUFFER_FLAG_RFF: GstVideoBufferFlags = 4194304;
pub const GST_VIDEO_BUFFER_FLAG_ONEFIELD: GstVideoBufferFlags = 8388608;
pub const GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW: GstVideoBufferFlags = 16777216;
pub const GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE: GstVideoBufferFlags = 33554432;
pub const GST_VIDEO_BUFFER_FLAG_LAST: GstVideoBufferFlags = 268435456;
bitflags! {
#[repr(C)]
pub struct GstVideoChromaFlags: c_uint {
const NONE = 0;
const INTERLACED = 1;
}
}
pub const GST_VIDEO_CHROMA_FLAG_NONE: GstVideoChromaFlags = GstVideoChromaFlags::NONE;
pub const GST_VIDEO_CHROMA_FLAG_INTERLACED: GstVideoChromaFlags = GstVideoChromaFlags::INTERLACED;
pub type GstVideoChromaFlags = c_uint;
pub const GST_VIDEO_CHROMA_FLAG_NONE: GstVideoChromaFlags = 0;
pub const GST_VIDEO_CHROMA_FLAG_INTERLACED: GstVideoChromaFlags = 1;
bitflags! {
#[repr(C)]
pub struct GstVideoChromaSite: c_uint {
const UNKNOWN = 0;
const NONE = 1;
const H_COSITED = 2;
const V_COSITED = 4;
const ALT_LINE = 8;
const COSITED = 6;
const JPEG = 1;
const MPEG2 = 2;
const DV = 14;
}
}
pub const GST_VIDEO_CHROMA_SITE_UNKNOWN: GstVideoChromaSite = GstVideoChromaSite::UNKNOWN;
pub const GST_VIDEO_CHROMA_SITE_NONE: GstVideoChromaSite = GstVideoChromaSite::JPEG;
pub const GST_VIDEO_CHROMA_SITE_H_COSITED: GstVideoChromaSite = GstVideoChromaSite::MPEG2;
pub const GST_VIDEO_CHROMA_SITE_V_COSITED: GstVideoChromaSite = GstVideoChromaSite::V_COSITED;
pub const GST_VIDEO_CHROMA_SITE_ALT_LINE: GstVideoChromaSite = GstVideoChromaSite::ALT_LINE;
pub const GST_VIDEO_CHROMA_SITE_COSITED: GstVideoChromaSite = GstVideoChromaSite::COSITED;
pub const GST_VIDEO_CHROMA_SITE_JPEG: GstVideoChromaSite = GstVideoChromaSite::JPEG;
pub const GST_VIDEO_CHROMA_SITE_MPEG2: GstVideoChromaSite = GstVideoChromaSite::MPEG2;
pub const GST_VIDEO_CHROMA_SITE_DV: GstVideoChromaSite = GstVideoChromaSite::DV;
pub type GstVideoChromaSite = c_uint;
pub const GST_VIDEO_CHROMA_SITE_UNKNOWN: GstVideoChromaSite = 0;
pub const GST_VIDEO_CHROMA_SITE_NONE: GstVideoChromaSite = 1;
pub const GST_VIDEO_CHROMA_SITE_H_COSITED: GstVideoChromaSite = 2;
pub const GST_VIDEO_CHROMA_SITE_V_COSITED: GstVideoChromaSite = 4;
pub const GST_VIDEO_CHROMA_SITE_ALT_LINE: GstVideoChromaSite = 8;
pub const GST_VIDEO_CHROMA_SITE_COSITED: GstVideoChromaSite = 6;
pub const GST_VIDEO_CHROMA_SITE_JPEG: GstVideoChromaSite = 1;
pub const GST_VIDEO_CHROMA_SITE_MPEG2: GstVideoChromaSite = 2;
pub const GST_VIDEO_CHROMA_SITE_DV: GstVideoChromaSite = 14;
bitflags! {
#[repr(C)]
pub struct GstVideoCodecFrameFlags: c_uint {
const DECODE_ONLY = 1;
const SYNC_POINT = 2;
const FORCE_KEYFRAME = 4;
const FORCE_KEYFRAME_HEADERS = 8;
}
}
pub const GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY: GstVideoCodecFrameFlags = GstVideoCodecFrameFlags::DECODE_ONLY;
pub const GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT: GstVideoCodecFrameFlags = GstVideoCodecFrameFlags::SYNC_POINT;
pub const GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME: GstVideoCodecFrameFlags = GstVideoCodecFrameFlags::FORCE_KEYFRAME;
pub const GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS: GstVideoCodecFrameFlags = GstVideoCodecFrameFlags::FORCE_KEYFRAME_HEADERS;
pub type GstVideoCodecFrameFlags = c_uint;
pub const GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY: GstVideoCodecFrameFlags = 1;
pub const GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT: GstVideoCodecFrameFlags = 2;
pub const GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME: GstVideoCodecFrameFlags = 4;
pub const GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS: GstVideoCodecFrameFlags = 8;
bitflags! {
#[repr(C)]
pub struct GstVideoDitherFlags: c_uint {
const NONE = 0;
const INTERLACED = 1;
const QUANTIZE = 2;
}
}
pub const GST_VIDEO_DITHER_FLAG_NONE: GstVideoDitherFlags = GstVideoDitherFlags::NONE;
pub const GST_VIDEO_DITHER_FLAG_INTERLACED: GstVideoDitherFlags = GstVideoDitherFlags::INTERLACED;
pub const GST_VIDEO_DITHER_FLAG_QUANTIZE: GstVideoDitherFlags = GstVideoDitherFlags::QUANTIZE;
pub type GstVideoDitherFlags = c_uint;
pub const GST_VIDEO_DITHER_FLAG_NONE: GstVideoDitherFlags = 0;
pub const GST_VIDEO_DITHER_FLAG_INTERLACED: GstVideoDitherFlags = 1;
pub const GST_VIDEO_DITHER_FLAG_QUANTIZE: GstVideoDitherFlags = 2;
bitflags! {
#[repr(C)]
pub struct GstVideoFlags: c_uint {
const NONE = 0;
const VARIABLE_FPS = 1;
const PREMULTIPLIED_ALPHA = 2;
}
}
pub const GST_VIDEO_FLAG_NONE: GstVideoFlags = GstVideoFlags::NONE;
pub const GST_VIDEO_FLAG_VARIABLE_FPS: GstVideoFlags = GstVideoFlags::VARIABLE_FPS;
pub const GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA: GstVideoFlags = GstVideoFlags::PREMULTIPLIED_ALPHA;
pub type GstVideoFlags = c_uint;
pub const GST_VIDEO_FLAG_NONE: GstVideoFlags = 0;
pub const GST_VIDEO_FLAG_VARIABLE_FPS: GstVideoFlags = 1;
pub const GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA: GstVideoFlags = 2;
bitflags! {
#[repr(C)]
pub struct GstVideoFormatFlags: c_uint {
const YUV = 1;
const RGB = 2;
const GRAY = 4;
const ALPHA = 8;
const LE = 16;
const PALETTE = 32;
const COMPLEX = 64;
const UNPACK = 128;
const TILED = 256;
}
}
pub const GST_VIDEO_FORMAT_FLAG_YUV: GstVideoFormatFlags = GstVideoFormatFlags::YUV;
pub const GST_VIDEO_FORMAT_FLAG_RGB: GstVideoFormatFlags = GstVideoFormatFlags::RGB;
pub const GST_VIDEO_FORMAT_FLAG_GRAY: GstVideoFormatFlags = GstVideoFormatFlags::GRAY;
pub const GST_VIDEO_FORMAT_FLAG_ALPHA: GstVideoFormatFlags = GstVideoFormatFlags::ALPHA;
pub const GST_VIDEO_FORMAT_FLAG_LE: GstVideoFormatFlags = GstVideoFormatFlags::LE;
pub const GST_VIDEO_FORMAT_FLAG_PALETTE: GstVideoFormatFlags = GstVideoFormatFlags::PALETTE;
pub const GST_VIDEO_FORMAT_FLAG_COMPLEX: GstVideoFormatFlags = GstVideoFormatFlags::COMPLEX;
pub const GST_VIDEO_FORMAT_FLAG_UNPACK: GstVideoFormatFlags = GstVideoFormatFlags::UNPACK;
pub const GST_VIDEO_FORMAT_FLAG_TILED: GstVideoFormatFlags = GstVideoFormatFlags::TILED;
pub type GstVideoFormatFlags = c_uint;
pub const GST_VIDEO_FORMAT_FLAG_YUV: GstVideoFormatFlags = 1;
pub const GST_VIDEO_FORMAT_FLAG_RGB: GstVideoFormatFlags = 2;
pub const GST_VIDEO_FORMAT_FLAG_GRAY: GstVideoFormatFlags = 4;
pub const GST_VIDEO_FORMAT_FLAG_ALPHA: GstVideoFormatFlags = 8;
pub const GST_VIDEO_FORMAT_FLAG_LE: GstVideoFormatFlags = 16;
pub const GST_VIDEO_FORMAT_FLAG_PALETTE: GstVideoFormatFlags = 32;
pub const GST_VIDEO_FORMAT_FLAG_COMPLEX: GstVideoFormatFlags = 64;
pub const GST_VIDEO_FORMAT_FLAG_UNPACK: GstVideoFormatFlags = 128;
pub const GST_VIDEO_FORMAT_FLAG_TILED: GstVideoFormatFlags = 256;
bitflags! {
#[repr(C)]
pub struct GstVideoFrameFlags: c_uint {
const NONE = 0;
const INTERLACED = 1;
const TFF = 2;
const RFF = 4;
const ONEFIELD = 8;
const MULTIPLE_VIEW = 16;
const FIRST_IN_BUNDLE = 32;
}
}
pub const GST_VIDEO_FRAME_FLAG_NONE: GstVideoFrameFlags = GstVideoFrameFlags::NONE;
pub const GST_VIDEO_FRAME_FLAG_INTERLACED: GstVideoFrameFlags = GstVideoFrameFlags::INTERLACED;
pub const GST_VIDEO_FRAME_FLAG_TFF: GstVideoFrameFlags = GstVideoFrameFlags::TFF;
pub const GST_VIDEO_FRAME_FLAG_RFF: GstVideoFrameFlags = GstVideoFrameFlags::RFF;
pub const GST_VIDEO_FRAME_FLAG_ONEFIELD: GstVideoFrameFlags = GstVideoFrameFlags::ONEFIELD;
pub const GST_VIDEO_FRAME_FLAG_MULTIPLE_VIEW: GstVideoFrameFlags = GstVideoFrameFlags::MULTIPLE_VIEW;
pub const GST_VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE: GstVideoFrameFlags = GstVideoFrameFlags::FIRST_IN_BUNDLE;
pub type GstVideoFrameFlags = c_uint;
pub const GST_VIDEO_FRAME_FLAG_NONE: GstVideoFrameFlags = 0;
pub const GST_VIDEO_FRAME_FLAG_INTERLACED: GstVideoFrameFlags = 1;
pub const GST_VIDEO_FRAME_FLAG_TFF: GstVideoFrameFlags = 2;
pub const GST_VIDEO_FRAME_FLAG_RFF: GstVideoFrameFlags = 4;
pub const GST_VIDEO_FRAME_FLAG_ONEFIELD: GstVideoFrameFlags = 8;
pub const GST_VIDEO_FRAME_FLAG_MULTIPLE_VIEW: GstVideoFrameFlags = 16;
pub const GST_VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE: GstVideoFrameFlags = 32;
bitflags! {
#[repr(C)]
pub struct GstVideoFrameMapFlags: c_uint {
const NO_REF = 65536;
const LAST = 16777216;
}
}
pub const GST_VIDEO_FRAME_MAP_FLAG_NO_REF: GstVideoFrameMapFlags = GstVideoFrameMapFlags::NO_REF;
pub const GST_VIDEO_FRAME_MAP_FLAG_LAST: GstVideoFrameMapFlags = GstVideoFrameMapFlags::LAST;
pub type GstVideoFrameMapFlags = c_uint;
pub const GST_VIDEO_FRAME_MAP_FLAG_NO_REF: GstVideoFrameMapFlags = 65536;
pub const GST_VIDEO_FRAME_MAP_FLAG_LAST: GstVideoFrameMapFlags = 16777216;
bitflags! {
#[repr(C)]
pub struct GstVideoMultiviewFlags: c_uint {
const NONE = 0;
const RIGHT_VIEW_FIRST = 1;
const LEFT_FLIPPED = 2;
const LEFT_FLOPPED = 4;
const RIGHT_FLIPPED = 8;
const RIGHT_FLOPPED = 16;
const HALF_ASPECT = 16384;
const MIXED_MONO = 32768;
}
}
pub const GST_VIDEO_MULTIVIEW_FLAGS_NONE: GstVideoMultiviewFlags = GstVideoMultiviewFlags::NONE;
pub const GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST: GstVideoMultiviewFlags = GstVideoMultiviewFlags::RIGHT_VIEW_FIRST;
pub const GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED: GstVideoMultiviewFlags = GstVideoMultiviewFlags::LEFT_FLIPPED;
pub const GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED: GstVideoMultiviewFlags = GstVideoMultiviewFlags::LEFT_FLOPPED;
pub const GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED: GstVideoMultiviewFlags = GstVideoMultiviewFlags::RIGHT_FLIPPED;
pub const GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED: GstVideoMultiviewFlags = GstVideoMultiviewFlags::RIGHT_FLOPPED;
pub const GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT: GstVideoMultiviewFlags = GstVideoMultiviewFlags::HALF_ASPECT;
pub const GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO: GstVideoMultiviewFlags = GstVideoMultiviewFlags::MIXED_MONO;
pub type GstVideoMultiviewFlags = c_uint;
pub const GST_VIDEO_MULTIVIEW_FLAGS_NONE: GstVideoMultiviewFlags = 0;
pub const GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST: GstVideoMultiviewFlags = 1;
pub const GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED: GstVideoMultiviewFlags = 2;
pub const GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED: GstVideoMultiviewFlags = 4;
pub const GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED: GstVideoMultiviewFlags = 8;
pub const GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED: GstVideoMultiviewFlags = 16;
pub const GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT: GstVideoMultiviewFlags = 16384;
pub const GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO: GstVideoMultiviewFlags = 32768;
bitflags! {
#[repr(C)]
pub struct GstVideoPackFlags: c_uint {
const NONE = 0;
const TRUNCATE_RANGE = 1;
const INTERLACED = 2;
}
}
pub const GST_VIDEO_PACK_FLAG_NONE: GstVideoPackFlags = GstVideoPackFlags::NONE;
pub const GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE: GstVideoPackFlags = GstVideoPackFlags::TRUNCATE_RANGE;
pub const GST_VIDEO_PACK_FLAG_INTERLACED: GstVideoPackFlags = GstVideoPackFlags::INTERLACED;
pub type GstVideoPackFlags = c_uint;
pub const GST_VIDEO_PACK_FLAG_NONE: GstVideoPackFlags = 0;
pub const GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE: GstVideoPackFlags = 1;
pub const GST_VIDEO_PACK_FLAG_INTERLACED: GstVideoPackFlags = 2;
bitflags! {
#[repr(C)]
pub struct GstVideoResamplerFlags: c_uint {
const NONE = 0;
const HALF_TAPS = 1;
}
}
pub const GST_VIDEO_RESAMPLER_FLAG_NONE: GstVideoResamplerFlags = GstVideoResamplerFlags::NONE;
pub const GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS: GstVideoResamplerFlags = GstVideoResamplerFlags::HALF_TAPS;
pub type GstVideoResamplerFlags = c_uint;
pub const GST_VIDEO_RESAMPLER_FLAG_NONE: GstVideoResamplerFlags = 0;
pub const GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS: GstVideoResamplerFlags = 1;
bitflags! {
#[repr(C)]
pub struct GstVideoScalerFlags: c_uint {
const NONE = 0;
const INTERLACED = 1;
}
}
pub const GST_VIDEO_SCALER_FLAG_NONE: GstVideoScalerFlags = GstVideoScalerFlags::NONE;
pub const GST_VIDEO_SCALER_FLAG_INTERLACED: GstVideoScalerFlags = GstVideoScalerFlags::INTERLACED;
pub type GstVideoScalerFlags = c_uint;
pub const GST_VIDEO_SCALER_FLAG_NONE: GstVideoScalerFlags = 0;
pub const GST_VIDEO_SCALER_FLAG_INTERLACED: GstVideoScalerFlags = 1;
bitflags! {
#[repr(C)]
pub struct GstVideoTimeCodeFlags: c_uint {
const NONE = 0;
const DROP_FRAME = 1;
const INTERLACED = 2;
}
}
pub const GST_VIDEO_TIME_CODE_FLAGS_NONE: GstVideoTimeCodeFlags = GstVideoTimeCodeFlags::NONE;
pub const GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME: GstVideoTimeCodeFlags = GstVideoTimeCodeFlags::DROP_FRAME;
pub const GST_VIDEO_TIME_CODE_FLAGS_INTERLACED: GstVideoTimeCodeFlags = GstVideoTimeCodeFlags::INTERLACED;
pub type GstVideoTimeCodeFlags = c_uint;
pub const GST_VIDEO_TIME_CODE_FLAGS_NONE: GstVideoTimeCodeFlags = 0;
pub const GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME: GstVideoTimeCodeFlags = 1;
pub const GST_VIDEO_TIME_CODE_FLAGS_INTERLACED: GstVideoTimeCodeFlags = 2;
// Unions
#[repr(C)]

View file

@ -0,0 +1,683 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_video_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_video_sys::*;
static PACKAGES: &[&str] = &["gstreamer-video-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
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>()}),
("GstVideoAlignment", Layout {size: size_of::<GstVideoAlignment>(), alignment: align_of::<GstVideoAlignment>()}),
("GstVideoAlphaMode", Layout {size: size_of::<GstVideoAlphaMode>(), alignment: align_of::<GstVideoAlphaMode>()}),
("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>()}),
("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>()}),
];
const RUST_CONSTANTS: &[(&str, &str)] = &[
("GST_BUFFER_POOL_OPTION_VIDEO_AFFINE_TRANSFORMATION_META", "GstBufferPoolOptionVideoAffineTransformation"),
("GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT", "GstBufferPoolOptionVideoAlignment"),
("GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META", "GstBufferPoolOptionVideoGLTextureUploadMeta"),
("GST_BUFFER_POOL_OPTION_VIDEO_META", "GstBufferPoolOptionVideoMeta"),
("GST_CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META", "meta:GstVideoAffineTransformation"),
("GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META", "meta:GstVideoGLTextureUploadMeta"),
("GST_CAPS_FEATURE_META_GST_VIDEO_META", "meta:GstVideoMeta"),
("GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION", "meta:GstVideoOverlayComposition"),
("GST_COLOR_BALANCE_HARDWARE", "0"),
("GST_COLOR_BALANCE_SOFTWARE", "1"),
("GST_META_TAG_VIDEO_COLORSPACE_STR", "colorspace"),
("GST_META_TAG_VIDEO_ORIENTATION_STR", "orientation"),
("GST_META_TAG_VIDEO_SIZE_STR", "size"),
("GST_META_TAG_VIDEO_STR", "video"),
("GST_NAVIGATION_COMMAND_ACTIVATE", "24"),
("GST_NAVIGATION_COMMAND_DOWN", "23"),
("GST_NAVIGATION_COMMAND_INVALID", "0"),
("GST_NAVIGATION_COMMAND_LEFT", "20"),
("GST_NAVIGATION_COMMAND_MENU1", "1"),
("GST_NAVIGATION_COMMAND_MENU2", "2"),
("GST_NAVIGATION_COMMAND_MENU3", "3"),
("GST_NAVIGATION_COMMAND_MENU4", "4"),
("GST_NAVIGATION_COMMAND_MENU5", "5"),
("GST_NAVIGATION_COMMAND_MENU6", "6"),
("GST_NAVIGATION_COMMAND_MENU7", "7"),
("GST_NAVIGATION_COMMAND_NEXT_ANGLE", "31"),
("GST_NAVIGATION_COMMAND_PREV_ANGLE", "30"),
("GST_NAVIGATION_COMMAND_RIGHT", "21"),
("GST_NAVIGATION_COMMAND_UP", "22"),
("GST_NAVIGATION_EVENT_COMMAND", "6"),
("GST_NAVIGATION_EVENT_INVALID", "0"),
("GST_NAVIGATION_EVENT_KEY_PRESS", "1"),
("GST_NAVIGATION_EVENT_KEY_RELEASE", "2"),
("GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS", "3"),
("GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE", "4"),
("GST_NAVIGATION_EVENT_MOUSE_MOVE", "5"),
("GST_NAVIGATION_MESSAGE_ANGLES_CHANGED", "3"),
("GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED", "2"),
("GST_NAVIGATION_MESSAGE_EVENT", "4"),
("GST_NAVIGATION_MESSAGE_INVALID", "0"),
("GST_NAVIGATION_MESSAGE_MOUSE_OVER", "1"),
("GST_NAVIGATION_QUERY_ANGLES", "2"),
("GST_NAVIGATION_QUERY_COMMANDS", "1"),
("GST_NAVIGATION_QUERY_INVALID", "0"),
("GST_VIDEO_ALPHA_MODE_COPY", "0"),
("GST_VIDEO_ALPHA_MODE_MULT", "2"),
("GST_VIDEO_ALPHA_MODE_SET", "1"),
("GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE", "33554432"),
("GST_VIDEO_BUFFER_FLAG_INTERLACED", "1048576"),
("GST_VIDEO_BUFFER_FLAG_LAST", "268435456"),
("GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW", "16777216"),
("GST_VIDEO_BUFFER_FLAG_ONEFIELD", "8388608"),
("GST_VIDEO_BUFFER_FLAG_RFF", "4194304"),
("GST_VIDEO_BUFFER_FLAG_TFF", "2097152"),
("GST_VIDEO_CHROMA_FLAG_INTERLACED", "1"),
("GST_VIDEO_CHROMA_FLAG_NONE", "0"),
("GST_VIDEO_CHROMA_METHOD_LINEAR", "1"),
("GST_VIDEO_CHROMA_METHOD_NEAREST", "0"),
("GST_VIDEO_CHROMA_MODE_DOWNSAMPLE_ONLY", "2"),
("GST_VIDEO_CHROMA_MODE_FULL", "0"),
("GST_VIDEO_CHROMA_MODE_NONE", "3"),
("GST_VIDEO_CHROMA_MODE_UPSAMPLE_ONLY", "1"),
("GST_VIDEO_CHROMA_SITE_ALT_LINE", "8"),
("GST_VIDEO_CHROMA_SITE_COSITED", "6"),
("GST_VIDEO_CHROMA_SITE_DV", "14"),
("GST_VIDEO_CHROMA_SITE_H_COSITED", "2"),
("GST_VIDEO_CHROMA_SITE_JPEG", "1"),
("GST_VIDEO_CHROMA_SITE_MPEG2", "2"),
("GST_VIDEO_CHROMA_SITE_NONE", "1"),
("GST_VIDEO_CHROMA_SITE_UNKNOWN", "0"),
("GST_VIDEO_CHROMA_SITE_V_COSITED", "4"),
("GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY", "1"),
("GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME", "4"),
("GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS", "8"),
("GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT", "2"),
("GST_VIDEO_COLORIMETRY_BT2020", "bt2020"),
("GST_VIDEO_COLORIMETRY_BT601", "bt601"),
("GST_VIDEO_COLORIMETRY_BT709", "bt709"),
("GST_VIDEO_COLORIMETRY_SMPTE240M", "smpte240m"),
("GST_VIDEO_COLORIMETRY_SRGB", "sRGB"),
("GST_VIDEO_COLOR_MATRIX_BT2020", "6"),
("GST_VIDEO_COLOR_MATRIX_BT601", "4"),
("GST_VIDEO_COLOR_MATRIX_BT709", "3"),
("GST_VIDEO_COLOR_MATRIX_FCC", "2"),
("GST_VIDEO_COLOR_MATRIX_RGB", "1"),
("GST_VIDEO_COLOR_MATRIX_SMPTE240M", "5"),
("GST_VIDEO_COLOR_MATRIX_UNKNOWN", "0"),
("GST_VIDEO_COLOR_PRIMARIES_ADOBERGB", "8"),
("GST_VIDEO_COLOR_PRIMARIES_BT2020", "7"),
("GST_VIDEO_COLOR_PRIMARIES_BT470BG", "3"),
("GST_VIDEO_COLOR_PRIMARIES_BT470M", "2"),
("GST_VIDEO_COLOR_PRIMARIES_BT709", "1"),
("GST_VIDEO_COLOR_PRIMARIES_FILM", "6"),
("GST_VIDEO_COLOR_PRIMARIES_SMPTE170M", "4"),
("GST_VIDEO_COLOR_PRIMARIES_SMPTE240M", "5"),
("GST_VIDEO_COLOR_PRIMARIES_UNKNOWN", "0"),
("GST_VIDEO_COLOR_RANGE_0_255", "1"),
("GST_VIDEO_COLOR_RANGE_16_235", "2"),
("GST_VIDEO_COLOR_RANGE_UNKNOWN", "0"),
("GST_VIDEO_COMP_A", "3"),
("GST_VIDEO_COMP_B", "2"),
("GST_VIDEO_COMP_G", "1"),
("GST_VIDEO_COMP_INDEX", "0"),
("GST_VIDEO_COMP_PALETTE", "1"),
("GST_VIDEO_COMP_R", "0"),
("GST_VIDEO_COMP_U", "1"),
("GST_VIDEO_COMP_V", "2"),
("GST_VIDEO_COMP_Y", "0"),
("GST_VIDEO_CONVERTER_OPT_ALPHA_MODE", "GstVideoConverter.alpha-mode"),
("GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE", "GstVideoConverter.alpha-value"),
("GST_VIDEO_CONVERTER_OPT_BORDER_ARGB", "GstVideoConverter.border-argb"),
("GST_VIDEO_CONVERTER_OPT_CHROMA_MODE", "GstVideoConverter.chroma-mode"),
("GST_VIDEO_CONVERTER_OPT_CHROMA_RESAMPLER_METHOD", "GstVideoConverter.chroma-resampler-method"),
("GST_VIDEO_CONVERTER_OPT_DEST_HEIGHT", "GstVideoConverter.dest-height"),
("GST_VIDEO_CONVERTER_OPT_DEST_WIDTH", "GstVideoConverter.dest-width"),
("GST_VIDEO_CONVERTER_OPT_DEST_X", "GstVideoConverter.dest-x"),
("GST_VIDEO_CONVERTER_OPT_DEST_Y", "GstVideoConverter.dest-y"),
("GST_VIDEO_CONVERTER_OPT_DITHER_METHOD", "GstVideoConverter.dither-method"),
("GST_VIDEO_CONVERTER_OPT_DITHER_QUANTIZATION", "GstVideoConverter.dither-quantization"),
("GST_VIDEO_CONVERTER_OPT_FILL_BORDER", "GstVideoConverter.fill-border"),
("GST_VIDEO_CONVERTER_OPT_GAMMA_MODE", "GstVideoConverter.gamma-mode"),
("GST_VIDEO_CONVERTER_OPT_MATRIX_MODE", "GstVideoConverter.matrix-mode"),
("GST_VIDEO_CONVERTER_OPT_PRIMARIES_MODE", "GstVideoConverter.primaries-mode"),
("GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD", "GstVideoConverter.resampler-method"),
("GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS", "GstVideoConverter.resampler-taps"),
("GST_VIDEO_CONVERTER_OPT_SRC_HEIGHT", "GstVideoConverter.src-height"),
("GST_VIDEO_CONVERTER_OPT_SRC_WIDTH", "GstVideoConverter.src-width"),
("GST_VIDEO_CONVERTER_OPT_SRC_X", "GstVideoConverter.src-x"),
("GST_VIDEO_CONVERTER_OPT_SRC_Y", "GstVideoConverter.src-y"),
("GST_VIDEO_CONVERTER_OPT_THREADS", "GstVideoConverter.threads"),
("GST_VIDEO_DECODER_MAX_ERRORS", "10"),
("GST_VIDEO_DECODER_SINK_NAME", "sink"),
("GST_VIDEO_DECODER_SRC_NAME", "src"),
("GST_VIDEO_DITHER_BAYER", "4"),
("GST_VIDEO_DITHER_FLAG_INTERLACED", "1"),
("GST_VIDEO_DITHER_FLAG_NONE", "0"),
("GST_VIDEO_DITHER_FLAG_QUANTIZE", "2"),
("GST_VIDEO_DITHER_FLOYD_STEINBERG", "2"),
("GST_VIDEO_DITHER_NONE", "0"),
("GST_VIDEO_DITHER_SIERRA_LITE", "3"),
("GST_VIDEO_DITHER_VERTERR", "1"),
("GST_VIDEO_ENCODER_SINK_NAME", "sink"),
("GST_VIDEO_ENCODER_SRC_NAME", "src"),
("GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST", "2"),
("GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST", "1"),
("GST_VIDEO_FIELD_ORDER_UNKNOWN", "0"),
("GST_VIDEO_FLAG_NONE", "0"),
("GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA", "2"),
("GST_VIDEO_FLAG_VARIABLE_FPS", "1"),
("GST_VIDEO_FORMATS_ALL", "{ I420, YV12, YUY2, UYVY, AYUV, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, Y41B, Y42B, YVYU, Y444, v210, v216, NV12, NV21, GRAY8, GRAY16_BE, GRAY16_LE, v308, RGB16, BGR16, RGB15, BGR15, UYVP, A420, RGB8P, YUV9, YVU9, IYU1, ARGB64, AYUV64, r210, I420_10BE, I420_10LE, I422_10BE, I422_10LE, Y444_10BE, Y444_10LE, GBR, GBR_10BE, GBR_10LE, NV16, NV24, NV12_64Z32, A420_10BE, A420_10LE, A422_10BE, A422_10LE, A444_10BE, A444_10LE, NV61, P010_10BE, P010_10LE, IYU2, VYUY, GBRA, GBRA_10BE, GBRA_10LE, GBR_12BE, GBR_12LE, GBRA_12BE, GBRA_12LE, I420_12BE, I420_12LE, I422_12BE, I422_12LE, Y444_12BE, Y444_12LE, GRAY10_LE32, NV12_10LE32, NV16_10LE32 }"),
("GST_VIDEO_FORMAT_A420", "34"),
("GST_VIDEO_FORMAT_A420_10BE", "54"),
("GST_VIDEO_FORMAT_A420_10LE", "55"),
("GST_VIDEO_FORMAT_A422_10BE", "56"),
("GST_VIDEO_FORMAT_A422_10LE", "57"),
("GST_VIDEO_FORMAT_A444_10BE", "58"),
("GST_VIDEO_FORMAT_A444_10LE", "59"),
("GST_VIDEO_FORMAT_ABGR", "14"),
("GST_VIDEO_FORMAT_ARGB", "13"),
("GST_VIDEO_FORMAT_ARGB64", "39"),
("GST_VIDEO_FORMAT_AYUV", "6"),
("GST_VIDEO_FORMAT_AYUV64", "40"),
("GST_VIDEO_FORMAT_BGR", "16"),
("GST_VIDEO_FORMAT_BGR15", "32"),
("GST_VIDEO_FORMAT_BGR16", "30"),
("GST_VIDEO_FORMAT_BGRA", "12"),
("GST_VIDEO_FORMAT_BGRx", "8"),
("GST_VIDEO_FORMAT_ENCODED", "1"),
("GST_VIDEO_FORMAT_FLAG_ALPHA", "8"),
("GST_VIDEO_FORMAT_FLAG_COMPLEX", "64"),
("GST_VIDEO_FORMAT_FLAG_GRAY", "4"),
("GST_VIDEO_FORMAT_FLAG_LE", "16"),
("GST_VIDEO_FORMAT_FLAG_PALETTE", "32"),
("GST_VIDEO_FORMAT_FLAG_RGB", "2"),
("GST_VIDEO_FORMAT_FLAG_TILED", "256"),
("GST_VIDEO_FORMAT_FLAG_UNPACK", "128"),
("GST_VIDEO_FORMAT_FLAG_YUV", "1"),
("GST_VIDEO_FORMAT_GBR", "48"),
("GST_VIDEO_FORMAT_GBRA", "65"),
("GST_VIDEO_FORMAT_GBRA_10BE", "66"),
("GST_VIDEO_FORMAT_GBRA_10LE", "67"),
("GST_VIDEO_FORMAT_GBRA_12BE", "70"),
("GST_VIDEO_FORMAT_GBRA_12LE", "71"),
("GST_VIDEO_FORMAT_GBR_10BE", "49"),
("GST_VIDEO_FORMAT_GBR_10LE", "50"),
("GST_VIDEO_FORMAT_GBR_12BE", "68"),
("GST_VIDEO_FORMAT_GBR_12LE", "69"),
("GST_VIDEO_FORMAT_GRAY10_LE32", "78"),
("GST_VIDEO_FORMAT_GRAY16_BE", "26"),
("GST_VIDEO_FORMAT_GRAY16_LE", "27"),
("GST_VIDEO_FORMAT_GRAY8", "25"),
("GST_VIDEO_FORMAT_I420", "2"),
("GST_VIDEO_FORMAT_I420_10BE", "42"),
("GST_VIDEO_FORMAT_I420_10LE", "43"),
("GST_VIDEO_FORMAT_I420_12BE", "72"),
("GST_VIDEO_FORMAT_I420_12LE", "73"),
("GST_VIDEO_FORMAT_I422_10BE", "44"),
("GST_VIDEO_FORMAT_I422_10LE", "45"),
("GST_VIDEO_FORMAT_I422_12BE", "74"),
("GST_VIDEO_FORMAT_I422_12LE", "75"),
("GST_VIDEO_FORMAT_IYU1", "38"),
("GST_VIDEO_FORMAT_IYU2", "63"),
("GST_VIDEO_FORMAT_NV12", "23"),
("GST_VIDEO_FORMAT_NV12_10LE32", "79"),
("GST_VIDEO_FORMAT_NV12_64Z32", "53"),
("GST_VIDEO_FORMAT_NV16", "51"),
("GST_VIDEO_FORMAT_NV16_10LE32", "80"),
("GST_VIDEO_FORMAT_NV21", "24"),
("GST_VIDEO_FORMAT_NV24", "52"),
("GST_VIDEO_FORMAT_NV61", "60"),
("GST_VIDEO_FORMAT_P010_10BE", "61"),
("GST_VIDEO_FORMAT_P010_10LE", "62"),
("GST_VIDEO_FORMAT_RGB", "15"),
("GST_VIDEO_FORMAT_RGB15", "31"),
("GST_VIDEO_FORMAT_RGB16", "29"),
("GST_VIDEO_FORMAT_RGB8P", "35"),
("GST_VIDEO_FORMAT_RGBA", "11"),
("GST_VIDEO_FORMAT_RGBx", "7"),
("GST_VIDEO_FORMAT_UNKNOWN", "0"),
("GST_VIDEO_FORMAT_UYVP", "33"),
("GST_VIDEO_FORMAT_UYVY", "5"),
("GST_VIDEO_FORMAT_VYUY", "64"),
("GST_VIDEO_FORMAT_Y41B", "17"),
("GST_VIDEO_FORMAT_Y42B", "18"),
("GST_VIDEO_FORMAT_Y444", "20"),
("GST_VIDEO_FORMAT_Y444_10BE", "46"),
("GST_VIDEO_FORMAT_Y444_10LE", "47"),
("GST_VIDEO_FORMAT_Y444_12BE", "76"),
("GST_VIDEO_FORMAT_Y444_12LE", "77"),
("GST_VIDEO_FORMAT_YUV9", "36"),
("GST_VIDEO_FORMAT_YUY2", "4"),
("GST_VIDEO_FORMAT_YV12", "3"),
("GST_VIDEO_FORMAT_YVU9", "37"),
("GST_VIDEO_FORMAT_YVYU", "19"),
("GST_VIDEO_FORMAT_r210", "41"),
("GST_VIDEO_FORMAT_v210", "21"),
("GST_VIDEO_FORMAT_v216", "22"),
("GST_VIDEO_FORMAT_v308", "28"),
("GST_VIDEO_FORMAT_xBGR", "10"),
("GST_VIDEO_FORMAT_xRGB", "9"),
("GST_VIDEO_FPS_RANGE", "(fraction) [ 0, max ]"),
("GST_VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE", "32"),
("GST_VIDEO_FRAME_FLAG_INTERLACED", "1"),
("GST_VIDEO_FRAME_FLAG_MULTIPLE_VIEW", "16"),
("GST_VIDEO_FRAME_FLAG_NONE", "0"),
("GST_VIDEO_FRAME_FLAG_ONEFIELD", "8"),
("GST_VIDEO_FRAME_FLAG_RFF", "4"),
("GST_VIDEO_FRAME_FLAG_TFF", "2"),
("GST_VIDEO_FRAME_MAP_FLAG_LAST", "16777216"),
("GST_VIDEO_FRAME_MAP_FLAG_NO_REF", "65536"),
("GST_VIDEO_GAMMA_MODE_NONE", "0"),
("GST_VIDEO_GAMMA_MODE_REMAP", "1"),
("GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_FLIP", "3"),
("GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_NORMAL", "2"),
("GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP", "1"),
("GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL", "0"),
("GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE", "0"),
("GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA", "1"),
("GST_VIDEO_GL_TEXTURE_TYPE_R", "5"),
("GST_VIDEO_GL_TEXTURE_TYPE_RG", "6"),
("GST_VIDEO_GL_TEXTURE_TYPE_RGB", "3"),
("GST_VIDEO_GL_TEXTURE_TYPE_RGB16", "2"),
("GST_VIDEO_GL_TEXTURE_TYPE_RGBA", "4"),
("GST_VIDEO_INTERLACE_MODE_FIELDS", "3"),
("GST_VIDEO_INTERLACE_MODE_INTERLEAVED", "1"),
("GST_VIDEO_INTERLACE_MODE_MIXED", "2"),
("GST_VIDEO_INTERLACE_MODE_PROGRESSIVE", "0"),
("GST_VIDEO_MATRIX_MODE_FULL", "0"),
("GST_VIDEO_MATRIX_MODE_INPUT_ONLY", "1"),
("GST_VIDEO_MATRIX_MODE_NONE", "3"),
("GST_VIDEO_MATRIX_MODE_OUTPUT_ONLY", "2"),
("GST_VIDEO_MAX_COMPONENTS", "4"),
("GST_VIDEO_MAX_PLANES", "4"),
("GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT", "16384"),
("GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED", "2"),
("GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED", "4"),
("GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO", "32768"),
("GST_VIDEO_MULTIVIEW_FLAGS_NONE", "0"),
("GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED", "8"),
("GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED", "16"),
("GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST", "1"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD", "8"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED", "5"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT", "1"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO", "0"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE", "-1"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT", "2"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED", "6"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE", "3"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX", "4"),
("GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM", "7"),
("GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD", "8"),
("GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED", "5"),
("GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME", "32"),
("GST_VIDEO_MULTIVIEW_MODE_LEFT", "1"),
("GST_VIDEO_MULTIVIEW_MODE_MONO", "0"),
("GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME", "33"),
("GST_VIDEO_MULTIVIEW_MODE_NONE", "-1"),
("GST_VIDEO_MULTIVIEW_MODE_RIGHT", "2"),
("GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED", "6"),
("GST_VIDEO_MULTIVIEW_MODE_SEPARATED", "34"),
("GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE", "3"),
("GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX", "4"),
("GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM", "7"),
("GST_VIDEO_ORIENTATION_180", "2"),
("GST_VIDEO_ORIENTATION_90L", "3"),
("GST_VIDEO_ORIENTATION_90R", "1"),
("GST_VIDEO_ORIENTATION_AUTO", "8"),
("GST_VIDEO_ORIENTATION_CUSTOM", "9"),
("GST_VIDEO_ORIENTATION_HORIZ", "4"),
("GST_VIDEO_ORIENTATION_IDENTITY", "0"),
("GST_VIDEO_ORIENTATION_UL_LR", "6"),
("GST_VIDEO_ORIENTATION_UR_LL", "7"),
("GST_VIDEO_ORIENTATION_VERT", "5"),
("GST_VIDEO_OVERLAY_COMPOSITION_BLEND_FORMATS", "{ BGRx, RGBx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, RGB, BGR, I420, YV12, AYUV, YUY2, UYVY, v308, Y41B, Y42B, Y444, NV12, NV21, A420, YUV9, YVU9, IYU1, GRAY8 }"),
("GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA", "2"),
("GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE", "0"),
("GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA", "1"),
("GST_VIDEO_PACK_FLAG_INTERLACED", "2"),
("GST_VIDEO_PACK_FLAG_NONE", "0"),
("GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE", "1"),
("GST_VIDEO_PRIMARIES_MODE_FAST", "2"),
("GST_VIDEO_PRIMARIES_MODE_MERGE_ONLY", "1"),
("GST_VIDEO_PRIMARIES_MODE_NONE", "0"),
("GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS", "1"),
("GST_VIDEO_RESAMPLER_FLAG_NONE", "0"),
("GST_VIDEO_RESAMPLER_METHOD_CUBIC", "2"),
("GST_VIDEO_RESAMPLER_METHOD_LANCZOS", "4"),
("GST_VIDEO_RESAMPLER_METHOD_LINEAR", "1"),
("GST_VIDEO_RESAMPLER_METHOD_NEAREST", "0"),
("GST_VIDEO_RESAMPLER_METHOD_SINC", "3"),
("GST_VIDEO_RESAMPLER_OPT_CUBIC_B", "GstVideoResampler.cubic-b"),
("GST_VIDEO_RESAMPLER_OPT_CUBIC_C", "GstVideoResampler.cubic-c"),
("GST_VIDEO_RESAMPLER_OPT_ENVELOPE", "GstVideoResampler.envelope"),
("GST_VIDEO_RESAMPLER_OPT_MAX_TAPS", "GstVideoResampler.max-taps"),
("GST_VIDEO_RESAMPLER_OPT_SHARPEN", "GstVideoResampler.sharpen"),
("GST_VIDEO_RESAMPLER_OPT_SHARPNESS", "GstVideoResampler.sharpness"),
("GST_VIDEO_SCALER_FLAG_INTERLACED", "1"),
("GST_VIDEO_SCALER_FLAG_NONE", "0"),
("GST_VIDEO_SCALER_OPT_DITHER_METHOD", "GstVideoScaler.dither-method"),
("GST_VIDEO_SIZE_RANGE", "(int) [ 1, max ]"),
("GST_VIDEO_TILE_MODE_UNKNOWN", "0"),
("GST_VIDEO_TILE_MODE_ZFLIPZ_2X2", "65536"),
("GST_VIDEO_TILE_TYPE_INDEXED", "0"),
("GST_VIDEO_TILE_TYPE_MASK", "65535"),
("GST_VIDEO_TILE_TYPE_SHIFT", "16"),
("GST_VIDEO_TILE_X_TILES_MASK", "65535"),
("GST_VIDEO_TILE_Y_TILES_SHIFT", "16"),
("GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME", "1"),
("GST_VIDEO_TIME_CODE_FLAGS_INTERLACED", "2"),
("GST_VIDEO_TIME_CODE_FLAGS_NONE", "0"),
("GST_VIDEO_TRANSFER_ADOBERGB", "12"),
("GST_VIDEO_TRANSFER_BT2020_12", "11"),
("GST_VIDEO_TRANSFER_BT709", "5"),
("GST_VIDEO_TRANSFER_GAMMA10", "1"),
("GST_VIDEO_TRANSFER_GAMMA18", "2"),
("GST_VIDEO_TRANSFER_GAMMA20", "3"),
("GST_VIDEO_TRANSFER_GAMMA22", "4"),
("GST_VIDEO_TRANSFER_GAMMA28", "8"),
("GST_VIDEO_TRANSFER_LOG100", "9"),
("GST_VIDEO_TRANSFER_LOG316", "10"),
("GST_VIDEO_TRANSFER_SMPTE240M", "6"),
("GST_VIDEO_TRANSFER_SRGB", "7"),
("GST_VIDEO_TRANSFER_UNKNOWN", "0"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/video/video.h>

View file

@ -12,6 +12,10 @@ path = "../gstreamer-sys"
[dependencies.gstreamer-sdp-sys]
path = "../gstreamer-sdp-sys"
[dev-dependencies]
shell-words = "0.1.0"
tempdir = "0.3"
[features]
dox = []

View file

@ -1,4 +1,4 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ fe7a6ff)
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT

View file

@ -0,0 +1,319 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
extern crate gstreamer_webrtc_sys;
extern crate shell_words;
extern crate tempdir;
use std::env;
use std::error::Error;
use std::path::Path;
use std::mem::{align_of, size_of};
use std::process::Command;
use std::str;
use gstreamer_webrtc_sys::*;
static PACKAGES: &[&str] = &["gstreamer-webrtc-1.0"];
#[derive(Clone, Debug)]
struct Compiler {
pub args: Vec<String>,
}
impl Compiler {
pub fn new() -> Result<Compiler, Box<Error>> {
let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned());
// For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?);
args.extend(get_var("CPPFLAGS", "")?);
args.extend(pkg_config_cflags(PACKAGES)?);
Ok(Compiler { args })
}
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) {
let arg = match val.into() {
None => format!("-D{}", var),
Some(val) => format!("-D{}={}", var, val),
};
self.args.push(arg);
}
pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<Error>> {
let mut cmd = self.to_command();
cmd.arg(src);
cmd.arg("-o");
cmd.arg(out);
let status = cmd.spawn()?.wait()?;
if !status.success() {
return Err(format!("compilation command {:?} failed, {}",
&cmd, status).into());
}
Ok(())
}
fn to_command(&self) -> Command {
let mut cmd = Command::new(&self.args[0]);
cmd.args(&self.args[1..]);
cmd
}
}
fn get_var(name: &str, default: &str) -> Result<Vec<String>, Box<Error>> {
match env::var(name) {
Ok(value) => Ok(shell_words::split(&value)?),
Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?),
Err(err) => Err(format!("{} {}", name, err).into()),
}
}
fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<Error>> {
if packages.is_empty() {
return Ok(Vec::new());
}
let mut cmd = Command::new("pkg-config");
cmd.arg("--cflags");
cmd.args(packages);
let out = cmd.output()?;
if !out.status.success() {
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,
alignment: usize,
}
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)]
struct Results {
/// Number of successfully completed tests.
passed: usize,
/// Total number of failed tests (including those that failed to compile).
failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
}
impl Results {
fn record_passed(&mut self) {
self.passed += 1;
}
fn record_failed(&mut self) {
self.failed += 1;
}
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String {
format!(
"{} passed; {} failed (compilation errors: {})",
self.passed,
self.failed,
self.failed_to_compile)
}
fn expect_total_success(&self) {
if self.failed == 0 {
println!("OK: {}", self.summary());
} else {
panic!("FAILED: {}", self.summary());
};
}
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("constants ... {}", results.summary());
}
}
results.expect_total_success();
}
#[test]
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");
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);
}
}
};
if (i + 1) % 25 == 0 {
println!("layout ... {}", results.summary());
}
}
results.expect_total_success();
}
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<Error>> {
let exe = dir.join("layout");
let mut cc = cc.clone();
cc.define("ABI_TYPE_NAME", name);
cc.compile(Path::new("tests/layout.c"), &exe)?;
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());
}
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})
}
fn get_c_value(dir: &Path, cc: &Compiler, name: &str) -> Result<String, Box<Error>> {
let exe = dir.join("constant");
let mut cc = cc.clone();
cc.define("ABI_CONSTANT_NAME", name);
cc.compile(Path::new("tests/constant.c"), &exe)?;
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());
}
Ok(str::from_utf8(&output.stdout)?.trim().to_owned())
}
const RUST_LAYOUTS: &[(&str, Layout)] = &[
("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>()}),
("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>()}),
("GstWebRTCPeerConnectionState", Layout {size: size_of::<GstWebRTCPeerConnectionState>(), alignment: align_of::<GstWebRTCPeerConnectionState>()}),
("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>()}),
("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)] = &[
("GST_WEBRTC_DTLS_SETUP_ACTIVE", "2"),
("GST_WEBRTC_DTLS_SETUP_ACTPASS", "1"),
("GST_WEBRTC_DTLS_SETUP_NONE", "0"),
("GST_WEBRTC_DTLS_SETUP_PASSIVE", "3"),
("GST_WEBRTC_DTLS_TRANSPORT_STATE_CLOSED", "1"),
("GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTED", "4"),
("GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTING", "3"),
("GST_WEBRTC_DTLS_TRANSPORT_STATE_FAILED", "2"),
("GST_WEBRTC_DTLS_TRANSPORT_STATE_NEW", "0"),
("GST_WEBRTC_ICE_COMPONENT_RTCP", "1"),
("GST_WEBRTC_ICE_COMPONENT_RTP", "0"),
("GST_WEBRTC_ICE_CONNECTION_STATE_CHECKING", "1"),
("GST_WEBRTC_ICE_CONNECTION_STATE_CLOSED", "6"),
("GST_WEBRTC_ICE_CONNECTION_STATE_COMPLETED", "3"),
("GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED", "2"),
("GST_WEBRTC_ICE_CONNECTION_STATE_DISCONNECTED", "5"),
("GST_WEBRTC_ICE_CONNECTION_STATE_FAILED", "4"),
("GST_WEBRTC_ICE_CONNECTION_STATE_NEW", "0"),
("GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE", "2"),
("GST_WEBRTC_ICE_GATHERING_STATE_GATHERING", "1"),
("GST_WEBRTC_ICE_GATHERING_STATE_NEW", "0"),
("GST_WEBRTC_ICE_ROLE_CONTROLLED", "0"),
("GST_WEBRTC_ICE_ROLE_CONTROLLING", "1"),
("GST_WEBRTC_PEER_CONNECTION_STATE_CLOSED", "5"),
("GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTED", "2"),
("GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING", "1"),
("GST_WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED", "3"),
("GST_WEBRTC_PEER_CONNECTION_STATE_FAILED", "4"),
("GST_WEBRTC_PEER_CONNECTION_STATE_NEW", "0"),
("GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE", "1"),
("GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE", "0"),
("GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY", "3"),
("GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY", "2"),
("GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV", "4"),
("GST_WEBRTC_SDP_TYPE_ANSWER", "3"),
("GST_WEBRTC_SDP_TYPE_OFFER", "1"),
("GST_WEBRTC_SDP_TYPE_PRANSWER", "2"),
("GST_WEBRTC_SDP_TYPE_ROLLBACK", "4"),
("GST_WEBRTC_SIGNALING_STATE_CLOSED", "1"),
("GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER", "2"),
("GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER", "4"),
("GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER", "3"),
("GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER", "5"),
("GST_WEBRTC_SIGNALING_STATE_STABLE", "0"),
("GST_WEBRTC_STATS_CANDIDATE_PAIR", "11"),
("GST_WEBRTC_STATS_CERTIFICATE", "14"),
("GST_WEBRTC_STATS_CODEC", "1"),
("GST_WEBRTC_STATS_CSRC", "6"),
("GST_WEBRTC_STATS_DATA_CHANNEL", "8"),
("GST_WEBRTC_STATS_INBOUND_RTP", "2"),
("GST_WEBRTC_STATS_LOCAL_CANDIDATE", "12"),
("GST_WEBRTC_STATS_OUTBOUND_RTP", "3"),
("GST_WEBRTC_STATS_PEER_CONNECTION", "7"),
("GST_WEBRTC_STATS_REMOTE_CANDIDATE", "13"),
("GST_WEBRTC_STATS_REMOTE_INBOUND_RTP", "4"),
("GST_WEBRTC_STATS_REMOTE_OUTBOUND_RTP", "5"),
("GST_WEBRTC_STATS_STREAM", "9"),
("GST_WEBRTC_STATS_TRANSPORT", "10"),
];

View file

@ -0,0 +1,27 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdio.h>
int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "%s",
const char *: "%s",
char: "%c",
signed char: "%hhd",
unsigned char: "%hhu",
short int: "%hd",
unsigned short int: "%hu",
int: "%d",
unsigned int: "%u",
long: "%ld",
unsigned long: "%lu",
long long: "%lld",
unsigned long long: "%llu",
double: "%f",
long double: "%ld"),
ABI_CONSTANT_NAME);
return 0;
}

View file

@ -0,0 +1,12 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ 6855214)
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
// DO NOT EDIT
#include "manual.h"
#include <stdalign.h>
#include <stdio.h>
int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME));
return 0;
}

View file

@ -0,0 +1,3 @@
// Feel free to edit this file, it won't be regenerated by gir generator unless removed.
#include <gst/webrtc/webrtc.h>