Regenerate everything with latest gir

This commit is contained in:
Sebastian Dröge 2021-02-07 17:07:17 +02:00
parent 31b68201a5
commit 9d86cef2da
130 changed files with 6253 additions and 3340 deletions

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_app_sys::*; use gstreamer_app_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,34 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GST_APP_STREAM_TYPE_RANDOM_ACCESS);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_APP_STREAM_TYPE_SEEKABLE);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_APP_STREAM_TYPE_STREAM);
char: "###gir test###%c###gir test###\n",
signed char: "###gir test###%hhd###gir test###\n",
unsigned char: "###gir test###%hhu###gir test###\n",
short int: "###gir test###%hd###gir test###\n",
unsigned short int: "###gir test###%hu###gir test###\n",
int: "###gir test###%d###gir test###\n",
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,12 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstAppSink", sizeof(GstAppSink), alignof(GstAppSink));
printf("%s;%zu;%zu\n", "GstAppSinkCallbacks", sizeof(GstAppSinkCallbacks), alignof(GstAppSinkCallbacks));
printf("%s;%zu;%zu\n", "GstAppSinkClass", sizeof(GstAppSinkClass), alignof(GstAppSinkClass));
printf("%s;%zu;%zu\n", "GstAppSrc", sizeof(GstAppSrc), alignof(GstAppSrc));
printf("%s;%zu;%zu\n", "GstAppSrcCallbacks", sizeof(GstAppSrcCallbacks), alignof(GstAppSrcCallbacks));
printf("%s;%zu;%zu\n", "GstAppSrcClass", sizeof(GstAppSrcClass), alignof(GstAppSrcClass));
printf("%s;%zu;%zu\n", "GstAppStreamType", sizeof(GstAppStreamType), alignof(GstAppStreamType));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_audio_sys::*; use gstreamer_audio_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,223 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_ALIGNMENT);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_DEVICE_FAILURE);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_FLUSH);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_NEW_CAPS);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_NO_DISCONT);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_SYNC_LATENCY);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_CUSTOM);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_NONE);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_SKEW);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_NONE);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_RE_TIMESTAMP);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_SKEW);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_CD_SRC_MODE_CONTINUOUS);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT((gint) GST_AUDIO_CD_SRC_MODE_NORMAL);
ABI_CONSTANT_NAME); PRINT_CONSTANT(GST_AUDIO_CHANNELS_RANGE);
PRINT_CONSTANT((guint) GST_AUDIO_CHANNEL_MIXER_FLAGS_NONE);
PRINT_CONSTANT((guint) GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_IN);
PRINT_CONSTANT((guint) GST_AUDIO_CHANNEL_MIXER_FLAGS_NON_INTERLEAVED_OUT);
PRINT_CONSTANT((guint) GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_IN);
PRINT_CONSTANT((guint) GST_AUDIO_CHANNEL_MIXER_FLAGS_UNPOSITIONED_OUT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_INVALID);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_LFE1);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_LFE2);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_MONO);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_NONE);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_REAR_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_REAR_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT);
PRINT_CONSTANT((gint) GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT);
PRINT_CONSTANT((guint) GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE);
PRINT_CONSTANT((guint) GST_AUDIO_CONVERTER_FLAG_NONE);
PRINT_CONSTANT((guint) GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE);
PRINT_CONSTANT(GST_AUDIO_CONVERTER_OPT_DITHER_METHOD);
PRINT_CONSTANT(GST_AUDIO_CONVERTER_OPT_MIX_MATRIX);
PRINT_CONSTANT(GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD);
PRINT_CONSTANT(GST_AUDIO_CONVERTER_OPT_QUANTIZATION);
PRINT_CONSTANT(GST_AUDIO_CONVERTER_OPT_RESAMPLER_METHOD);
PRINT_CONSTANT(GST_AUDIO_DECODER_MAX_ERRORS);
PRINT_CONSTANT(GST_AUDIO_DECODER_SINK_NAME);
PRINT_CONSTANT(GST_AUDIO_DECODER_SRC_NAME);
PRINT_CONSTANT(GST_AUDIO_DEF_CHANNELS);
PRINT_CONSTANT(GST_AUDIO_DEF_FORMAT);
PRINT_CONSTANT(GST_AUDIO_DEF_RATE);
PRINT_CONSTANT((gint) GST_AUDIO_DITHER_NONE);
PRINT_CONSTANT((gint) GST_AUDIO_DITHER_RPDF);
PRINT_CONSTANT((gint) GST_AUDIO_DITHER_TPDF);
PRINT_CONSTANT((gint) GST_AUDIO_DITHER_TPDF_HF);
PRINT_CONSTANT(GST_AUDIO_ENCODER_SINK_NAME);
PRINT_CONSTANT(GST_AUDIO_ENCODER_SRC_NAME);
PRINT_CONSTANT((guint) GST_AUDIO_FLAG_NONE);
PRINT_CONSTANT((guint) GST_AUDIO_FLAG_UNPOSITIONED);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_ENCODED);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_F32);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_F32BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_F32LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_F64);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_F64BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_F64LE);
PRINT_CONSTANT((guint) GST_AUDIO_FORMAT_FLAG_COMPLEX);
PRINT_CONSTANT((guint) GST_AUDIO_FORMAT_FLAG_FLOAT);
PRINT_CONSTANT((guint) GST_AUDIO_FORMAT_FLAG_INTEGER);
PRINT_CONSTANT((guint) GST_AUDIO_FORMAT_FLAG_SIGNED);
PRINT_CONSTANT((guint) GST_AUDIO_FORMAT_FLAG_UNPACK);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S16);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S16BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S16LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S18);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S18BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S18LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S20);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S20BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S20LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S24);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S24BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S24LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S24_32);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S24_32BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S24_32LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S32);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S32BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S32LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_S8);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U16);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U16BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U16LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U18);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U18BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U18LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U20);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U20BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U20LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U24);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U24BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U24LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U24_32);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U24_32BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U24_32LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U32);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U32BE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U32LE);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_U8);
PRINT_CONSTANT((gint) GST_AUDIO_FORMAT_UNKNOWN);
PRINT_CONSTANT((gint) GST_AUDIO_LAYOUT_INTERLEAVED);
PRINT_CONSTANT((gint) GST_AUDIO_LAYOUT_NON_INTERLEAVED);
PRINT_CONSTANT((gint) GST_AUDIO_NOISE_SHAPING_ERROR_FEEDBACK);
PRINT_CONSTANT((gint) GST_AUDIO_NOISE_SHAPING_HIGH);
PRINT_CONSTANT((gint) GST_AUDIO_NOISE_SHAPING_MEDIUM);
PRINT_CONSTANT((gint) GST_AUDIO_NOISE_SHAPING_NONE);
PRINT_CONSTANT((gint) GST_AUDIO_NOISE_SHAPING_SIMPLE);
PRINT_CONSTANT((guint) GST_AUDIO_PACK_FLAG_NONE);
PRINT_CONSTANT((guint) GST_AUDIO_PACK_FLAG_TRUNCATE_RANGE);
PRINT_CONSTANT((guint) GST_AUDIO_QUANTIZE_FLAG_NONE);
PRINT_CONSTANT((guint) GST_AUDIO_QUANTIZE_FLAG_NON_INTERLEAVED);
PRINT_CONSTANT(GST_AUDIO_RATE_RANGE);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_CUBIC);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_LINEAR);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_FILTER_INTERPOLATION_NONE);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_FILTER_MODE_FULL);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_FILTER_MODE_INTERPOLATED);
PRINT_CONSTANT((guint) GST_AUDIO_RESAMPLER_FLAG_NONE);
PRINT_CONSTANT((guint) GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN);
PRINT_CONSTANT((guint) GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT);
PRINT_CONSTANT((guint) GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_METHOD_BLACKMAN_NUTTALL);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_METHOD_CUBIC);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_METHOD_KAISER);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_METHOD_LINEAR);
PRINT_CONSTANT((gint) GST_AUDIO_RESAMPLER_METHOD_NEAREST);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_CUBIC_B);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_CUBIC_C);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_CUTOFF);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_FILTER_INTERPOLATION);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_FILTER_MODE);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_FILTER_MODE_THRESHOLD);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_FILTER_OVERSAMPLE);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_MAX_PHASE_ERROR);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_N_TAPS);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_STOP_ATTENUATION);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_OPT_TRANSITION_BANDWIDTH);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_QUALITY_DEFAULT);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_QUALITY_MAX);
PRINT_CONSTANT(GST_AUDIO_RESAMPLER_QUALITY_MIN);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_A_LAW);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_EAC3);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_FLAC);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_GSM);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IMA_ADPCM);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG2_AAC_RAW);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MPEG4_AAC_RAW);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_MU_LAW);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_STATE_ERROR);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_STATE_PAUSED);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_STATE_STARTED);
PRINT_CONSTANT((gint) GST_AUDIO_RING_BUFFER_STATE_STOPPED);
PRINT_CONSTANT(GST_META_TAG_AUDIO_CHANNELS_STR);
PRINT_CONSTANT(GST_META_TAG_AUDIO_RATE_STR);
PRINT_CONSTANT(GST_META_TAG_AUDIO_STR);
PRINT_CONSTANT((gint) GST_STREAM_VOLUME_FORMAT_CUBIC);
PRINT_CONSTANT((gint) GST_STREAM_VOLUME_FORMAT_DB);
PRINT_CONSTANT((gint) GST_STREAM_VOLUME_FORMAT_LINEAR);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,63 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstAudioAggregator", sizeof(GstAudioAggregator), alignof(GstAudioAggregator));
printf("%s;%zu;%zu\n", "GstAudioAggregatorClass", sizeof(GstAudioAggregatorClass), alignof(GstAudioAggregatorClass));
printf("%s;%zu;%zu\n", "GstAudioAggregatorConvertPad", sizeof(GstAudioAggregatorConvertPad), alignof(GstAudioAggregatorConvertPad));
printf("%s;%zu;%zu\n", "GstAudioAggregatorConvertPadClass", sizeof(GstAudioAggregatorConvertPadClass), alignof(GstAudioAggregatorConvertPadClass));
printf("%s;%zu;%zu\n", "GstAudioAggregatorPad", sizeof(GstAudioAggregatorPad), alignof(GstAudioAggregatorPad));
printf("%s;%zu;%zu\n", "GstAudioAggregatorPadClass", sizeof(GstAudioAggregatorPadClass), alignof(GstAudioAggregatorPadClass));
printf("%s;%zu;%zu\n", "GstAudioBaseSink", sizeof(GstAudioBaseSink), alignof(GstAudioBaseSink));
printf("%s;%zu;%zu\n", "GstAudioBaseSinkClass", sizeof(GstAudioBaseSinkClass), alignof(GstAudioBaseSinkClass));
printf("%s;%zu;%zu\n", "GstAudioBaseSinkDiscontReason", sizeof(GstAudioBaseSinkDiscontReason), alignof(GstAudioBaseSinkDiscontReason));
printf("%s;%zu;%zu\n", "GstAudioBaseSinkSlaveMethod", sizeof(GstAudioBaseSinkSlaveMethod), alignof(GstAudioBaseSinkSlaveMethod));
printf("%s;%zu;%zu\n", "GstAudioBaseSrc", sizeof(GstAudioBaseSrc), alignof(GstAudioBaseSrc));
printf("%s;%zu;%zu\n", "GstAudioBaseSrcClass", sizeof(GstAudioBaseSrcClass), alignof(GstAudioBaseSrcClass));
printf("%s;%zu;%zu\n", "GstAudioBaseSrcSlaveMethod", sizeof(GstAudioBaseSrcSlaveMethod), alignof(GstAudioBaseSrcSlaveMethod));
printf("%s;%zu;%zu\n", "GstAudioBuffer", sizeof(GstAudioBuffer), alignof(GstAudioBuffer));
printf("%s;%zu;%zu\n", "GstAudioCdSrc", sizeof(GstAudioCdSrc), alignof(GstAudioCdSrc));
printf("%s;%zu;%zu\n", "GstAudioCdSrcClass", sizeof(GstAudioCdSrcClass), alignof(GstAudioCdSrcClass));
printf("%s;%zu;%zu\n", "GstAudioCdSrcMode", sizeof(GstAudioCdSrcMode), alignof(GstAudioCdSrcMode));
printf("%s;%zu;%zu\n", "GstAudioCdSrcTrack", sizeof(GstAudioCdSrcTrack), alignof(GstAudioCdSrcTrack));
printf("%s;%zu;%zu\n", "GstAudioChannelMixerFlags", sizeof(GstAudioChannelMixerFlags), alignof(GstAudioChannelMixerFlags));
printf("%s;%zu;%zu\n", "GstAudioChannelPosition", sizeof(GstAudioChannelPosition), alignof(GstAudioChannelPosition));
printf("%s;%zu;%zu\n", "GstAudioClippingMeta", sizeof(GstAudioClippingMeta), alignof(GstAudioClippingMeta));
printf("%s;%zu;%zu\n", "GstAudioClock", sizeof(GstAudioClock), alignof(GstAudioClock));
printf("%s;%zu;%zu\n", "GstAudioClockClass", sizeof(GstAudioClockClass), alignof(GstAudioClockClass));
printf("%s;%zu;%zu\n", "GstAudioConverterFlags", sizeof(GstAudioConverterFlags), alignof(GstAudioConverterFlags));
printf("%s;%zu;%zu\n", "GstAudioDecoder", sizeof(GstAudioDecoder), alignof(GstAudioDecoder));
printf("%s;%zu;%zu\n", "GstAudioDecoderClass", sizeof(GstAudioDecoderClass), alignof(GstAudioDecoderClass));
printf("%s;%zu;%zu\n", "GstAudioDitherMethod", sizeof(GstAudioDitherMethod), alignof(GstAudioDitherMethod));
printf("%s;%zu;%zu\n", "GstAudioDownmixMeta", sizeof(GstAudioDownmixMeta), alignof(GstAudioDownmixMeta));
printf("%s;%zu;%zu\n", "GstAudioEncoder", sizeof(GstAudioEncoder), alignof(GstAudioEncoder));
printf("%s;%zu;%zu\n", "GstAudioEncoderClass", sizeof(GstAudioEncoderClass), alignof(GstAudioEncoderClass));
printf("%s;%zu;%zu\n", "GstAudioFilter", sizeof(GstAudioFilter), alignof(GstAudioFilter));
printf("%s;%zu;%zu\n", "GstAudioFilterClass", sizeof(GstAudioFilterClass), alignof(GstAudioFilterClass));
printf("%s;%zu;%zu\n", "GstAudioFlags", sizeof(GstAudioFlags), alignof(GstAudioFlags));
printf("%s;%zu;%zu\n", "GstAudioFormat", sizeof(GstAudioFormat), alignof(GstAudioFormat));
printf("%s;%zu;%zu\n", "GstAudioFormatFlags", sizeof(GstAudioFormatFlags), alignof(GstAudioFormatFlags));
printf("%s;%zu;%zu\n", "GstAudioFormatInfo", sizeof(GstAudioFormatInfo), alignof(GstAudioFormatInfo));
printf("%s;%zu;%zu\n", "GstAudioInfo", sizeof(GstAudioInfo), alignof(GstAudioInfo));
printf("%s;%zu;%zu\n", "GstAudioLayout", sizeof(GstAudioLayout), alignof(GstAudioLayout));
printf("%s;%zu;%zu\n", "GstAudioMeta", sizeof(GstAudioMeta), alignof(GstAudioMeta));
printf("%s;%zu;%zu\n", "GstAudioNoiseShapingMethod", sizeof(GstAudioNoiseShapingMethod), alignof(GstAudioNoiseShapingMethod));
printf("%s;%zu;%zu\n", "GstAudioPackFlags", sizeof(GstAudioPackFlags), alignof(GstAudioPackFlags));
printf("%s;%zu;%zu\n", "GstAudioQuantizeFlags", sizeof(GstAudioQuantizeFlags), alignof(GstAudioQuantizeFlags));
printf("%s;%zu;%zu\n", "GstAudioResamplerFilterInterpolation", sizeof(GstAudioResamplerFilterInterpolation), alignof(GstAudioResamplerFilterInterpolation));
printf("%s;%zu;%zu\n", "GstAudioResamplerFilterMode", sizeof(GstAudioResamplerFilterMode), alignof(GstAudioResamplerFilterMode));
printf("%s;%zu;%zu\n", "GstAudioResamplerFlags", sizeof(GstAudioResamplerFlags), alignof(GstAudioResamplerFlags));
printf("%s;%zu;%zu\n", "GstAudioResamplerMethod", sizeof(GstAudioResamplerMethod), alignof(GstAudioResamplerMethod));
printf("%s;%zu;%zu\n", "GstAudioRingBuffer", sizeof(GstAudioRingBuffer), alignof(GstAudioRingBuffer));
printf("%s;%zu;%zu\n", "GstAudioRingBufferClass", sizeof(GstAudioRingBufferClass), alignof(GstAudioRingBufferClass));
printf("%s;%zu;%zu\n", "GstAudioRingBufferFormatType", sizeof(GstAudioRingBufferFormatType), alignof(GstAudioRingBufferFormatType));
printf("%s;%zu;%zu\n", "GstAudioRingBufferSpec", sizeof(GstAudioRingBufferSpec), alignof(GstAudioRingBufferSpec));
printf("%s;%zu;%zu\n", "GstAudioRingBufferState", sizeof(GstAudioRingBufferState), alignof(GstAudioRingBufferState));
printf("%s;%zu;%zu\n", "GstAudioSink", sizeof(GstAudioSink), alignof(GstAudioSink));
printf("%s;%zu;%zu\n", "GstAudioSinkClass", sizeof(GstAudioSinkClass), alignof(GstAudioSinkClass));
printf("%s;%zu;%zu\n", "GstAudioSinkClassExtension", sizeof(GstAudioSinkClassExtension), alignof(GstAudioSinkClassExtension));
printf("%s;%zu;%zu\n", "GstAudioSrc", sizeof(GstAudioSrc), alignof(GstAudioSrc));
printf("%s;%zu;%zu\n", "GstAudioSrcClass", sizeof(GstAudioSrcClass), alignof(GstAudioSrcClass));
printf("%s;%zu;%zu\n", "GstStreamVolumeFormat", sizeof(GstStreamVolumeFormat), alignof(GstStreamVolumeFormat));
printf("%s;%zu;%zu\n", "GstStreamVolumeInterface", sizeof(GstStreamVolumeInterface), alignof(GstStreamVolumeInterface));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_base_sys::*; use gstreamer_base_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,52 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GST_AGGREGATOR_START_TIME_SELECTION_FIRST);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_AGGREGATOR_START_TIME_SELECTION_SET);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_AGGREGATOR_START_TIME_SELECTION_ZERO);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT(GST_BASE_PARSE_FLAG_DRAINING);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT(GST_BASE_PARSE_FLAG_LOST_SYNC);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_CLIP);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_DROP);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_NONE);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_NO_FRAME);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_QUEUE);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_SRC_FLAG_LAST);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_SRC_FLAG_STARTED);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((guint) GST_BASE_SRC_FLAG_STARTING);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT(GST_BASE_TRANSFORM_SINK_NAME);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT(GST_BASE_TRANSFORM_SRC_NAME);
ABI_CONSTANT_NAME); PRINT_CONSTANT((guint) GST_COLLECT_PADS_STATE_EOS);
PRINT_CONSTANT((guint) GST_COLLECT_PADS_STATE_FLUSHING);
PRINT_CONSTANT((guint) GST_COLLECT_PADS_STATE_LOCKED);
PRINT_CONSTANT((guint) GST_COLLECT_PADS_STATE_NEW_SEGMENT);
PRINT_CONSTANT((guint) GST_COLLECT_PADS_STATE_WAITING);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,35 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstAggregator", sizeof(GstAggregator), alignof(GstAggregator));
printf("%s;%zu;%zu\n", "GstAggregatorClass", sizeof(GstAggregatorClass), alignof(GstAggregatorClass));
printf("%s;%zu;%zu\n", "GstAggregatorPad", sizeof(GstAggregatorPad), alignof(GstAggregatorPad));
printf("%s;%zu;%zu\n", "GstAggregatorPadClass", sizeof(GstAggregatorPadClass), alignof(GstAggregatorPadClass));
printf("%s;%zu;%zu\n", "GstAggregatorStartTimeSelection", sizeof(GstAggregatorStartTimeSelection), alignof(GstAggregatorStartTimeSelection));
printf("%s;%zu;%zu\n", "GstBaseParse", sizeof(GstBaseParse), alignof(GstBaseParse));
printf("%s;%zu;%zu\n", "GstBaseParseClass", sizeof(GstBaseParseClass), alignof(GstBaseParseClass));
printf("%s;%zu;%zu\n", "GstBaseParseFrame", sizeof(GstBaseParseFrame), alignof(GstBaseParseFrame));
printf("%s;%zu;%zu\n", "GstBaseParseFrameFlags", sizeof(GstBaseParseFrameFlags), alignof(GstBaseParseFrameFlags));
printf("%s;%zu;%zu\n", "GstBaseSink", sizeof(GstBaseSink), alignof(GstBaseSink));
printf("%s;%zu;%zu\n", "GstBaseSinkClass", sizeof(GstBaseSinkClass), alignof(GstBaseSinkClass));
printf("%s;%zu;%zu\n", "GstBaseSrc", sizeof(GstBaseSrc), alignof(GstBaseSrc));
printf("%s;%zu;%zu\n", "GstBaseSrcClass", sizeof(GstBaseSrcClass), alignof(GstBaseSrcClass));
printf("%s;%zu;%zu\n", "GstBaseSrcFlags", sizeof(GstBaseSrcFlags), alignof(GstBaseSrcFlags));
printf("%s;%zu;%zu\n", "GstBaseTransform", sizeof(GstBaseTransform), alignof(GstBaseTransform));
printf("%s;%zu;%zu\n", "GstBaseTransformClass", sizeof(GstBaseTransformClass), alignof(GstBaseTransformClass));
printf("%s;%zu;%zu\n", "GstBitReader", sizeof(GstBitReader), alignof(GstBitReader));
printf("%s;%zu;%zu\n", "GstBitWriter", sizeof(GstBitWriter), alignof(GstBitWriter));
printf("%s;%zu;%zu\n", "GstByteReader", sizeof(GstByteReader), alignof(GstByteReader));
printf("%s;%zu;%zu\n", "GstByteWriter", sizeof(GstByteWriter), alignof(GstByteWriter));
printf("%s;%zu;%zu\n", "GstCollectData", sizeof(GstCollectData), alignof(GstCollectData));
printf("%s;%zu;%zu\n", "GstCollectPads", sizeof(GstCollectPads), alignof(GstCollectPads));
printf("%s;%zu;%zu\n", "GstCollectPadsClass", sizeof(GstCollectPadsClass), alignof(GstCollectPadsClass));
printf("%s;%zu;%zu\n", "GstCollectPadsStateFlags", sizeof(GstCollectPadsStateFlags), alignof(GstCollectPadsStateFlags));
printf("%s;%zu;%zu\n", "GstDataQueue", sizeof(GstDataQueue), alignof(GstDataQueue));
printf("%s;%zu;%zu\n", "GstDataQueueClass", sizeof(GstDataQueueClass), alignof(GstDataQueueClass));
printf("%s;%zu;%zu\n", "GstDataQueueItem", sizeof(GstDataQueueItem), alignof(GstDataQueueItem));
printf("%s;%zu;%zu\n", "GstDataQueueSize", sizeof(GstDataQueueSize), alignof(GstDataQueueSize));
printf("%s;%zu;%zu\n", "GstPushSrc", sizeof(GstPushSrc), alignof(GstPushSrc));
printf("%s;%zu;%zu\n", "GstPushSrcClass", sizeof(GstPushSrcClass), alignof(GstPushSrcClass));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_check_sys::*; use gstreamer_check_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,31 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "###gir test###%s###gir test###\n",
const char *: "###gir test###%s###gir test###\n",
char: "###gir test###%c###gir test###\n",
signed char: "###gir test###%hhd###gir test###\n",
unsigned char: "###gir test###%hhu###gir test###\n",
short int: "###gir test###%hd###gir test###\n",
unsigned short int: "###gir test###%hu###gir test###\n",
int: "###gir test###%d###gir test###\n",
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,8 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstHarness", sizeof(GstHarness), alignof(GstHarness));
printf("%s;%zu;%zu\n", "GstTestClock", sizeof(GstTestClock), alignof(GstTestClock));
printf("%s;%zu;%zu\n", "GstTestClockClass", sizeof(GstTestClockClass), alignof(GstTestClockClass));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_controller_sys::*; use gstreamer_controller_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,40 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_CUBIC);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_CUBIC_MONOTONIC);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_LINEAR);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_NONE);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_REVERSE_SAW);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_SAW);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_SINE);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_SQUARE);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_TRIANGLE);
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,22 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstARGBControlBinding", sizeof(GstARGBControlBinding), alignof(GstARGBControlBinding));
printf("%s;%zu;%zu\n", "GstARGBControlBindingClass", sizeof(GstARGBControlBindingClass), alignof(GstARGBControlBindingClass));
printf("%s;%zu;%zu\n", "GstControlPoint", sizeof(GstControlPoint), alignof(GstControlPoint));
printf("%s;%zu;%zu\n", "GstDirectControlBinding", sizeof(GstDirectControlBinding), alignof(GstDirectControlBinding));
printf("%s;%zu;%zu\n", "GstDirectControlBindingClass", sizeof(GstDirectControlBindingClass), alignof(GstDirectControlBindingClass));
printf("%s;%zu;%zu\n", "GstInterpolationControlSource", sizeof(GstInterpolationControlSource), alignof(GstInterpolationControlSource));
printf("%s;%zu;%zu\n", "GstInterpolationControlSourceClass", sizeof(GstInterpolationControlSourceClass), alignof(GstInterpolationControlSourceClass));
printf("%s;%zu;%zu\n", "GstInterpolationMode", sizeof(GstInterpolationMode), alignof(GstInterpolationMode));
printf("%s;%zu;%zu\n", "GstLFOControlSource", sizeof(GstLFOControlSource), alignof(GstLFOControlSource));
printf("%s;%zu;%zu\n", "GstLFOControlSourceClass", sizeof(GstLFOControlSourceClass), alignof(GstLFOControlSourceClass));
printf("%s;%zu;%zu\n", "GstLFOWaveform", sizeof(GstLFOWaveform), alignof(GstLFOWaveform));
printf("%s;%zu;%zu\n", "GstProxyControlBinding", sizeof(GstProxyControlBinding), alignof(GstProxyControlBinding));
printf("%s;%zu;%zu\n", "GstProxyControlBindingClass", sizeof(GstProxyControlBindingClass), alignof(GstProxyControlBindingClass));
printf("%s;%zu;%zu\n", "GstTimedValueControlSource", sizeof(GstTimedValueControlSource), alignof(GstTimedValueControlSource));
printf("%s;%zu;%zu\n", "GstTimedValueControlSourceClass", sizeof(GstTimedValueControlSourceClass), alignof(GstTimedValueControlSourceClass));
printf("%s;%zu;%zu\n", "GstTriggerControlSource", sizeof(GstTriggerControlSource), alignof(GstTriggerControlSource));
printf("%s;%zu;%zu\n", "GstTriggerControlSourceClass", sizeof(GstTriggerControlSourceClass), alignof(GstTriggerControlSourceClass));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_editing_services_sys::*; use gstreamer_editing_services_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,189 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GES_ASSET_LOADING_ASYNC);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GES_ASSET_LOADING_ERROR);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GES_ASSET_LOADING_OK);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((gint) GES_CHILDREN_IGNORE_NOTIFIES);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT((gint) GES_CHILDREN_LAST);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((gint) GES_CHILDREN_UPDATE);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GES_CHILDREN_UPDATE_ALL_VALUES);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GES_CHILDREN_UPDATE_OFFSETS);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GES_EDGE_END);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GES_EDGE_NONE);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GES_EDGE_START);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GES_EDIT_MODE_NORMAL);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GES_EDIT_MODE_RIPPLE);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((gint) GES_EDIT_MODE_ROLL);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT((gint) GES_EDIT_MODE_SLIDE);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT((gint) GES_EDIT_MODE_TRIM);
ABI_CONSTANT_NAME); PRINT_CONSTANT((gint) GES_ERROR_ASSET_LOADING);
PRINT_CONSTANT((gint) GES_ERROR_ASSET_WRONG_ID);
PRINT_CONSTANT((gint) GES_ERROR_FORMATTER_MALFORMED_INPUT_FILE);
PRINT_CONSTANT((gint) GES_ERROR_INVALID_EFFECT_BIN_DESCRIPTION);
PRINT_CONSTANT((gint) GES_ERROR_INVALID_FRAME_NUMBER);
PRINT_CONSTANT((gint) GES_ERROR_INVALID_OVERLAP_IN_TRACK);
PRINT_CONSTANT((gint) GES_ERROR_NEGATIVE_LAYER);
PRINT_CONSTANT((gint) GES_ERROR_NEGATIVE_TIME);
PRINT_CONSTANT((gint) GES_ERROR_NOT_ENOUGH_INTERNAL_CONTENT);
PRINT_CONSTANT(GES_FRAME_NUMBER_NONE);
PRINT_CONSTANT(GES_META_DESCRIPTION);
PRINT_CONSTANT(GES_META_FORMATTER_EXTENSION);
PRINT_CONSTANT(GES_META_FORMATTER_MIMETYPE);
PRINT_CONSTANT(GES_META_FORMATTER_NAME);
PRINT_CONSTANT(GES_META_FORMATTER_RANK);
PRINT_CONSTANT(GES_META_FORMATTER_VERSION);
PRINT_CONSTANT(GES_META_FORMAT_VERSION);
PRINT_CONSTANT(GES_META_MARKER_COLOR);
PRINT_CONSTANT((guint) GES_META_READABLE);
PRINT_CONSTANT((guint) GES_META_READ_WRITE);
PRINT_CONSTANT(GES_META_VOLUME);
PRINT_CONSTANT(GES_META_VOLUME_DEFAULT);
PRINT_CONSTANT((guint) GES_META_WRITABLE);
PRINT_CONSTANT(GES_MULTI_FILE_URI_PREFIX);
PRINT_CONSTANT(GES_PADDING);
PRINT_CONSTANT(GES_PADDING_LARGE);
PRINT_CONSTANT((guint) GES_PIPELINE_MODE_PREVIEW);
PRINT_CONSTANT((guint) GES_PIPELINE_MODE_PREVIEW_AUDIO);
PRINT_CONSTANT((guint) GES_PIPELINE_MODE_PREVIEW_VIDEO);
PRINT_CONSTANT((guint) GES_PIPELINE_MODE_RENDER);
PRINT_CONSTANT((guint) GES_PIPELINE_MODE_SMART_RENDER);
PRINT_CONSTANT((gint) GES_TEXT_HALIGN_ABSOLUTE);
PRINT_CONSTANT((gint) GES_TEXT_HALIGN_CENTER);
PRINT_CONSTANT((gint) GES_TEXT_HALIGN_LEFT);
PRINT_CONSTANT((gint) GES_TEXT_HALIGN_POSITION);
PRINT_CONSTANT((gint) GES_TEXT_HALIGN_RIGHT);
PRINT_CONSTANT((gint) GES_TEXT_VALIGN_ABSOLUTE);
PRINT_CONSTANT((gint) GES_TEXT_VALIGN_BASELINE);
PRINT_CONSTANT((gint) GES_TEXT_VALIGN_BOTTOM);
PRINT_CONSTANT((gint) GES_TEXT_VALIGN_CENTER);
PRINT_CONSTANT((gint) GES_TEXT_VALIGN_POSITION);
PRINT_CONSTANT((gint) GES_TEXT_VALIGN_TOP);
PRINT_CONSTANT(GES_TIMELINE_ELEMENT_NO_LAYER_PRIORITY);
PRINT_CONSTANT((guint) GES_TRACK_TYPE_AUDIO);
PRINT_CONSTANT((guint) GES_TRACK_TYPE_CUSTOM);
PRINT_CONSTANT((guint) GES_TRACK_TYPE_TEXT);
PRINT_CONSTANT((guint) GES_TRACK_TYPE_UNKNOWN);
PRINT_CONSTANT((guint) GES_TRACK_TYPE_VIDEO);
PRINT_CONSTANT(GES_VERSION_MAJOR);
PRINT_CONSTANT(GES_VERSION_MICRO);
PRINT_CONSTANT(GES_VERSION_MINOR);
PRINT_CONSTANT(GES_VERSION_NANO);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_DBL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_DTL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_H);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNDOOR_V);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_D);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_L);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_R);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BARNVEE_U);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_LR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BAR_WIPE_TB);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOWTIE_H);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOWTIE_V);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BC);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_BR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_LC);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_RC);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TC);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_BOX_WIPE_TR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW12);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW3);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW6);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_CLOCK_CW9);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_CROSSFADE);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DIAGONAL_TL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DIAGONAL_TR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FIH);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FIV);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FOH);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLEFAN_FOV);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_OH);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_OV);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PD);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PDBL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PDTL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_DOUBLESWEEP_PV);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_B);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_CR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_CT);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_L);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_R);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FAN_T);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FOUR_BOX_WIPE_CI);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_FOUR_BOX_WIPE_CO);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_IRIS_RECT);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_MISC_DIAGONAL_DBD);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_MISC_DIAGONAL_DD);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_NONE);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_FB);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_TBH);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_PINWHEEL_TBV);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_B);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_L);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_R);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SALOONDOOR_T);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWB);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWBL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWBR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWT);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWTL);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_SINGLESWEEP_CWTR);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_D);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_L);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_R);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_VEE_U);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_H);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_R);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_U);
PRINT_CONSTANT((gint) GES_VIDEO_STANDARD_TRANSITION_TYPE_WINDSHIELD_V);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_CHROMA_ZONE_PLATE);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_GAMUT);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_BLACK);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_BLINK);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_BLUE);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_CHECKERS1);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_CHECKERS2);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_CHECKERS4);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_CHECKERS8);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_CIRCULAR);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_GREEN);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_RED);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_SMPTE);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_SMPTE75);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_SNOW);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_SOLID);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_PATTERN_WHITE);
PRINT_CONSTANT((gint) GES_VIDEO_TEST_ZONE_PLATE);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,126 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GESAsset", sizeof(GESAsset), alignof(GESAsset));
printf("%s;%zu;%zu\n", "GESAssetClass", sizeof(GESAssetClass), alignof(GESAssetClass));
printf("%s;%zu;%zu\n", "GESAssetLoadingReturn", sizeof(GESAssetLoadingReturn), alignof(GESAssetLoadingReturn));
printf("%s;%zu;%zu\n", "GESAudioSource", sizeof(GESAudioSource), alignof(GESAudioSource));
printf("%s;%zu;%zu\n", "GESAudioSourceClass", sizeof(GESAudioSourceClass), alignof(GESAudioSourceClass));
printf("%s;%zu;%zu\n", "GESAudioTestSource", sizeof(GESAudioTestSource), alignof(GESAudioTestSource));
printf("%s;%zu;%zu\n", "GESAudioTestSourceClass", sizeof(GESAudioTestSourceClass), alignof(GESAudioTestSourceClass));
printf("%s;%zu;%zu\n", "GESAudioTrack", sizeof(GESAudioTrack), alignof(GESAudioTrack));
printf("%s;%zu;%zu\n", "GESAudioTrackClass", sizeof(GESAudioTrackClass), alignof(GESAudioTrackClass));
printf("%s;%zu;%zu\n", "GESAudioTransition", sizeof(GESAudioTransition), alignof(GESAudioTransition));
printf("%s;%zu;%zu\n", "GESAudioTransitionClass", sizeof(GESAudioTransitionClass), alignof(GESAudioTransitionClass));
printf("%s;%zu;%zu\n", "GESAudioUriSource", sizeof(GESAudioUriSource), alignof(GESAudioUriSource));
printf("%s;%zu;%zu\n", "GESAudioUriSourceClass", sizeof(GESAudioUriSourceClass), alignof(GESAudioUriSourceClass));
printf("%s;%zu;%zu\n", "GESBaseEffect", sizeof(GESBaseEffect), alignof(GESBaseEffect));
printf("%s;%zu;%zu\n", "GESBaseEffectClass", sizeof(GESBaseEffectClass), alignof(GESBaseEffectClass));
printf("%s;%zu;%zu\n", "GESBaseEffectClip", sizeof(GESBaseEffectClip), alignof(GESBaseEffectClip));
printf("%s;%zu;%zu\n", "GESBaseEffectClipClass", sizeof(GESBaseEffectClipClass), alignof(GESBaseEffectClipClass));
printf("%s;%zu;%zu\n", "GESBaseTransitionClip", sizeof(GESBaseTransitionClip), alignof(GESBaseTransitionClip));
printf("%s;%zu;%zu\n", "GESBaseTransitionClipClass", sizeof(GESBaseTransitionClipClass), alignof(GESBaseTransitionClipClass));
printf("%s;%zu;%zu\n", "GESBaseXmlFormatter", sizeof(GESBaseXmlFormatter), alignof(GESBaseXmlFormatter));
printf("%s;%zu;%zu\n", "GESBaseXmlFormatterClass", sizeof(GESBaseXmlFormatterClass), alignof(GESBaseXmlFormatterClass));
printf("%s;%zu;%zu\n", "GESChildrenControlMode", sizeof(GESChildrenControlMode), alignof(GESChildrenControlMode));
printf("%s;%zu;%zu\n", "GESClip", sizeof(GESClip), alignof(GESClip));
printf("%s;%zu;%zu\n", "GESClipAsset", sizeof(GESClipAsset), alignof(GESClipAsset));
printf("%s;%zu;%zu\n", "GESClipAssetClass", sizeof(GESClipAssetClass), alignof(GESClipAssetClass));
printf("%s;%zu;%zu\n", "GESClipClass", sizeof(GESClipClass), alignof(GESClipClass));
printf("%s;%zu;%zu\n", "GESCommandLineFormatter", sizeof(GESCommandLineFormatter), alignof(GESCommandLineFormatter));
printf("%s;%zu;%zu\n", "GESCommandLineFormatterClass", sizeof(GESCommandLineFormatterClass), alignof(GESCommandLineFormatterClass));
printf("%s;%zu;%zu\n", "GESContainer", sizeof(GESContainer), alignof(GESContainer));
printf("%s;%zu;%zu\n", "GESContainerClass", sizeof(GESContainerClass), alignof(GESContainerClass));
printf("%s;%zu;%zu\n", "GESEdge", sizeof(GESEdge), alignof(GESEdge));
printf("%s;%zu;%zu\n", "GESEditMode", sizeof(GESEditMode), alignof(GESEditMode));
printf("%s;%zu;%zu\n", "GESEffect", sizeof(GESEffect), alignof(GESEffect));
printf("%s;%zu;%zu\n", "GESEffectAsset", sizeof(GESEffectAsset), alignof(GESEffectAsset));
printf("%s;%zu;%zu\n", "GESEffectAssetClass", sizeof(GESEffectAssetClass), alignof(GESEffectAssetClass));
printf("%s;%zu;%zu\n", "GESEffectClass", sizeof(GESEffectClass), alignof(GESEffectClass));
printf("%s;%zu;%zu\n", "GESEffectClip", sizeof(GESEffectClip), alignof(GESEffectClip));
printf("%s;%zu;%zu\n", "GESEffectClipClass", sizeof(GESEffectClipClass), alignof(GESEffectClipClass));
printf("%s;%zu;%zu\n", "GESError", sizeof(GESError), alignof(GESError));
printf("%s;%zu;%zu\n", "GESExtractableInterface", sizeof(GESExtractableInterface), alignof(GESExtractableInterface));
printf("%s;%zu;%zu\n", "GESFormatter", sizeof(GESFormatter), alignof(GESFormatter));
printf("%s;%zu;%zu\n", "GESFormatterClass", sizeof(GESFormatterClass), alignof(GESFormatterClass));
printf("%s;%zu;%zu\n", "GESFrameNumber", sizeof(GESFrameNumber), alignof(GESFrameNumber));
printf("%s;%zu;%zu\n", "GESGroup", sizeof(GESGroup), alignof(GESGroup));
printf("%s;%zu;%zu\n", "GESGroupClass", sizeof(GESGroupClass), alignof(GESGroupClass));
printf("%s;%zu;%zu\n", "GESImageSource", sizeof(GESImageSource), alignof(GESImageSource));
printf("%s;%zu;%zu\n", "GESImageSourceClass", sizeof(GESImageSourceClass), alignof(GESImageSourceClass));
printf("%s;%zu;%zu\n", "GESLayer", sizeof(GESLayer), alignof(GESLayer));
printf("%s;%zu;%zu\n", "GESLayerClass", sizeof(GESLayerClass), alignof(GESLayerClass));
printf("%s;%zu;%zu\n", "GESMarkerClass", sizeof(GESMarkerClass), alignof(GESMarkerClass));
printf("%s;%zu;%zu\n", "GESMarkerListClass", sizeof(GESMarkerListClass), alignof(GESMarkerListClass));
printf("%s;%zu;%zu\n", "GESMetaContainerInterface", sizeof(GESMetaContainerInterface), alignof(GESMetaContainerInterface));
printf("%s;%zu;%zu\n", "GESMetaFlag", sizeof(GESMetaFlag), alignof(GESMetaFlag));
printf("%s;%zu;%zu\n", "GESMultiFileSource", sizeof(GESMultiFileSource), alignof(GESMultiFileSource));
printf("%s;%zu;%zu\n", "GESMultiFileSourceClass", sizeof(GESMultiFileSourceClass), alignof(GESMultiFileSourceClass));
printf("%s;%zu;%zu\n", "GESOperation", sizeof(GESOperation), alignof(GESOperation));
printf("%s;%zu;%zu\n", "GESOperationClass", sizeof(GESOperationClass), alignof(GESOperationClass));
printf("%s;%zu;%zu\n", "GESOperationClip", sizeof(GESOperationClip), alignof(GESOperationClip));
printf("%s;%zu;%zu\n", "GESOperationClipClass", sizeof(GESOperationClipClass), alignof(GESOperationClipClass));
printf("%s;%zu;%zu\n", "GESOverlayClip", sizeof(GESOverlayClip), alignof(GESOverlayClip));
printf("%s;%zu;%zu\n", "GESOverlayClipClass", sizeof(GESOverlayClipClass), alignof(GESOverlayClipClass));
printf("%s;%zu;%zu\n", "GESPipeline", sizeof(GESPipeline), alignof(GESPipeline));
printf("%s;%zu;%zu\n", "GESPipelineClass", sizeof(GESPipelineClass), alignof(GESPipelineClass));
printf("%s;%zu;%zu\n", "GESPipelineFlags", sizeof(GESPipelineFlags), alignof(GESPipelineFlags));
printf("%s;%zu;%zu\n", "GESPitiviFormatter", sizeof(GESPitiviFormatter), alignof(GESPitiviFormatter));
printf("%s;%zu;%zu\n", "GESPitiviFormatterClass", sizeof(GESPitiviFormatterClass), alignof(GESPitiviFormatterClass));
printf("%s;%zu;%zu\n", "GESProject", sizeof(GESProject), alignof(GESProject));
printf("%s;%zu;%zu\n", "GESProjectClass", sizeof(GESProjectClass), alignof(GESProjectClass));
printf("%s;%zu;%zu\n", "GESSource", sizeof(GESSource), alignof(GESSource));
printf("%s;%zu;%zu\n", "GESSourceClass", sizeof(GESSourceClass), alignof(GESSourceClass));
printf("%s;%zu;%zu\n", "GESSourceClip", sizeof(GESSourceClip), alignof(GESSourceClip));
printf("%s;%zu;%zu\n", "GESSourceClipAsset", sizeof(GESSourceClipAsset), alignof(GESSourceClipAsset));
printf("%s;%zu;%zu\n", "GESSourceClipAssetClass", sizeof(GESSourceClipAssetClass), alignof(GESSourceClipAssetClass));
printf("%s;%zu;%zu\n", "GESSourceClipClass", sizeof(GESSourceClipClass), alignof(GESSourceClipClass));
printf("%s;%zu;%zu\n", "GESTestClip", sizeof(GESTestClip), alignof(GESTestClip));
printf("%s;%zu;%zu\n", "GESTestClipClass", sizeof(GESTestClipClass), alignof(GESTestClipClass));
printf("%s;%zu;%zu\n", "GESTextHAlign", sizeof(GESTextHAlign), alignof(GESTextHAlign));
printf("%s;%zu;%zu\n", "GESTextOverlay", sizeof(GESTextOverlay), alignof(GESTextOverlay));
printf("%s;%zu;%zu\n", "GESTextOverlayClass", sizeof(GESTextOverlayClass), alignof(GESTextOverlayClass));
printf("%s;%zu;%zu\n", "GESTextOverlayClip", sizeof(GESTextOverlayClip), alignof(GESTextOverlayClip));
printf("%s;%zu;%zu\n", "GESTextOverlayClipClass", sizeof(GESTextOverlayClipClass), alignof(GESTextOverlayClipClass));
printf("%s;%zu;%zu\n", "GESTextVAlign", sizeof(GESTextVAlign), alignof(GESTextVAlign));
printf("%s;%zu;%zu\n", "GESTimeline", sizeof(GESTimeline), alignof(GESTimeline));
printf("%s;%zu;%zu\n", "GESTimelineClass", sizeof(GESTimelineClass), alignof(GESTimelineClass));
printf("%s;%zu;%zu\n", "GESTimelineElement", sizeof(GESTimelineElement), alignof(GESTimelineElement));
printf("%s;%zu;%zu\n", "GESTimelineElementClass", sizeof(GESTimelineElementClass), alignof(GESTimelineElementClass));
printf("%s;%zu;%zu\n", "GESTitleClip", sizeof(GESTitleClip), alignof(GESTitleClip));
printf("%s;%zu;%zu\n", "GESTitleClipClass", sizeof(GESTitleClipClass), alignof(GESTitleClipClass));
printf("%s;%zu;%zu\n", "GESTitleSource", sizeof(GESTitleSource), alignof(GESTitleSource));
printf("%s;%zu;%zu\n", "GESTitleSourceClass", sizeof(GESTitleSourceClass), alignof(GESTitleSourceClass));
printf("%s;%zu;%zu\n", "GESTrack", sizeof(GESTrack), alignof(GESTrack));
printf("%s;%zu;%zu\n", "GESTrackClass", sizeof(GESTrackClass), alignof(GESTrackClass));
printf("%s;%zu;%zu\n", "GESTrackElement", sizeof(GESTrackElement), alignof(GESTrackElement));
printf("%s;%zu;%zu\n", "GESTrackElementAsset", sizeof(GESTrackElementAsset), alignof(GESTrackElementAsset));
printf("%s;%zu;%zu\n", "GESTrackElementAssetClass", sizeof(GESTrackElementAssetClass), alignof(GESTrackElementAssetClass));
printf("%s;%zu;%zu\n", "GESTrackElementClass", sizeof(GESTrackElementClass), alignof(GESTrackElementClass));
printf("%s;%zu;%zu\n", "GESTrackType", sizeof(GESTrackType), alignof(GESTrackType));
printf("%s;%zu;%zu\n", "GESTransition", sizeof(GESTransition), alignof(GESTransition));
printf("%s;%zu;%zu\n", "GESTransitionClass", sizeof(GESTransitionClass), alignof(GESTransitionClass));
printf("%s;%zu;%zu\n", "GESTransitionClip", sizeof(GESTransitionClip), alignof(GESTransitionClip));
printf("%s;%zu;%zu\n", "GESTransitionClipClass", sizeof(GESTransitionClipClass), alignof(GESTransitionClipClass));
printf("%s;%zu;%zu\n", "GESUriClip", sizeof(GESUriClip), alignof(GESUriClip));
printf("%s;%zu;%zu\n", "GESUriClipAsset", sizeof(GESUriClipAsset), alignof(GESUriClipAsset));
printf("%s;%zu;%zu\n", "GESUriClipAssetClass", sizeof(GESUriClipAssetClass), alignof(GESUriClipAssetClass));
printf("%s;%zu;%zu\n", "GESUriClipClass", sizeof(GESUriClipClass), alignof(GESUriClipClass));
printf("%s;%zu;%zu\n", "GESUriSourceAsset", sizeof(GESUriSourceAsset), alignof(GESUriSourceAsset));
printf("%s;%zu;%zu\n", "GESUriSourceAssetClass", sizeof(GESUriSourceAssetClass), alignof(GESUriSourceAssetClass));
printf("%s;%zu;%zu\n", "GESVideoSource", sizeof(GESVideoSource), alignof(GESVideoSource));
printf("%s;%zu;%zu\n", "GESVideoSourceClass", sizeof(GESVideoSourceClass), alignof(GESVideoSourceClass));
printf("%s;%zu;%zu\n", "GESVideoStandardTransitionType", sizeof(GESVideoStandardTransitionType), alignof(GESVideoStandardTransitionType));
printf("%s;%zu;%zu\n", "GESVideoTestPattern", sizeof(GESVideoTestPattern), alignof(GESVideoTestPattern));
printf("%s;%zu;%zu\n", "GESVideoTestSource", sizeof(GESVideoTestSource), alignof(GESVideoTestSource));
printf("%s;%zu;%zu\n", "GESVideoTestSourceClass", sizeof(GESVideoTestSourceClass), alignof(GESVideoTestSourceClass));
printf("%s;%zu;%zu\n", "GESVideoTrack", sizeof(GESVideoTrack), alignof(GESVideoTrack));
printf("%s;%zu;%zu\n", "GESVideoTrackClass", sizeof(GESVideoTrackClass), alignof(GESVideoTrackClass));
printf("%s;%zu;%zu\n", "GESVideoTransition", sizeof(GESVideoTransition), alignof(GESVideoTransition));
printf("%s;%zu;%zu\n", "GESVideoTransitionClass", sizeof(GESVideoTransitionClass), alignof(GESVideoTransitionClass));
printf("%s;%zu;%zu\n", "GESVideoUriSource", sizeof(GESVideoUriSource), alignof(GESVideoUriSource));
printf("%s;%zu;%zu\n", "GESVideoUriSourceClass", sizeof(GESVideoUriSourceClass), alignof(GESVideoUriSourceClass));
printf("%s;%zu;%zu\n", "GESXmlFormatter", sizeof(GESXmlFormatter), alignof(GESXmlFormatter));
printf("%s;%zu;%zu\n", "GESXmlFormatterClass", sizeof(GESXmlFormatterClass), alignof(GESXmlFormatterClass));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_gl_egl_sys::*; use gstreamer_gl_egl_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,32 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT(GST_GL_DISPLAY_EGL_NAME);
char *: "###gir test###%s###gir test###\n",
const char *: "###gir test###%s###gir test###\n",
char: "###gir test###%c###gir test###\n",
signed char: "###gir test###%hhd###gir test###\n",
unsigned char: "###gir test###%hhu###gir test###\n",
short int: "###gir test###%hd###gir test###\n",
unsigned short int: "###gir test###%hu###gir test###\n",
int: "###gir test###%d###gir test###\n",
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,7 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstGLDisplayEGL", sizeof(GstGLDisplayEGL), alignof(GstGLDisplayEGL));
printf("%s;%zu;%zu\n", "GstGLDisplayEGLClass", sizeof(GstGLDisplayEGLClass), alignof(GstGLDisplayEGLClass));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_gl_sys::*; use gstreamer_gl_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,161 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_SYNC_META);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT(GST_CAPS_FEATURE_MEMORY_GL_BUFFER);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT(GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_GLSL_ERROR_COMPILE);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_GLSL_ERROR_LINK);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_GLSL_ERROR_PROGRAM);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((guint) GST_GLSL_PROFILE_ANY);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((guint) GST_GLSL_PROFILE_COMPATIBILITY);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((guint) GST_GLSL_PROFILE_CORE);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((guint) GST_GLSL_PROFILE_ES);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((guint) GST_GLSL_PROFILE_NONE);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT((gint) GST_GLSL_VERSION_100);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT((gint) GST_GLSL_VERSION_110);
ABI_CONSTANT_NAME); PRINT_CONSTANT((gint) GST_GLSL_VERSION_120);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_130);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_140);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_150);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_300);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_310);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_320);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_330);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_400);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_410);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_420);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_430);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_440);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_450);
PRINT_CONSTANT((gint) GST_GLSL_VERSION_NONE);
PRINT_CONSTANT(GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_ALLOC);
PRINT_CONSTANT(GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_BUFFER);
PRINT_CONSTANT(GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_USER);
PRINT_CONSTANT(GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO);
PRINT_CONSTANT(GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE);
PRINT_CONSTANT(GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM);
PRINT_CONSTANT((gint) GST_GL_ALPHA);
PRINT_CONSTANT((guint) GST_GL_API_ANY);
PRINT_CONSTANT((guint) GST_GL_API_GLES1);
PRINT_CONSTANT(GST_GL_API_GLES1_NAME);
PRINT_CONSTANT((guint) GST_GL_API_GLES2);
PRINT_CONSTANT(GST_GL_API_GLES2_NAME);
PRINT_CONSTANT((guint) GST_GL_API_NONE);
PRINT_CONSTANT((guint) GST_GL_API_OPENGL);
PRINT_CONSTANT((guint) GST_GL_API_OPENGL3);
PRINT_CONSTANT(GST_GL_API_OPENGL3_NAME);
PRINT_CONSTANT(GST_GL_API_OPENGL_NAME);
PRINT_CONSTANT(GST_GL_BASE_MEMORY_ALLOCATOR_NAME);
PRINT_CONSTANT((gint) GST_GL_BASE_MEMORY_ERROR_FAILED);
PRINT_CONSTANT((gint) GST_GL_BASE_MEMORY_ERROR_OLD_LIBS);
PRINT_CONSTANT((gint) GST_GL_BASE_MEMORY_ERROR_RESOURCE_UNAVAILABLE);
PRINT_CONSTANT((guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_DOWNLOAD);
PRINT_CONSTANT((guint) GST_GL_BASE_MEMORY_TRANSFER_NEED_UPLOAD);
PRINT_CONSTANT(GST_GL_BUFFER_ALLOCATOR_NAME);
PRINT_CONSTANT(GST_GL_COLOR_CONVERT_EXT_FORMATS);
PRINT_CONSTANT((gint) GST_GL_CONTEXT_ERROR_CREATE_CONTEXT);
PRINT_CONSTANT((gint) GST_GL_CONTEXT_ERROR_FAILED);
PRINT_CONSTANT((gint) GST_GL_CONTEXT_ERROR_OLD_LIBS);
PRINT_CONSTANT((gint) GST_GL_CONTEXT_ERROR_RESOURCE_UNAVAILABLE);
PRINT_CONSTANT((gint) GST_GL_CONTEXT_ERROR_WRONG_API);
PRINT_CONSTANT((gint) GST_GL_CONTEXT_ERROR_WRONG_CONFIG);
PRINT_CONSTANT(GST_GL_CONTEXT_TYPE_CGL);
PRINT_CONSTANT(GST_GL_CONTEXT_TYPE_EAGL);
PRINT_CONSTANT(GST_GL_CONTEXT_TYPE_EGL);
PRINT_CONSTANT(GST_GL_CONTEXT_TYPE_GLX);
PRINT_CONSTANT(GST_GL_CONTEXT_TYPE_WGL);
PRINT_CONSTANT((gint) GST_GL_DEPTH24_STENCIL8);
PRINT_CONSTANT((gint) GST_GL_DEPTH_COMPONENT16);
PRINT_CONSTANT(GST_GL_DISPLAY_CONTEXT_TYPE);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_ANY);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_COCOA);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_DISPMANX);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_EGL);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_EGL_DEVICE);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_GBM);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_NONE);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_VIV_FB);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_WAYLAND);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_WIN32);
PRINT_CONSTANT((guint) GST_GL_DISPLAY_TYPE_X11);
PRINT_CONSTANT((gint) GST_GL_LUMINANCE);
PRINT_CONSTANT((gint) GST_GL_LUMINANCE_ALPHA);
PRINT_CONSTANT(GST_GL_MEMORY_ALLOCATOR_NAME);
PRINT_CONSTANT(GST_GL_MEMORY_PBO_ALLOCATOR_NAME);
PRINT_CONSTANT(GST_GL_MEMORY_VIDEO_EXT_FORMATS);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_ANY);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_CGL);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_EAGL);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_EGL);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_GLX);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_NONE);
PRINT_CONSTANT((guint) GST_GL_PLATFORM_WGL);
PRINT_CONSTANT((gint) GST_GL_QUERY_NONE);
PRINT_CONSTANT((gint) GST_GL_QUERY_TIMESTAMP);
PRINT_CONSTANT((gint) GST_GL_QUERY_TIME_ELAPSED);
PRINT_CONSTANT((gint) GST_GL_R16);
PRINT_CONSTANT((gint) GST_GL_R8);
PRINT_CONSTANT((gint) GST_GL_RED);
PRINT_CONSTANT(GST_GL_RENDERBUFFER_ALLOCATOR_NAME);
PRINT_CONSTANT((gint) GST_GL_RG);
PRINT_CONSTANT((gint) GST_GL_RG16);
PRINT_CONSTANT((gint) GST_GL_RG8);
PRINT_CONSTANT((gint) GST_GL_RGB);
PRINT_CONSTANT((gint) GST_GL_RGB10_A2);
PRINT_CONSTANT((gint) GST_GL_RGB16);
PRINT_CONSTANT((gint) GST_GL_RGB565);
PRINT_CONSTANT((gint) GST_GL_RGB8);
PRINT_CONSTANT((gint) GST_GL_RGBA);
PRINT_CONSTANT((gint) GST_GL_RGBA16);
PRINT_CONSTANT((gint) GST_GL_RGBA8);
PRINT_CONSTANT((gint) GST_GL_STEREO_DOWNMIX_ANAGLYPH_AMBER_BLUE_DUBOIS);
PRINT_CONSTANT((gint) GST_GL_STEREO_DOWNMIX_ANAGLYPH_GREEN_MAGENTA_DUBOIS);
PRINT_CONSTANT((gint) GST_GL_STEREO_DOWNMIX_ANAGLYPH_RED_CYAN_DUBOIS);
PRINT_CONSTANT((gint) GST_GL_TEXTURE_TARGET_2D);
PRINT_CONSTANT(GST_GL_TEXTURE_TARGET_2D_STR);
PRINT_CONSTANT((gint) GST_GL_TEXTURE_TARGET_EXTERNAL_OES);
PRINT_CONSTANT(GST_GL_TEXTURE_TARGET_EXTERNAL_OES_STR);
PRINT_CONSTANT((gint) GST_GL_TEXTURE_TARGET_NONE);
PRINT_CONSTANT((gint) GST_GL_TEXTURE_TARGET_RECTANGLE);
PRINT_CONSTANT(GST_GL_TEXTURE_TARGET_RECTANGLE_STR);
PRINT_CONSTANT((gint) GST_GL_UPLOAD_DONE);
PRINT_CONSTANT((gint) GST_GL_UPLOAD_ERROR);
PRINT_CONSTANT((gint) GST_GL_UPLOAD_RECONFIGURE);
PRINT_CONSTANT((gint) GST_GL_UPLOAD_UNSHARED_GL_CONTEXT);
PRINT_CONSTANT((gint) GST_GL_UPLOAD_UNSUPPORTED);
PRINT_CONSTANT((gint) GST_GL_WINDOW_ERROR_FAILED);
PRINT_CONSTANT((gint) GST_GL_WINDOW_ERROR_OLD_LIBS);
PRINT_CONSTANT((gint) GST_GL_WINDOW_ERROR_RESOURCE_UNAVAILABLE);
PRINT_CONSTANT(GST_MAP_GL);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,70 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstGLAPI", sizeof(GstGLAPI), alignof(GstGLAPI));
printf("%s;%zu;%zu\n", "GstGLAllocationParams", sizeof(GstGLAllocationParams), alignof(GstGLAllocationParams));
printf("%s;%zu;%zu\n", "GstGLAsyncDebug", sizeof(GstGLAsyncDebug), alignof(GstGLAsyncDebug));
printf("%s;%zu;%zu\n", "GstGLBaseFilter", sizeof(GstGLBaseFilter), alignof(GstGLBaseFilter));
printf("%s;%zu;%zu\n", "GstGLBaseFilterClass", sizeof(GstGLBaseFilterClass), alignof(GstGLBaseFilterClass));
printf("%s;%zu;%zu\n", "GstGLBaseMemory", sizeof(GstGLBaseMemory), alignof(GstGLBaseMemory));
printf("%s;%zu;%zu\n", "GstGLBaseMemoryAllocator", sizeof(GstGLBaseMemoryAllocator), alignof(GstGLBaseMemoryAllocator));
printf("%s;%zu;%zu\n", "GstGLBaseMemoryAllocatorClass", sizeof(GstGLBaseMemoryAllocatorClass), alignof(GstGLBaseMemoryAllocatorClass));
printf("%s;%zu;%zu\n", "GstGLBaseMemoryError", sizeof(GstGLBaseMemoryError), alignof(GstGLBaseMemoryError));
printf("%s;%zu;%zu\n", "GstGLBaseMemoryTransfer", sizeof(GstGLBaseMemoryTransfer), alignof(GstGLBaseMemoryTransfer));
printf("%s;%zu;%zu\n", "GstGLBaseSrc", sizeof(GstGLBaseSrc), alignof(GstGLBaseSrc));
printf("%s;%zu;%zu\n", "GstGLBaseSrcClass", sizeof(GstGLBaseSrcClass), alignof(GstGLBaseSrcClass));
printf("%s;%zu;%zu\n", "GstGLBuffer", sizeof(GstGLBuffer), alignof(GstGLBuffer));
printf("%s;%zu;%zu\n", "GstGLBufferAllocationParams", sizeof(GstGLBufferAllocationParams), alignof(GstGLBufferAllocationParams));
printf("%s;%zu;%zu\n", "GstGLBufferAllocator", sizeof(GstGLBufferAllocator), alignof(GstGLBufferAllocator));
printf("%s;%zu;%zu\n", "GstGLBufferAllocatorClass", sizeof(GstGLBufferAllocatorClass), alignof(GstGLBufferAllocatorClass));
printf("%s;%zu;%zu\n", "GstGLBufferPool", sizeof(GstGLBufferPool), alignof(GstGLBufferPool));
printf("%s;%zu;%zu\n", "GstGLBufferPoolClass", sizeof(GstGLBufferPoolClass), alignof(GstGLBufferPoolClass));
printf("%s;%zu;%zu\n", "GstGLColorConvert", sizeof(GstGLColorConvert), alignof(GstGLColorConvert));
printf("%s;%zu;%zu\n", "GstGLColorConvertClass", sizeof(GstGLColorConvertClass), alignof(GstGLColorConvertClass));
printf("%s;%zu;%zu\n", "GstGLContext", sizeof(GstGLContext), alignof(GstGLContext));
printf("%s;%zu;%zu\n", "GstGLContextClass", sizeof(GstGLContextClass), alignof(GstGLContextClass));
printf("%s;%zu;%zu\n", "GstGLContextError", sizeof(GstGLContextError), alignof(GstGLContextError));
printf("%s;%zu;%zu\n", "GstGLDisplay", sizeof(GstGLDisplay), alignof(GstGLDisplay));
printf("%s;%zu;%zu\n", "GstGLDisplayClass", sizeof(GstGLDisplayClass), alignof(GstGLDisplayClass));
printf("%s;%zu;%zu\n", "GstGLDisplayType", sizeof(GstGLDisplayType), alignof(GstGLDisplayType));
printf("%s;%zu;%zu\n", "GstGLFilter", sizeof(GstGLFilter), alignof(GstGLFilter));
printf("%s;%zu;%zu\n", "GstGLFilterClass", sizeof(GstGLFilterClass), alignof(GstGLFilterClass));
printf("%s;%zu;%zu\n", "GstGLFormat", sizeof(GstGLFormat), alignof(GstGLFormat));
printf("%s;%zu;%zu\n", "GstGLFramebuffer", sizeof(GstGLFramebuffer), alignof(GstGLFramebuffer));
printf("%s;%zu;%zu\n", "GstGLFramebufferClass", sizeof(GstGLFramebufferClass), alignof(GstGLFramebufferClass));
printf("%s;%zu;%zu\n", "GstGLMemory", sizeof(GstGLMemory), alignof(GstGLMemory));
printf("%s;%zu;%zu\n", "GstGLMemoryAllocator", sizeof(GstGLMemoryAllocator), alignof(GstGLMemoryAllocator));
printf("%s;%zu;%zu\n", "GstGLMemoryAllocatorClass", sizeof(GstGLMemoryAllocatorClass), alignof(GstGLMemoryAllocatorClass));
printf("%s;%zu;%zu\n", "GstGLMemoryPBO", sizeof(GstGLMemoryPBO), alignof(GstGLMemoryPBO));
printf("%s;%zu;%zu\n", "GstGLMemoryPBOAllocator", sizeof(GstGLMemoryPBOAllocator), alignof(GstGLMemoryPBOAllocator));
printf("%s;%zu;%zu\n", "GstGLMemoryPBOAllocatorClass", sizeof(GstGLMemoryPBOAllocatorClass), alignof(GstGLMemoryPBOAllocatorClass));
printf("%s;%zu;%zu\n", "GstGLOverlayCompositor", sizeof(GstGLOverlayCompositor), alignof(GstGLOverlayCompositor));
printf("%s;%zu;%zu\n", "GstGLOverlayCompositorClass", sizeof(GstGLOverlayCompositorClass), alignof(GstGLOverlayCompositorClass));
printf("%s;%zu;%zu\n", "GstGLPlatform", sizeof(GstGLPlatform), alignof(GstGLPlatform));
printf("%s;%zu;%zu\n", "GstGLQuery", sizeof(GstGLQuery), alignof(GstGLQuery));
printf("%s;%zu;%zu\n", "GstGLQueryType", sizeof(GstGLQueryType), alignof(GstGLQueryType));
printf("%s;%zu;%zu\n", "GstGLRenderbuffer", sizeof(GstGLRenderbuffer), alignof(GstGLRenderbuffer));
printf("%s;%zu;%zu\n", "GstGLRenderbufferAllocationParams", sizeof(GstGLRenderbufferAllocationParams), alignof(GstGLRenderbufferAllocationParams));
printf("%s;%zu;%zu\n", "GstGLRenderbufferAllocator", sizeof(GstGLRenderbufferAllocator), alignof(GstGLRenderbufferAllocator));
printf("%s;%zu;%zu\n", "GstGLRenderbufferAllocatorClass", sizeof(GstGLRenderbufferAllocatorClass), alignof(GstGLRenderbufferAllocatorClass));
printf("%s;%zu;%zu\n", "GstGLSLError", sizeof(GstGLSLError), alignof(GstGLSLError));
printf("%s;%zu;%zu\n", "GstGLSLProfile", sizeof(GstGLSLProfile), alignof(GstGLSLProfile));
printf("%s;%zu;%zu\n", "GstGLSLStage", sizeof(GstGLSLStage), alignof(GstGLSLStage));
printf("%s;%zu;%zu\n", "GstGLSLStageClass", sizeof(GstGLSLStageClass), alignof(GstGLSLStageClass));
printf("%s;%zu;%zu\n", "GstGLSLVersion", sizeof(GstGLSLVersion), alignof(GstGLSLVersion));
printf("%s;%zu;%zu\n", "GstGLShader", sizeof(GstGLShader), alignof(GstGLShader));
printf("%s;%zu;%zu\n", "GstGLShaderClass", sizeof(GstGLShaderClass), alignof(GstGLShaderClass));
printf("%s;%zu;%zu\n", "GstGLStereoDownmix", sizeof(GstGLStereoDownmix), alignof(GstGLStereoDownmix));
printf("%s;%zu;%zu\n", "GstGLSyncMeta", sizeof(GstGLSyncMeta), alignof(GstGLSyncMeta));
printf("%s;%zu;%zu\n", "GstGLTextureTarget", sizeof(GstGLTextureTarget), alignof(GstGLTextureTarget));
printf("%s;%zu;%zu\n", "GstGLUpload", sizeof(GstGLUpload), alignof(GstGLUpload));
printf("%s;%zu;%zu\n", "GstGLUploadClass", sizeof(GstGLUploadClass), alignof(GstGLUploadClass));
printf("%s;%zu;%zu\n", "GstGLUploadReturn", sizeof(GstGLUploadReturn), alignof(GstGLUploadReturn));
printf("%s;%zu;%zu\n", "GstGLVideoAllocationParams", sizeof(GstGLVideoAllocationParams), alignof(GstGLVideoAllocationParams));
printf("%s;%zu;%zu\n", "GstGLViewConvert", sizeof(GstGLViewConvert), alignof(GstGLViewConvert));
printf("%s;%zu;%zu\n", "GstGLViewConvertClass", sizeof(GstGLViewConvertClass), alignof(GstGLViewConvertClass));
printf("%s;%zu;%zu\n", "GstGLWindow", sizeof(GstGLWindow), alignof(GstGLWindow));
printf("%s;%zu;%zu\n", "GstGLWindowClass", sizeof(GstGLWindowClass), alignof(GstGLWindowClass));
printf("%s;%zu;%zu\n", "GstGLWindowError", sizeof(GstGLWindowError), alignof(GstGLWindowError));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_gl_wayland_sys::*; use gstreamer_gl_wayland_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,31 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "###gir test###%s###gir test###\n",
const char *: "###gir test###%s###gir test###\n",
char: "###gir test###%c###gir test###\n",
signed char: "###gir test###%hhd###gir test###\n",
unsigned char: "###gir test###%hhu###gir test###\n",
short int: "###gir test###%hd###gir test###\n",
unsigned short int: "###gir test###%hu###gir test###\n",
int: "###gir test###%d###gir test###\n",
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,7 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstGLDisplayWayland", sizeof(GstGLDisplayWayland), alignof(GstGLDisplayWayland));
printf("%s;%zu;%zu\n", "GstGLDisplayWaylandClass", sizeof(GstGLDisplayWaylandClass), alignof(GstGLDisplayWaylandClass));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_gl_x11_sys::*; use gstreamer_gl_x11_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,31 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME),
char *: "###gir test###%s###gir test###\n",
const char *: "###gir test###%s###gir test###\n",
char: "###gir test###%c###gir test###\n",
signed char: "###gir test###%hhd###gir test###\n",
unsigned char: "###gir test###%hhu###gir test###\n",
short int: "###gir test###%hd###gir test###\n",
unsigned short int: "###gir test###%hu###gir test###\n",
int: "###gir test###%d###gir test###\n",
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,7 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstGLDisplayX11", sizeof(GstGLDisplayX11), alignof(GstGLDisplayX11));
printf("%s;%zu;%zu\n", "GstGLDisplayX11Class", sizeof(GstGLDisplayX11Class), alignof(GstGLDisplayX11Class));
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_mpegts_sys::*; use gstreamer_mpegts_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,537 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) ADDITIONAL_INFO_PAGE);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_DIGITAL_RADIO_SOUND);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_HD_DIGITAL_TELEVISION);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_REFERENCE);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_TIME_SHIFTED);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_MOSAIC);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_SD_DIGITAL_TELEVISION);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_REFERENCE);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_TIME_SHIFTED);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_DIGITAL_TELEVISION);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_REFERENCE);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_TIME_SHIFTED);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_DATA_BROADCAST);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_DIGITAL_RADIO_SOUND);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT((gint) GST_DVB_SERVICE_DIGITAL_TELEVISION);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT((gint) GST_DVB_SERVICE_DVB_MHP);
ABI_CONSTANT_NAME); PRINT_CONSTANT((gint) GST_DVB_SERVICE_DVB_SRM);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_FM_RADIO);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_MOSAIC);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_MPEG2_HD_DIGITAL_TELEVISION);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_NVOD_REFERENCE);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_NVOD_TIME_SHIFTED);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_RCS_FLS);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_RCS_MAP);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_RESERVED_00);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_RESERVED_09);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_RESERVED_0D_COMMON_INTERFACE);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_RESERVED_FF);
PRINT_CONSTANT((gint) GST_DVB_SERVICE_TELETEXT);
PRINT_CONSTANT((gint) GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT0);
PRINT_CONSTANT((gint) GST_MPEGTS_ATSC_MGT_TABLE_TYPE_EIT127);
PRINT_CONSTANT((gint) GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT0);
PRINT_CONSTANT((gint) GST_MPEGTS_ATSC_MGT_TABLE_TYPE_ETT127);
PRINT_CONSTANT((gint) GST_MPEGTS_AUDIO_TYPE_CLEAN_EFFECTS);
PRINT_CONSTANT((gint) GST_MPEGTS_AUDIO_TYPE_HEARING_IMPAIRED);
PRINT_CONSTANT((gint) GST_MPEGTS_AUDIO_TYPE_UNDEFINED);
PRINT_CONSTANT((gint) GST_MPEGTS_AUDIO_TYPE_VISUAL_IMPAIRED_COMMENTARY);
PRINT_CONSTANT((gint) GST_MPEGTS_CABLE_OUTER_FEC_NONE);
PRINT_CONSTANT((gint) GST_MPEGTS_CABLE_OUTER_FEC_RS_204_188);
PRINT_CONSTANT((gint) GST_MPEGTS_CABLE_OUTER_FEC_UNDEFINED);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_ARTS_CULTURE);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_CHILDREN_YOUTH_PROGRAM);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_EDUCATION_SCIENCE_FACTUAL);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_LEISURE_HOBBIES);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_MOVIE_DRAMA);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_MUSIC_BALLET_DANCE);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_NEWS_CURRENT_AFFAIRS);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_SHOW_GAME_SHOW);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_SOCIAL_POLITICAL_ECONOMICS);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_SPECIAL_CHARACTERISTICS);
PRINT_CONSTANT((gint) GST_MPEGTS_CONTENT_SPORTS);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_CA_REPLACEMENT);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_DATA_BROADCAST);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_EPG);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_EVENT);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_HAND_OVER_ASSOCIATED);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_HAND_OVER_IDENTICAL);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_HAND_OVER_LOCAL_VARIATION);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_HAND_OVER_RESERVED);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_INFORMATION);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_IP_MAC_NOTIFICATION);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_RCS_MAP);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_RESERVED_00);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_SERVICE_REPLACEMENT);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_SYSTEM_SOFTWARE_UPDATE);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_COMPLETE_SI);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_INT);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_LINKAGE_TS_CONTAINING_SSU);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_0);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_ATIS_F);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_CISSA);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA1);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA2);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_FULL_ENHANCED);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_MINIMAL_ENHANCED);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_CSA3_STANDARD);
PRINT_CONSTANT((gint) GST_MPEGTS_DVB_SCRAMBLING_MODE_RESERVED);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_1_2);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_2_3);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_2_5);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_3_4);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_3_5);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_4_5);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_5_6);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_6_7);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_7_8);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_8_9);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_9_10);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_AUTO);
PRINT_CONSTANT((gint) GST_MPEGTS_FEC_NONE);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_19_128);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_19_256);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_1_128);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_1_16);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_1_32);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_1_4);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_1_8);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_AUTO);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_PN420);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_PN595);
PRINT_CONSTANT((gint) GST_MPEGTS_GUARD_INTERVAL_PN945);
PRINT_CONSTANT((gint) GST_MPEGTS_HIERARCHY_1);
PRINT_CONSTANT((gint) GST_MPEGTS_HIERARCHY_2);
PRINT_CONSTANT((gint) GST_MPEGTS_HIERARCHY_4);
PRINT_CONSTANT((gint) GST_MPEGTS_HIERARCHY_AUTO);
PRINT_CONSTANT((gint) GST_MPEGTS_HIERARCHY_NONE);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_APSK_16);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_APSK_32);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_DQPSK);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_NONE);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_PSK_8);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QAM_128);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QAM_16);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QAM_256);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QAM_32);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QAM_4_NR_);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QAM_64);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QAM_AUTO);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_QPSK);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_VSB_16);
PRINT_CONSTANT((gint) GST_MPEGTS_MODULATION_VSB_8);
PRINT_CONSTANT((gint) GST_MPEGTS_POLARIZATION_CIRCULAR_LEFT);
PRINT_CONSTANT((gint) GST_MPEGTS_POLARIZATION_CIRCULAR_RIGHT);
PRINT_CONSTANT((gint) GST_MPEGTS_POLARIZATION_LINEAR_HORIZONTAL);
PRINT_CONSTANT((gint) GST_MPEGTS_POLARIZATION_LINEAR_VERTICAL);
PRINT_CONSTANT((gint) GST_MPEGTS_ROLLOFF_20);
PRINT_CONSTANT((gint) GST_MPEGTS_ROLLOFF_25);
PRINT_CONSTANT((gint) GST_MPEGTS_ROLLOFF_35);
PRINT_CONSTANT((gint) GST_MPEGTS_ROLLOFF_AUTO);
PRINT_CONSTANT((gint) GST_MPEGTS_ROLLOFF_RESERVED);
PRINT_CONSTANT((gint) GST_MPEGTS_RUNNING_STATUS_NOT_RUNNING);
PRINT_CONSTANT((gint) GST_MPEGTS_RUNNING_STATUS_OFF_AIR);
PRINT_CONSTANT((gint) GST_MPEGTS_RUNNING_STATUS_PAUSING);
PRINT_CONSTANT((gint) GST_MPEGTS_RUNNING_STATUS_RUNNING);
PRINT_CONSTANT((gint) GST_MPEGTS_RUNNING_STATUS_STARTS_IN_FEW_SECONDS);
PRINT_CONSTANT((gint) GST_MPEGTS_RUNNING_STATUS_UNDEFINED);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_ATSC_CVCT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_ATSC_EIT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_ATSC_ETT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_ATSC_MGT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_ATSC_RRT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_ATSC_STT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_ATSC_TVCT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_BAT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_CAT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_EIT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_NIT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_PAT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_PMT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_SCTE_SIT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_SDT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_TDT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_TOT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_TSDT);
PRINT_CONSTANT((gint) GST_MPEGTS_SECTION_UNKNOWN);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_AAC);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_AC_3);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_AVC);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_DTS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_MPEG1_LAYER2_AUDIO);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_MPEG2_VIDEO);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_SRM_CPCM);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_CONTENT_TELETEXT_OR_SUBTITLE);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_ADTS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_CLEAN);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_AUDIO_AAC_LATM);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG1);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_AUDIO_MPEG2);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_AUXILIARY);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_DSMCC_A);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_DSMCC_B);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_DSMCC_C);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_DSMCC_D);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_DSM_CC);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_H_222_1);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_IPMP_STREAM);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_METADATA_DATA_CAROUSEL);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_METADATA_PES_PACKETS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_METADATA_SECTIONS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_MHEG);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_MPEG2_IPMP);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_MPEG4_TIMED_TEXT);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_PRIVATE_PES_PACKETS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_PRIVATE_SECTIONS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_RESERVED_00);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_ASYNC_DATA);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_DSMCC_DCB);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_DST_NRT);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_ISOCH_DATA);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_SIGNALING);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_SIT);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_SUBTITLING);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SCTE_SYNC_DATA);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SL_FLEXMUX_SECTIONS);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_H264);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_HEVC);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_JP2K);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG1);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_MPEG4);
PRINT_CONSTANT((gint) GST_MPEGTS_STREAM_TYPE_VIDEO_RVC);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_16K);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_1K);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_2K);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_32K);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_4K);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_8K);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_AUTO);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_C1);
PRINT_CONSTANT((gint) GST_MPEGTS_TRANSMISSION_MODE_C3780);
PRINT_CONSTANT((gint) GST_MTS_DESC_AC3_AUDIO_STREAM);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_AC3);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_CAPTION_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_COMPONENT_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_CONTENT_ADVISORY);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_CRC32);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_DATA_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_DCC_ARRIVING_REQUEST);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_DCC_DEPARTING_REQUEST);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_DOWNLOAD_DESCRIPTOR);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_EAC3);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_ENHANCED_SIGNALING);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_EXTENDED_CHANNEL_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_GENRE);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_GROUP_LINK);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_MODULE_LINK);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_MULTIPROTOCOL_ENCAPSULATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_PID_COUNT);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_PRIVATE_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_REDISTRIBUTION_CONTROL);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_SERVICE_LOCATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_STUFFING);
PRINT_CONSTANT((gint) GST_MTS_DESC_ATSC_TIME_SHIFTED_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_DESC_AUDIO_STREAM);
PRINT_CONSTANT((gint) GST_MTS_DESC_AUXILIARY_VIDEO_STREAM);
PRINT_CONSTANT((gint) GST_MTS_DESC_AVC_TIMING_AND_HRD);
PRINT_CONSTANT((gint) GST_MTS_DESC_AVC_VIDEO);
PRINT_CONSTANT((gint) GST_MTS_DESC_CA);
PRINT_CONSTANT((gint) GST_MTS_DESC_CONTENT_LABELING);
PRINT_CONSTANT((gint) GST_MTS_DESC_COPYRIGHT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DATA_STREAM_ALIGNMENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DSMCC_ASSOCIATION_TAG);
PRINT_CONSTANT((gint) GST_MTS_DESC_DSMCC_CAROUSEL_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DSMCC_DEFERRED_ASSOCIATION_TAG);
PRINT_CONSTANT((gint) GST_MTS_DESC_DSMCC_NPT_ENDPOINT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DSMCC_NPT_REFERENCE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DSMCC_STREAM_EVENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DSMCC_STREAM_MODE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DTG_LOGICAL_CHANNEL);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_AAC);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_AC3);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_ADAPTATION_FIELD_DATA);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_ANCILLARY_DATA);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_ANNOUNCEMENT_SUPPORT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_APPLICATION_SIGNALLING);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_BOUQUET_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_CABLE_DELIVERY_SYSTEM);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_CA_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_CELL_FREQUENCY_LINK);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_CELL_LIST);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_COMPONENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_CONTENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_CONTENT_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_COUNTRY_AVAILABILITY);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_DATA_BROADCAST);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_DATA_BROADCAST_ID);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_DEFAULT_AUTHORITY);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_DSNG);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_DTS);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_ECM_REPETITION_RATE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_ENHANCED_AC3);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_EXTENDED_EVENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_EXTENSION);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_FREQUENCY_LIST);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_FTA_CONTENT_MANAGEMENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_LINKAGE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_LOCAL_TIME_OFFSET);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_MOSAIC);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_NETWORK_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_NVOD_REFERENCE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_PARENTAL_RATING);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_PARTIAL_TRANSPORT_STREAM);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_PDC);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_RELATED_CONTENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_S2_SATELLITE_DELIVERY_SYSTEM);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SATELLITE_DELIVERY_SYSTEM);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SCRAMBLING);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SERVICE_AVAILABILITY);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SERVICE_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SERVICE_LIST);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SERVICE_MOVE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SHORT_EVENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SHORT_SMOOTHING_BUFFER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_STREAM_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_STUFFING);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_SUBTITLING);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TELEPHONE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TELETEXT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TIMESLICE_FEC_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TIME_SHIFTED_EVENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TIME_SHIFTED_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TRANSPORT_STREAM);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_TVA_ID);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_VBI_DATA);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_VBI_TELETEXT);
PRINT_CONSTANT((gint) GST_MTS_DESC_DVB_XAIT_LOCATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXTERNAL_ES_ID);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_AC4);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_C2_DELIVERY_SYSTEM);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_CP);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_CPCM_DELIVERY_SIGNALLING);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_CP_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_DTS_HD_AUDIO_STREAM);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_DTS_NEUTRAL);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_IMAGE_ICON);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_MESSAGE);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_NETWORK_CHANGE_NOTIFY);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_SERVICE_RELOCATED);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_SH_DELIVERY_SYSTEM);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_SUPPLEMENTARY_AUDIO);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_T2MI);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_TARGET_REGION);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_TARGET_REGION_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_URI_LINKAGE);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_VIDEO_DEPTH_RANGE);
PRINT_CONSTANT((gint) GST_MTS_DESC_EXT_DVB_XAIT_PID);
PRINT_CONSTANT((gint) GST_MTS_DESC_FLEX_MUX_TIMING);
PRINT_CONSTANT((gint) GST_MTS_DESC_FMC);
PRINT_CONSTANT((gint) GST_MTS_DESC_FMX_BUFFER_SIZE);
PRINT_CONSTANT((gint) GST_MTS_DESC_HIERARCHY);
PRINT_CONSTANT((gint) GST_MTS_DESC_IBP);
PRINT_CONSTANT((gint) GST_MTS_DESC_IOD);
PRINT_CONSTANT((gint) GST_MTS_DESC_IPMP);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_AUDIO_COMPONENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_BASIC_LOCAL_EVENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_BOARD_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_BROADCASTER_NAME);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_CA_CONTRACT_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_CA_EMM_TS);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_CA_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_COMPONENT_GROUP);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_CONNECTED_TRANSMISSION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_CONTENT_AVAILABILITY);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_DATA_CONTENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_DIGITAL_COPY_CONTROL);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_DOWNLOAD_CONTENT);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_EVENT_GROUP);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_EXTENDED_BROADCASTER);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_HIERARCHICAL_TRANSMISSION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_HYPERLINK);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_LDT_LINKAGE);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_LOGO_TRANSMISSION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_NETWORK_IDENTIFICATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_NODE_RELATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_PARTIAL_TS_TIME);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_REFERENCE);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_SERIES);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_SERVICE_GROUP);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_SHORT_NODE_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_SI_PARAMETER);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_SI_PRIME_TS);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_STC_REFERENCE);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_TARGET_REGION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_TS_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISDB_VIDEO_DECODE_CONTROL);
PRINT_CONSTANT((gint) GST_MTS_DESC_ISO_639_LANGUAGE);
PRINT_CONSTANT((gint) GST_MTS_DESC_J2K_VIDEO);
PRINT_CONSTANT((gint) GST_MTS_DESC_MAXIMUM_BITRATE);
PRINT_CONSTANT((gint) GST_MTS_DESC_METADATA);
PRINT_CONSTANT((gint) GST_MTS_DESC_METADATA_POINTER);
PRINT_CONSTANT((gint) GST_MTS_DESC_METADATA_STD);
PRINT_CONSTANT((gint) GST_MTS_DESC_MPEG2_AAC_AUDIO);
PRINT_CONSTANT((gint) GST_MTS_DESC_MPEG2_STEREOSCOPIC_VIDEO_FORMAT);
PRINT_CONSTANT((gint) GST_MTS_DESC_MPEG4_AUDIO);
PRINT_CONSTANT((gint) GST_MTS_DESC_MPEG4_AUDIO_EXTENSION);
PRINT_CONSTANT((gint) GST_MTS_DESC_MPEG4_TEXT);
PRINT_CONSTANT((gint) GST_MTS_DESC_MPEG4_VIDEO);
PRINT_CONSTANT((gint) GST_MTS_DESC_MULTIPLEX_BUFFER);
PRINT_CONSTANT((gint) GST_MTS_DESC_MULTIPLEX_BUFFER_UTILISATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_MUX_CODE);
PRINT_CONSTANT((gint) GST_MTS_DESC_MVC_EXTENSION);
PRINT_CONSTANT((gint) GST_MTS_DESC_MVC_OPERATION_POINT);
PRINT_CONSTANT((gint) GST_MTS_DESC_PRIVATE_DATA_INDICATOR);
PRINT_CONSTANT((gint) GST_MTS_DESC_REGISTRATION);
PRINT_CONSTANT((gint) GST_MTS_DESC_RESERVED_00);
PRINT_CONSTANT((gint) GST_MTS_DESC_RESERVED_01);
PRINT_CONSTANT((gint) GST_MTS_DESC_SL);
PRINT_CONSTANT((gint) GST_MTS_DESC_SMOOTHING_BUFFER);
PRINT_CONSTANT((gint) GST_MTS_DESC_STD);
PRINT_CONSTANT((gint) GST_MTS_DESC_STEREOSCOPIC_PROGRAM_INFO);
PRINT_CONSTANT((gint) GST_MTS_DESC_STEREOSCOPIC_VIDEO_INFO);
PRINT_CONSTANT((gint) GST_MTS_DESC_SVC_EXTENSION);
PRINT_CONSTANT((gint) GST_MTS_DESC_SYSTEM_CLOCK);
PRINT_CONSTANT((gint) GST_MTS_DESC_TARGET_BACKGROUND_GRID);
PRINT_CONSTANT((gint) GST_MTS_DESC_VIDEO_STREAM);
PRINT_CONSTANT((gint) GST_MTS_DESC_VIDEO_WINDOW);
PRINT_CONSTANT((gint) GST_MTS_SCTE_DESC_AUDIO);
PRINT_CONSTANT((gint) GST_MTS_SCTE_DESC_AVAIL);
PRINT_CONSTANT((gint) GST_MTS_SCTE_DESC_DTMF);
PRINT_CONSTANT((gint) GST_MTS_SCTE_DESC_SEGMENTATION);
PRINT_CONSTANT((gint) GST_MTS_SCTE_DESC_TIME);
PRINT_CONSTANT((gint) GST_MTS_SCTE_SPLICE_COMMAND_BANDWIDTH);
PRINT_CONSTANT((gint) GST_MTS_SCTE_SPLICE_COMMAND_INSERT);
PRINT_CONSTANT((gint) GST_MTS_SCTE_SPLICE_COMMAND_NULL);
PRINT_CONSTANT((gint) GST_MTS_SCTE_SPLICE_COMMAND_PRIVATE);
PRINT_CONSTANT((gint) GST_MTS_SCTE_SPLICE_COMMAND_SCHEDULE);
PRINT_CONSTANT((gint) GST_MTS_SCTE_SPLICE_COMMAND_TIME);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_14496_OBJET_DESCRIPTOR);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_14496_SCENE_DESCRIPTION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_APPLICATION_INFORMATION_TABLE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_AGGREGATE_DATA_EVENT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_AGGREGATE_EVENT_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_AGGREGATE_EXTENDED_TEXT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_CABLE_VIRTUAL_CHANNEL);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_CHANNEL_OR_EVENT_EXTENDED_TEXT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_DATA_EVENT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_DATA_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_DIRECTED_CHANNEL_CHANGE_SECTION_CODE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_EVENT_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_LONG_TERM_SERVICE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_MASTER_GUIDE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_NETWORK_RESOURCE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_RATING_REGION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_SATELLITE_VIRTUAL_CHANNEL);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_SYSTEM_TIME);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_ATSC_TERRESTRIAL_VIRTUAL_CHANNEL);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_BOUQUET_ASSOCIATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CA_MESSAGE_ECM_0);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CA_MESSAGE_ECM_1);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_1);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CA_MESSAGE_SYSTEM_PRIVATE_N);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CMT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CONDITIONAL_ACCESS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CONTAINER);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_CONTENT_IDENTIFIER);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_DISCONTINUITY_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_DSM_CC_ADDRESSABLE_SECTIONS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGES);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_DSM_CC_MULTIPROTO_ENCAPSULATED_DATA);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_DSM_CC_PRIVATE_DATA);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_DSM_CC_STREAM_DESCRIPTORS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_DSM_CC_U_N_MESSAGES);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_PRESENT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_1);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_EVENT_INFORMATION_ACTUAL_TS_SCHEDULE_N);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_PRESENT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_1);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_EVENT_INFORMATION_OTHER_TS_SCHEDULE_N);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_FCT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_IPMP_CONTROL_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_LL_FEC_PARITY_DATA_TABLE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_METADATA);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_MPE_FEC);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_MPE_IFEC);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_NETWORK_INFORMATION_ACTUAL_NETWORK);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_NETWORK_INFORMATION_OTHER_NETWORK);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_PCR_PACKET_PAYLOAD);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_PROGRAM_ASSOCIATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_RELATED_CONTENT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_RESOLUTION_NOTIFICATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_RUNNING_STATUS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCTE_DDB);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCTE_DII);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCTE_EAS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCTE_EBIF);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCTE_EISS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCTE_RESERVED);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SCTE_SPLICE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SELECTION_INFORMATION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_ACTUAL_TS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SERVICE_DESCRIPTION_OTHER_TS);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_SPT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_STUFFING);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TBTP);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TCT);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TIM);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TIME_DATE);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TIME_OFFSET);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TRANSMISSION_MODE_SUPPORT_PAYLOAD);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TS_DESCRIPTION);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_TS_PROGRAM_MAP);
PRINT_CONSTANT((gint) GST_MTS_TABLE_ID_UNSET);
PRINT_CONSTANT((gint) HEARING_IMPAIRED_PAGE);
PRINT_CONSTANT((gint) INITIAL_PAGE);
PRINT_CONSTANT((gint) PROGRAMME_SCHEDULE_PAGE);
PRINT_CONSTANT((gint) SUBTITLE_PAGE);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,91 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstMpegtsATSCDescriptorType", sizeof(GstMpegtsATSCDescriptorType), alignof(GstMpegtsATSCDescriptorType));
printf("%s;%zu;%zu\n", "GstMpegtsAtscEIT", sizeof(GstMpegtsAtscEIT), alignof(GstMpegtsAtscEIT));
printf("%s;%zu;%zu\n", "GstMpegtsAtscEITEvent", sizeof(GstMpegtsAtscEITEvent), alignof(GstMpegtsAtscEITEvent));
printf("%s;%zu;%zu\n", "GstMpegtsAtscETT", sizeof(GstMpegtsAtscETT), alignof(GstMpegtsAtscETT));
printf("%s;%zu;%zu\n", "GstMpegtsAtscMGT", sizeof(GstMpegtsAtscMGT), alignof(GstMpegtsAtscMGT));
printf("%s;%zu;%zu\n", "GstMpegtsAtscMGTTable", sizeof(GstMpegtsAtscMGTTable), alignof(GstMpegtsAtscMGTTable));
printf("%s;%zu;%zu\n", "GstMpegtsAtscMGTTableType", sizeof(GstMpegtsAtscMGTTableType), alignof(GstMpegtsAtscMGTTableType));
printf("%s;%zu;%zu\n", "GstMpegtsAtscMultString", sizeof(GstMpegtsAtscMultString), alignof(GstMpegtsAtscMultString));
printf("%s;%zu;%zu\n", "GstMpegtsAtscRRT", sizeof(GstMpegtsAtscRRT), alignof(GstMpegtsAtscRRT));
printf("%s;%zu;%zu\n", "GstMpegtsAtscRRTDimension", sizeof(GstMpegtsAtscRRTDimension), alignof(GstMpegtsAtscRRTDimension));
printf("%s;%zu;%zu\n", "GstMpegtsAtscRRTDimensionValue", sizeof(GstMpegtsAtscRRTDimensionValue), alignof(GstMpegtsAtscRRTDimensionValue));
printf("%s;%zu;%zu\n", "GstMpegtsAtscSTT", sizeof(GstMpegtsAtscSTT), alignof(GstMpegtsAtscSTT));
printf("%s;%zu;%zu\n", "GstMpegtsAtscStringSegment", sizeof(GstMpegtsAtscStringSegment), alignof(GstMpegtsAtscStringSegment));
printf("%s;%zu;%zu\n", "GstMpegtsAtscVCT", sizeof(GstMpegtsAtscVCT), alignof(GstMpegtsAtscVCT));
printf("%s;%zu;%zu\n", "GstMpegtsAtscVCTSource", sizeof(GstMpegtsAtscVCTSource), alignof(GstMpegtsAtscVCTSource));
printf("%s;%zu;%zu\n", "GstMpegtsBAT", sizeof(GstMpegtsBAT), alignof(GstMpegtsBAT));
printf("%s;%zu;%zu\n", "GstMpegtsBATStream", sizeof(GstMpegtsBATStream), alignof(GstMpegtsBATStream));
printf("%s;%zu;%zu\n", "GstMpegtsCableDeliverySystemDescriptor", sizeof(GstMpegtsCableDeliverySystemDescriptor), alignof(GstMpegtsCableDeliverySystemDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsCableOuterFECScheme", sizeof(GstMpegtsCableOuterFECScheme), alignof(GstMpegtsCableOuterFECScheme));
printf("%s;%zu;%zu\n", "GstMpegtsComponentDescriptor", sizeof(GstMpegtsComponentDescriptor), alignof(GstMpegtsComponentDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsComponentStreamContent", sizeof(GstMpegtsComponentStreamContent), alignof(GstMpegtsComponentStreamContent));
printf("%s;%zu;%zu\n", "GstMpegtsContent", sizeof(GstMpegtsContent), alignof(GstMpegtsContent));
printf("%s;%zu;%zu\n", "GstMpegtsContentNibbleHi", sizeof(GstMpegtsContentNibbleHi), alignof(GstMpegtsContentNibbleHi));
printf("%s;%zu;%zu\n", "GstMpegtsDVBCodeRate", sizeof(GstMpegtsDVBCodeRate), alignof(GstMpegtsDVBCodeRate));
printf("%s;%zu;%zu\n", "GstMpegtsDVBDescriptorType", sizeof(GstMpegtsDVBDescriptorType), alignof(GstMpegtsDVBDescriptorType));
printf("%s;%zu;%zu\n", "GstMpegtsDVBExtendedDescriptorType", sizeof(GstMpegtsDVBExtendedDescriptorType), alignof(GstMpegtsDVBExtendedDescriptorType));
printf("%s;%zu;%zu\n", "GstMpegtsDVBLinkageDescriptor", sizeof(GstMpegtsDVBLinkageDescriptor), alignof(GstMpegtsDVBLinkageDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsDVBLinkageEvent", sizeof(GstMpegtsDVBLinkageEvent), alignof(GstMpegtsDVBLinkageEvent));
printf("%s;%zu;%zu\n", "GstMpegtsDVBLinkageExtendedEvent", sizeof(GstMpegtsDVBLinkageExtendedEvent), alignof(GstMpegtsDVBLinkageExtendedEvent));
printf("%s;%zu;%zu\n", "GstMpegtsDVBLinkageHandOverType", sizeof(GstMpegtsDVBLinkageHandOverType), alignof(GstMpegtsDVBLinkageHandOverType));
printf("%s;%zu;%zu\n", "GstMpegtsDVBLinkageMobileHandOver", sizeof(GstMpegtsDVBLinkageMobileHandOver), alignof(GstMpegtsDVBLinkageMobileHandOver));
printf("%s;%zu;%zu\n", "GstMpegtsDVBLinkageType", sizeof(GstMpegtsDVBLinkageType), alignof(GstMpegtsDVBLinkageType));
printf("%s;%zu;%zu\n", "GstMpegtsDVBParentalRatingItem", sizeof(GstMpegtsDVBParentalRatingItem), alignof(GstMpegtsDVBParentalRatingItem));
printf("%s;%zu;%zu\n", "GstMpegtsDVBScramblingModeType", sizeof(GstMpegtsDVBScramblingModeType), alignof(GstMpegtsDVBScramblingModeType));
printf("%s;%zu;%zu\n", "GstMpegtsDVBServiceListItem", sizeof(GstMpegtsDVBServiceListItem), alignof(GstMpegtsDVBServiceListItem));
printf("%s;%zu;%zu\n", "GstMpegtsDVBServiceType", sizeof(GstMpegtsDVBServiceType), alignof(GstMpegtsDVBServiceType));
printf("%s;%zu;%zu\n", "GstMpegtsDVBTeletextType", sizeof(GstMpegtsDVBTeletextType), alignof(GstMpegtsDVBTeletextType));
printf("%s;%zu;%zu\n", "GstMpegtsDataBroadcastDescriptor", sizeof(GstMpegtsDataBroadcastDescriptor), alignof(GstMpegtsDataBroadcastDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsDescriptor", sizeof(GstMpegtsDescriptor), alignof(GstMpegtsDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsDescriptorType", sizeof(GstMpegtsDescriptorType), alignof(GstMpegtsDescriptorType));
printf("%s;%zu;%zu\n", "GstMpegtsDvbMultilingualBouquetNameItem", sizeof(GstMpegtsDvbMultilingualBouquetNameItem), alignof(GstMpegtsDvbMultilingualBouquetNameItem));
printf("%s;%zu;%zu\n", "GstMpegtsDvbMultilingualComponentItem", sizeof(GstMpegtsDvbMultilingualComponentItem), alignof(GstMpegtsDvbMultilingualComponentItem));
printf("%s;%zu;%zu\n", "GstMpegtsDvbMultilingualNetworkNameItem", sizeof(GstMpegtsDvbMultilingualNetworkNameItem), alignof(GstMpegtsDvbMultilingualNetworkNameItem));
printf("%s;%zu;%zu\n", "GstMpegtsDvbMultilingualServiceNameItem", sizeof(GstMpegtsDvbMultilingualServiceNameItem), alignof(GstMpegtsDvbMultilingualServiceNameItem));
printf("%s;%zu;%zu\n", "GstMpegtsEIT", sizeof(GstMpegtsEIT), alignof(GstMpegtsEIT));
printf("%s;%zu;%zu\n", "GstMpegtsEITEvent", sizeof(GstMpegtsEITEvent), alignof(GstMpegtsEITEvent));
printf("%s;%zu;%zu\n", "GstMpegtsExtendedEventDescriptor", sizeof(GstMpegtsExtendedEventDescriptor), alignof(GstMpegtsExtendedEventDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsExtendedEventItem", sizeof(GstMpegtsExtendedEventItem), alignof(GstMpegtsExtendedEventItem));
printf("%s;%zu;%zu\n", "GstMpegtsISDBDescriptorType", sizeof(GstMpegtsISDBDescriptorType), alignof(GstMpegtsISDBDescriptorType));
printf("%s;%zu;%zu\n", "GstMpegtsISO639LanguageDescriptor", sizeof(GstMpegtsISO639LanguageDescriptor), alignof(GstMpegtsISO639LanguageDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsIso639AudioType", sizeof(GstMpegtsIso639AudioType), alignof(GstMpegtsIso639AudioType));
printf("%s;%zu;%zu\n", "GstMpegtsLogicalChannel", sizeof(GstMpegtsLogicalChannel), alignof(GstMpegtsLogicalChannel));
printf("%s;%zu;%zu\n", "GstMpegtsLogicalChannelDescriptor", sizeof(GstMpegtsLogicalChannelDescriptor), alignof(GstMpegtsLogicalChannelDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsMiscDescriptorType", sizeof(GstMpegtsMiscDescriptorType), alignof(GstMpegtsMiscDescriptorType));
printf("%s;%zu;%zu\n", "GstMpegtsModulationType", sizeof(GstMpegtsModulationType), alignof(GstMpegtsModulationType));
printf("%s;%zu;%zu\n", "GstMpegtsNIT", sizeof(GstMpegtsNIT), alignof(GstMpegtsNIT));
printf("%s;%zu;%zu\n", "GstMpegtsNITStream", sizeof(GstMpegtsNITStream), alignof(GstMpegtsNITStream));
printf("%s;%zu;%zu\n", "GstMpegtsPMT", sizeof(GstMpegtsPMT), alignof(GstMpegtsPMT));
printf("%s;%zu;%zu\n", "GstMpegtsPMTStream", sizeof(GstMpegtsPMTStream), alignof(GstMpegtsPMTStream));
printf("%s;%zu;%zu\n", "GstMpegtsPatProgram", sizeof(GstMpegtsPatProgram), alignof(GstMpegtsPatProgram));
printf("%s;%zu;%zu\n", "GstMpegtsRunningStatus", sizeof(GstMpegtsRunningStatus), alignof(GstMpegtsRunningStatus));
printf("%s;%zu;%zu\n", "GstMpegtsSCTESIT", sizeof(GstMpegtsSCTESIT), alignof(GstMpegtsSCTESIT));
printf("%s;%zu;%zu\n", "GstMpegtsSCTESpliceCommandType", sizeof(GstMpegtsSCTESpliceCommandType), alignof(GstMpegtsSCTESpliceCommandType));
printf("%s;%zu;%zu\n", "GstMpegtsSCTESpliceDescriptor", sizeof(GstMpegtsSCTESpliceDescriptor), alignof(GstMpegtsSCTESpliceDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsSCTESpliceEvent", sizeof(GstMpegtsSCTESpliceEvent), alignof(GstMpegtsSCTESpliceEvent));
printf("%s;%zu;%zu\n", "GstMpegtsSDT", sizeof(GstMpegtsSDT), alignof(GstMpegtsSDT));
printf("%s;%zu;%zu\n", "GstMpegtsSDTService", sizeof(GstMpegtsSDTService), alignof(GstMpegtsSDTService));
printf("%s;%zu;%zu\n", "GstMpegtsSatelliteDeliverySystemDescriptor", sizeof(GstMpegtsSatelliteDeliverySystemDescriptor), alignof(GstMpegtsSatelliteDeliverySystemDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsSatellitePolarizationType", sizeof(GstMpegtsSatellitePolarizationType), alignof(GstMpegtsSatellitePolarizationType));
printf("%s;%zu;%zu\n", "GstMpegtsSatelliteRolloff", sizeof(GstMpegtsSatelliteRolloff), alignof(GstMpegtsSatelliteRolloff));
printf("%s;%zu;%zu\n", "GstMpegtsScteStreamType", sizeof(GstMpegtsScteStreamType), alignof(GstMpegtsScteStreamType));
printf("%s;%zu;%zu\n", "GstMpegtsSection", sizeof(GstMpegtsSection), alignof(GstMpegtsSection));
printf("%s;%zu;%zu\n", "GstMpegtsSectionATSCTableID", sizeof(GstMpegtsSectionATSCTableID), alignof(GstMpegtsSectionATSCTableID));
printf("%s;%zu;%zu\n", "GstMpegtsSectionDVBTableID", sizeof(GstMpegtsSectionDVBTableID), alignof(GstMpegtsSectionDVBTableID));
printf("%s;%zu;%zu\n", "GstMpegtsSectionSCTETableID", sizeof(GstMpegtsSectionSCTETableID), alignof(GstMpegtsSectionSCTETableID));
printf("%s;%zu;%zu\n", "GstMpegtsSectionTableID", sizeof(GstMpegtsSectionTableID), alignof(GstMpegtsSectionTableID));
printf("%s;%zu;%zu\n", "GstMpegtsSectionType", sizeof(GstMpegtsSectionType), alignof(GstMpegtsSectionType));
printf("%s;%zu;%zu\n", "GstMpegtsStreamType", sizeof(GstMpegtsStreamType), alignof(GstMpegtsStreamType));
printf("%s;%zu;%zu\n", "GstMpegtsT2DeliverySystemCell", sizeof(GstMpegtsT2DeliverySystemCell), alignof(GstMpegtsT2DeliverySystemCell));
printf("%s;%zu;%zu\n", "GstMpegtsT2DeliverySystemCellExtension", sizeof(GstMpegtsT2DeliverySystemCellExtension), alignof(GstMpegtsT2DeliverySystemCellExtension));
printf("%s;%zu;%zu\n", "GstMpegtsT2DeliverySystemDescriptor", sizeof(GstMpegtsT2DeliverySystemDescriptor), alignof(GstMpegtsT2DeliverySystemDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsTOT", sizeof(GstMpegtsTOT), alignof(GstMpegtsTOT));
printf("%s;%zu;%zu\n", "GstMpegtsTerrestrialDeliverySystemDescriptor", sizeof(GstMpegtsTerrestrialDeliverySystemDescriptor), alignof(GstMpegtsTerrestrialDeliverySystemDescriptor));
printf("%s;%zu;%zu\n", "GstMpegtsTerrestrialGuardInterval", sizeof(GstMpegtsTerrestrialGuardInterval), alignof(GstMpegtsTerrestrialGuardInterval));
printf("%s;%zu;%zu\n", "GstMpegtsTerrestrialHierarchy", sizeof(GstMpegtsTerrestrialHierarchy), alignof(GstMpegtsTerrestrialHierarchy));
printf("%s;%zu;%zu\n", "GstMpegtsTerrestrialTransmissionMode", sizeof(GstMpegtsTerrestrialTransmissionMode), alignof(GstMpegtsTerrestrialTransmissionMode));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_net_sys::*; use gstreamer_net_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,37 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT(GST_NET_TIME_PACKET_SIZE);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT(GST_PTP_CLOCK_ID_NONE);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT(GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT(GST_PTP_STATISTICS_NEW_DOMAIN_FOUND);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT(GST_PTP_STATISTICS_PATH_DELAY_MEASURED);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT(GST_PTP_STATISTICS_TIME_UPDATED);
short int: "###gir test###%hd###gir test###\n",
unsigned short int: "###gir test###%hu###gir test###\n",
int: "###gir test###%d###gir test###\n",
unsigned int: "###gir test###%u###gir test###\n",
long: "###gir test###%ld###gir test###\n",
unsigned long: "###gir test###%lu###gir test###\n",
long long: "###gir test###%lld###gir test###\n",
unsigned long long: "###gir test###%llu###gir test###\n",
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,16 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstNetAddressMeta", sizeof(GstNetAddressMeta), alignof(GstNetAddressMeta));
printf("%s;%zu;%zu\n", "GstNetClientClock", sizeof(GstNetClientClock), alignof(GstNetClientClock));
printf("%s;%zu;%zu\n", "GstNetClientClockClass", sizeof(GstNetClientClockClass), alignof(GstNetClientClockClass));
printf("%s;%zu;%zu\n", "GstNetControlMessageMeta", sizeof(GstNetControlMessageMeta), alignof(GstNetControlMessageMeta));
printf("%s;%zu;%zu\n", "GstNetTimePacket", sizeof(GstNetTimePacket), alignof(GstNetTimePacket));
printf("%s;%zu;%zu\n", "GstNetTimeProvider", sizeof(GstNetTimeProvider), alignof(GstNetTimeProvider));
printf("%s;%zu;%zu\n", "GstNetTimeProviderClass", sizeof(GstNetTimeProviderClass), alignof(GstNetTimeProviderClass));
printf("%s;%zu;%zu\n", "GstNtpClock", sizeof(GstNtpClock), alignof(GstNtpClock));
printf("%s;%zu;%zu\n", "GstNtpClockClass", sizeof(GstNtpClockClass), alignof(GstNtpClockClass));
printf("%s;%zu;%zu\n", "GstPtpClock", sizeof(GstPtpClock), alignof(GstPtpClock));
printf("%s;%zu;%zu\n", "GstPtpClockClass", sizeof(GstPtpClockClass), alignof(GstPtpClockClass));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_pbutils_sys::*; use gstreamer_pbutils_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,68 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_NONE);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GST_DISCOVERER_BUSY);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GST_DISCOVERER_ERROR);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GST_DISCOVERER_MISSING_PLUGINS);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((gint) GST_DISCOVERER_OK);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT((guint) GST_DISCOVERER_SERIALIZE_ALL);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT((guint) GST_DISCOVERER_SERIALIZE_BASIC);
ABI_CONSTANT_NAME); PRINT_CONSTANT((guint) GST_DISCOVERER_SERIALIZE_CAPS);
PRINT_CONSTANT((guint) GST_DISCOVERER_SERIALIZE_MISC);
PRINT_CONSTANT((guint) GST_DISCOVERER_SERIALIZE_TAGS);
PRINT_CONSTANT((gint) GST_DISCOVERER_TIMEOUT);
PRINT_CONSTANT((gint) GST_DISCOVERER_URI_INVALID);
PRINT_CONSTANT(GST_ENCODING_CATEGORY_CAPTURE);
PRINT_CONSTANT(GST_ENCODING_CATEGORY_DEVICE);
PRINT_CONSTANT(GST_ENCODING_CATEGORY_FILE_EXTENSION);
PRINT_CONSTANT(GST_ENCODING_CATEGORY_ONLINE_SERVICE);
PRINT_CONSTANT(GST_ENCODING_CATEGORY_STORAGE_EDITING);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_CRASHED);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_ERROR);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_HELPER_MISSING);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_INSTALL_IN_PROGRESS);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_INTERNAL_FAILURE);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_INVALID);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_NOT_FOUND);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_PARTIAL_SUCCESS);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_STARTED_OK);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_SUCCESS);
PRINT_CONSTANT((gint) GST_INSTALL_PLUGINS_USER_ABORT);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,20 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstAudioVisualizer", sizeof(GstAudioVisualizer), alignof(GstAudioVisualizer));
printf("%s;%zu;%zu\n", "GstAudioVisualizerClass", sizeof(GstAudioVisualizerClass), alignof(GstAudioVisualizerClass));
printf("%s;%zu;%zu\n", "GstAudioVisualizerShader", sizeof(GstAudioVisualizerShader), alignof(GstAudioVisualizerShader));
printf("%s;%zu;%zu\n", "GstDiscoverer", sizeof(GstDiscoverer), alignof(GstDiscoverer));
printf("%s;%zu;%zu\n", "GstDiscovererAudioInfoClass", sizeof(GstDiscovererAudioInfoClass), alignof(GstDiscovererAudioInfoClass));
printf("%s;%zu;%zu\n", "GstDiscovererClass", sizeof(GstDiscovererClass), alignof(GstDiscovererClass));
printf("%s;%zu;%zu\n", "GstDiscovererContainerInfoClass", sizeof(GstDiscovererContainerInfoClass), alignof(GstDiscovererContainerInfoClass));
printf("%s;%zu;%zu\n", "GstDiscovererInfoClass", sizeof(GstDiscovererInfoClass), alignof(GstDiscovererInfoClass));
printf("%s;%zu;%zu\n", "GstDiscovererResult", sizeof(GstDiscovererResult), alignof(GstDiscovererResult));
printf("%s;%zu;%zu\n", "GstDiscovererSerializeFlags", sizeof(GstDiscovererSerializeFlags), alignof(GstDiscovererSerializeFlags));
printf("%s;%zu;%zu\n", "GstDiscovererStreamInfoClass", sizeof(GstDiscovererStreamInfoClass), alignof(GstDiscovererStreamInfoClass));
printf("%s;%zu;%zu\n", "GstDiscovererSubtitleInfoClass", sizeof(GstDiscovererSubtitleInfoClass), alignof(GstDiscovererSubtitleInfoClass));
printf("%s;%zu;%zu\n", "GstDiscovererVideoInfoClass", sizeof(GstDiscovererVideoInfoClass), alignof(GstDiscovererVideoInfoClass));
printf("%s;%zu;%zu\n", "GstEncodingTargetClass", sizeof(GstEncodingTargetClass), alignof(GstEncodingTargetClass));
printf("%s;%zu;%zu\n", "GstInstallPluginsReturn", sizeof(GstInstallPluginsReturn), alignof(GstInstallPluginsReturn));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_player_sys::*; use gstreamer_player_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,45 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_BRIGHTNESS);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_CONTRAST);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_HUE);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_SATURATION);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_ERROR_FAILED);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_STATE_BUFFERING);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_STATE_PAUSED);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_STATE_PLAYING);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_STATE_STOPPED);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_JPG);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_PNG);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_RAW_BGRx);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_RAW_NATIVE);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_RAW_xRGB);
double: "###gir test###%f###gir test###\n",
long double: "###gir test###%ld###gir test###\n"),
ABI_CONSTANT_NAME);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,12 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstPlayerColorBalanceType", sizeof(GstPlayerColorBalanceType), alignof(GstPlayerColorBalanceType));
printf("%s;%zu;%zu\n", "GstPlayerError", sizeof(GstPlayerError), alignof(GstPlayerError));
printf("%s;%zu;%zu\n", "GstPlayerSignalDispatcherInterface", sizeof(GstPlayerSignalDispatcherInterface), alignof(GstPlayerSignalDispatcherInterface));
printf("%s;%zu;%zu\n", "GstPlayerSnapshotFormat", sizeof(GstPlayerSnapshotFormat), alignof(GstPlayerSnapshotFormat));
printf("%s;%zu;%zu\n", "GstPlayerState", sizeof(GstPlayerState), alignof(GstPlayerState));
printf("%s;%zu;%zu\n", "GstPlayerVideoRendererInterface", sizeof(GstPlayerVideoRendererInterface), alignof(GstPlayerVideoRendererInterface));
printf("%s;%zu;%zu\n", "GstPlayerVisualization", sizeof(GstPlayerVisualization), alignof(GstPlayerVisualization));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_rtp_sys::*; use gstreamer_rtp_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,158 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((gint) GST_RTCP_FB_TYPE_INVALID);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT(GST_RTCP_MAX_BYE_SSRC_COUNT);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT(GST_RTCP_MAX_RB_COUNT);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT(GST_RTCP_MAX_SDES);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT(GST_RTCP_MAX_SDES_ITEM_COUNT);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_AFB);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_FIR);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_PLI);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_RPSI);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_SLI);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_TSTN);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_TSTR);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_VBCN);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT(GST_RTCP_REDUCED_SIZE_VALID_MASK);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT((gint) GST_RTCP_RTPFB_TYPE_NACK);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT((gint) GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ);
ABI_CONSTANT_NAME); PRINT_CONSTANT((gint) GST_RTCP_RTPFB_TYPE_TMMBN);
PRINT_CONSTANT((gint) GST_RTCP_RTPFB_TYPE_TMMBR);
PRINT_CONSTANT((gint) GST_RTCP_RTPFB_TYPE_TWCC);
PRINT_CONSTANT((gint) GST_RTCP_SDES_CNAME);
PRINT_CONSTANT((gint) GST_RTCP_SDES_EMAIL);
PRINT_CONSTANT((gint) GST_RTCP_SDES_END);
PRINT_CONSTANT((gint) GST_RTCP_SDES_INVALID);
PRINT_CONSTANT((gint) GST_RTCP_SDES_LOC);
PRINT_CONSTANT((gint) GST_RTCP_SDES_NAME);
PRINT_CONSTANT((gint) GST_RTCP_SDES_NOTE);
PRINT_CONSTANT((gint) GST_RTCP_SDES_PHONE);
PRINT_CONSTANT((gint) GST_RTCP_SDES_PRIV);
PRINT_CONSTANT((gint) GST_RTCP_SDES_TOOL);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_APP);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_BYE);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_INVALID);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_PSFB);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_RR);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_RTPFB);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_SDES);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_SR);
PRINT_CONSTANT((gint) GST_RTCP_TYPE_XR);
PRINT_CONSTANT(GST_RTCP_VALID_MASK);
PRINT_CONSTANT(GST_RTCP_VALID_VALUE);
PRINT_CONSTANT(GST_RTCP_VERSION);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_DLRR);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_DRLE);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_INVALID);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_LRLE);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_PRT);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_RRT);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_SSUMM);
PRINT_CONSTANT((gint) GST_RTCP_XR_TYPE_VOIP_METRICS);
PRINT_CONSTANT((guint) GST_RTP_BUFFER_FLAG_LAST);
PRINT_CONSTANT((guint) GST_RTP_BUFFER_FLAG_REDUNDANT);
PRINT_CONSTANT((guint) GST_RTP_BUFFER_FLAG_RETRANSMISSION);
PRINT_CONSTANT((guint) GST_RTP_BUFFER_MAP_FLAG_LAST);
PRINT_CONSTANT((guint) GST_RTP_BUFFER_MAP_FLAG_SKIP_PADDING);
PRINT_CONSTANT(GST_RTP_HDREXT_BASE);
PRINT_CONSTANT(GST_RTP_HDREXT_NTP_56);
PRINT_CONSTANT(GST_RTP_HDREXT_NTP_56_SIZE);
PRINT_CONSTANT(GST_RTP_HDREXT_NTP_64);
PRINT_CONSTANT(GST_RTP_HDREXT_NTP_64_SIZE);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_1016);
PRINT_CONSTANT(GST_RTP_PAYLOAD_1016_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_CELLB);
PRINT_CONSTANT(GST_RTP_PAYLOAD_CELLB_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_CN);
PRINT_CONSTANT(GST_RTP_PAYLOAD_CN_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_DVI4_11025);
PRINT_CONSTANT(GST_RTP_PAYLOAD_DVI4_11025_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_DVI4_16000);
PRINT_CONSTANT(GST_RTP_PAYLOAD_DVI4_16000_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_DVI4_22050);
PRINT_CONSTANT(GST_RTP_PAYLOAD_DVI4_22050_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_DVI4_8000);
PRINT_CONSTANT(GST_RTP_PAYLOAD_DVI4_8000_STRING);
PRINT_CONSTANT(GST_RTP_PAYLOAD_DYNAMIC_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_G721);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G721_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_G722);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G722_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_G723);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G723_53);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G723_53_STRING);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G723_63);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G723_63_STRING);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G723_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_G728);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G728_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_G729);
PRINT_CONSTANT(GST_RTP_PAYLOAD_G729_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_GSM);
PRINT_CONSTANT(GST_RTP_PAYLOAD_GSM_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_H261);
PRINT_CONSTANT(GST_RTP_PAYLOAD_H261_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_H263);
PRINT_CONSTANT(GST_RTP_PAYLOAD_H263_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_JPEG);
PRINT_CONSTANT(GST_RTP_PAYLOAD_JPEG_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_L16_MONO);
PRINT_CONSTANT(GST_RTP_PAYLOAD_L16_MONO_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_L16_STEREO);
PRINT_CONSTANT(GST_RTP_PAYLOAD_L16_STEREO_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_LPC);
PRINT_CONSTANT(GST_RTP_PAYLOAD_LPC_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_MP2T);
PRINT_CONSTANT(GST_RTP_PAYLOAD_MP2T_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_MPA);
PRINT_CONSTANT(GST_RTP_PAYLOAD_MPA_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_MPV);
PRINT_CONSTANT(GST_RTP_PAYLOAD_MPV_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_NV);
PRINT_CONSTANT(GST_RTP_PAYLOAD_NV_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_PCMA);
PRINT_CONSTANT(GST_RTP_PAYLOAD_PCMA_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_PCMU);
PRINT_CONSTANT(GST_RTP_PAYLOAD_PCMU_STRING);
PRINT_CONSTANT((gint) GST_RTP_PAYLOAD_QCELP);
PRINT_CONSTANT(GST_RTP_PAYLOAD_QCELP_STRING);
PRINT_CONSTANT(GST_RTP_PAYLOAD_TS41);
PRINT_CONSTANT(GST_RTP_PAYLOAD_TS41_STRING);
PRINT_CONSTANT(GST_RTP_PAYLOAD_TS48);
PRINT_CONSTANT(GST_RTP_PAYLOAD_TS48_STRING);
PRINT_CONSTANT((gint) GST_RTP_PROFILE_AVP);
PRINT_CONSTANT((gint) GST_RTP_PROFILE_AVPF);
PRINT_CONSTANT((gint) GST_RTP_PROFILE_SAVP);
PRINT_CONSTANT((gint) GST_RTP_PROFILE_SAVPF);
PRINT_CONSTANT((gint) GST_RTP_PROFILE_UNKNOWN);
PRINT_CONSTANT(GST_RTP_SOURCE_META_MAX_CSRC_COUNT);
PRINT_CONSTANT(GST_RTP_VERSION);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,24 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstRTCPBuffer", sizeof(GstRTCPBuffer), alignof(GstRTCPBuffer));
printf("%s;%zu;%zu\n", "GstRTCPFBType", sizeof(GstRTCPFBType), alignof(GstRTCPFBType));
printf("%s;%zu;%zu\n", "GstRTCPPacket", sizeof(GstRTCPPacket), alignof(GstRTCPPacket));
printf("%s;%zu;%zu\n", "GstRTCPSDESType", sizeof(GstRTCPSDESType), alignof(GstRTCPSDESType));
printf("%s;%zu;%zu\n", "GstRTCPType", sizeof(GstRTCPType), alignof(GstRTCPType));
printf("%s;%zu;%zu\n", "GstRTCPXRType", sizeof(GstRTCPXRType), alignof(GstRTCPXRType));
printf("%s;%zu;%zu\n", "GstRTPBaseAudioPayload", sizeof(GstRTPBaseAudioPayload), alignof(GstRTPBaseAudioPayload));
printf("%s;%zu;%zu\n", "GstRTPBaseAudioPayloadClass", sizeof(GstRTPBaseAudioPayloadClass), alignof(GstRTPBaseAudioPayloadClass));
printf("%s;%zu;%zu\n", "GstRTPBaseDepayload", sizeof(GstRTPBaseDepayload), alignof(GstRTPBaseDepayload));
printf("%s;%zu;%zu\n", "GstRTPBaseDepayloadClass", sizeof(GstRTPBaseDepayloadClass), alignof(GstRTPBaseDepayloadClass));
printf("%s;%zu;%zu\n", "GstRTPBasePayload", sizeof(GstRTPBasePayload), alignof(GstRTPBasePayload));
printf("%s;%zu;%zu\n", "GstRTPBasePayloadClass", sizeof(GstRTPBasePayloadClass), alignof(GstRTPBasePayloadClass));
printf("%s;%zu;%zu\n", "GstRTPBuffer", sizeof(GstRTPBuffer), alignof(GstRTPBuffer));
printf("%s;%zu;%zu\n", "GstRTPBufferFlags", sizeof(GstRTPBufferFlags), alignof(GstRTPBufferFlags));
printf("%s;%zu;%zu\n", "GstRTPBufferMapFlags", sizeof(GstRTPBufferMapFlags), alignof(GstRTPBufferMapFlags));
printf("%s;%zu;%zu\n", "GstRTPPayload", sizeof(GstRTPPayload), alignof(GstRTPPayload));
printf("%s;%zu;%zu\n", "GstRTPPayloadInfo", sizeof(GstRTPPayloadInfo), alignof(GstRTPPayloadInfo));
printf("%s;%zu;%zu\n", "GstRTPProfile", sizeof(GstRTPProfile), alignof(GstRTPProfile));
printf("%s;%zu;%zu\n", "GstRTPSourceMeta", sizeof(GstRTPSourceMeta), alignof(GstRTPSourceMeta));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_rtsp_server_sys::*; use gstreamer_rtsp_server_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,74 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_EVEN_PORT);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_IPV4);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_IPV6);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_MULTICAST);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_NONE);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_UNICAST);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT(GST_RTSP_ADDRESS_POOL_ANY_IPV4);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT(GST_RTSP_ADDRESS_POOL_ANY_IPV6);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_EINVAL);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_ELAST);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_ERANGE);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_ERESERVED);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_OK);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_CONNECT);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT);
ABI_CONSTANT_NAME); PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_TRANSPORT_CLIENT_SETTINGS);
PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_URL);
PRINT_CONSTANT((gint) GST_RTSP_FILTER_KEEP);
PRINT_CONSTANT((gint) GST_RTSP_FILTER_REF);
PRINT_CONSTANT((gint) GST_RTSP_FILTER_REMOVE);
PRINT_CONSTANT((gint) GST_RTSP_MEDIA_STATUS_ERROR);
PRINT_CONSTANT((gint) GST_RTSP_MEDIA_STATUS_PREPARED);
PRINT_CONSTANT((gint) GST_RTSP_MEDIA_STATUS_PREPARING);
PRINT_CONSTANT((gint) GST_RTSP_MEDIA_STATUS_SUSPENDED);
PRINT_CONSTANT((gint) GST_RTSP_MEDIA_STATUS_UNPREPARED);
PRINT_CONSTANT((gint) GST_RTSP_MEDIA_STATUS_UNPREPARING);
PRINT_CONSTANT(GST_RTSP_ONVIF_BACKCHANNEL_REQUIREMENT);
PRINT_CONSTANT(GST_RTSP_ONVIF_REPLAY_REQUIREMENT);
PRINT_CONSTANT(GST_RTSP_PERM_MEDIA_FACTORY_ACCESS);
PRINT_CONSTANT(GST_RTSP_PERM_MEDIA_FACTORY_CONSTRUCT);
PRINT_CONSTANT((gint) GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK);
PRINT_CONSTANT((gint) GST_RTSP_PUBLISH_CLOCK_MODE_CLOCK_AND_OFFSET);
PRINT_CONSTANT((gint) GST_RTSP_PUBLISH_CLOCK_MODE_NONE);
PRINT_CONSTANT((gint) GST_RTSP_SUSPEND_MODE_NONE);
PRINT_CONSTANT((gint) GST_RTSP_SUSPEND_MODE_PAUSE);
PRINT_CONSTANT((gint) GST_RTSP_SUSPEND_MODE_RESET);
PRINT_CONSTANT((gint) GST_RTSP_THREAD_TYPE_CLIENT);
PRINT_CONSTANT((gint) GST_RTSP_THREAD_TYPE_MEDIA);
PRINT_CONSTANT(GST_RTSP_TOKEN_MEDIA_FACTORY_ROLE);
PRINT_CONSTANT(GST_RTSP_TOKEN_TRANSPORT_CLIENT_SETTINGS);
PRINT_CONSTANT((guint) GST_RTSP_TRANSPORT_MODE_PLAY);
PRINT_CONSTANT((guint) GST_RTSP_TRANSPORT_MODE_RECORD);
return 0; return 0;
} }

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
@ -7,6 +7,55 @@
#include <stdio.h> #include <stdio.h>
int main() { int main() {
printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); printf("%s;%zu;%zu\n", "GstRTSPAddress", sizeof(GstRTSPAddress), alignof(GstRTSPAddress));
printf("%s;%zu;%zu\n", "GstRTSPAddressFlags", sizeof(GstRTSPAddressFlags), alignof(GstRTSPAddressFlags));
printf("%s;%zu;%zu\n", "GstRTSPAddressPool", sizeof(GstRTSPAddressPool), alignof(GstRTSPAddressPool));
printf("%s;%zu;%zu\n", "GstRTSPAddressPoolClass", sizeof(GstRTSPAddressPoolClass), alignof(GstRTSPAddressPoolClass));
printf("%s;%zu;%zu\n", "GstRTSPAddressPoolResult", sizeof(GstRTSPAddressPoolResult), alignof(GstRTSPAddressPoolResult));
printf("%s;%zu;%zu\n", "GstRTSPAuth", sizeof(GstRTSPAuth), alignof(GstRTSPAuth));
printf("%s;%zu;%zu\n", "GstRTSPAuthClass", sizeof(GstRTSPAuthClass), alignof(GstRTSPAuthClass));
printf("%s;%zu;%zu\n", "GstRTSPClient", sizeof(GstRTSPClient), alignof(GstRTSPClient));
printf("%s;%zu;%zu\n", "GstRTSPClientClass", sizeof(GstRTSPClientClass), alignof(GstRTSPClientClass));
printf("%s;%zu;%zu\n", "GstRTSPContext", sizeof(GstRTSPContext), alignof(GstRTSPContext));
printf("%s;%zu;%zu\n", "GstRTSPFilterResult", sizeof(GstRTSPFilterResult), alignof(GstRTSPFilterResult));
printf("%s;%zu;%zu\n", "GstRTSPMedia", sizeof(GstRTSPMedia), alignof(GstRTSPMedia));
printf("%s;%zu;%zu\n", "GstRTSPMediaClass", sizeof(GstRTSPMediaClass), alignof(GstRTSPMediaClass));
printf("%s;%zu;%zu\n", "GstRTSPMediaFactory", sizeof(GstRTSPMediaFactory), alignof(GstRTSPMediaFactory));
printf("%s;%zu;%zu\n", "GstRTSPMediaFactoryClass", sizeof(GstRTSPMediaFactoryClass), alignof(GstRTSPMediaFactoryClass));
printf("%s;%zu;%zu\n", "GstRTSPMediaFactoryURI", sizeof(GstRTSPMediaFactoryURI), alignof(GstRTSPMediaFactoryURI));
printf("%s;%zu;%zu\n", "GstRTSPMediaFactoryURIClass", sizeof(GstRTSPMediaFactoryURIClass), alignof(GstRTSPMediaFactoryURIClass));
printf("%s;%zu;%zu\n", "GstRTSPMediaStatus", sizeof(GstRTSPMediaStatus), alignof(GstRTSPMediaStatus));
printf("%s;%zu;%zu\n", "GstRTSPMountPoints", sizeof(GstRTSPMountPoints), alignof(GstRTSPMountPoints));
printf("%s;%zu;%zu\n", "GstRTSPMountPointsClass", sizeof(GstRTSPMountPointsClass), alignof(GstRTSPMountPointsClass));
printf("%s;%zu;%zu\n", "GstRTSPOnvifClient", sizeof(GstRTSPOnvifClient), alignof(GstRTSPOnvifClient));
printf("%s;%zu;%zu\n", "GstRTSPOnvifClientClass", sizeof(GstRTSPOnvifClientClass), alignof(GstRTSPOnvifClientClass));
printf("%s;%zu;%zu\n", "GstRTSPOnvifMedia", sizeof(GstRTSPOnvifMedia), alignof(GstRTSPOnvifMedia));
printf("%s;%zu;%zu\n", "GstRTSPOnvifMediaClass", sizeof(GstRTSPOnvifMediaClass), alignof(GstRTSPOnvifMediaClass));
printf("%s;%zu;%zu\n", "GstRTSPOnvifMediaFactory", sizeof(GstRTSPOnvifMediaFactory), alignof(GstRTSPOnvifMediaFactory));
printf("%s;%zu;%zu\n", "GstRTSPOnvifMediaFactoryClass", sizeof(GstRTSPOnvifMediaFactoryClass), alignof(GstRTSPOnvifMediaFactoryClass));
printf("%s;%zu;%zu\n", "GstRTSPOnvifServer", sizeof(GstRTSPOnvifServer), alignof(GstRTSPOnvifServer));
printf("%s;%zu;%zu\n", "GstRTSPOnvifServerClass", sizeof(GstRTSPOnvifServerClass), alignof(GstRTSPOnvifServerClass));
printf("%s;%zu;%zu\n", "GstRTSPPermissions", sizeof(GstRTSPPermissions), alignof(GstRTSPPermissions));
printf("%s;%zu;%zu\n", "GstRTSPPublishClockMode", sizeof(GstRTSPPublishClockMode), alignof(GstRTSPPublishClockMode));
printf("%s;%zu;%zu\n", "GstRTSPServer", sizeof(GstRTSPServer), alignof(GstRTSPServer));
printf("%s;%zu;%zu\n", "GstRTSPServerClass", sizeof(GstRTSPServerClass), alignof(GstRTSPServerClass));
printf("%s;%zu;%zu\n", "GstRTSPSession", sizeof(GstRTSPSession), alignof(GstRTSPSession));
printf("%s;%zu;%zu\n", "GstRTSPSessionClass", sizeof(GstRTSPSessionClass), alignof(GstRTSPSessionClass));
printf("%s;%zu;%zu\n", "GstRTSPSessionMedia", sizeof(GstRTSPSessionMedia), alignof(GstRTSPSessionMedia));
printf("%s;%zu;%zu\n", "GstRTSPSessionMediaClass", sizeof(GstRTSPSessionMediaClass), alignof(GstRTSPSessionMediaClass));
printf("%s;%zu;%zu\n", "GstRTSPSessionPool", sizeof(GstRTSPSessionPool), alignof(GstRTSPSessionPool));
printf("%s;%zu;%zu\n", "GstRTSPSessionPoolClass", sizeof(GstRTSPSessionPoolClass), alignof(GstRTSPSessionPoolClass));
printf("%s;%zu;%zu\n", "GstRTSPStream", sizeof(GstRTSPStream), alignof(GstRTSPStream));
printf("%s;%zu;%zu\n", "GstRTSPStreamClass", sizeof(GstRTSPStreamClass), alignof(GstRTSPStreamClass));
printf("%s;%zu;%zu\n", "GstRTSPStreamTransport", sizeof(GstRTSPStreamTransport), alignof(GstRTSPStreamTransport));
printf("%s;%zu;%zu\n", "GstRTSPStreamTransportClass", sizeof(GstRTSPStreamTransportClass), alignof(GstRTSPStreamTransportClass));
printf("%s;%zu;%zu\n", "GstRTSPSuspendMode", sizeof(GstRTSPSuspendMode), alignof(GstRTSPSuspendMode));
printf("%s;%zu;%zu\n", "GstRTSPThread", sizeof(GstRTSPThread), alignof(GstRTSPThread));
printf("%s;%zu;%zu\n", "GstRTSPThreadPool", sizeof(GstRTSPThreadPool), alignof(GstRTSPThreadPool));
printf("%s;%zu;%zu\n", "GstRTSPThreadPoolClass", sizeof(GstRTSPThreadPoolClass), alignof(GstRTSPThreadPoolClass));
printf("%s;%zu;%zu\n", "GstRTSPThreadType", sizeof(GstRTSPThreadType), alignof(GstRTSPThreadType));
printf("%s;%zu;%zu\n", "GstRTSPToken", sizeof(GstRTSPToken), alignof(GstRTSPToken));
printf("%s;%zu;%zu\n", "GstRTSPTransportMode", sizeof(GstRTSPTransportMode), alignof(GstRTSPTransportMode));
printf("%s;%zu;%zu\n", "GstSDPInfo", sizeof(GstSDPInfo), alignof(GstSDPInfo));
return 0; return 0;
} }

View file

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ c85699a) Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#[cfg(not(feature = "dox"))] #[cfg(not(feature = "dox"))]

View file

@ -1,5 +1,5 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]

View file

@ -1,10 +1,11 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
use gstreamer_rtsp_sys::*; use gstreamer_rtsp_sys::*;
use std::env; use std::env;
use std::error::Error; use std::error::Error;
use std::ffi::OsString;
use std::mem::{align_of, size_of}; use std::mem::{align_of, size_of};
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -22,6 +23,8 @@ impl Compiler {
pub fn new() -> Result<Compiler, Box<dyn Error>> { pub fn new() -> Result<Compiler, Box<dyn Error>> {
let mut args = get_var("CC", "cc")?; let mut args = get_var("CC", "cc")?;
args.push("-Wno-deprecated-declarations".to_owned()); args.push("-Wno-deprecated-declarations".to_owned());
// For _Generic
args.push("-std=c11".to_owned());
// For %z support in printf when using MinGW. // For %z support in printf when using MinGW.
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
args.extend(get_var("CFLAGS", "")?); args.extend(get_var("CFLAGS", "")?);
@ -30,14 +33,6 @@ impl Compiler {
Ok(Compiler { args }) 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<dyn Error>> { pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box<dyn Error>> {
let mut cmd = self.to_command(); let mut cmd = self.to_command();
cmd.arg(src); cmd.arg(src);
@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result<Vec<String>, Box<dyn Error>> {
if packages.is_empty() { if packages.is_empty() {
return Ok(Vec::new()); return Ok(Vec::new());
} }
let mut cmd = Command::new("pkg-config"); let pkg_config = env::var_os("PKG_CONFIG").unwrap_or_else(|| OsString::from("pkg-config"));
let mut cmd = Command::new(pkg_config);
cmd.arg("--cflags"); cmd.arg("--cflags");
cmd.args(packages); cmd.args(packages);
let out = cmd.output()?; let out = cmd.output()?;
@ -92,8 +88,6 @@ struct Results {
passed: usize, passed: usize,
/// Total number of failed tests (including those that failed to compile). /// Total number of failed tests (including those that failed to compile).
failed: usize, failed: usize,
/// Number of tests that failed to compile.
failed_to_compile: usize,
} }
impl Results { impl Results {
@ -103,15 +97,8 @@ impl Results {
fn record_failed(&mut self) { fn record_failed(&mut self) {
self.failed += 1; self.failed += 1;
} }
fn record_failed_to_compile(&mut self) {
self.failed += 1;
self.failed_to_compile += 1;
}
fn summary(&self) -> String { fn summary(&self) -> String {
format!( format!("{} passed; {} failed", self.passed, self.failed)
"{} passed; {} failed (compilation errors: {})",
self.passed, self.failed, self.failed_to_compile
)
} }
fn expect_total_success(&self) { fn expect_total_success(&self) {
if self.failed == 0 { if self.failed == 0 {
@ -124,92 +111,94 @@ impl Results {
#[test] #[test]
fn cross_validate_constants_with_c() { fn cross_validate_constants_with_c() {
let tmpdir = Builder::new() let mut c_constants: Vec<(String, String)> = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("constant").unwrap().lines() {
"1", let mut words = l.trim().split(";");
get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), let name = words.next().expect("Failed to parse name").to_owned();
"failed to obtain correct constant value for 1" let value = words
); .next()
.and_then(|s| s.parse().ok())
let mut results: Results = Default::default(); .expect("Failed to parse value");
for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { c_constants.push((name, value));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_value), (c_name, c_value)) in
RUST_CONSTANTS.iter().zip(c_constants.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_value != c_value {
results.record_failed();
eprintln!(
"Constant value mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_value, &c_value
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
#[test] #[test]
fn cross_validate_layout_with_c() { fn cross_validate_layout_with_c() {
let tmpdir = Builder::new() let mut c_layouts = Vec::new();
.prefix("abi")
.tempdir()
.expect("temporary directory");
let cc = Compiler::new().expect("configured compiler");
assert_eq!( for l in get_c_output("layout").unwrap().lines() {
Layout { let mut words = l.trim().split(";");
size: 1, let name = words.next().expect("Failed to parse name").to_owned();
alignment: 1 let size = words
}, .next()
get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), .and_then(|s| s.parse().ok())
"failed to obtain correct layout for char type" .expect("Failed to parse size");
); let alignment = words
.next()
let mut results: Results = Default::default(); .and_then(|s| s.parse().ok())
for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { .expect("Failed to parse alignment");
match get_c_layout(tmpdir.path(), &cc, name) { c_layouts.push((name, Layout { size, alignment }));
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());
}
} }
let mut results = Results::default();
for ((rust_name, rust_layout), (c_name, c_layout)) in RUST_LAYOUTS.iter().zip(c_layouts.iter())
{
if rust_name != c_name {
results.record_failed();
eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,);
continue;
}
if rust_layout != c_layout {
results.record_failed();
eprintln!(
"Layout mismatch for {}\nRust: {:?}\nC: {:?}",
rust_name, rust_layout, &c_layout
);
continue;
}
results.record_passed();
}
results.expect_total_success(); results.expect_total_success();
} }
fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn Error>> { fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
let exe = dir.join("layout"); let tmpdir = Builder::new().prefix("abi").tempdir()?;
let mut cc = cc.clone(); let exe = tmpdir.path().join(name);
cc.define("ABI_TYPE_NAME", name); let c_file = Path::new("tests").join(name).with_extension("c");
cc.compile(Path::new("tests/layout.c"), &exe)?;
let cc = Compiler::new().expect("configured compiler");
cc.compile(&c_file, &exe)?;
let mut abi_cmd = Command::new(exe); let mut abi_cmd = Command::new(exe);
let output = abi_cmd.output()?; let output = abi_cmd.output()?;
@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result<Layout, Box<dyn
return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into());
} }
let stdout = str::from_utf8(&output.stdout)?; Ok(String::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<dyn 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());
}
let output = str::from_utf8(&output.stdout)?.trim();
if !output.starts_with("###gir test###") || !output.ends_with("###gir test###") {
return Err(format!(
"command {:?} return invalid output, {:?}",
&abi_cmd, &output
)
.into());
}
Ok(String::from(&output[14..(output.len() - 14)]))
} }
const RUST_LAYOUTS: &[(&str, Layout)] = &[ const RUST_LAYOUTS: &[(&str, Layout)] = &[

View file

@ -1,27 +1,248 @@
// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) // This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a)
// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) // from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201)
// DO NOT EDIT // DO NOT EDIT
#include "manual.h" #include "manual.h"
#include <stdio.h> #include <stdio.h>
#define PRINT_CONSTANT(CONSTANT_NAME) \
printf("%s;", #CONSTANT_NAME); \
printf(_Generic((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"), \
CONSTANT_NAME); \
printf("\n");
int main() { int main() {
printf(_Generic((ABI_CONSTANT_NAME), PRINT_CONSTANT((guint) GST_RTSP_ANNOUNCE);
char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_AUTH_BASIC);
const char *: "###gir test###%s###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_AUTH_DIGEST);
char: "###gir test###%c###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_AUTH_NONE);
signed char: "###gir test###%hhd###gir test###\n", PRINT_CONSTANT(GST_RTSP_DEFAULT_PORT);
unsigned char: "###gir test###%hhu###gir test###\n", PRINT_CONSTANT((guint) GST_RTSP_DESCRIBE);
short int: "###gir test###%hd###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_EEOF);
unsigned short int: "###gir test###%hu###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_EINTR);
int: "###gir test###%d###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_EINVAL);
unsigned int: "###gir test###%u###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ELAST);
long: "###gir test###%ld###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ENET);
unsigned long: "###gir test###%lu###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ENOMEM);
long long: "###gir test###%lld###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ENOTIMPL);
unsigned long long: "###gir test###%llu###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_ENOTIP);
double: "###gir test###%f###gir test###\n", PRINT_CONSTANT((gint) GST_RTSP_EPARSE);
long double: "###gir test###%ld###gir test###\n"), PRINT_CONSTANT((gint) GST_RTSP_ERESOLV);
ABI_CONSTANT_NAME); PRINT_CONSTANT((gint) GST_RTSP_ERROR);
PRINT_CONSTANT((gint) GST_RTSP_ESYS);
PRINT_CONSTANT((gint) GST_RTSP_ETGET);
PRINT_CONSTANT((gint) GST_RTSP_ETIMEOUT);
PRINT_CONSTANT((gint) GST_RTSP_ETPOST);
PRINT_CONSTANT((guint) GST_RTSP_EV_READ);
PRINT_CONSTANT((guint) GST_RTSP_EV_WRITE);
PRINT_CONSTANT((gint) GST_RTSP_EWSASTART);
PRINT_CONSTANT((gint) GST_RTSP_EWSAVERSION);
PRINT_CONSTANT((gint) GST_RTSP_FAM_INET);
PRINT_CONSTANT((gint) GST_RTSP_FAM_INET6);
PRINT_CONSTANT((gint) GST_RTSP_FAM_NONE);
PRINT_CONSTANT((guint) GST_RTSP_GET);
PRINT_CONSTANT((guint) GST_RTSP_GET_PARAMETER);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ACCEPT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ACCEPT_CHARSET);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ACCEPT_ENCODING);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ACCEPT_LANGUAGE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ACCEPT_RANGES);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ALERT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ALLOW);
PRINT_CONSTANT((gint) GST_RTSP_HDR_AUTHENTICATION_INFO);
PRINT_CONSTANT((gint) GST_RTSP_HDR_AUTHORIZATION);
PRINT_CONSTANT((gint) GST_RTSP_HDR_BANDWIDTH);
PRINT_CONSTANT((gint) GST_RTSP_HDR_BLOCKSIZE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CACHE_CONTROL);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CLIENT_CHALLENGE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CLIENT_ID);
PRINT_CONSTANT((gint) GST_RTSP_HDR_COMPANY_ID);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONFERENCE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONNECTION);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONTENT_BASE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONTENT_ENCODING);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONTENT_LANGUAGE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONTENT_LENGTH);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONTENT_LOCATION);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CONTENT_TYPE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_CSEQ);
PRINT_CONSTANT((gint) GST_RTSP_HDR_DATE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_ETAG);
PRINT_CONSTANT((gint) GST_RTSP_HDR_EXPIRES);
PRINT_CONSTANT((gint) GST_RTSP_HDR_FRAMES);
PRINT_CONSTANT((gint) GST_RTSP_HDR_FROM);
PRINT_CONSTANT((gint) GST_RTSP_HDR_GUID);
PRINT_CONSTANT((gint) GST_RTSP_HDR_HOST);
PRINT_CONSTANT((gint) GST_RTSP_HDR_IF_MATCH);
PRINT_CONSTANT((gint) GST_RTSP_HDR_IF_MODIFIED_SINCE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_INVALID);
PRINT_CONSTANT((gint) GST_RTSP_HDR_KEYMGMT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_LANGUAGE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_LAST);
PRINT_CONSTANT((gint) GST_RTSP_HDR_LAST_MODIFIED);
PRINT_CONSTANT((gint) GST_RTSP_HDR_LOCATION);
PRINT_CONSTANT((gint) GST_RTSP_HDR_MAX_ASM_WIDTH);
PRINT_CONSTANT((gint) GST_RTSP_HDR_MEDIA_PROPERTIES);
PRINT_CONSTANT((gint) GST_RTSP_HDR_PIPELINED_REQUESTS);
PRINT_CONSTANT((gint) GST_RTSP_HDR_PLAYER_START_TIME);
PRINT_CONSTANT((gint) GST_RTSP_HDR_PRAGMA);
PRINT_CONSTANT((gint) GST_RTSP_HDR_PROXY_AUTHENTICATE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_PROXY_REQUIRE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_PUBLIC);
PRINT_CONSTANT((gint) GST_RTSP_HDR_RANGE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_RATE_CONTROL);
PRINT_CONSTANT((gint) GST_RTSP_HDR_REAL_CHALLENGE1);
PRINT_CONSTANT((gint) GST_RTSP_HDR_REAL_CHALLENGE2);
PRINT_CONSTANT((gint) GST_RTSP_HDR_REAL_CHALLENGE3);
PRINT_CONSTANT((gint) GST_RTSP_HDR_REFERER);
PRINT_CONSTANT((gint) GST_RTSP_HDR_REGION_DATA);
PRINT_CONSTANT((gint) GST_RTSP_HDR_REQUIRE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_RETRY_AFTER);
PRINT_CONSTANT((gint) GST_RTSP_HDR_RTCP_INTERVAL);
PRINT_CONSTANT((gint) GST_RTSP_HDR_RTP_INFO);
PRINT_CONSTANT((gint) GST_RTSP_HDR_SCALE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_SEEK_STYLE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_SERVER);
PRINT_CONSTANT((gint) GST_RTSP_HDR_SESSION);
PRINT_CONSTANT((gint) GST_RTSP_HDR_SPEED);
PRINT_CONSTANT((gint) GST_RTSP_HDR_SUBSCRIBE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_SUPPORTED);
PRINT_CONSTANT((gint) GST_RTSP_HDR_TIMESTAMP);
PRINT_CONSTANT((gint) GST_RTSP_HDR_TRANSPORT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_UNSUPPORTED);
PRINT_CONSTANT((gint) GST_RTSP_HDR_USER_AGENT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_VARY);
PRINT_CONSTANT((gint) GST_RTSP_HDR_VIA);
PRINT_CONSTANT((gint) GST_RTSP_HDR_WWW_AUTHENTICATE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_ACCELERATE_STREAMING);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_ACCEPT_AUTHENT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_ACCEPT_PROXY_AUTHENT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_BROADCAST_ID);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_BURST_STREAMING);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_NOTICE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_PLAYER_LAG_TIME);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_PLAYLIST);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_PLAYLIST_CHANGE_NOTICE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_PLAYLIST_GEN_ID);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_PLAYLIST_SEEK_ID);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_PROXY_CLIENT_AGENT);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_PROXY_CLIENT_VERB);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_RECEDING_PLAYLISTCHANGE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_RTP_INFO);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_SERVER_IP_ADDRESS);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_SESSIONCOOKIE);
PRINT_CONSTANT((gint) GST_RTSP_HDR_X_STARTUPPROFILE);
PRINT_CONSTANT((guint) GST_RTSP_INVALID);
PRINT_CONSTANT((guint) GST_RTSP_LOWER_TRANS_HTTP);
PRINT_CONSTANT((guint) GST_RTSP_LOWER_TRANS_TCP);
PRINT_CONSTANT((guint) GST_RTSP_LOWER_TRANS_TLS);
PRINT_CONSTANT((guint) GST_RTSP_LOWER_TRANS_UDP);
PRINT_CONSTANT((guint) GST_RTSP_LOWER_TRANS_UDP_MCAST);
PRINT_CONSTANT((guint) GST_RTSP_LOWER_TRANS_UNKNOWN);
PRINT_CONSTANT((gint) GST_RTSP_MESSAGE_DATA);
PRINT_CONSTANT((gint) GST_RTSP_MESSAGE_HTTP_REQUEST);
PRINT_CONSTANT((gint) GST_RTSP_MESSAGE_HTTP_RESPONSE);
PRINT_CONSTANT((gint) GST_RTSP_MESSAGE_INVALID);
PRINT_CONSTANT((gint) GST_RTSP_MESSAGE_REQUEST);
PRINT_CONSTANT((gint) GST_RTSP_MESSAGE_RESPONSE);
PRINT_CONSTANT((gint) GST_RTSP_OK);
PRINT_CONSTANT((guint) GST_RTSP_OPTIONS);
PRINT_CONSTANT((guint) GST_RTSP_PAUSE);
PRINT_CONSTANT((guint) GST_RTSP_PLAY);
PRINT_CONSTANT((guint) GST_RTSP_POST);
PRINT_CONSTANT((guint) GST_RTSP_PROFILE_AVP);
PRINT_CONSTANT((guint) GST_RTSP_PROFILE_AVPF);
PRINT_CONSTANT((guint) GST_RTSP_PROFILE_SAVP);
PRINT_CONSTANT((guint) GST_RTSP_PROFILE_SAVPF);
PRINT_CONSTANT((guint) GST_RTSP_PROFILE_UNKNOWN);
PRINT_CONSTANT((gint) GST_RTSP_RANGE_CLOCK);
PRINT_CONSTANT((gint) GST_RTSP_RANGE_NPT);
PRINT_CONSTANT((gint) GST_RTSP_RANGE_SMPTE);
PRINT_CONSTANT((gint) GST_RTSP_RANGE_SMPTE_25);
PRINT_CONSTANT((gint) GST_RTSP_RANGE_SMPTE_30_DROP);
PRINT_CONSTANT((guint) GST_RTSP_RECORD);
PRINT_CONSTANT((guint) GST_RTSP_REDIRECT);
PRINT_CONSTANT((guint) GST_RTSP_SETUP);
PRINT_CONSTANT((guint) GST_RTSP_SET_PARAMETER);
PRINT_CONSTANT((gint) GST_RTSP_STATE_INIT);
PRINT_CONSTANT((gint) GST_RTSP_STATE_INVALID);
PRINT_CONSTANT((gint) GST_RTSP_STATE_PLAYING);
PRINT_CONSTANT((gint) GST_RTSP_STATE_READY);
PRINT_CONSTANT((gint) GST_RTSP_STATE_RECORDING);
PRINT_CONSTANT((gint) GST_RTSP_STATE_SEEKING);
PRINT_CONSTANT((gint) GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED);
PRINT_CONSTANT((gint) GST_RTSP_STS_BAD_GATEWAY);
PRINT_CONSTANT((gint) GST_RTSP_STS_BAD_REQUEST);
PRINT_CONSTANT((gint) GST_RTSP_STS_CONFERENCE_NOT_FOUND);
PRINT_CONSTANT((gint) GST_RTSP_STS_CONTINUE);
PRINT_CONSTANT((gint) GST_RTSP_STS_CREATED);
PRINT_CONSTANT((gint) GST_RTSP_STS_DESTINATION_UNREACHABLE);
PRINT_CONSTANT((gint) GST_RTSP_STS_FORBIDDEN);
PRINT_CONSTANT((gint) GST_RTSP_STS_GATEWAY_TIMEOUT);
PRINT_CONSTANT((gint) GST_RTSP_STS_GONE);
PRINT_CONSTANT((gint) GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE);
PRINT_CONSTANT((gint) GST_RTSP_STS_INTERNAL_SERVER_ERROR);
PRINT_CONSTANT((gint) GST_RTSP_STS_INVALID);
PRINT_CONSTANT((gint) GST_RTSP_STS_INVALID_RANGE);
PRINT_CONSTANT((gint) GST_RTSP_STS_KEY_MANAGEMENT_FAILURE);
PRINT_CONSTANT((gint) GST_RTSP_STS_LENGTH_REQUIRED);
PRINT_CONSTANT((gint) GST_RTSP_STS_LOW_ON_STORAGE);
PRINT_CONSTANT((gint) GST_RTSP_STS_METHOD_NOT_ALLOWED);
PRINT_CONSTANT((gint) GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE);
PRINT_CONSTANT((gint) GST_RTSP_STS_MOVED_PERMANENTLY);
PRINT_CONSTANT((gint) GST_RTSP_STS_MOVE_TEMPORARILY);
PRINT_CONSTANT((gint) GST_RTSP_STS_MULTIPLE_CHOICES);
PRINT_CONSTANT((gint) GST_RTSP_STS_NOT_ACCEPTABLE);
PRINT_CONSTANT((gint) GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH);
PRINT_CONSTANT((gint) GST_RTSP_STS_NOT_FOUND);
PRINT_CONSTANT((gint) GST_RTSP_STS_NOT_IMPLEMENTED);
PRINT_CONSTANT((gint) GST_RTSP_STS_NOT_MODIFIED);
PRINT_CONSTANT((gint) GST_RTSP_STS_OK);
PRINT_CONSTANT((gint) GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED);
PRINT_CONSTANT((gint) GST_RTSP_STS_OPTION_NOT_SUPPORTED);
PRINT_CONSTANT((gint) GST_RTSP_STS_PARAMETER_IS_READONLY);
PRINT_CONSTANT((gint) GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD);
PRINT_CONSTANT((gint) GST_RTSP_STS_PAYMENT_REQUIRED);
PRINT_CONSTANT((gint) GST_RTSP_STS_PRECONDITION_FAILED);
PRINT_CONSTANT((gint) GST_RTSP_STS_PROXY_AUTH_REQUIRED);
PRINT_CONSTANT((gint) GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE);
PRINT_CONSTANT((gint) GST_RTSP_STS_REQUEST_TIMEOUT);
PRINT_CONSTANT((gint) GST_RTSP_STS_REQUEST_URI_TOO_LARGE);
PRINT_CONSTANT((gint) GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED);
PRINT_CONSTANT((gint) GST_RTSP_STS_SEE_OTHER);
PRINT_CONSTANT((gint) GST_RTSP_STS_SERVICE_UNAVAILABLE);
PRINT_CONSTANT((gint) GST_RTSP_STS_SESSION_NOT_FOUND);
PRINT_CONSTANT((gint) GST_RTSP_STS_UNAUTHORIZED);
PRINT_CONSTANT((gint) GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE);
PRINT_CONSTANT((gint) GST_RTSP_STS_UNSUPPORTED_TRANSPORT);
PRINT_CONSTANT((gint) GST_RTSP_STS_USE_PROXY);
PRINT_CONSTANT((guint) GST_RTSP_TEARDOWN);
PRINT_CONSTANT((gint) GST_RTSP_TIME_END);
PRINT_CONSTANT((gint) GST_RTSP_TIME_FRAMES);
PRINT_CONSTANT((gint) GST_RTSP_TIME_NOW);
PRINT_CONSTANT((gint) GST_RTSP_TIME_SECONDS);
PRINT_CONSTANT((gint) GST_RTSP_TIME_UTC);
PRINT_CONSTANT((guint) GST_RTSP_TRANS_RDT);
PRINT_CONSTANT((guint) GST_RTSP_TRANS_RTP);
PRINT_CONSTANT((guint) GST_RTSP_TRANS_UNKNOWN);
PRINT_CONSTANT((gint) GST_RTSP_VERSION_1_0);
PRINT_CONSTANT((gint) GST_RTSP_VERSION_1_1);
PRINT_CONSTANT((gint) GST_RTSP_VERSION_2_0);
PRINT_CONSTANT((gint) GST_RTSP_VERSION_INVALID);
return 0; return 0;
} }

Some files were not shown because too many files have changed in this diff Show more