From 9d86cef2da15013207d7607fc50006e030f003f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 7 Feb 2021 17:07:17 +0200 Subject: [PATCH] Regenerate everything with latest gir --- gstreamer-app/src/auto/versions.txt | 4 +- gstreamer-app/sys/build.rs | 4 +- gstreamer-app/sys/src/lib.rs | 4 +- gstreamer-app/sys/tests/abi.rs | 209 ++--- gstreamer-app/sys/tests/constant.c | 45 +- gstreamer-app/sys/tests/layout.c | 12 +- gstreamer-audio/src/auto/versions.txt | 4 +- gstreamer-audio/sys/build.rs | 4 +- gstreamer-audio/sys/src/lib.rs | 4 +- gstreamer-audio/sys/tests/abi.rs | 209 ++--- gstreamer-audio/sys/tests/constant.c | 234 +++++- gstreamer-audio/sys/tests/layout.c | 63 +- gstreamer-base/src/auto/versions.txt | 4 +- gstreamer-base/sys/build.rs | 4 +- gstreamer-base/sys/src/lib.rs | 4 +- gstreamer-base/sys/tests/abi.rs | 209 ++--- gstreamer-base/sys/tests/constant.c | 63 +- gstreamer-base/sys/tests/layout.c | 35 +- gstreamer-check/src/auto/versions.txt | 4 +- gstreamer-check/sys/build.rs | 4 +- gstreamer-check/sys/src/lib.rs | 4 +- gstreamer-check/sys/tests/abi.rs | 209 ++--- gstreamer-check/sys/tests/constant.c | 42 +- gstreamer-check/sys/tests/layout.c | 8 +- gstreamer-controller/src/auto/versions.txt | 4 +- gstreamer-controller/sys/build.rs | 4 +- gstreamer-controller/sys/src/lib.rs | 4 +- gstreamer-controller/sys/tests/abi.rs | 209 ++--- gstreamer-controller/sys/tests/constant.c | 51 +- gstreamer-controller/sys/tests/layout.c | 22 +- .../src/auto/versions.txt | 4 +- gstreamer-editing-services/sys/build.rs | 4 +- gstreamer-editing-services/sys/src/lib.rs | 4 +- gstreamer-editing-services/sys/tests/abi.rs | 209 ++--- .../sys/tests/constant.c | 200 ++++- gstreamer-editing-services/sys/tests/layout.c | 126 ++- gstreamer-gl/egl/src/auto/versions.txt | 4 +- gstreamer-gl/egl/sys/build.rs | 4 +- gstreamer-gl/egl/sys/src/lib.rs | 4 +- gstreamer-gl/egl/sys/tests/abi.rs | 209 ++--- gstreamer-gl/egl/sys/tests/constant.c | 43 +- gstreamer-gl/egl/sys/tests/layout.c | 7 +- gstreamer-gl/src/auto/versions.txt | 4 +- gstreamer-gl/sys/build.rs | 4 +- gstreamer-gl/sys/src/lib.rs | 4 +- gstreamer-gl/sys/tests/abi.rs | 209 ++--- gstreamer-gl/sys/tests/constant.c | 172 +++- gstreamer-gl/sys/tests/layout.c | 70 +- gstreamer-gl/wayland/src/auto/versions.txt | 4 +- gstreamer-gl/wayland/sys/build.rs | 4 +- gstreamer-gl/wayland/sys/src/lib.rs | 4 +- gstreamer-gl/wayland/sys/tests/abi.rs | 209 ++--- gstreamer-gl/wayland/sys/tests/constant.c | 42 +- gstreamer-gl/wayland/sys/tests/layout.c | 7 +- gstreamer-gl/x11/src/auto/versions.txt | 4 +- gstreamer-gl/x11/sys/build.rs | 4 +- gstreamer-gl/x11/sys/src/lib.rs | 4 +- gstreamer-gl/x11/sys/tests/abi.rs | 209 ++--- gstreamer-gl/x11/sys/tests/constant.c | 42 +- gstreamer-gl/x11/sys/tests/layout.c | 7 +- gstreamer-mpegts/sys/build.rs | 4 +- gstreamer-mpegts/sys/src/lib.rs | 4 +- gstreamer-mpegts/sys/tests/abi.rs | 209 ++--- gstreamer-mpegts/sys/tests/constant.c | 548 ++++++++++++- gstreamer-mpegts/sys/tests/layout.c | 91 ++- gstreamer-net/src/auto/versions.txt | 4 +- gstreamer-net/sys/build.rs | 4 +- gstreamer-net/sys/src/lib.rs | 4 +- gstreamer-net/sys/tests/abi.rs | 209 ++--- gstreamer-net/sys/tests/constant.c | 48 +- gstreamer-net/sys/tests/layout.c | 16 +- gstreamer-pbutils/src/auto/versions.txt | 4 +- gstreamer-pbutils/sys/build.rs | 4 +- gstreamer-pbutils/sys/src/lib.rs | 4 +- gstreamer-pbutils/sys/tests/abi.rs | 209 ++--- gstreamer-pbutils/sys/tests/constant.c | 79 +- gstreamer-pbutils/sys/tests/layout.c | 20 +- gstreamer-player/src/auto/versions.txt | 4 +- gstreamer-player/sys/build.rs | 4 +- gstreamer-player/sys/src/lib.rs | 4 +- gstreamer-player/sys/tests/abi.rs | 209 ++--- gstreamer-player/sys/tests/constant.c | 56 +- gstreamer-player/sys/tests/layout.c | 12 +- gstreamer-rtp/src/auto/versions.txt | 4 +- gstreamer-rtp/sys/build.rs | 4 +- gstreamer-rtp/sys/src/lib.rs | 4 +- gstreamer-rtp/sys/tests/abi.rs | 209 ++--- gstreamer-rtp/sys/tests/constant.c | 169 +++- gstreamer-rtp/sys/tests/layout.c | 24 +- gstreamer-rtsp-server/src/auto/versions.txt | 4 +- gstreamer-rtsp-server/sys/build.rs | 4 +- gstreamer-rtsp-server/sys/src/lib.rs | 4 +- gstreamer-rtsp-server/sys/tests/abi.rs | 209 ++--- gstreamer-rtsp-server/sys/tests/constant.c | 85 +- gstreamer-rtsp-server/sys/tests/layout.c | 55 +- gstreamer-rtsp/src/auto/versions.txt | 4 +- gstreamer-rtsp/sys/build.rs | 4 +- gstreamer-rtsp/sys/src/lib.rs | 4 +- gstreamer-rtsp/sys/tests/abi.rs | 209 ++--- gstreamer-rtsp/sys/tests/constant.c | 259 +++++- gstreamer-rtsp/sys/tests/layout.c | 31 +- gstreamer-sdp/src/auto/versions.txt | 4 +- gstreamer-sdp/sys/build.rs | 4 +- gstreamer-sdp/sys/src/lib.rs | 4 +- gstreamer-sdp/sys/tests/abi.rs | 209 ++--- gstreamer-sdp/sys/tests/constant.c | 108 ++- gstreamer-sdp/sys/tests/layout.c | 37 +- gstreamer-tag/sys/build.rs | 4 +- gstreamer-tag/sys/src/lib.rs | 4 +- gstreamer-tag/sys/tests/abi.rs | 209 ++--- gstreamer-tag/sys/tests/constant.c | 118 ++- gstreamer-tag/sys/tests/layout.c | 13 +- gstreamer-video/src/auto/versions.txt | 4 +- gstreamer-video/sys/build.rs | 4 +- gstreamer-video/sys/src/lib.rs | 4 +- gstreamer-video/sys/tests/abi.rs | 209 ++--- gstreamer-video/sys/tests/constant.c | 479 ++++++++++- gstreamer-video/sys/tests/layout.c | 104 ++- gstreamer-webrtc/src/auto/versions.txt | 4 +- gstreamer-webrtc/sys/build.rs | 4 +- gstreamer-webrtc/sys/src/lib.rs | 4 +- gstreamer-webrtc/sys/tests/abi.rs | 209 ++--- gstreamer-webrtc/sys/tests/constant.c | 121 ++- gstreamer-webrtc/sys/tests/layout.c | 35 +- gstreamer/src/auto/versions.txt | 4 +- gstreamer/sys/build.rs | 4 +- gstreamer/sys/src/lib.rs | 4 +- gstreamer/sys/tests/abi.rs | 209 ++--- gstreamer/sys/tests/constant.c | 761 +++++++++++++++++- gstreamer/sys/tests/layout.c | 179 +++- 130 files changed, 6253 insertions(+), 3340 deletions(-) diff --git a/gstreamer-app/src/auto/versions.txt b/gstreamer-app/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-app/src/auto/versions.txt +++ b/gstreamer-app/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-app/sys/build.rs b/gstreamer-app/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-app/sys/build.rs +++ b/gstreamer-app/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-app/sys/src/lib.rs b/gstreamer-app/sys/src/lib.rs index a671d689f..f7991e5ad 100644 --- a/gstreamer-app/sys/src/lib.rs +++ b/gstreamer-app/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-app/sys/tests/abi.rs b/gstreamer-app/sys/tests/abi.rs index f95e40fec..b626a2ea2 100644 --- a/gstreamer-app/sys/tests/abi.rs +++ b/gstreamer-app/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_app_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-app/sys/tests/constant.c b/gstreamer-app/sys/tests/constant.c index a337466c3..4ee916b92 100644 --- a/gstreamer-app/sys/tests/constant.c +++ b/gstreamer-app/sys/tests/constant.c @@ -1,27 +1,34 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_APP_STREAM_TYPE_RANDOM_ACCESS); + PRINT_CONSTANT((gint) GST_APP_STREAM_TYPE_SEEKABLE); + PRINT_CONSTANT((gint) GST_APP_STREAM_TYPE_STREAM); return 0; } diff --git a/gstreamer-app/sys/tests/layout.c b/gstreamer-app/sys/tests/layout.c index 8414dd55f..7b58e363b 100644 --- a/gstreamer-app/sys/tests/layout.c +++ b/gstreamer-app/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,12 @@ #include 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; } diff --git a/gstreamer-audio/src/auto/versions.txt b/gstreamer-audio/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-audio/src/auto/versions.txt +++ b/gstreamer-audio/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-audio/sys/build.rs b/gstreamer-audio/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-audio/sys/build.rs +++ b/gstreamer-audio/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-audio/sys/src/lib.rs b/gstreamer-audio/sys/src/lib.rs index 0a8627afa..b36f4287c 100644 --- a/gstreamer-audio/sys/src/lib.rs +++ b/gstreamer-audio/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-audio/sys/tests/abi.rs b/gstreamer-audio/sys/tests/abi.rs index be164433f..588349069 100644 --- a/gstreamer-audio/sys/tests/abi.rs +++ b/gstreamer-audio/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_audio_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-audio/sys/tests/constant.c b/gstreamer-audio/sys/tests/constant.c index a337466c3..1e85de6b8 100644 --- a/gstreamer-audio/sys/tests/constant.c +++ b/gstreamer-audio/sys/tests/constant.c @@ -1,27 +1,223 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_ALIGNMENT); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_DEVICE_FAILURE); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_FLUSH); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_NEW_CAPS); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_NO_DISCONT); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_DISCONT_REASON_SYNC_LATENCY); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_CUSTOM); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_NONE); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_RESAMPLE); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SINK_SLAVE_SKEW); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_NONE); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_RESAMPLE); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_RE_TIMESTAMP); + PRINT_CONSTANT((gint) GST_AUDIO_BASE_SRC_SLAVE_SKEW); + PRINT_CONSTANT((gint) GST_AUDIO_CD_SRC_MODE_CONTINUOUS); + PRINT_CONSTANT((gint) GST_AUDIO_CD_SRC_MODE_NORMAL); + 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; } diff --git a/gstreamer-audio/sys/tests/layout.c b/gstreamer-audio/sys/tests/layout.c index 8414dd55f..514328ab3 100644 --- a/gstreamer-audio/sys/tests/layout.c +++ b/gstreamer-audio/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,63 @@ #include 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; } diff --git a/gstreamer-base/src/auto/versions.txt b/gstreamer-base/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-base/src/auto/versions.txt +++ b/gstreamer-base/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-base/sys/build.rs b/gstreamer-base/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-base/sys/build.rs +++ b/gstreamer-base/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-base/sys/src/lib.rs b/gstreamer-base/sys/src/lib.rs index 4b023a3c0..e3310ddc3 100644 --- a/gstreamer-base/sys/src/lib.rs +++ b/gstreamer-base/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-base/sys/tests/abi.rs b/gstreamer-base/sys/tests/abi.rs index 45cadab28..56f0a02de 100644 --- a/gstreamer-base/sys/tests/abi.rs +++ b/gstreamer-base/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_base_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-base/sys/tests/constant.c b/gstreamer-base/sys/tests/constant.c index a337466c3..02902aee8 100644 --- a/gstreamer-base/sys/tests/constant.c +++ b/gstreamer-base/sys/tests/constant.c @@ -1,27 +1,52 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_AGGREGATOR_START_TIME_SELECTION_FIRST); + PRINT_CONSTANT((gint) GST_AGGREGATOR_START_TIME_SELECTION_SET); + PRINT_CONSTANT((gint) GST_AGGREGATOR_START_TIME_SELECTION_ZERO); + PRINT_CONSTANT(GST_BASE_PARSE_FLAG_DRAINING); + PRINT_CONSTANT(GST_BASE_PARSE_FLAG_LOST_SYNC); + PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_CLIP); + PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_DROP); + PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_NEW_FRAME); + PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_NONE); + PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_NO_FRAME); + PRINT_CONSTANT((guint) GST_BASE_PARSE_FRAME_FLAG_QUEUE); + PRINT_CONSTANT((guint) GST_BASE_SRC_FLAG_LAST); + PRINT_CONSTANT((guint) GST_BASE_SRC_FLAG_STARTED); + PRINT_CONSTANT((guint) GST_BASE_SRC_FLAG_STARTING); + PRINT_CONSTANT(GST_BASE_TRANSFORM_SINK_NAME); + PRINT_CONSTANT(GST_BASE_TRANSFORM_SRC_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; } diff --git a/gstreamer-base/sys/tests/layout.c b/gstreamer-base/sys/tests/layout.c index 8414dd55f..90b84b225 100644 --- a/gstreamer-base/sys/tests/layout.c +++ b/gstreamer-base/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,35 @@ #include 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; } diff --git a/gstreamer-check/src/auto/versions.txt b/gstreamer-check/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-check/src/auto/versions.txt +++ b/gstreamer-check/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-check/sys/build.rs b/gstreamer-check/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-check/sys/build.rs +++ b/gstreamer-check/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-check/sys/src/lib.rs b/gstreamer-check/sys/src/lib.rs index bc5890f0b..2afdb5c77 100644 --- a/gstreamer-check/sys/src/lib.rs +++ b/gstreamer-check/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-check/sys/tests/abi.rs b/gstreamer-check/sys/tests/abi.rs index a18a27c99..3a4bcfa75 100644 --- a/gstreamer-check/sys/tests/abi.rs +++ b/gstreamer-check/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_check_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-check/sys/tests/constant.c b/gstreamer-check/sys/tests/constant.c index a337466c3..2b54f6198 100644 --- a/gstreamer-check/sys/tests/constant.c +++ b/gstreamer-check/sys/tests/constant.c @@ -1,27 +1,31 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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; } diff --git a/gstreamer-check/sys/tests/layout.c b/gstreamer-check/sys/tests/layout.c index 8414dd55f..8a25a2a0e 100644 --- a/gstreamer-check/sys/tests/layout.c +++ b/gstreamer-check/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,8 @@ #include 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; } diff --git a/gstreamer-controller/src/auto/versions.txt b/gstreamer-controller/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-controller/src/auto/versions.txt +++ b/gstreamer-controller/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-controller/sys/build.rs b/gstreamer-controller/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-controller/sys/build.rs +++ b/gstreamer-controller/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-controller/sys/src/lib.rs b/gstreamer-controller/sys/src/lib.rs index 1b38553cf..b82911e87 100644 --- a/gstreamer-controller/sys/src/lib.rs +++ b/gstreamer-controller/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-controller/sys/tests/abi.rs b/gstreamer-controller/sys/tests/abi.rs index becd5ad70..a98c42dbd 100644 --- a/gstreamer-controller/sys/tests/abi.rs +++ b/gstreamer-controller/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_controller_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-controller/sys/tests/constant.c b/gstreamer-controller/sys/tests/constant.c index a337466c3..eaeea1bd4 100644 --- a/gstreamer-controller/sys/tests/constant.c +++ b/gstreamer-controller/sys/tests/constant.c @@ -1,27 +1,40 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_CUBIC); + PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_CUBIC_MONOTONIC); + PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_LINEAR); + PRINT_CONSTANT((gint) GST_INTERPOLATION_MODE_NONE); + PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_REVERSE_SAW); + PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_SAW); + PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_SINE); + PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_SQUARE); + PRINT_CONSTANT((gint) GST_LFO_WAVEFORM_TRIANGLE); return 0; } diff --git a/gstreamer-controller/sys/tests/layout.c b/gstreamer-controller/sys/tests/layout.c index 8414dd55f..db8cee471 100644 --- a/gstreamer-controller/sys/tests/layout.c +++ b/gstreamer-controller/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,22 @@ #include 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; } diff --git a/gstreamer-editing-services/src/auto/versions.txt b/gstreamer-editing-services/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-editing-services/src/auto/versions.txt +++ b/gstreamer-editing-services/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-editing-services/sys/build.rs b/gstreamer-editing-services/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-editing-services/sys/build.rs +++ b/gstreamer-editing-services/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-editing-services/sys/src/lib.rs b/gstreamer-editing-services/sys/src/lib.rs index 0715b22dd..a5df211fa 100644 --- a/gstreamer-editing-services/sys/src/lib.rs +++ b/gstreamer-editing-services/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-editing-services/sys/tests/abi.rs b/gstreamer-editing-services/sys/tests/abi.rs index 99b2fca87..e33f469a2 100644 --- a/gstreamer-editing-services/sys/tests/abi.rs +++ b/gstreamer-editing-services/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_editing_services_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-editing-services/sys/tests/constant.c b/gstreamer-editing-services/sys/tests/constant.c index a337466c3..4df6e859a 100644 --- a/gstreamer-editing-services/sys/tests/constant.c +++ b/gstreamer-editing-services/sys/tests/constant.c @@ -1,27 +1,189 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GES_ASSET_LOADING_ASYNC); + PRINT_CONSTANT((gint) GES_ASSET_LOADING_ERROR); + PRINT_CONSTANT((gint) GES_ASSET_LOADING_OK); + PRINT_CONSTANT((gint) GES_CHILDREN_IGNORE_NOTIFIES); + PRINT_CONSTANT((gint) GES_CHILDREN_LAST); + PRINT_CONSTANT((gint) GES_CHILDREN_UPDATE); + PRINT_CONSTANT((gint) GES_CHILDREN_UPDATE_ALL_VALUES); + PRINT_CONSTANT((gint) GES_CHILDREN_UPDATE_OFFSETS); + PRINT_CONSTANT((gint) GES_EDGE_END); + PRINT_CONSTANT((gint) GES_EDGE_NONE); + PRINT_CONSTANT((gint) GES_EDGE_START); + PRINT_CONSTANT((gint) GES_EDIT_MODE_NORMAL); + PRINT_CONSTANT((gint) GES_EDIT_MODE_RIPPLE); + PRINT_CONSTANT((gint) GES_EDIT_MODE_ROLL); + PRINT_CONSTANT((gint) GES_EDIT_MODE_SLIDE); + PRINT_CONSTANT((gint) GES_EDIT_MODE_TRIM); + 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; } diff --git a/gstreamer-editing-services/sys/tests/layout.c b/gstreamer-editing-services/sys/tests/layout.c index 8414dd55f..9c101af23 100644 --- a/gstreamer-editing-services/sys/tests/layout.c +++ b/gstreamer-editing-services/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,126 @@ #include 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; } diff --git a/gstreamer-gl/egl/src/auto/versions.txt b/gstreamer-gl/egl/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-gl/egl/src/auto/versions.txt +++ b/gstreamer-gl/egl/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-gl/egl/sys/build.rs b/gstreamer-gl/egl/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-gl/egl/sys/build.rs +++ b/gstreamer-gl/egl/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-gl/egl/sys/src/lib.rs b/gstreamer-gl/egl/sys/src/lib.rs index 9a665d3b0..2406e8445 100644 --- a/gstreamer-gl/egl/sys/src/lib.rs +++ b/gstreamer-gl/egl/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-gl/egl/sys/tests/abi.rs b/gstreamer-gl/egl/sys/tests/abi.rs index 0ef5cb99d..127d1a5df 100644 --- a/gstreamer-gl/egl/sys/tests/abi.rs +++ b/gstreamer-gl/egl/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_gl_egl_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-gl/egl/sys/tests/constant.c b/gstreamer-gl/egl/sys/tests/constant.c index a337466c3..4dbdacd04 100644 --- a/gstreamer-gl/egl/sys/tests/constant.c +++ b/gstreamer-gl/egl/sys/tests/constant.c @@ -1,27 +1,32 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT(GST_GL_DISPLAY_EGL_NAME); return 0; } diff --git a/gstreamer-gl/egl/sys/tests/layout.c b/gstreamer-gl/egl/sys/tests/layout.c index 8414dd55f..b423f27fc 100644 --- a/gstreamer-gl/egl/sys/tests/layout.c +++ b/gstreamer-gl/egl/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,7 @@ #include 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; } diff --git a/gstreamer-gl/src/auto/versions.txt b/gstreamer-gl/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-gl/src/auto/versions.txt +++ b/gstreamer-gl/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-gl/sys/build.rs b/gstreamer-gl/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-gl/sys/build.rs +++ b/gstreamer-gl/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-gl/sys/src/lib.rs b/gstreamer-gl/sys/src/lib.rs index d8a2638ad..cb7754415 100644 --- a/gstreamer-gl/sys/src/lib.rs +++ b/gstreamer-gl/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-gl/sys/tests/abi.rs b/gstreamer-gl/sys/tests/abi.rs index c286dca96..9a034ca66 100644 --- a/gstreamer-gl/sys/tests/abi.rs +++ b/gstreamer-gl/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_gl_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-gl/sys/tests/constant.c b/gstreamer-gl/sys/tests/constant.c index a337466c3..e2a455385 100644 --- a/gstreamer-gl/sys/tests/constant.c +++ b/gstreamer-gl/sys/tests/constant.c @@ -1,27 +1,161 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_SYNC_META); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_2D); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_EXTERNAL_OES); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_GL_TEXTURE_TARGET_RECTANGLE); + PRINT_CONSTANT(GST_CAPS_FEATURE_MEMORY_GL_BUFFER); + PRINT_CONSTANT(GST_CAPS_FEATURE_MEMORY_GL_MEMORY); + PRINT_CONSTANT((gint) GST_GLSL_ERROR_COMPILE); + PRINT_CONSTANT((gint) GST_GLSL_ERROR_LINK); + PRINT_CONSTANT((gint) GST_GLSL_ERROR_PROGRAM); + PRINT_CONSTANT((guint) GST_GLSL_PROFILE_ANY); + PRINT_CONSTANT((guint) GST_GLSL_PROFILE_COMPATIBILITY); + PRINT_CONSTANT((guint) GST_GLSL_PROFILE_CORE); + PRINT_CONSTANT((guint) GST_GLSL_PROFILE_ES); + PRINT_CONSTANT((guint) GST_GLSL_PROFILE_NONE); + PRINT_CONSTANT((gint) GST_GLSL_VERSION_100); + PRINT_CONSTANT((gint) GST_GLSL_VERSION_110); + 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; } diff --git a/gstreamer-gl/sys/tests/layout.c b/gstreamer-gl/sys/tests/layout.c index 8414dd55f..021700463 100644 --- a/gstreamer-gl/sys/tests/layout.c +++ b/gstreamer-gl/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,70 @@ #include 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; } diff --git a/gstreamer-gl/wayland/src/auto/versions.txt b/gstreamer-gl/wayland/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-gl/wayland/src/auto/versions.txt +++ b/gstreamer-gl/wayland/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-gl/wayland/sys/build.rs b/gstreamer-gl/wayland/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-gl/wayland/sys/build.rs +++ b/gstreamer-gl/wayland/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-gl/wayland/sys/src/lib.rs b/gstreamer-gl/wayland/sys/src/lib.rs index e891219b7..a117c85bb 100644 --- a/gstreamer-gl/wayland/sys/src/lib.rs +++ b/gstreamer-gl/wayland/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-gl/wayland/sys/tests/abi.rs b/gstreamer-gl/wayland/sys/tests/abi.rs index a47345bdd..b11539d5c 100644 --- a/gstreamer-gl/wayland/sys/tests/abi.rs +++ b/gstreamer-gl/wayland/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_gl_wayland_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-gl/wayland/sys/tests/constant.c b/gstreamer-gl/wayland/sys/tests/constant.c index a337466c3..2b54f6198 100644 --- a/gstreamer-gl/wayland/sys/tests/constant.c +++ b/gstreamer-gl/wayland/sys/tests/constant.c @@ -1,27 +1,31 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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; } diff --git a/gstreamer-gl/wayland/sys/tests/layout.c b/gstreamer-gl/wayland/sys/tests/layout.c index 8414dd55f..59b1904e9 100644 --- a/gstreamer-gl/wayland/sys/tests/layout.c +++ b/gstreamer-gl/wayland/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,7 @@ #include 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; } diff --git a/gstreamer-gl/x11/src/auto/versions.txt b/gstreamer-gl/x11/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-gl/x11/src/auto/versions.txt +++ b/gstreamer-gl/x11/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-gl/x11/sys/build.rs b/gstreamer-gl/x11/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-gl/x11/sys/build.rs +++ b/gstreamer-gl/x11/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-gl/x11/sys/src/lib.rs b/gstreamer-gl/x11/sys/src/lib.rs index efb0dc03e..038725f8f 100644 --- a/gstreamer-gl/x11/sys/src/lib.rs +++ b/gstreamer-gl/x11/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-gl/x11/sys/tests/abi.rs b/gstreamer-gl/x11/sys/tests/abi.rs index a432e4a52..b6b0e09cb 100644 --- a/gstreamer-gl/x11/sys/tests/abi.rs +++ b/gstreamer-gl/x11/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_gl_x11_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-gl/x11/sys/tests/constant.c b/gstreamer-gl/x11/sys/tests/constant.c index a337466c3..2b54f6198 100644 --- a/gstreamer-gl/x11/sys/tests/constant.c +++ b/gstreamer-gl/x11/sys/tests/constant.c @@ -1,27 +1,31 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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; } diff --git a/gstreamer-gl/x11/sys/tests/layout.c b/gstreamer-gl/x11/sys/tests/layout.c index 8414dd55f..e0fd32a2d 100644 --- a/gstreamer-gl/x11/sys/tests/layout.c +++ b/gstreamer-gl/x11/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,7 @@ #include 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; } diff --git a/gstreamer-mpegts/sys/build.rs b/gstreamer-mpegts/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-mpegts/sys/build.rs +++ b/gstreamer-mpegts/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-mpegts/sys/src/lib.rs b/gstreamer-mpegts/sys/src/lib.rs index 9c544318b..fb8d4feb9 100644 --- a/gstreamer-mpegts/sys/src/lib.rs +++ b/gstreamer-mpegts/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-mpegts/sys/tests/abi.rs b/gstreamer-mpegts/sys/tests/abi.rs index 008c27bae..99d5db5cf 100644 --- a/gstreamer-mpegts/sys/tests/abi.rs +++ b/gstreamer-mpegts/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_mpegts_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-mpegts/sys/tests/constant.c b/gstreamer-mpegts/sys/tests/constant.c index a337466c3..eadd96be3 100644 --- a/gstreamer-mpegts/sys/tests/constant.c +++ b/gstreamer-mpegts/sys/tests/constant.c @@ -1,27 +1,537 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) ADDITIONAL_INFO_PAGE); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_DIGITAL_RADIO_SOUND); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_HD_DIGITAL_TELEVISION); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_REFERENCE); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_HD_NVOD_TIME_SHIFTED); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_MOSAIC); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_SD_DIGITAL_TELEVISION); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_REFERENCE); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_SD_NVOD_TIME_SHIFTED); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_DIGITAL_TELEVISION); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_REFERENCE); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_ADVANCED_CODEC_STEREO_HD_NVOD_TIME_SHIFTED); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_DATA_BROADCAST); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_DIGITAL_RADIO_SOUND); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_DIGITAL_TELEVISION); + PRINT_CONSTANT((gint) GST_DVB_SERVICE_DVB_MHP); + 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; } diff --git a/gstreamer-mpegts/sys/tests/layout.c b/gstreamer-mpegts/sys/tests/layout.c index 8414dd55f..c4d6f04a0 100644 --- a/gstreamer-mpegts/sys/tests/layout.c +++ b/gstreamer-mpegts/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,91 @@ #include 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; } diff --git a/gstreamer-net/src/auto/versions.txt b/gstreamer-net/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-net/src/auto/versions.txt +++ b/gstreamer-net/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-net/sys/build.rs b/gstreamer-net/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-net/sys/build.rs +++ b/gstreamer-net/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-net/sys/src/lib.rs b/gstreamer-net/sys/src/lib.rs index 23cc6d6df..be38c21bf 100644 --- a/gstreamer-net/sys/src/lib.rs +++ b/gstreamer-net/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-net/sys/tests/abi.rs b/gstreamer-net/sys/tests/abi.rs index b131aba4e..439bec4bd 100644 --- a/gstreamer-net/sys/tests/abi.rs +++ b/gstreamer-net/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_net_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-net/sys/tests/constant.c b/gstreamer-net/sys/tests/constant.c index a337466c3..952566dc9 100644 --- a/gstreamer-net/sys/tests/constant.c +++ b/gstreamer-net/sys/tests/constant.c @@ -1,27 +1,37 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT(GST_NET_TIME_PACKET_SIZE); + PRINT_CONSTANT(GST_PTP_CLOCK_ID_NONE); + PRINT_CONSTANT(GST_PTP_STATISTICS_BEST_MASTER_CLOCK_SELECTED); + PRINT_CONSTANT(GST_PTP_STATISTICS_NEW_DOMAIN_FOUND); + PRINT_CONSTANT(GST_PTP_STATISTICS_PATH_DELAY_MEASURED); + PRINT_CONSTANT(GST_PTP_STATISTICS_TIME_UPDATED); return 0; } diff --git a/gstreamer-net/sys/tests/layout.c b/gstreamer-net/sys/tests/layout.c index 8414dd55f..1ae047f6a 100644 --- a/gstreamer-net/sys/tests/layout.c +++ b/gstreamer-net/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,16 @@ #include 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; } diff --git a/gstreamer-pbutils/src/auto/versions.txt b/gstreamer-pbutils/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-pbutils/src/auto/versions.txt +++ b/gstreamer-pbutils/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-pbutils/sys/build.rs b/gstreamer-pbutils/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-pbutils/sys/build.rs +++ b/gstreamer-pbutils/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-pbutils/sys/src/lib.rs b/gstreamer-pbutils/sys/src/lib.rs index 30ec607b9..0a5a9367f 100644 --- a/gstreamer-pbutils/sys/src/lib.rs +++ b/gstreamer-pbutils/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-pbutils/sys/tests/abi.rs b/gstreamer-pbutils/sys/tests/abi.rs index fbfd111b0..76dc69338 100644 --- a/gstreamer-pbutils/sys/tests/abi.rs +++ b/gstreamer-pbutils/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_pbutils_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-pbutils/sys/tests/constant.c b/gstreamer-pbutils/sys/tests/constant.c index a337466c3..3bd54d05a 100644 --- a/gstreamer-pbutils/sys/tests/constant.c +++ b/gstreamer-pbutils/sys/tests/constant.c @@ -1,27 +1,68 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT); + PRINT_CONSTANT((gint) GST_AUDIO_VISUALIZER_SHADER_NONE); + PRINT_CONSTANT((gint) GST_DISCOVERER_BUSY); + PRINT_CONSTANT((gint) GST_DISCOVERER_ERROR); + PRINT_CONSTANT((gint) GST_DISCOVERER_MISSING_PLUGINS); + PRINT_CONSTANT((gint) GST_DISCOVERER_OK); + PRINT_CONSTANT((guint) GST_DISCOVERER_SERIALIZE_ALL); + PRINT_CONSTANT((guint) GST_DISCOVERER_SERIALIZE_BASIC); + 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; } diff --git a/gstreamer-pbutils/sys/tests/layout.c b/gstreamer-pbutils/sys/tests/layout.c index 8414dd55f..aa9c287da 100644 --- a/gstreamer-pbutils/sys/tests/layout.c +++ b/gstreamer-pbutils/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,20 @@ #include 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; } diff --git a/gstreamer-player/src/auto/versions.txt b/gstreamer-player/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-player/src/auto/versions.txt +++ b/gstreamer-player/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-player/sys/build.rs b/gstreamer-player/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-player/sys/build.rs +++ b/gstreamer-player/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-player/sys/src/lib.rs b/gstreamer-player/sys/src/lib.rs index 670904084..f7263b64a 100644 --- a/gstreamer-player/sys/src/lib.rs +++ b/gstreamer-player/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-player/sys/tests/abi.rs b/gstreamer-player/sys/tests/abi.rs index c5ad4f6cc..3235317c1 100644 --- a/gstreamer-player/sys/tests/abi.rs +++ b/gstreamer-player/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_player_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-player/sys/tests/constant.c b/gstreamer-player/sys/tests/constant.c index a337466c3..ed0a307a0 100644 --- a/gstreamer-player/sys/tests/constant.c +++ b/gstreamer-player/sys/tests/constant.c @@ -1,27 +1,45 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_BRIGHTNESS); + PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_CONTRAST); + PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_HUE); + PRINT_CONSTANT((gint) GST_PLAYER_COLOR_BALANCE_SATURATION); + PRINT_CONSTANT((gint) GST_PLAYER_ERROR_FAILED); + PRINT_CONSTANT((gint) GST_PLAYER_STATE_BUFFERING); + PRINT_CONSTANT((gint) GST_PLAYER_STATE_PAUSED); + PRINT_CONSTANT((gint) GST_PLAYER_STATE_PLAYING); + PRINT_CONSTANT((gint) GST_PLAYER_STATE_STOPPED); + PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_JPG); + PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_PNG); + PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_RAW_BGRx); + PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_RAW_NATIVE); + PRINT_CONSTANT((gint) GST_PLAYER_THUMBNAIL_RAW_xRGB); return 0; } diff --git a/gstreamer-player/sys/tests/layout.c b/gstreamer-player/sys/tests/layout.c index 8414dd55f..f044a322f 100644 --- a/gstreamer-player/sys/tests/layout.c +++ b/gstreamer-player/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,12 @@ #include 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; } diff --git a/gstreamer-rtp/src/auto/versions.txt b/gstreamer-rtp/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-rtp/src/auto/versions.txt +++ b/gstreamer-rtp/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-rtp/sys/build.rs b/gstreamer-rtp/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-rtp/sys/build.rs +++ b/gstreamer-rtp/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-rtp/sys/src/lib.rs b/gstreamer-rtp/sys/src/lib.rs index a82df08ac..c0af4aeff 100644 --- a/gstreamer-rtp/sys/src/lib.rs +++ b/gstreamer-rtp/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-rtp/sys/tests/abi.rs b/gstreamer-rtp/sys/tests/abi.rs index 699b1aa88..15803db45 100644 --- a/gstreamer-rtp/sys/tests/abi.rs +++ b/gstreamer-rtp/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_rtp_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-rtp/sys/tests/constant.c b/gstreamer-rtp/sys/tests/constant.c index a337466c3..a119c7131 100644 --- a/gstreamer-rtp/sys/tests/constant.c +++ b/gstreamer-rtp/sys/tests/constant.c @@ -1,27 +1,158 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_RTCP_FB_TYPE_INVALID); + PRINT_CONSTANT(GST_RTCP_MAX_BYE_SSRC_COUNT); + PRINT_CONSTANT(GST_RTCP_MAX_RB_COUNT); + PRINT_CONSTANT(GST_RTCP_MAX_SDES); + PRINT_CONSTANT(GST_RTCP_MAX_SDES_ITEM_COUNT); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_AFB); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_FIR); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_PLI); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_RPSI); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_SLI); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_TSTN); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_TSTR); + PRINT_CONSTANT((gint) GST_RTCP_PSFB_TYPE_VBCN); + PRINT_CONSTANT(GST_RTCP_REDUCED_SIZE_VALID_MASK); + PRINT_CONSTANT((gint) GST_RTCP_RTPFB_TYPE_NACK); + PRINT_CONSTANT((gint) GST_RTCP_RTPFB_TYPE_RTCP_SR_REQ); + 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; } diff --git a/gstreamer-rtp/sys/tests/layout.c b/gstreamer-rtp/sys/tests/layout.c index 8414dd55f..8a67fdc44 100644 --- a/gstreamer-rtp/sys/tests/layout.c +++ b/gstreamer-rtp/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,24 @@ #include 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; } diff --git a/gstreamer-rtsp-server/src/auto/versions.txt b/gstreamer-rtsp-server/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-rtsp-server/src/auto/versions.txt +++ b/gstreamer-rtsp-server/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-rtsp-server/sys/build.rs b/gstreamer-rtsp-server/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-rtsp-server/sys/build.rs +++ b/gstreamer-rtsp-server/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-rtsp-server/sys/src/lib.rs b/gstreamer-rtsp-server/sys/src/lib.rs index 370110efb..c0b3aedc8 100644 --- a/gstreamer-rtsp-server/sys/src/lib.rs +++ b/gstreamer-rtsp-server/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-rtsp-server/sys/tests/abi.rs b/gstreamer-rtsp-server/sys/tests/abi.rs index c737049fa..ba8cb054c 100644 --- a/gstreamer-rtsp-server/sys/tests/abi.rs +++ b/gstreamer-rtsp-server/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_rtsp_server_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-rtsp-server/sys/tests/constant.c b/gstreamer-rtsp-server/sys/tests/constant.c index a337466c3..1ba59e58e 100644 --- a/gstreamer-rtsp-server/sys/tests/constant.c +++ b/gstreamer-rtsp-server/sys/tests/constant.c @@ -1,27 +1,74 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_EVEN_PORT); + PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_IPV4); + PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_IPV6); + PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_MULTICAST); + PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_NONE); + PRINT_CONSTANT((guint) GST_RTSP_ADDRESS_FLAG_UNICAST); + PRINT_CONSTANT(GST_RTSP_ADDRESS_POOL_ANY_IPV4); + PRINT_CONSTANT(GST_RTSP_ADDRESS_POOL_ANY_IPV6); + PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_EINVAL); + PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_ELAST); + PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_ERANGE); + PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_ERESERVED); + PRINT_CONSTANT((gint) GST_RTSP_ADDRESS_POOL_OK); + PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_CONNECT); + PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_ACCESS); + PRINT_CONSTANT(GST_RTSP_AUTH_CHECK_MEDIA_FACTORY_CONSTRUCT); + 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; } diff --git a/gstreamer-rtsp-server/sys/tests/layout.c b/gstreamer-rtsp-server/sys/tests/layout.c index 8414dd55f..755a2593a 100644 --- a/gstreamer-rtsp-server/sys/tests/layout.c +++ b/gstreamer-rtsp-server/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,55 @@ #include 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; } diff --git a/gstreamer-rtsp/src/auto/versions.txt b/gstreamer-rtsp/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-rtsp/src/auto/versions.txt +++ b/gstreamer-rtsp/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-rtsp/sys/build.rs b/gstreamer-rtsp/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-rtsp/sys/build.rs +++ b/gstreamer-rtsp/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-rtsp/sys/src/lib.rs b/gstreamer-rtsp/sys/src/lib.rs index 66071bba1..8303035d7 100644 --- a/gstreamer-rtsp/sys/src/lib.rs +++ b/gstreamer-rtsp/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-rtsp/sys/tests/abi.rs b/gstreamer-rtsp/sys/tests/abi.rs index 39d0d255b..dfff7b11c 100644 --- a/gstreamer-rtsp/sys/tests/abi.rs +++ b/gstreamer-rtsp/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_rtsp_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-rtsp/sys/tests/constant.c b/gstreamer-rtsp/sys/tests/constant.c index a337466c3..3b0f8ef7e 100644 --- a/gstreamer-rtsp/sys/tests/constant.c +++ b/gstreamer-rtsp/sys/tests/constant.c @@ -1,27 +1,248 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((guint) GST_RTSP_ANNOUNCE); + PRINT_CONSTANT((gint) GST_RTSP_AUTH_BASIC); + PRINT_CONSTANT((gint) GST_RTSP_AUTH_DIGEST); + PRINT_CONSTANT((gint) GST_RTSP_AUTH_NONE); + PRINT_CONSTANT(GST_RTSP_DEFAULT_PORT); + PRINT_CONSTANT((guint) GST_RTSP_DESCRIBE); + PRINT_CONSTANT((gint) GST_RTSP_EEOF); + PRINT_CONSTANT((gint) GST_RTSP_EINTR); + PRINT_CONSTANT((gint) GST_RTSP_EINVAL); + PRINT_CONSTANT((gint) GST_RTSP_ELAST); + PRINT_CONSTANT((gint) GST_RTSP_ENET); + PRINT_CONSTANT((gint) GST_RTSP_ENOMEM); + PRINT_CONSTANT((gint) GST_RTSP_ENOTIMPL); + PRINT_CONSTANT((gint) GST_RTSP_ENOTIP); + PRINT_CONSTANT((gint) GST_RTSP_EPARSE); + PRINT_CONSTANT((gint) GST_RTSP_ERESOLV); + 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; } diff --git a/gstreamer-rtsp/sys/tests/layout.c b/gstreamer-rtsp/sys/tests/layout.c index 8414dd55f..0bef153eb 100644 --- a/gstreamer-rtsp/sys/tests/layout.c +++ b/gstreamer-rtsp/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,31 @@ #include int main() { - printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); + printf("%s;%zu;%zu\n", "GstRTSPAuthCredential", sizeof(GstRTSPAuthCredential), alignof(GstRTSPAuthCredential)); + printf("%s;%zu;%zu\n", "GstRTSPAuthMethod", sizeof(GstRTSPAuthMethod), alignof(GstRTSPAuthMethod)); + printf("%s;%zu;%zu\n", "GstRTSPAuthParam", sizeof(GstRTSPAuthParam), alignof(GstRTSPAuthParam)); + printf("%s;%zu;%zu\n", "GstRTSPEvent", sizeof(GstRTSPEvent), alignof(GstRTSPEvent)); + printf("%s;%zu;%zu\n", "GstRTSPExtensionInterface", sizeof(GstRTSPExtensionInterface), alignof(GstRTSPExtensionInterface)); + printf("%s;%zu;%zu\n", "GstRTSPFamily", sizeof(GstRTSPFamily), alignof(GstRTSPFamily)); + printf("%s;%zu;%zu\n", "GstRTSPHeaderField", sizeof(GstRTSPHeaderField), alignof(GstRTSPHeaderField)); + printf("%s;%zu;%zu\n", "GstRTSPLowerTrans", sizeof(GstRTSPLowerTrans), alignof(GstRTSPLowerTrans)); + printf("%s;%zu;%zu\n", "GstRTSPMessage", sizeof(GstRTSPMessage), alignof(GstRTSPMessage)); + printf("%s;%zu;%zu\n", "GstRTSPMethod", sizeof(GstRTSPMethod), alignof(GstRTSPMethod)); + printf("%s;%zu;%zu\n", "GstRTSPMsgType", sizeof(GstRTSPMsgType), alignof(GstRTSPMsgType)); + printf("%s;%zu;%zu\n", "GstRTSPProfile", sizeof(GstRTSPProfile), alignof(GstRTSPProfile)); + printf("%s;%zu;%zu\n", "GstRTSPRange", sizeof(GstRTSPRange), alignof(GstRTSPRange)); + printf("%s;%zu;%zu\n", "GstRTSPRangeUnit", sizeof(GstRTSPRangeUnit), alignof(GstRTSPRangeUnit)); + printf("%s;%zu;%zu\n", "GstRTSPResult", sizeof(GstRTSPResult), alignof(GstRTSPResult)); + printf("%s;%zu;%zu\n", "GstRTSPState", sizeof(GstRTSPState), alignof(GstRTSPState)); + printf("%s;%zu;%zu\n", "GstRTSPStatusCode", sizeof(GstRTSPStatusCode), alignof(GstRTSPStatusCode)); + printf("%s;%zu;%zu\n", "GstRTSPTime", sizeof(GstRTSPTime), alignof(GstRTSPTime)); + printf("%s;%zu;%zu\n", "GstRTSPTime2", sizeof(GstRTSPTime2), alignof(GstRTSPTime2)); + printf("%s;%zu;%zu\n", "GstRTSPTimeRange", sizeof(GstRTSPTimeRange), alignof(GstRTSPTimeRange)); + printf("%s;%zu;%zu\n", "GstRTSPTimeType", sizeof(GstRTSPTimeType), alignof(GstRTSPTimeType)); + printf("%s;%zu;%zu\n", "GstRTSPTransMode", sizeof(GstRTSPTransMode), alignof(GstRTSPTransMode)); + printf("%s;%zu;%zu\n", "GstRTSPTransport", sizeof(GstRTSPTransport), alignof(GstRTSPTransport)); + printf("%s;%zu;%zu\n", "GstRTSPUrl", sizeof(GstRTSPUrl), alignof(GstRTSPUrl)); + printf("%s;%zu;%zu\n", "GstRTSPVersion", sizeof(GstRTSPVersion), alignof(GstRTSPVersion)); + printf("%s;%zu;%zu\n", "GstRTSPWatchFuncs", sizeof(GstRTSPWatchFuncs), alignof(GstRTSPWatchFuncs)); return 0; } diff --git a/gstreamer-sdp/src/auto/versions.txt b/gstreamer-sdp/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-sdp/src/auto/versions.txt +++ b/gstreamer-sdp/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-sdp/sys/build.rs b/gstreamer-sdp/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-sdp/sys/build.rs +++ b/gstreamer-sdp/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-sdp/sys/src/lib.rs b/gstreamer-sdp/sys/src/lib.rs index f62bb8e14..d1ae7c655 100644 --- a/gstreamer-sdp/sys/src/lib.rs +++ b/gstreamer-sdp/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-sdp/sys/tests/abi.rs b/gstreamer-sdp/sys/tests/abi.rs index 554055843..9938d660f 100644 --- a/gstreamer-sdp/sys/tests/abi.rs +++ b/gstreamer-sdp/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_sdp_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-sdp/sys/tests/constant.c b/gstreamer-sdp/sys/tests/constant.c index a337466c3..7936bf76a 100644 --- a/gstreamer-sdp/sys/tests/constant.c +++ b/gstreamer-sdp/sys/tests/constant.c @@ -1,27 +1,97 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_MIKEY_CACHE_ALWAYS); + PRINT_CONSTANT((gint) GST_MIKEY_CACHE_FOR_CSB); + PRINT_CONSTANT((gint) GST_MIKEY_CACHE_NONE); + PRINT_CONSTANT((gint) GST_MIKEY_ENC_AES_CM_128); + PRINT_CONSTANT((gint) GST_MIKEY_ENC_AES_GCM_128); + PRINT_CONSTANT((gint) GST_MIKEY_ENC_AES_KW_128); + PRINT_CONSTANT((gint) GST_MIKEY_ENC_NULL); + PRINT_CONSTANT((gint) GST_MIKEY_KD_TEK); + PRINT_CONSTANT((gint) GST_MIKEY_KD_TGK); + PRINT_CONSTANT((gint) GST_MIKEY_KV_INTERVAL); + PRINT_CONSTANT((gint) GST_MIKEY_KV_NULL); + PRINT_CONSTANT((gint) GST_MIKEY_KV_SPI); + PRINT_CONSTANT((gint) GST_MIKEY_MAC_HMAC_SHA_1_160); + PRINT_CONSTANT((gint) GST_MIKEY_MAC_NULL); + PRINT_CONSTANT((gint) GST_MIKEY_MAP_TYPE_SRTP); + PRINT_CONSTANT((gint) GST_MIKEY_PRF_MIKEY_1); + PRINT_CONSTANT((gint) GST_MIKEY_PT_CERT); + PRINT_CONSTANT((gint) GST_MIKEY_PT_CHASH); + PRINT_CONSTANT((gint) GST_MIKEY_PT_DH); + PRINT_CONSTANT((gint) GST_MIKEY_PT_ERR); + PRINT_CONSTANT((gint) GST_MIKEY_PT_GEN_EXT); + PRINT_CONSTANT((gint) GST_MIKEY_PT_ID); + PRINT_CONSTANT((gint) GST_MIKEY_PT_KEMAC); + PRINT_CONSTANT((gint) GST_MIKEY_PT_KEY_DATA); + PRINT_CONSTANT((gint) GST_MIKEY_PT_LAST); + PRINT_CONSTANT((gint) GST_MIKEY_PT_PKE); + PRINT_CONSTANT((gint) GST_MIKEY_PT_RAND); + PRINT_CONSTANT((gint) GST_MIKEY_PT_SIGN); + PRINT_CONSTANT((gint) GST_MIKEY_PT_SP); + PRINT_CONSTANT((gint) GST_MIKEY_PT_T); + PRINT_CONSTANT((gint) GST_MIKEY_PT_V); + PRINT_CONSTANT((gint) GST_MIKEY_SEC_PROTO_SRTP); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_AEAD_AUTH_TAG_LEN); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_AUTH_ALG); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_AUTH_KEY_LEN); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_AUTH_TAG_LEN); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_ENC_ALG); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_ENC_KEY_LEN); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_FEC_ORDER); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_KEY_DERIV_RATE); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_PRF); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_SALT_KEY_LEN); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_SRTCP_ENC); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_SRTP_AUTH); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_SRTP_ENC); + PRINT_CONSTANT((gint) GST_MIKEY_SP_SRTP_SRTP_PREFIX_LEN); + PRINT_CONSTANT((gint) GST_MIKEY_TS_TYPE_COUNTER); + PRINT_CONSTANT((gint) GST_MIKEY_TS_TYPE_NTP); + PRINT_CONSTANT((gint) GST_MIKEY_TS_TYPE_NTP_UTC); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_DH_INIT); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_DH_RESP); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_ERROR); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_INVALID); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_PK_INIT); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_PK_VERIFY); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_PSK_INIT); + PRINT_CONSTANT((gint) GST_MIKEY_TYPE_PSK_VERIFY); + PRINT_CONSTANT(GST_MIKEY_VERSION); + PRINT_CONSTANT(GST_SDP_BWTYPE_AS); + PRINT_CONSTANT(GST_SDP_BWTYPE_CT); + PRINT_CONSTANT(GST_SDP_BWTYPE_EXT_PREFIX); + PRINT_CONSTANT(GST_SDP_BWTYPE_RR); + PRINT_CONSTANT(GST_SDP_BWTYPE_RS); + PRINT_CONSTANT(GST_SDP_BWTYPE_TIAS); + PRINT_CONSTANT((gint) GST_SDP_EINVAL); + PRINT_CONSTANT((gint) GST_SDP_OK); return 0; } diff --git a/gstreamer-sdp/sys/tests/layout.c b/gstreamer-sdp/sys/tests/layout.c index 8414dd55f..4db3e4ffd 100644 --- a/gstreamer-sdp/sys/tests/layout.c +++ b/gstreamer-sdp/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,37 @@ #include int main() { - printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); + printf("%s;%zu;%zu\n", "GstMIKEYCacheType", sizeof(GstMIKEYCacheType), alignof(GstMIKEYCacheType)); + printf("%s;%zu;%zu\n", "GstMIKEYEncAlg", sizeof(GstMIKEYEncAlg), alignof(GstMIKEYEncAlg)); + printf("%s;%zu;%zu\n", "GstMIKEYKVType", sizeof(GstMIKEYKVType), alignof(GstMIKEYKVType)); + printf("%s;%zu;%zu\n", "GstMIKEYKeyDataType", sizeof(GstMIKEYKeyDataType), alignof(GstMIKEYKeyDataType)); + printf("%s;%zu;%zu\n", "GstMIKEYMacAlg", sizeof(GstMIKEYMacAlg), alignof(GstMIKEYMacAlg)); + printf("%s;%zu;%zu\n", "GstMIKEYMapSRTP", sizeof(GstMIKEYMapSRTP), alignof(GstMIKEYMapSRTP)); + printf("%s;%zu;%zu\n", "GstMIKEYMapType", sizeof(GstMIKEYMapType), alignof(GstMIKEYMapType)); + printf("%s;%zu;%zu\n", "GstMIKEYMessage", sizeof(GstMIKEYMessage), alignof(GstMIKEYMessage)); + printf("%s;%zu;%zu\n", "GstMIKEYPRFFunc", sizeof(GstMIKEYPRFFunc), alignof(GstMIKEYPRFFunc)); + printf("%s;%zu;%zu\n", "GstMIKEYPayload", sizeof(GstMIKEYPayload), alignof(GstMIKEYPayload)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadKEMAC", sizeof(GstMIKEYPayloadKEMAC), alignof(GstMIKEYPayloadKEMAC)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadKeyData", sizeof(GstMIKEYPayloadKeyData), alignof(GstMIKEYPayloadKeyData)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadPKE", sizeof(GstMIKEYPayloadPKE), alignof(GstMIKEYPayloadPKE)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadRAND", sizeof(GstMIKEYPayloadRAND), alignof(GstMIKEYPayloadRAND)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadSP", sizeof(GstMIKEYPayloadSP), alignof(GstMIKEYPayloadSP)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadSPParam", sizeof(GstMIKEYPayloadSPParam), alignof(GstMIKEYPayloadSPParam)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadT", sizeof(GstMIKEYPayloadT), alignof(GstMIKEYPayloadT)); + printf("%s;%zu;%zu\n", "GstMIKEYPayloadType", sizeof(GstMIKEYPayloadType), alignof(GstMIKEYPayloadType)); + printf("%s;%zu;%zu\n", "GstMIKEYSecProto", sizeof(GstMIKEYSecProto), alignof(GstMIKEYSecProto)); + printf("%s;%zu;%zu\n", "GstMIKEYSecSRTP", sizeof(GstMIKEYSecSRTP), alignof(GstMIKEYSecSRTP)); + printf("%s;%zu;%zu\n", "GstMIKEYTSType", sizeof(GstMIKEYTSType), alignof(GstMIKEYTSType)); + printf("%s;%zu;%zu\n", "GstMIKEYType", sizeof(GstMIKEYType), alignof(GstMIKEYType)); + printf("%s;%zu;%zu\n", "GstSDPAttribute", sizeof(GstSDPAttribute), alignof(GstSDPAttribute)); + printf("%s;%zu;%zu\n", "GstSDPBandwidth", sizeof(GstSDPBandwidth), alignof(GstSDPBandwidth)); + printf("%s;%zu;%zu\n", "GstSDPConnection", sizeof(GstSDPConnection), alignof(GstSDPConnection)); + printf("%s;%zu;%zu\n", "GstSDPKey", sizeof(GstSDPKey), alignof(GstSDPKey)); + printf("%s;%zu;%zu\n", "GstSDPMedia", sizeof(GstSDPMedia), alignof(GstSDPMedia)); + printf("%s;%zu;%zu\n", "GstSDPMessage", sizeof(GstSDPMessage), alignof(GstSDPMessage)); + printf("%s;%zu;%zu\n", "GstSDPOrigin", sizeof(GstSDPOrigin), alignof(GstSDPOrigin)); + printf("%s;%zu;%zu\n", "GstSDPResult", sizeof(GstSDPResult), alignof(GstSDPResult)); + printf("%s;%zu;%zu\n", "GstSDPTime", sizeof(GstSDPTime), alignof(GstSDPTime)); + printf("%s;%zu;%zu\n", "GstSDPZone", sizeof(GstSDPZone), alignof(GstSDPZone)); return 0; } diff --git a/gstreamer-tag/sys/build.rs b/gstreamer-tag/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-tag/sys/build.rs +++ b/gstreamer-tag/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-tag/sys/src/lib.rs b/gstreamer-tag/sys/src/lib.rs index 07c1980ad..0f3b2344e 100644 --- a/gstreamer-tag/sys/src/lib.rs +++ b/gstreamer-tag/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-tag/sys/tests/abi.rs b/gstreamer-tag/sys/tests/abi.rs index 808ebea8a..fc9a66f82 100644 --- a/gstreamer-tag/sys/tests/abi.rs +++ b/gstreamer-tag/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_tag_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-tag/sys/tests/constant.c b/gstreamer-tag/sys/tests/constant.c index a337466c3..8013a694f 100644 --- a/gstreamer-tag/sys/tests/constant.c +++ b/gstreamer-tag/sys/tests/constant.c @@ -1,27 +1,107 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT(GST_TAG_ACOUSTID_FINGERPRINT); + PRINT_CONSTANT(GST_TAG_ACOUSTID_ID); + PRINT_CONSTANT(GST_TAG_CAPTURING_CONTRAST); + PRINT_CONSTANT(GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO); + PRINT_CONSTANT(GST_TAG_CAPTURING_EXPOSURE_COMPENSATION); + PRINT_CONSTANT(GST_TAG_CAPTURING_EXPOSURE_MODE); + PRINT_CONSTANT(GST_TAG_CAPTURING_EXPOSURE_PROGRAM); + PRINT_CONSTANT(GST_TAG_CAPTURING_FLASH_FIRED); + PRINT_CONSTANT(GST_TAG_CAPTURING_FLASH_MODE); + PRINT_CONSTANT(GST_TAG_CAPTURING_FOCAL_LENGTH); + PRINT_CONSTANT(GST_TAG_CAPTURING_FOCAL_LENGTH_35_MM); + PRINT_CONSTANT(GST_TAG_CAPTURING_FOCAL_RATIO); + PRINT_CONSTANT(GST_TAG_CAPTURING_GAIN_ADJUSTMENT); + PRINT_CONSTANT(GST_TAG_CAPTURING_ISO_SPEED); + PRINT_CONSTANT(GST_TAG_CAPTURING_METERING_MODE); + PRINT_CONSTANT(GST_TAG_CAPTURING_SATURATION); + PRINT_CONSTANT(GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE); + PRINT_CONSTANT(GST_TAG_CAPTURING_SHARPNESS); + PRINT_CONSTANT(GST_TAG_CAPTURING_SHUTTER_SPEED); + PRINT_CONSTANT(GST_TAG_CAPTURING_SOURCE); + PRINT_CONSTANT(GST_TAG_CAPTURING_WHITE_BALANCE); + PRINT_CONSTANT(GST_TAG_CDDA_CDDB_DISCID); + PRINT_CONSTANT(GST_TAG_CDDA_CDDB_DISCID_FULL); + PRINT_CONSTANT(GST_TAG_CDDA_MUSICBRAINZ_DISCID); + PRINT_CONSTANT(GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL); + PRINT_CONSTANT(GST_TAG_CMML_CLIP); + PRINT_CONSTANT(GST_TAG_CMML_HEAD); + PRINT_CONSTANT(GST_TAG_CMML_STREAM); + PRINT_CONSTANT((gint) GST_TAG_DEMUX_RESULT_AGAIN); + PRINT_CONSTANT((gint) GST_TAG_DEMUX_RESULT_BROKEN_TAG); + PRINT_CONSTANT((gint) GST_TAG_DEMUX_RESULT_OK); + PRINT_CONSTANT(GST_TAG_ID3V2_HEADER_SIZE); + PRINT_CONSTANT(GST_TAG_IMAGE_HORIZONTAL_PPI); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_ARTIST); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_BACK_COVER); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_COMPOSER); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_CONDUCTOR); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_DURING_RECORDING); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_FISH); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_FRONT_COVER); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_ILLUSTRATION); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_LEAD_ARTIST); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_LEAFLET_PAGE); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_LYRICIST); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_MEDIUM); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_NONE); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_RECORDING_LOCATION); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_UNDEFINED); + PRINT_CONSTANT((gint) GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE); + PRINT_CONSTANT(GST_TAG_IMAGE_VERTICAL_PPI); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_PERMITS_DISTRIBUTION); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_PERMITS_REPRODUCTION); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_PERMITS_SHARING); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_REQUIRES_ATTRIBUTION); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_REQUIRES_COPYLEFT); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_REQUIRES_NOTICE); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE); + PRINT_CONSTANT((guint) GST_TAG_LICENSE_REQUIRES_SOURCE_CODE); + PRINT_CONSTANT(GST_TAG_MUSICAL_KEY); + PRINT_CONSTANT(GST_TAG_MUSICBRAINZ_ALBUMARTISTID); + PRINT_CONSTANT(GST_TAG_MUSICBRAINZ_ALBUMID); + PRINT_CONSTANT(GST_TAG_MUSICBRAINZ_ARTISTID); + PRINT_CONSTANT(GST_TAG_MUSICBRAINZ_RELEASEGROUPID); + PRINT_CONSTANT(GST_TAG_MUSICBRAINZ_RELEASETRACKID); + PRINT_CONSTANT(GST_TAG_MUSICBRAINZ_TRACKID); + PRINT_CONSTANT(GST_TAG_MUSICBRAINZ_TRMID); return 0; } diff --git a/gstreamer-tag/sys/tests/layout.c b/gstreamer-tag/sys/tests/layout.c index 8414dd55f..38ed73daa 100644 --- a/gstreamer-tag/sys/tests/layout.c +++ b/gstreamer-tag/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,13 @@ #include int main() { - printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); + printf("%s;%zu;%zu\n", "GstTagDemux", sizeof(GstTagDemux), alignof(GstTagDemux)); + printf("%s;%zu;%zu\n", "GstTagDemuxClass", sizeof(GstTagDemuxClass), alignof(GstTagDemuxClass)); + printf("%s;%zu;%zu\n", "GstTagDemuxResult", sizeof(GstTagDemuxResult), alignof(GstTagDemuxResult)); + printf("%s;%zu;%zu\n", "GstTagImageType", sizeof(GstTagImageType), alignof(GstTagImageType)); + printf("%s;%zu;%zu\n", "GstTagLicenseFlags", sizeof(GstTagLicenseFlags), alignof(GstTagLicenseFlags)); + printf("%s;%zu;%zu\n", "GstTagMux", sizeof(GstTagMux), alignof(GstTagMux)); + printf("%s;%zu;%zu\n", "GstTagMuxClass", sizeof(GstTagMuxClass), alignof(GstTagMuxClass)); + printf("%s;%zu;%zu\n", "GstTagXmpWriterInterface", sizeof(GstTagXmpWriterInterface), alignof(GstTagXmpWriterInterface)); return 0; } diff --git a/gstreamer-video/src/auto/versions.txt b/gstreamer-video/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-video/src/auto/versions.txt +++ b/gstreamer-video/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-video/sys/build.rs b/gstreamer-video/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-video/sys/build.rs +++ b/gstreamer-video/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-video/sys/src/lib.rs b/gstreamer-video/sys/src/lib.rs index fa8936700..fe4dada8a 100644 --- a/gstreamer-video/sys/src/lib.rs +++ b/gstreamer-video/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-video/sys/tests/abi.rs b/gstreamer-video/sys/tests/abi.rs index 0a1c0e359..163cbf2f9 100644 --- a/gstreamer-video/sys/tests/abi.rs +++ b/gstreamer-video/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_video_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-video/sys/tests/constant.c b/gstreamer-video/sys/tests/constant.c index a337466c3..f5ac4b366 100644 --- a/gstreamer-video/sys/tests/constant.c +++ b/gstreamer-video/sys/tests/constant.c @@ -1,27 +1,468 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_VIDEO_AFFINE_TRANSFORMATION_META); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META); + PRINT_CONSTANT(GST_BUFFER_POOL_OPTION_VIDEO_META); + PRINT_CONSTANT(GST_CAPS_FEATURE_FORMAT_INTERLACED); + PRINT_CONSTANT(GST_CAPS_FEATURE_META_GST_VIDEO_AFFINE_TRANSFORMATION_META); + PRINT_CONSTANT(GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META); + PRINT_CONSTANT(GST_CAPS_FEATURE_META_GST_VIDEO_META); + PRINT_CONSTANT(GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); + PRINT_CONSTANT((gint) GST_COLOR_BALANCE_HARDWARE); + PRINT_CONSTANT((gint) GST_COLOR_BALANCE_SOFTWARE); + PRINT_CONSTANT(GST_META_TAG_VIDEO_COLORSPACE_STR); + PRINT_CONSTANT(GST_META_TAG_VIDEO_ORIENTATION_STR); + PRINT_CONSTANT(GST_META_TAG_VIDEO_SIZE_STR); + PRINT_CONSTANT(GST_META_TAG_VIDEO_STR); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_ACTIVATE); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_DOWN); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_INVALID); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_LEFT); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_MENU1); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_MENU2); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_MENU3); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_MENU4); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_MENU5); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_MENU6); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_MENU7); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_NEXT_ANGLE); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_PREV_ANGLE); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_RIGHT); + PRINT_CONSTANT((gint) GST_NAVIGATION_COMMAND_UP); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_COMMAND); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_INVALID); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_KEY_PRESS); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_KEY_RELEASE); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_MOUSE_MOVE); + PRINT_CONSTANT((gint) GST_NAVIGATION_EVENT_MOUSE_SCROLL); + PRINT_CONSTANT((gint) GST_NAVIGATION_MESSAGE_ANGLES_CHANGED); + PRINT_CONSTANT((gint) GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED); + PRINT_CONSTANT((gint) GST_NAVIGATION_MESSAGE_EVENT); + PRINT_CONSTANT((gint) GST_NAVIGATION_MESSAGE_INVALID); + PRINT_CONSTANT((gint) GST_NAVIGATION_MESSAGE_MOUSE_OVER); + PRINT_CONSTANT((gint) GST_NAVIGATION_QUERY_ANGLES); + PRINT_CONSTANT((gint) GST_NAVIGATION_QUERY_COMMANDS); + PRINT_CONSTANT((gint) GST_NAVIGATION_QUERY_INVALID); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_14_9_LETTER_14_9_PILLAR); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_14_9_TOP_ALIGNED); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_16_9_LETTER_14_9_CENTER); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_16_9_LETTER_16_9_FULL); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_16_9_LETTER_4_3_CENTER); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_16_9_TOP_ALIGNED); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_4_3_FULL_14_9_CENTER); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_4_3_FULL_16_9_FULL); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_4_3_FULL_4_3_PILLAR); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_GREATER_THAN_16_9); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_SPEC_ATSC_A53); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_SPEC_DVB_ETSI); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_SPEC_SMPTE_ST2016_1); + PRINT_CONSTANT((gint) GST_VIDEO_AFD_UNAVAILABLE); + PRINT_CONSTANT((gint) GST_VIDEO_ALPHA_MODE_COPY); + PRINT_CONSTANT((gint) GST_VIDEO_ALPHA_MODE_MULT); + PRINT_CONSTANT((gint) GST_VIDEO_ALPHA_MODE_SET); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID16_S2016_3_AFD_BAR); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID16_S334_EIA_608); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID16_S334_EIA_708); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_CAMERA_POSITION); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_DELETION); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_3G_AUDIO_DATA_FIRST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_3G_AUDIO_DATA_LAST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_ERROR_DETECTION); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_HDTV_AUDIO_DATA_FIRST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_HDTV_AUDIO_DATA_LAST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_1_FIRST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_1_LAST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_2_FIRST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_HANC_SDTV_AUDIO_DATA_2_LAST); + PRINT_CONSTANT((gint) GST_VIDEO_ANCILLARY_DID_UNDEFINED); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_INTERLACED); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_LAST); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_MARKER); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_ONEFIELD); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_RFF); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_TFF); + PRINT_CONSTANT((guint) GST_VIDEO_BUFFER_FLAG_TOP_FIELD); + PRINT_CONSTANT((gint) GST_VIDEO_CAPTION_TYPE_CEA608_RAW); + PRINT_CONSTANT((gint) GST_VIDEO_CAPTION_TYPE_CEA608_S334_1A); + PRINT_CONSTANT((gint) GST_VIDEO_CAPTION_TYPE_CEA708_CDP); + PRINT_CONSTANT((gint) GST_VIDEO_CAPTION_TYPE_CEA708_RAW); + PRINT_CONSTANT((gint) GST_VIDEO_CAPTION_TYPE_UNKNOWN); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_FLAG_INTERLACED); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_FLAG_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_CHROMA_METHOD_LINEAR); + PRINT_CONSTANT((gint) GST_VIDEO_CHROMA_METHOD_NEAREST); + PRINT_CONSTANT((gint) GST_VIDEO_CHROMA_MODE_DOWNSAMPLE_ONLY); + PRINT_CONSTANT((gint) GST_VIDEO_CHROMA_MODE_FULL); + PRINT_CONSTANT((gint) GST_VIDEO_CHROMA_MODE_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_CHROMA_MODE_UPSAMPLE_ONLY); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_ALT_LINE); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_COSITED); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_DV); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_H_COSITED); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_JPEG); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_MPEG2); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_UNKNOWN); + PRINT_CONSTANT((guint) GST_VIDEO_CHROMA_SITE_V_COSITED); + PRINT_CONSTANT((guint) GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY); + PRINT_CONSTANT((guint) GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME); + PRINT_CONSTANT((guint) GST_VIDEO_CODEC_FRAME_FLAG_FORCE_KEYFRAME_HEADERS); + PRINT_CONSTANT((guint) GST_VIDEO_CODEC_FRAME_FLAG_SYNC_POINT); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_BT2020); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_BT2020_10); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_BT2100_HLG); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_BT2100_PQ); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_BT601); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_BT709); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_SMPTE240M); + PRINT_CONSTANT(GST_VIDEO_COLORIMETRY_SRGB); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_MATRIX_BT2020); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_MATRIX_BT601); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_MATRIX_BT709); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_MATRIX_FCC); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_MATRIX_RGB); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_MATRIX_SMPTE240M); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_MATRIX_UNKNOWN); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_ADOBERGB); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_BT2020); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_BT470BG); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_BT470M); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_BT709); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_EBU3213); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_FILM); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_SMPTE170M); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_SMPTE240M); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_SMPTEEG432); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_SMPTERP431); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_SMPTEST428); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_PRIMARIES_UNKNOWN); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_RANGE_0_255); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_RANGE_16_235); + PRINT_CONSTANT((gint) GST_VIDEO_COLOR_RANGE_UNKNOWN); + PRINT_CONSTANT(GST_VIDEO_COMP_A); + PRINT_CONSTANT(GST_VIDEO_COMP_B); + PRINT_CONSTANT(GST_VIDEO_COMP_G); + PRINT_CONSTANT(GST_VIDEO_COMP_INDEX); + PRINT_CONSTANT(GST_VIDEO_COMP_PALETTE); + PRINT_CONSTANT(GST_VIDEO_COMP_R); + PRINT_CONSTANT(GST_VIDEO_COMP_U); + PRINT_CONSTANT(GST_VIDEO_COMP_V); + PRINT_CONSTANT(GST_VIDEO_COMP_Y); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_ALPHA_MODE); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_ALPHA_VALUE); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_BORDER_ARGB); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_CHROMA_MODE); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_CHROMA_RESAMPLER_METHOD); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_DEST_HEIGHT); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_DEST_WIDTH); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_DEST_X); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_DEST_Y); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_DITHER_METHOD); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_DITHER_QUANTIZATION); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_FILL_BORDER); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_GAMMA_MODE); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_MATRIX_MODE); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_PRIMARIES_MODE); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_SRC_HEIGHT); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_SRC_WIDTH); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_SRC_X); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_SRC_Y); + PRINT_CONSTANT(GST_VIDEO_CONVERTER_OPT_THREADS); + PRINT_CONSTANT(GST_VIDEO_DECODER_MAX_ERRORS); + PRINT_CONSTANT(GST_VIDEO_DECODER_SINK_NAME); + PRINT_CONSTANT(GST_VIDEO_DECODER_SRC_NAME); + PRINT_CONSTANT((gint) GST_VIDEO_DITHER_BAYER); + PRINT_CONSTANT((guint) GST_VIDEO_DITHER_FLAG_INTERLACED); + PRINT_CONSTANT((guint) GST_VIDEO_DITHER_FLAG_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_DITHER_FLAG_QUANTIZE); + PRINT_CONSTANT((gint) GST_VIDEO_DITHER_FLOYD_STEINBERG); + PRINT_CONSTANT((gint) GST_VIDEO_DITHER_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_DITHER_SIERRA_LITE); + PRINT_CONSTANT((gint) GST_VIDEO_DITHER_VERTERR); + PRINT_CONSTANT(GST_VIDEO_ENCODER_SINK_NAME); + PRINT_CONSTANT(GST_VIDEO_ENCODER_SRC_NAME); + PRINT_CONSTANT((gint) GST_VIDEO_FIELD_ORDER_BOTTOM_FIELD_FIRST); + PRINT_CONSTANT((gint) GST_VIDEO_FIELD_ORDER_TOP_FIELD_FIRST); + PRINT_CONSTANT((gint) GST_VIDEO_FIELD_ORDER_UNKNOWN); + PRINT_CONSTANT((guint) GST_VIDEO_FLAG_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_FLAG_PREMULTIPLIED_ALPHA); + PRINT_CONSTANT((guint) GST_VIDEO_FLAG_VARIABLE_FPS); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_A420); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_A420_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_A420_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_A422_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_A422_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_A444_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_A444_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_ABGR); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_ARGB); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_ARGB64); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_AYUV); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_AYUV64); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_BGR); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_BGR10A2_LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_BGR15); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_BGR16); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_BGRA); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_BGRx); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_ENCODED); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_ALPHA); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_COMPLEX); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_GRAY); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_LE); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_PALETTE); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_RGB); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_TILED); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_UNPACK); + PRINT_CONSTANT((guint) GST_VIDEO_FORMAT_FLAG_YUV); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBR); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBRA); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBRA_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBRA_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBRA_12BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBRA_12LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBR_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBR_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBR_12BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GBR_12LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GRAY10_LE32); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GRAY16_BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GRAY16_LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_GRAY8); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I420); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I420_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I420_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I420_12BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I420_12LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I422_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I422_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I422_12BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_I422_12LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_IYU1); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_IYU2); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV12); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV12_10LE32); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV12_10LE40); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV12_32L32); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV12_4L4); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV12_64Z32); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV16); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV16_10LE32); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV21); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV24); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_NV61); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_P010_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_P010_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_P012_BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_P012_LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_P016_BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_P016_LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_RGB); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_RGB10A2_LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_RGB15); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_RGB16); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_RGB8P); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_RGBA); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_RGBx); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_UNKNOWN); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_UYVP); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_UYVY); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_VUYA); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_VYUY); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y210); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y212_BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y212_LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y410); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y412_BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y412_LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y41B); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y42B); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y444); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y444_10BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y444_10LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y444_12BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y444_12LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y444_16BE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_Y444_16LE); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_YUV9); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_YUY2); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_YV12); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_YVU9); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_YVYU); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_r210); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_v210); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_v216); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_v308); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_xBGR); + PRINT_CONSTANT((gint) GST_VIDEO_FORMAT_xRGB); + PRINT_CONSTANT(GST_VIDEO_FPS_RANGE); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_FIRST_IN_BUNDLE); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_INTERLACED); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_MULTIPLE_VIEW); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_ONEFIELD); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_RFF); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_TFF); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_FLAG_TOP_FIELD); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_MAP_FLAG_LAST); + PRINT_CONSTANT((guint) GST_VIDEO_FRAME_MAP_FLAG_NO_REF); + PRINT_CONSTANT((gint) GST_VIDEO_GAMMA_MODE_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_GAMMA_MODE_REMAP); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_FLIP); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_ORIENTATION_X_FLIP_Y_NORMAL); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_FLIP); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_TYPE_LUMINANCE_ALPHA); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_TYPE_R); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_TYPE_RG); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_TYPE_RGB); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_TYPE_RGB16); + PRINT_CONSTANT((gint) GST_VIDEO_GL_TEXTURE_TYPE_RGBA); + PRINT_CONSTANT((gint) GST_VIDEO_INTERLACE_MODE_ALTERNATE); + PRINT_CONSTANT((gint) GST_VIDEO_INTERLACE_MODE_FIELDS); + PRINT_CONSTANT((gint) GST_VIDEO_INTERLACE_MODE_INTERLEAVED); + PRINT_CONSTANT((gint) GST_VIDEO_INTERLACE_MODE_MIXED); + PRINT_CONSTANT((gint) GST_VIDEO_INTERLACE_MODE_PROGRESSIVE); + PRINT_CONSTANT((gint) GST_VIDEO_MATRIX_MODE_FULL); + PRINT_CONSTANT((gint) GST_VIDEO_MATRIX_MODE_INPUT_ONLY); + PRINT_CONSTANT((gint) GST_VIDEO_MATRIX_MODE_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_MATRIX_MODE_OUTPUT_ONLY); + PRINT_CONSTANT(GST_VIDEO_MAX_COMPONENTS); + PRINT_CONSTANT(GST_VIDEO_MAX_PLANES); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_HALF_ASPECT); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLIPPED); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_LEFT_FLOPPED); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLIPPED); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_FLOPPED); + PRINT_CONSTANT((guint) GST_VIDEO_MULTIVIEW_FLAGS_RIGHT_VIEW_FIRST); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_CHECKERBOARD); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_COLUMN_INTERLEAVED); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_LEFT); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_MONO); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_RIGHT); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_ROW_INTERLEAVED); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_SIDE_BY_SIDE_QUINCUNX); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_FRAME_PACKING_TOP_BOTTOM); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_CHECKERBOARD); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_COLUMN_INTERLEAVED); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_FRAME_BY_FRAME); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_LEFT); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_MONO); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_MULTIVIEW_FRAME_BY_FRAME); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_RIGHT); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_ROW_INTERLEAVED); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_SEPARATED); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_SIDE_BY_SIDE_QUINCUNX); + PRINT_CONSTANT((gint) GST_VIDEO_MULTIVIEW_MODE_TOP_BOTTOM); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_180); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_90L); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_90R); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_AUTO); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_CUSTOM); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_HORIZ); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_IDENTITY); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_UL_LR); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_UR_LL); + PRINT_CONSTANT((gint) GST_VIDEO_ORIENTATION_VERT); + PRINT_CONSTANT((guint) GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA); + PRINT_CONSTANT((guint) GST_VIDEO_OVERLAY_FORMAT_FLAG_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA); + PRINT_CONSTANT((guint) GST_VIDEO_PACK_FLAG_INTERLACED); + PRINT_CONSTANT((guint) GST_VIDEO_PACK_FLAG_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_PACK_FLAG_TRUNCATE_RANGE); + PRINT_CONSTANT((gint) GST_VIDEO_PRIMARIES_MODE_FAST); + PRINT_CONSTANT((gint) GST_VIDEO_PRIMARIES_MODE_MERGE_ONLY); + PRINT_CONSTANT((gint) GST_VIDEO_PRIMARIES_MODE_NONE); + PRINT_CONSTANT((guint) GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS); + PRINT_CONSTANT((guint) GST_VIDEO_RESAMPLER_FLAG_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_RESAMPLER_METHOD_CUBIC); + PRINT_CONSTANT((gint) GST_VIDEO_RESAMPLER_METHOD_LANCZOS); + PRINT_CONSTANT((gint) GST_VIDEO_RESAMPLER_METHOD_LINEAR); + PRINT_CONSTANT((gint) GST_VIDEO_RESAMPLER_METHOD_NEAREST); + PRINT_CONSTANT((gint) GST_VIDEO_RESAMPLER_METHOD_SINC); + PRINT_CONSTANT(GST_VIDEO_RESAMPLER_OPT_CUBIC_B); + PRINT_CONSTANT(GST_VIDEO_RESAMPLER_OPT_CUBIC_C); + PRINT_CONSTANT(GST_VIDEO_RESAMPLER_OPT_ENVELOPE); + PRINT_CONSTANT(GST_VIDEO_RESAMPLER_OPT_MAX_TAPS); + PRINT_CONSTANT(GST_VIDEO_RESAMPLER_OPT_SHARPEN); + PRINT_CONSTANT(GST_VIDEO_RESAMPLER_OPT_SHARPNESS); + PRINT_CONSTANT((guint) GST_VIDEO_SCALER_FLAG_INTERLACED); + PRINT_CONSTANT((guint) GST_VIDEO_SCALER_FLAG_NONE); + PRINT_CONSTANT(GST_VIDEO_SCALER_OPT_DITHER_METHOD); + PRINT_CONSTANT(GST_VIDEO_SIZE_RANGE); + PRINT_CONSTANT((gint) GST_VIDEO_TILE_MODE_LINEAR); + PRINT_CONSTANT((gint) GST_VIDEO_TILE_MODE_UNKNOWN); + PRINT_CONSTANT((gint) GST_VIDEO_TILE_MODE_ZFLIPZ_2X2); + PRINT_CONSTANT((gint) GST_VIDEO_TILE_TYPE_INDEXED); + PRINT_CONSTANT(GST_VIDEO_TILE_TYPE_MASK); + PRINT_CONSTANT(GST_VIDEO_TILE_TYPE_SHIFT); + PRINT_CONSTANT(GST_VIDEO_TILE_X_TILES_MASK); + PRINT_CONSTANT(GST_VIDEO_TILE_Y_TILES_SHIFT); + PRINT_CONSTANT((guint) GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME); + PRINT_CONSTANT((guint) GST_VIDEO_TIME_CODE_FLAGS_INTERLACED); + PRINT_CONSTANT((guint) GST_VIDEO_TIME_CODE_FLAGS_NONE); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_ADOBERGB); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_ARIB_STD_B67); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_BT2020_10); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_BT2020_12); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_BT601); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_BT709); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_GAMMA10); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_GAMMA18); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_GAMMA20); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_GAMMA22); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_GAMMA28); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_LOG100); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_LOG316); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_SMPTE2084); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_SMPTE240M); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_SRGB); + PRINT_CONSTANT((gint) GST_VIDEO_TRANSFER_UNKNOWN); + PRINT_CONSTANT((gint) GST_VIDEO_VBI_PARSER_RESULT_DONE); + PRINT_CONSTANT((gint) GST_VIDEO_VBI_PARSER_RESULT_ERROR); + PRINT_CONSTANT((gint) GST_VIDEO_VBI_PARSER_RESULT_OK); return 0; } diff --git a/gstreamer-video/sys/tests/layout.c b/gstreamer-video/sys/tests/layout.c index 8414dd55f..eb5b0f1d9 100644 --- a/gstreamer-video/sys/tests/layout.c +++ b/gstreamer-video/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,104 @@ #include int main() { - printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); + printf("%s;%zu;%zu\n", "GstColorBalanceChannel", sizeof(GstColorBalanceChannel), alignof(GstColorBalanceChannel)); + printf("%s;%zu;%zu\n", "GstColorBalanceChannelClass", sizeof(GstColorBalanceChannelClass), alignof(GstColorBalanceChannelClass)); + printf("%s;%zu;%zu\n", "GstColorBalanceInterface", sizeof(GstColorBalanceInterface), alignof(GstColorBalanceInterface)); + printf("%s;%zu;%zu\n", "GstColorBalanceType", sizeof(GstColorBalanceType), alignof(GstColorBalanceType)); + printf("%s;%zu;%zu\n", "GstNavigationCommand", sizeof(GstNavigationCommand), alignof(GstNavigationCommand)); + printf("%s;%zu;%zu\n", "GstNavigationEventType", sizeof(GstNavigationEventType), alignof(GstNavigationEventType)); + printf("%s;%zu;%zu\n", "GstNavigationInterface", sizeof(GstNavigationInterface), alignof(GstNavigationInterface)); + printf("%s;%zu;%zu\n", "GstNavigationMessageType", sizeof(GstNavigationMessageType), alignof(GstNavigationMessageType)); + printf("%s;%zu;%zu\n", "GstNavigationQueryType", sizeof(GstNavigationQueryType), alignof(GstNavigationQueryType)); + printf("%s;%zu;%zu\n", "GstVideoAFDMeta", sizeof(GstVideoAFDMeta), alignof(GstVideoAFDMeta)); + printf("%s;%zu;%zu\n", "GstVideoAFDSpec", sizeof(GstVideoAFDSpec), alignof(GstVideoAFDSpec)); + printf("%s;%zu;%zu\n", "GstVideoAFDValue", sizeof(GstVideoAFDValue), alignof(GstVideoAFDValue)); + printf("%s;%zu;%zu\n", "GstVideoAffineTransformationMeta", sizeof(GstVideoAffineTransformationMeta), alignof(GstVideoAffineTransformationMeta)); + printf("%s;%zu;%zu\n", "GstVideoAggregator", sizeof(GstVideoAggregator), alignof(GstVideoAggregator)); + printf("%s;%zu;%zu\n", "GstVideoAggregatorClass", sizeof(GstVideoAggregatorClass), alignof(GstVideoAggregatorClass)); + printf("%s;%zu;%zu\n", "GstVideoAggregatorConvertPad", sizeof(GstVideoAggregatorConvertPad), alignof(GstVideoAggregatorConvertPad)); + printf("%s;%zu;%zu\n", "GstVideoAggregatorConvertPadClass", sizeof(GstVideoAggregatorConvertPadClass), alignof(GstVideoAggregatorConvertPadClass)); + printf("%s;%zu;%zu\n", "GstVideoAggregatorPad", sizeof(GstVideoAggregatorPad), alignof(GstVideoAggregatorPad)); + printf("%s;%zu;%zu\n", "GstVideoAggregatorPadClass", sizeof(GstVideoAggregatorPadClass), alignof(GstVideoAggregatorPadClass)); + printf("%s;%zu;%zu\n", "GstVideoAlignment", sizeof(GstVideoAlignment), alignof(GstVideoAlignment)); + printf("%s;%zu;%zu\n", "GstVideoAlphaMode", sizeof(GstVideoAlphaMode), alignof(GstVideoAlphaMode)); + printf("%s;%zu;%zu\n", "GstVideoAncillary", sizeof(GstVideoAncillary), alignof(GstVideoAncillary)); + printf("%s;%zu;%zu\n", "GstVideoAncillaryDID", sizeof(GstVideoAncillaryDID), alignof(GstVideoAncillaryDID)); + printf("%s;%zu;%zu\n", "GstVideoAncillaryDID16", sizeof(GstVideoAncillaryDID16), alignof(GstVideoAncillaryDID16)); + printf("%s;%zu;%zu\n", "GstVideoBarMeta", sizeof(GstVideoBarMeta), alignof(GstVideoBarMeta)); + printf("%s;%zu;%zu\n", "GstVideoBufferFlags", sizeof(GstVideoBufferFlags), alignof(GstVideoBufferFlags)); + printf("%s;%zu;%zu\n", "GstVideoBufferPool", sizeof(GstVideoBufferPool), alignof(GstVideoBufferPool)); + printf("%s;%zu;%zu\n", "GstVideoBufferPoolClass", sizeof(GstVideoBufferPoolClass), alignof(GstVideoBufferPoolClass)); + printf("%s;%zu;%zu\n", "GstVideoCaptionMeta", sizeof(GstVideoCaptionMeta), alignof(GstVideoCaptionMeta)); + printf("%s;%zu;%zu\n", "GstVideoCaptionType", sizeof(GstVideoCaptionType), alignof(GstVideoCaptionType)); + printf("%s;%zu;%zu\n", "GstVideoChromaFlags", sizeof(GstVideoChromaFlags), alignof(GstVideoChromaFlags)); + printf("%s;%zu;%zu\n", "GstVideoChromaMethod", sizeof(GstVideoChromaMethod), alignof(GstVideoChromaMethod)); + printf("%s;%zu;%zu\n", "GstVideoChromaMode", sizeof(GstVideoChromaMode), alignof(GstVideoChromaMode)); + printf("%s;%zu;%zu\n", "GstVideoChromaSite", sizeof(GstVideoChromaSite), alignof(GstVideoChromaSite)); + printf("%s;%zu;%zu\n", "GstVideoCodecFrame", sizeof(GstVideoCodecFrame), alignof(GstVideoCodecFrame)); + printf("%s;%zu;%zu\n", "GstVideoCodecFrameFlags", sizeof(GstVideoCodecFrameFlags), alignof(GstVideoCodecFrameFlags)); + printf("%s;%zu;%zu\n", "GstVideoCodecState", sizeof(GstVideoCodecState), alignof(GstVideoCodecState)); + printf("%s;%zu;%zu\n", "GstVideoColorMatrix", sizeof(GstVideoColorMatrix), alignof(GstVideoColorMatrix)); + printf("%s;%zu;%zu\n", "GstVideoColorPrimaries", sizeof(GstVideoColorPrimaries), alignof(GstVideoColorPrimaries)); + printf("%s;%zu;%zu\n", "GstVideoColorPrimariesInfo", sizeof(GstVideoColorPrimariesInfo), alignof(GstVideoColorPrimariesInfo)); + printf("%s;%zu;%zu\n", "GstVideoColorRange", sizeof(GstVideoColorRange), alignof(GstVideoColorRange)); + printf("%s;%zu;%zu\n", "GstVideoColorimetry", sizeof(GstVideoColorimetry), alignof(GstVideoColorimetry)); + printf("%s;%zu;%zu\n", "GstVideoContentLightLevel", sizeof(GstVideoContentLightLevel), alignof(GstVideoContentLightLevel)); + printf("%s;%zu;%zu\n", "GstVideoCropMeta", sizeof(GstVideoCropMeta), alignof(GstVideoCropMeta)); + printf("%s;%zu;%zu\n", "GstVideoDecoder", sizeof(GstVideoDecoder), alignof(GstVideoDecoder)); + printf("%s;%zu;%zu\n", "GstVideoDecoderClass", sizeof(GstVideoDecoderClass), alignof(GstVideoDecoderClass)); + printf("%s;%zu;%zu\n", "GstVideoDirectionInterface", sizeof(GstVideoDirectionInterface), alignof(GstVideoDirectionInterface)); + printf("%s;%zu;%zu\n", "GstVideoDitherFlags", sizeof(GstVideoDitherFlags), alignof(GstVideoDitherFlags)); + printf("%s;%zu;%zu\n", "GstVideoDitherMethod", sizeof(GstVideoDitherMethod), alignof(GstVideoDitherMethod)); + printf("%s;%zu;%zu\n", "GstVideoEncoder", sizeof(GstVideoEncoder), alignof(GstVideoEncoder)); + printf("%s;%zu;%zu\n", "GstVideoEncoderClass", sizeof(GstVideoEncoderClass), alignof(GstVideoEncoderClass)); + printf("%s;%zu;%zu\n", "GstVideoFieldOrder", sizeof(GstVideoFieldOrder), alignof(GstVideoFieldOrder)); + printf("%s;%zu;%zu\n", "GstVideoFilter", sizeof(GstVideoFilter), alignof(GstVideoFilter)); + printf("%s;%zu;%zu\n", "GstVideoFilterClass", sizeof(GstVideoFilterClass), alignof(GstVideoFilterClass)); + printf("%s;%zu;%zu\n", "GstVideoFlags", sizeof(GstVideoFlags), alignof(GstVideoFlags)); + printf("%s;%zu;%zu\n", "GstVideoFormat", sizeof(GstVideoFormat), alignof(GstVideoFormat)); + printf("%s;%zu;%zu\n", "GstVideoFormatFlags", sizeof(GstVideoFormatFlags), alignof(GstVideoFormatFlags)); + printf("%s;%zu;%zu\n", "GstVideoFormatInfo", sizeof(GstVideoFormatInfo), alignof(GstVideoFormatInfo)); + printf("%s;%zu;%zu\n", "GstVideoFrame", sizeof(GstVideoFrame), alignof(GstVideoFrame)); + printf("%s;%zu;%zu\n", "GstVideoFrameFlags", sizeof(GstVideoFrameFlags), alignof(GstVideoFrameFlags)); + printf("%s;%zu;%zu\n", "GstVideoFrameMapFlags", sizeof(GstVideoFrameMapFlags), alignof(GstVideoFrameMapFlags)); + printf("%s;%zu;%zu\n", "GstVideoGLTextureOrientation", sizeof(GstVideoGLTextureOrientation), alignof(GstVideoGLTextureOrientation)); + printf("%s;%zu;%zu\n", "GstVideoGLTextureType", sizeof(GstVideoGLTextureType), alignof(GstVideoGLTextureType)); + printf("%s;%zu;%zu\n", "GstVideoGLTextureUploadMeta", sizeof(GstVideoGLTextureUploadMeta), alignof(GstVideoGLTextureUploadMeta)); + printf("%s;%zu;%zu\n", "GstVideoGammaMode", sizeof(GstVideoGammaMode), alignof(GstVideoGammaMode)); + printf("%s;%zu;%zu\n", "GstVideoInfo", sizeof(GstVideoInfo), alignof(GstVideoInfo)); + printf("%s;%zu;%zu\n", "GstVideoInterlaceMode", sizeof(GstVideoInterlaceMode), alignof(GstVideoInterlaceMode)); + printf("%s;%zu;%zu\n", "GstVideoMasteringDisplayInfo", sizeof(GstVideoMasteringDisplayInfo), alignof(GstVideoMasteringDisplayInfo)); + printf("%s;%zu;%zu\n", "GstVideoMasteringDisplayInfoCoordinates", sizeof(GstVideoMasteringDisplayInfoCoordinates), alignof(GstVideoMasteringDisplayInfoCoordinates)); + printf("%s;%zu;%zu\n", "GstVideoMatrixMode", sizeof(GstVideoMatrixMode), alignof(GstVideoMatrixMode)); + printf("%s;%zu;%zu\n", "GstVideoMeta", sizeof(GstVideoMeta), alignof(GstVideoMeta)); + printf("%s;%zu;%zu\n", "GstVideoMetaTransform", sizeof(GstVideoMetaTransform), alignof(GstVideoMetaTransform)); + printf("%s;%zu;%zu\n", "GstVideoMultiviewFlags", sizeof(GstVideoMultiviewFlags), alignof(GstVideoMultiviewFlags)); + printf("%s;%zu;%zu\n", "GstVideoMultiviewFramePacking", sizeof(GstVideoMultiviewFramePacking), alignof(GstVideoMultiviewFramePacking)); + printf("%s;%zu;%zu\n", "GstVideoMultiviewMode", sizeof(GstVideoMultiviewMode), alignof(GstVideoMultiviewMode)); + printf("%s;%zu;%zu\n", "GstVideoOrientationInterface", sizeof(GstVideoOrientationInterface), alignof(GstVideoOrientationInterface)); + printf("%s;%zu;%zu\n", "GstVideoOrientationMethod", sizeof(GstVideoOrientationMethod), alignof(GstVideoOrientationMethod)); + printf("%s;%zu;%zu\n", "GstVideoOverlayCompositionMeta", sizeof(GstVideoOverlayCompositionMeta), alignof(GstVideoOverlayCompositionMeta)); + printf("%s;%zu;%zu\n", "GstVideoOverlayFormatFlags", sizeof(GstVideoOverlayFormatFlags), alignof(GstVideoOverlayFormatFlags)); + printf("%s;%zu;%zu\n", "GstVideoOverlayInterface", sizeof(GstVideoOverlayInterface), alignof(GstVideoOverlayInterface)); + printf("%s;%zu;%zu\n", "GstVideoPackFlags", sizeof(GstVideoPackFlags), alignof(GstVideoPackFlags)); + printf("%s;%zu;%zu\n", "GstVideoPrimariesMode", sizeof(GstVideoPrimariesMode), alignof(GstVideoPrimariesMode)); + printf("%s;%zu;%zu\n", "GstVideoRectangle", sizeof(GstVideoRectangle), alignof(GstVideoRectangle)); + printf("%s;%zu;%zu\n", "GstVideoRegionOfInterestMeta", sizeof(GstVideoRegionOfInterestMeta), alignof(GstVideoRegionOfInterestMeta)); + printf("%s;%zu;%zu\n", "GstVideoResampler", sizeof(GstVideoResampler), alignof(GstVideoResampler)); + printf("%s;%zu;%zu\n", "GstVideoResamplerFlags", sizeof(GstVideoResamplerFlags), alignof(GstVideoResamplerFlags)); + printf("%s;%zu;%zu\n", "GstVideoResamplerMethod", sizeof(GstVideoResamplerMethod), alignof(GstVideoResamplerMethod)); + printf("%s;%zu;%zu\n", "GstVideoScalerFlags", sizeof(GstVideoScalerFlags), alignof(GstVideoScalerFlags)); + printf("%s;%zu;%zu\n", "GstVideoSink", sizeof(GstVideoSink), alignof(GstVideoSink)); + printf("%s;%zu;%zu\n", "GstVideoSinkClass", sizeof(GstVideoSinkClass), alignof(GstVideoSinkClass)); + printf("%s;%zu;%zu\n", "GstVideoTileMode", sizeof(GstVideoTileMode), alignof(GstVideoTileMode)); + printf("%s;%zu;%zu\n", "GstVideoTileType", sizeof(GstVideoTileType), alignof(GstVideoTileType)); + printf("%s;%zu;%zu\n", "GstVideoTimeCode", sizeof(GstVideoTimeCode), alignof(GstVideoTimeCode)); + printf("%s;%zu;%zu\n", "GstVideoTimeCodeConfig", sizeof(GstVideoTimeCodeConfig), alignof(GstVideoTimeCodeConfig)); + printf("%s;%zu;%zu\n", "GstVideoTimeCodeFlags", sizeof(GstVideoTimeCodeFlags), alignof(GstVideoTimeCodeFlags)); + printf("%s;%zu;%zu\n", "GstVideoTimeCodeInterval", sizeof(GstVideoTimeCodeInterval), alignof(GstVideoTimeCodeInterval)); + printf("%s;%zu;%zu\n", "GstVideoTimeCodeMeta", sizeof(GstVideoTimeCodeMeta), alignof(GstVideoTimeCodeMeta)); + printf("%s;%zu;%zu\n", "GstVideoTransferFunction", sizeof(GstVideoTransferFunction), alignof(GstVideoTransferFunction)); + printf("%s;%zu;%zu\n", "GstVideoVBIParserResult", sizeof(GstVideoVBIParserResult), alignof(GstVideoVBIParserResult)); return 0; } diff --git a/gstreamer-webrtc/src/auto/versions.txt b/gstreamer-webrtc/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer-webrtc/src/auto/versions.txt +++ b/gstreamer-webrtc/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer-webrtc/sys/build.rs b/gstreamer-webrtc/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer-webrtc/sys/build.rs +++ b/gstreamer-webrtc/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer-webrtc/sys/src/lib.rs b/gstreamer-webrtc/sys/src/lib.rs index 09d20d9fc..a83d5419f 100644 --- a/gstreamer-webrtc/sys/src/lib.rs +++ b/gstreamer-webrtc/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer-webrtc/sys/tests/abi.rs b/gstreamer-webrtc/sys/tests/abi.rs index 8ba33b57e..1b9c57b10 100644 --- a/gstreamer-webrtc/sys/tests/abi.rs +++ b/gstreamer-webrtc/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_webrtc_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer-webrtc/sys/tests/constant.c b/gstreamer-webrtc/sys/tests/constant.c index a337466c3..ed32770e1 100644 --- a/gstreamer-webrtc/sys/tests/constant.c +++ b/gstreamer-webrtc/sys/tests/constant.c @@ -1,27 +1,110 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((gint) GST_WEBRTC_BUNDLE_POLICY_BALANCED); + PRINT_CONSTANT((gint) GST_WEBRTC_BUNDLE_POLICY_MAX_BUNDLE); + PRINT_CONSTANT((gint) GST_WEBRTC_BUNDLE_POLICY_MAX_COMPAT); + PRINT_CONSTANT((gint) GST_WEBRTC_BUNDLE_POLICY_NONE); + PRINT_CONSTANT((gint) GST_WEBRTC_DATA_CHANNEL_STATE_CLOSED); + PRINT_CONSTANT((gint) GST_WEBRTC_DATA_CHANNEL_STATE_CLOSING); + PRINT_CONSTANT((gint) GST_WEBRTC_DATA_CHANNEL_STATE_CONNECTING); + PRINT_CONSTANT((gint) GST_WEBRTC_DATA_CHANNEL_STATE_NEW); + PRINT_CONSTANT((gint) GST_WEBRTC_DATA_CHANNEL_STATE_OPEN); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_SETUP_ACTIVE); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_SETUP_ACTPASS); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_SETUP_NONE); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_SETUP_PASSIVE); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_TRANSPORT_STATE_CLOSED); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTED); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_TRANSPORT_STATE_CONNECTING); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_TRANSPORT_STATE_FAILED); + PRINT_CONSTANT((gint) GST_WEBRTC_DTLS_TRANSPORT_STATE_NEW); + PRINT_CONSTANT((gint) GST_WEBRTC_FEC_TYPE_NONE); + PRINT_CONSTANT((gint) GST_WEBRTC_FEC_TYPE_ULP_RED); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_COMPONENT_RTCP); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_COMPONENT_RTP); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_CONNECTION_STATE_CHECKING); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_CONNECTION_STATE_CLOSED); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_CONNECTION_STATE_COMPLETED); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_CONNECTION_STATE_CONNECTED); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_CONNECTION_STATE_DISCONNECTED); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_CONNECTION_STATE_FAILED); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_CONNECTION_STATE_NEW); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_GATHERING_STATE_COMPLETE); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_GATHERING_STATE_GATHERING); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_GATHERING_STATE_NEW); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_ROLE_CONTROLLED); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_ROLE_CONTROLLING); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_TRANSPORT_POLICY_ALL); + PRINT_CONSTANT((gint) GST_WEBRTC_ICE_TRANSPORT_POLICY_RELAY); + PRINT_CONSTANT((gint) GST_WEBRTC_PEER_CONNECTION_STATE_CLOSED); + PRINT_CONSTANT((gint) GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTED); + PRINT_CONSTANT((gint) GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING); + PRINT_CONSTANT((gint) GST_WEBRTC_PEER_CONNECTION_STATE_DISCONNECTED); + PRINT_CONSTANT((gint) GST_WEBRTC_PEER_CONNECTION_STATE_FAILED); + PRINT_CONSTANT((gint) GST_WEBRTC_PEER_CONNECTION_STATE_NEW); + PRINT_CONSTANT((gint) GST_WEBRTC_PRIORITY_TYPE_HIGH); + PRINT_CONSTANT((gint) GST_WEBRTC_PRIORITY_TYPE_LOW); + PRINT_CONSTANT((gint) GST_WEBRTC_PRIORITY_TYPE_MEDIUM); + PRINT_CONSTANT((gint) GST_WEBRTC_PRIORITY_TYPE_VERY_LOW); + PRINT_CONSTANT((gint) GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE); + PRINT_CONSTANT((gint) GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE); + PRINT_CONSTANT((gint) GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY); + PRINT_CONSTANT((gint) GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY); + PRINT_CONSTANT((gint) GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV); + PRINT_CONSTANT((gint) GST_WEBRTC_SCTP_TRANSPORT_STATE_CLOSED); + PRINT_CONSTANT((gint) GST_WEBRTC_SCTP_TRANSPORT_STATE_CONNECTED); + PRINT_CONSTANT((gint) GST_WEBRTC_SCTP_TRANSPORT_STATE_CONNECTING); + PRINT_CONSTANT((gint) GST_WEBRTC_SCTP_TRANSPORT_STATE_NEW); + PRINT_CONSTANT((gint) GST_WEBRTC_SDP_TYPE_ANSWER); + PRINT_CONSTANT((gint) GST_WEBRTC_SDP_TYPE_OFFER); + PRINT_CONSTANT((gint) GST_WEBRTC_SDP_TYPE_PRANSWER); + PRINT_CONSTANT((gint) GST_WEBRTC_SDP_TYPE_ROLLBACK); + PRINT_CONSTANT((gint) GST_WEBRTC_SIGNALING_STATE_CLOSED); + PRINT_CONSTANT((gint) GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_OFFER); + PRINT_CONSTANT((gint) GST_WEBRTC_SIGNALING_STATE_HAVE_LOCAL_PRANSWER); + PRINT_CONSTANT((gint) GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER); + PRINT_CONSTANT((gint) GST_WEBRTC_SIGNALING_STATE_HAVE_REMOTE_PRANSWER); + PRINT_CONSTANT((gint) GST_WEBRTC_SIGNALING_STATE_STABLE); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_CANDIDATE_PAIR); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_CERTIFICATE); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_CODEC); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_CSRC); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_DATA_CHANNEL); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_INBOUND_RTP); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_LOCAL_CANDIDATE); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_OUTBOUND_RTP); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_PEER_CONNECTION); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_REMOTE_CANDIDATE); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_REMOTE_INBOUND_RTP); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_REMOTE_OUTBOUND_RTP); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_STREAM); + PRINT_CONSTANT((gint) GST_WEBRTC_STATS_TRANSPORT); return 0; } diff --git a/gstreamer-webrtc/sys/tests/layout.c b/gstreamer-webrtc/sys/tests/layout.c index 8414dd55f..7c19372ef 100644 --- a/gstreamer-webrtc/sys/tests/layout.c +++ b/gstreamer-webrtc/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,35 @@ #include int main() { - printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); + printf("%s;%zu;%zu\n", "GstWebRTCBundlePolicy", sizeof(GstWebRTCBundlePolicy), alignof(GstWebRTCBundlePolicy)); + printf("%s;%zu;%zu\n", "GstWebRTCDTLSSetup", sizeof(GstWebRTCDTLSSetup), alignof(GstWebRTCDTLSSetup)); + printf("%s;%zu;%zu\n", "GstWebRTCDTLSTransport", sizeof(GstWebRTCDTLSTransport), alignof(GstWebRTCDTLSTransport)); + printf("%s;%zu;%zu\n", "GstWebRTCDTLSTransportClass", sizeof(GstWebRTCDTLSTransportClass), alignof(GstWebRTCDTLSTransportClass)); + printf("%s;%zu;%zu\n", "GstWebRTCDTLSTransportState", sizeof(GstWebRTCDTLSTransportState), alignof(GstWebRTCDTLSTransportState)); + printf("%s;%zu;%zu\n", "GstWebRTCDataChannel", sizeof(GstWebRTCDataChannel), alignof(GstWebRTCDataChannel)); + printf("%s;%zu;%zu\n", "GstWebRTCDataChannelClass", sizeof(GstWebRTCDataChannelClass), alignof(GstWebRTCDataChannelClass)); + printf("%s;%zu;%zu\n", "GstWebRTCDataChannelState", sizeof(GstWebRTCDataChannelState), alignof(GstWebRTCDataChannelState)); + printf("%s;%zu;%zu\n", "GstWebRTCFECType", sizeof(GstWebRTCFECType), alignof(GstWebRTCFECType)); + printf("%s;%zu;%zu\n", "GstWebRTCICEComponent", sizeof(GstWebRTCICEComponent), alignof(GstWebRTCICEComponent)); + printf("%s;%zu;%zu\n", "GstWebRTCICEConnectionState", sizeof(GstWebRTCICEConnectionState), alignof(GstWebRTCICEConnectionState)); + printf("%s;%zu;%zu\n", "GstWebRTCICEGatheringState", sizeof(GstWebRTCICEGatheringState), alignof(GstWebRTCICEGatheringState)); + printf("%s;%zu;%zu\n", "GstWebRTCICERole", sizeof(GstWebRTCICERole), alignof(GstWebRTCICERole)); + printf("%s;%zu;%zu\n", "GstWebRTCICETransport", sizeof(GstWebRTCICETransport), alignof(GstWebRTCICETransport)); + printf("%s;%zu;%zu\n", "GstWebRTCICETransportClass", sizeof(GstWebRTCICETransportClass), alignof(GstWebRTCICETransportClass)); + printf("%s;%zu;%zu\n", "GstWebRTCICETransportPolicy", sizeof(GstWebRTCICETransportPolicy), alignof(GstWebRTCICETransportPolicy)); + printf("%s;%zu;%zu\n", "GstWebRTCPeerConnectionState", sizeof(GstWebRTCPeerConnectionState), alignof(GstWebRTCPeerConnectionState)); + printf("%s;%zu;%zu\n", "GstWebRTCPriorityType", sizeof(GstWebRTCPriorityType), alignof(GstWebRTCPriorityType)); + printf("%s;%zu;%zu\n", "GstWebRTCRTPReceiver", sizeof(GstWebRTCRTPReceiver), alignof(GstWebRTCRTPReceiver)); + printf("%s;%zu;%zu\n", "GstWebRTCRTPReceiverClass", sizeof(GstWebRTCRTPReceiverClass), alignof(GstWebRTCRTPReceiverClass)); + printf("%s;%zu;%zu\n", "GstWebRTCRTPSender", sizeof(GstWebRTCRTPSender), alignof(GstWebRTCRTPSender)); + printf("%s;%zu;%zu\n", "GstWebRTCRTPSenderClass", sizeof(GstWebRTCRTPSenderClass), alignof(GstWebRTCRTPSenderClass)); + printf("%s;%zu;%zu\n", "GstWebRTCRTPTransceiver", sizeof(GstWebRTCRTPTransceiver), alignof(GstWebRTCRTPTransceiver)); + printf("%s;%zu;%zu\n", "GstWebRTCRTPTransceiverClass", sizeof(GstWebRTCRTPTransceiverClass), alignof(GstWebRTCRTPTransceiverClass)); + printf("%s;%zu;%zu\n", "GstWebRTCRTPTransceiverDirection", sizeof(GstWebRTCRTPTransceiverDirection), alignof(GstWebRTCRTPTransceiverDirection)); + printf("%s;%zu;%zu\n", "GstWebRTCSCTPTransportState", sizeof(GstWebRTCSCTPTransportState), alignof(GstWebRTCSCTPTransportState)); + printf("%s;%zu;%zu\n", "GstWebRTCSDPType", sizeof(GstWebRTCSDPType), alignof(GstWebRTCSDPType)); + printf("%s;%zu;%zu\n", "GstWebRTCSessionDescription", sizeof(GstWebRTCSessionDescription), alignof(GstWebRTCSessionDescription)); + printf("%s;%zu;%zu\n", "GstWebRTCSignalingState", sizeof(GstWebRTCSignalingState), alignof(GstWebRTCSignalingState)); + printf("%s;%zu;%zu\n", "GstWebRTCStatsType", sizeof(GstWebRTCStatsType), alignof(GstWebRTCStatsType)); return 0; } diff --git a/gstreamer/src/auto/versions.txt b/gstreamer/src/auto/versions.txt index d8ef0593e..3b681567e 100644 --- a/gstreamer/src/auto/versions.txt +++ b/gstreamer/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c85699a) -from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +Generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) diff --git a/gstreamer/sys/build.rs b/gstreamer/sys/build.rs index 81d67c0db..bdcb058d9 100644 --- a/gstreamer/sys/build.rs +++ b/gstreamer/sys/build.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #[cfg(not(feature = "dox"))] diff --git a/gstreamer/sys/src/lib.rs b/gstreamer/sys/src/lib.rs index 7dee0f386..ac5abf4e4 100644 --- a/gstreamer/sys/src/lib.rs +++ b/gstreamer/sys/src/lib.rs @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] diff --git a/gstreamer/sys/tests/abi.rs b/gstreamer/sys/tests/abi.rs index 07cbefbd7..c5b0fa103 100644 --- a/gstreamer/sys/tests/abi.rs +++ b/gstreamer/sys/tests/abi.rs @@ -1,10 +1,11 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT use gstreamer_sys::*; use std::env; use std::error::Error; +use std::ffi::OsString; use std::mem::{align_of, size_of}; use std::path::Path; use std::process::Command; @@ -22,6 +23,8 @@ impl Compiler { pub fn new() -> Result> { let mut args = get_var("CC", "cc")?; args.push("-Wno-deprecated-declarations".to_owned()); + // For _Generic + args.push("-std=c11".to_owned()); // For %z support in printf when using MinGW. args.push("-D__USE_MINGW_ANSI_STDIO".to_owned()); args.extend(get_var("CFLAGS", "")?); @@ -30,14 +33,6 @@ impl Compiler { Ok(Compiler { args }) } - pub fn define<'a, V: Into>>(&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> { let mut cmd = self.to_command(); cmd.arg(src); @@ -69,7 +64,8 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { if packages.is_empty() { 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.args(packages); let out = cmd.output()?; @@ -92,8 +88,6 @@ struct Results { passed: usize, /// Total number of failed tests (including those that failed to compile). failed: usize, - /// Number of tests that failed to compile. - failed_to_compile: usize, } impl Results { @@ -103,15 +97,8 @@ impl Results { fn record_failed(&mut self) { self.failed += 1; } - fn record_failed_to_compile(&mut self) { - self.failed += 1; - self.failed_to_compile += 1; - } fn summary(&self) -> String { - format!( - "{} passed; {} failed (compilation errors: {})", - self.passed, self.failed, self.failed_to_compile - ) + format!("{} passed; {} failed", self.passed, self.failed) } fn expect_total_success(&self) { if self.failed == 0 { @@ -124,92 +111,94 @@ impl Results { #[test] fn cross_validate_constants_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_constants: Vec<(String, String)> = Vec::new(); - assert_eq!( - "1", - get_c_value(tmpdir.path(), &cc, "1").expect("C constant"), - "failed to obtain correct constant value for 1" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_value)) in RUST_CONSTANTS.iter().enumerate() { - match get_c_value(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(ref c_value) => { - if rust_value == c_value { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_value, c_value - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("constants ... {}", results.summary()); - } + for l in get_c_output("constant").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let value = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse value"); + c_constants.push((name, value)); } + + 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(); } #[test] fn cross_validate_layout_with_c() { - let tmpdir = Builder::new() - .prefix("abi") - .tempdir() - .expect("temporary directory"); - let cc = Compiler::new().expect("configured compiler"); + let mut c_layouts = Vec::new(); - assert_eq!( - Layout { - size: 1, - alignment: 1 - }, - get_c_layout(tmpdir.path(), &cc, "char").expect("C layout"), - "failed to obtain correct layout for char type" - ); - - let mut results: Results = Default::default(); - for (i, &(name, rust_layout)) in RUST_LAYOUTS.iter().enumerate() { - match get_c_layout(tmpdir.path(), &cc, name) { - Err(e) => { - results.record_failed_to_compile(); - eprintln!("{}", e); - } - Ok(c_layout) => { - if rust_layout == c_layout { - results.record_passed(); - } else { - results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - name, rust_layout, &c_layout - ); - } - } - }; - if (i + 1) % 25 == 0 { - println!("layout ... {}", results.summary()); - } + for l in get_c_output("layout").unwrap().lines() { + let mut words = l.trim().split(";"); + let name = words.next().expect("Failed to parse name").to_owned(); + let size = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse size"); + let alignment = words + .next() + .and_then(|s| s.parse().ok()) + .expect("Failed to parse alignment"); + c_layouts.push((name, Layout { size, alignment })); } + + 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(); } -fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result> { - let exe = dir.join("layout"); - let mut cc = cc.clone(); - cc.define("ABI_TYPE_NAME", name); - cc.compile(Path::new("tests/layout.c"), &exe)?; +fn get_c_output(name: &str) -> Result> { + let tmpdir = Builder::new().prefix("abi").tempdir()?; + let exe = tmpdir.path().join(name); + let c_file = Path::new("tests").join(name).with_extension("c"); + + let cc = Compiler::new().expect("configured compiler"); + cc.compile(&c_file, &exe)?; let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; @@ -217,35 +206,7 @@ fn get_c_layout(dir: &Path, cc: &Compiler, name: &str) -> Result Result> { - 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)])) + Ok(String::from_utf8(output.stdout)?) } const RUST_LAYOUTS: &[(&str, Layout)] = &[ diff --git a/gstreamer/sys/tests/constant.c b/gstreamer/sys/tests/constant.c index a337466c3..759c3d47a 100644 --- a/gstreamer/sys/tests/constant.c +++ b/gstreamer/sys/tests/constant.c @@ -1,27 +1,750 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" #include +#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() { - 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); + PRINT_CONSTANT((guint) GST_ALLOCATOR_FLAG_CUSTOM_ALLOC); + PRINT_CONSTANT((guint) GST_ALLOCATOR_FLAG_LAST); + PRINT_CONSTANT(GST_ALLOCATOR_SYSMEM); + PRINT_CONSTANT((guint) GST_BIN_FLAG_LAST); + PRINT_CONSTANT((guint) GST_BIN_FLAG_NO_RESYNC); + PRINT_CONSTANT((guint) GST_BIN_FLAG_STREAMS_AWARE); + PRINT_CONSTANT((gint) GST_BUFFERING_DOWNLOAD); + PRINT_CONSTANT((gint) GST_BUFFERING_LIVE); + PRINT_CONSTANT((gint) GST_BUFFERING_STREAM); + PRINT_CONSTANT((gint) GST_BUFFERING_TIMESHIFT); + PRINT_CONSTANT(GST_BUFFER_COPY_ALL); + PRINT_CONSTANT((guint) GST_BUFFER_COPY_DEEP); + PRINT_CONSTANT((guint) GST_BUFFER_COPY_FLAGS); + PRINT_CONSTANT((guint) GST_BUFFER_COPY_MEMORY); + PRINT_CONSTANT((guint) GST_BUFFER_COPY_MERGE); + PRINT_CONSTANT((guint) GST_BUFFER_COPY_META); + PRINT_CONSTANT(GST_BUFFER_COPY_METADATA); + PRINT_CONSTANT((guint) GST_BUFFER_COPY_NONE); + PRINT_CONSTANT((guint) GST_BUFFER_COPY_TIMESTAMPS); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_CORRUPTED); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_DECODE_ONLY); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_DELTA_UNIT); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_DISCONT); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_DROPPABLE); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_GAP); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_HEADER); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_LAST); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_LIVE); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_MARKER); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_NON_DROPPABLE); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_RESYNC); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_SYNC_AFTER); + PRINT_CONSTANT((guint) GST_BUFFER_FLAG_TAG_MEMORY); + PRINT_CONSTANT(GST_BUFFER_OFFSET_NONE); + PRINT_CONSTANT((guint) GST_BUFFER_POOL_ACQUIRE_FLAG_DISCONT); + PRINT_CONSTANT((guint) GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT); + PRINT_CONSTANT((guint) GST_BUFFER_POOL_ACQUIRE_FLAG_KEY_UNIT); + PRINT_CONSTANT((guint) GST_BUFFER_POOL_ACQUIRE_FLAG_LAST); + PRINT_CONSTANT((guint) GST_BUFFER_POOL_ACQUIRE_FLAG_NONE); + PRINT_CONSTANT((gint) GST_BUS_ASYNC); + PRINT_CONSTANT((gint) GST_BUS_DROP); + PRINT_CONSTANT((guint) GST_BUS_FLAG_LAST); + PRINT_CONSTANT((guint) GST_BUS_FLUSHING); + PRINT_CONSTANT((gint) GST_BUS_PASS); + PRINT_CONSTANT(GST_CAN_INLINE); + PRINT_CONSTANT(GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY); + PRINT_CONSTANT((guint) GST_CAPS_FLAG_ANY); + PRINT_CONSTANT((gint) GST_CAPS_INTERSECT_FIRST); + PRINT_CONSTANT((gint) GST_CAPS_INTERSECT_ZIG_ZAG); + PRINT_CONSTANT((gint) GST_CLOCK_BADTIME); + PRINT_CONSTANT((gint) GST_CLOCK_BUSY); + PRINT_CONSTANT((gint) GST_CLOCK_DONE); + PRINT_CONSTANT((gint) GST_CLOCK_EARLY); + PRINT_CONSTANT((gint) GST_CLOCK_ENTRY_PERIODIC); + PRINT_CONSTANT((gint) GST_CLOCK_ENTRY_SINGLE); + PRINT_CONSTANT((gint) GST_CLOCK_ERROR); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_CAN_DO_PERIODIC_ASYNC); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_CAN_DO_PERIODIC_SYNC); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_CAN_DO_SINGLE_ASYNC); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_CAN_DO_SINGLE_SYNC); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_CAN_SET_MASTER); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_CAN_SET_RESOLUTION); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_LAST); + PRINT_CONSTANT((guint) GST_CLOCK_FLAG_NEEDS_STARTUP_SYNC); + PRINT_CONSTANT((gint) GST_CLOCK_OK); + PRINT_CONSTANT(GST_CLOCK_TIME_NONE); + PRINT_CONSTANT((gint) GST_CLOCK_TYPE_MONOTONIC); + PRINT_CONSTANT((gint) GST_CLOCK_TYPE_OTHER); + PRINT_CONSTANT((gint) GST_CLOCK_TYPE_REALTIME); + PRINT_CONSTANT((gint) GST_CLOCK_TYPE_TAI); + PRINT_CONSTANT((gint) GST_CLOCK_UNSCHEDULED); + PRINT_CONSTANT((gint) GST_CLOCK_UNSUPPORTED); + PRINT_CONSTANT((gint) GST_CORE_ERROR_CAPS); + PRINT_CONSTANT((gint) GST_CORE_ERROR_CLOCK); + PRINT_CONSTANT((gint) GST_CORE_ERROR_DISABLED); + PRINT_CONSTANT((gint) GST_CORE_ERROR_EVENT); + PRINT_CONSTANT((gint) GST_CORE_ERROR_FAILED); + PRINT_CONSTANT((gint) GST_CORE_ERROR_MISSING_PLUGIN); + PRINT_CONSTANT((gint) GST_CORE_ERROR_NEGOTIATION); + PRINT_CONSTANT((gint) GST_CORE_ERROR_NOT_IMPLEMENTED); + PRINT_CONSTANT((gint) GST_CORE_ERROR_NUM_ERRORS); + PRINT_CONSTANT((gint) GST_CORE_ERROR_PAD); + PRINT_CONSTANT((gint) GST_CORE_ERROR_SEEK); + PRINT_CONSTANT((gint) GST_CORE_ERROR_STATE_CHANGE); + PRINT_CONSTANT((gint) GST_CORE_ERROR_TAG); + PRINT_CONSTANT((gint) GST_CORE_ERROR_THREAD); + PRINT_CONSTANT((gint) GST_CORE_ERROR_TOO_LAZY); + PRINT_CONSTANT((guint) GST_DEBUG_BG_BLACK); + PRINT_CONSTANT((guint) GST_DEBUG_BG_BLUE); + PRINT_CONSTANT((guint) GST_DEBUG_BG_CYAN); + PRINT_CONSTANT((guint) GST_DEBUG_BG_GREEN); + PRINT_CONSTANT((guint) GST_DEBUG_BG_MAGENTA); + PRINT_CONSTANT(GST_DEBUG_BG_MASK); + PRINT_CONSTANT((guint) GST_DEBUG_BG_RED); + PRINT_CONSTANT((guint) GST_DEBUG_BG_WHITE); + PRINT_CONSTANT((guint) GST_DEBUG_BG_YELLOW); + PRINT_CONSTANT((guint) GST_DEBUG_BOLD); + PRINT_CONSTANT((gint) GST_DEBUG_COLOR_MODE_OFF); + PRINT_CONSTANT((gint) GST_DEBUG_COLOR_MODE_ON); + PRINT_CONSTANT((gint) GST_DEBUG_COLOR_MODE_UNIX); + PRINT_CONSTANT((guint) GST_DEBUG_FG_BLACK); + PRINT_CONSTANT((guint) GST_DEBUG_FG_BLUE); + PRINT_CONSTANT((guint) GST_DEBUG_FG_CYAN); + PRINT_CONSTANT((guint) GST_DEBUG_FG_GREEN); + PRINT_CONSTANT((guint) GST_DEBUG_FG_MAGENTA); + PRINT_CONSTANT(GST_DEBUG_FG_MASK); + PRINT_CONSTANT((guint) GST_DEBUG_FG_RED); + PRINT_CONSTANT((guint) GST_DEBUG_FG_WHITE); + PRINT_CONSTANT((guint) GST_DEBUG_FG_YELLOW); + PRINT_CONSTANT(GST_DEBUG_FORMAT_MASK); + PRINT_CONSTANT((guint) GST_DEBUG_GRAPH_SHOW_ALL); + PRINT_CONSTANT((guint) GST_DEBUG_GRAPH_SHOW_CAPS_DETAILS); + PRINT_CONSTANT((guint) GST_DEBUG_GRAPH_SHOW_FULL_PARAMS); + PRINT_CONSTANT((guint) GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE); + PRINT_CONSTANT((guint) GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS); + PRINT_CONSTANT((guint) GST_DEBUG_GRAPH_SHOW_STATES); + PRINT_CONSTANT((guint) GST_DEBUG_GRAPH_SHOW_VERBOSE); + PRINT_CONSTANT((guint) GST_DEBUG_UNDERLINE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_DECODER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_DECRYPTOR); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_DEMUXER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_DEPAYLOADER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_ENCODER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_ENCRYPTOR); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_FORMATTER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_HARDWARE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_MEDIA_AUDIO); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_MEDIA_IMAGE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_MEDIA_METADATA); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_MEDIA_SUBTITLE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_MEDIA_VIDEO); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_MUXER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_PARSER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_PAYLOADER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_SINK); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_KLASS_SRC); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_ANY); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_DECODABLE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_DECODER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_DECRYPTOR); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_DEMUXER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_ENCODER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_ENCRYPTOR); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_FORMATTER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_HARDWARE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_MUXER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_PARSER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_PAYLOADER); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_SINK); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_SRC); + PRINT_CONSTANT(GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER); + PRINT_CONSTANT((guint) GST_ELEMENT_FLAG_INDEXABLE); + PRINT_CONSTANT((guint) GST_ELEMENT_FLAG_LAST); + PRINT_CONSTANT((guint) GST_ELEMENT_FLAG_LOCKED_STATE); + PRINT_CONSTANT((guint) GST_ELEMENT_FLAG_PROVIDE_CLOCK); + PRINT_CONSTANT((guint) GST_ELEMENT_FLAG_REQUIRE_CLOCK); + PRINT_CONSTANT((guint) GST_ELEMENT_FLAG_SINK); + PRINT_CONSTANT((guint) GST_ELEMENT_FLAG_SOURCE); + PRINT_CONSTANT(GST_ELEMENT_METADATA_AUTHOR); + PRINT_CONSTANT(GST_ELEMENT_METADATA_DESCRIPTION); + PRINT_CONSTANT(GST_ELEMENT_METADATA_DOC_URI); + PRINT_CONSTANT(GST_ELEMENT_METADATA_ICON_NAME); + PRINT_CONSTANT(GST_ELEMENT_METADATA_KLASS); + PRINT_CONSTANT(GST_ELEMENT_METADATA_LONGNAME); + PRINT_CONSTANT((gint) GST_EVENT_BUFFERSIZE); + PRINT_CONSTANT((gint) GST_EVENT_CAPS); + PRINT_CONSTANT((gint) GST_EVENT_CUSTOM_BOTH); + PRINT_CONSTANT((gint) GST_EVENT_CUSTOM_BOTH_OOB); + PRINT_CONSTANT((gint) GST_EVENT_CUSTOM_DOWNSTREAM); + PRINT_CONSTANT((gint) GST_EVENT_CUSTOM_DOWNSTREAM_OOB); + PRINT_CONSTANT((gint) GST_EVENT_CUSTOM_DOWNSTREAM_STICKY); + PRINT_CONSTANT((gint) GST_EVENT_CUSTOM_UPSTREAM); + PRINT_CONSTANT((gint) GST_EVENT_EOS); + PRINT_CONSTANT((gint) GST_EVENT_FLUSH_START); + PRINT_CONSTANT((gint) GST_EVENT_FLUSH_STOP); + PRINT_CONSTANT((gint) GST_EVENT_GAP); + PRINT_CONSTANT((gint) GST_EVENT_INSTANT_RATE_CHANGE); + PRINT_CONSTANT((gint) GST_EVENT_INSTANT_RATE_SYNC_TIME); + PRINT_CONSTANT((gint) GST_EVENT_LATENCY); + PRINT_CONSTANT((gint) GST_EVENT_NAVIGATION); + PRINT_CONSTANT(GST_EVENT_NUM_SHIFT); + PRINT_CONSTANT((gint) GST_EVENT_PROTECTION); + PRINT_CONSTANT((gint) GST_EVENT_QOS); + PRINT_CONSTANT((gint) GST_EVENT_RECONFIGURE); + PRINT_CONSTANT((gint) GST_EVENT_SEEK); + PRINT_CONSTANT((gint) GST_EVENT_SEGMENT); + PRINT_CONSTANT((gint) GST_EVENT_SEGMENT_DONE); + PRINT_CONSTANT((gint) GST_EVENT_SELECT_STREAMS); + PRINT_CONSTANT((gint) GST_EVENT_SINK_MESSAGE); + PRINT_CONSTANT((gint) GST_EVENT_STEP); + PRINT_CONSTANT((gint) GST_EVENT_STREAM_COLLECTION); + PRINT_CONSTANT((gint) GST_EVENT_STREAM_GROUP_DONE); + PRINT_CONSTANT((gint) GST_EVENT_STREAM_START); + PRINT_CONSTANT((gint) GST_EVENT_TAG); + PRINT_CONSTANT((gint) GST_EVENT_TOC); + PRINT_CONSTANT((gint) GST_EVENT_TOC_SELECT); + PRINT_CONSTANT(GST_EVENT_TYPE_BOTH); + PRINT_CONSTANT((guint) GST_EVENT_TYPE_DOWNSTREAM); + PRINT_CONSTANT((guint) GST_EVENT_TYPE_SERIALIZED); + PRINT_CONSTANT((guint) GST_EVENT_TYPE_STICKY); + PRINT_CONSTANT((guint) GST_EVENT_TYPE_STICKY_MULTI); + PRINT_CONSTANT((guint) GST_EVENT_TYPE_UPSTREAM); + PRINT_CONSTANT((gint) GST_EVENT_UNKNOWN); + PRINT_CONSTANT(GST_FLAG_SET_MASK_EXACT); + PRINT_CONSTANT((gint) GST_FLOW_CUSTOM_ERROR); + PRINT_CONSTANT((gint) GST_FLOW_CUSTOM_ERROR_1); + PRINT_CONSTANT((gint) GST_FLOW_CUSTOM_ERROR_2); + PRINT_CONSTANT((gint) GST_FLOW_CUSTOM_SUCCESS); + PRINT_CONSTANT((gint) GST_FLOW_CUSTOM_SUCCESS_1); + PRINT_CONSTANT((gint) GST_FLOW_CUSTOM_SUCCESS_2); + PRINT_CONSTANT((gint) GST_FLOW_EOS); + PRINT_CONSTANT((gint) GST_FLOW_ERROR); + PRINT_CONSTANT((gint) GST_FLOW_FLUSHING); + PRINT_CONSTANT((gint) GST_FLOW_NOT_LINKED); + PRINT_CONSTANT((gint) GST_FLOW_NOT_NEGOTIATED); + PRINT_CONSTANT((gint) GST_FLOW_NOT_SUPPORTED); + PRINT_CONSTANT((gint) GST_FLOW_OK); + PRINT_CONSTANT((gint) GST_FORMAT_BUFFERS); + PRINT_CONSTANT((gint) GST_FORMAT_BYTES); + PRINT_CONSTANT((gint) GST_FORMAT_DEFAULT); + PRINT_CONSTANT((gint) GST_FORMAT_PERCENT); + PRINT_CONSTANT(GST_FORMAT_PERCENT_MAX); + PRINT_CONSTANT(GST_FORMAT_PERCENT_SCALE); + PRINT_CONSTANT((gint) GST_FORMAT_TIME); + PRINT_CONSTANT((gint) GST_FORMAT_UNDEFINED); + PRINT_CONSTANT(GST_GROUP_ID_INVALID); + PRINT_CONSTANT((gint) GST_ITERATOR_DONE); + PRINT_CONSTANT((gint) GST_ITERATOR_ERROR); + PRINT_CONSTANT((gint) GST_ITERATOR_ITEM_END); + PRINT_CONSTANT((gint) GST_ITERATOR_ITEM_PASS); + PRINT_CONSTANT((gint) GST_ITERATOR_ITEM_SKIP); + PRINT_CONSTANT((gint) GST_ITERATOR_OK); + PRINT_CONSTANT((gint) GST_ITERATOR_RESYNC); + PRINT_CONSTANT((gint) GST_LEVEL_COUNT); + PRINT_CONSTANT((gint) GST_LEVEL_DEBUG); + PRINT_CONSTANT((gint) GST_LEVEL_ERROR); + PRINT_CONSTANT((gint) GST_LEVEL_FIXME); + PRINT_CONSTANT((gint) GST_LEVEL_INFO); + PRINT_CONSTANT((gint) GST_LEVEL_LOG); + PRINT_CONSTANT((gint) GST_LEVEL_MEMDUMP); + PRINT_CONSTANT((gint) GST_LEVEL_NONE); + PRINT_CONSTANT((gint) GST_LEVEL_TRACE); + PRINT_CONSTANT((gint) GST_LEVEL_WARNING); + PRINT_CONSTANT((gint) GST_LIBRARY_ERROR_ENCODE); + PRINT_CONSTANT((gint) GST_LIBRARY_ERROR_FAILED); + PRINT_CONSTANT((gint) GST_LIBRARY_ERROR_INIT); + PRINT_CONSTANT((gint) GST_LIBRARY_ERROR_NUM_ERRORS); + PRINT_CONSTANT((gint) GST_LIBRARY_ERROR_SETTINGS); + PRINT_CONSTANT((gint) GST_LIBRARY_ERROR_SHUTDOWN); + PRINT_CONSTANT((gint) GST_LIBRARY_ERROR_TOO_LAZY); + PRINT_CONSTANT(GST_LICENSE_UNKNOWN); + PRINT_CONSTANT((guint) GST_LOCK_FLAG_EXCLUSIVE); + PRINT_CONSTANT((guint) GST_LOCK_FLAG_LAST); + PRINT_CONSTANT((guint) GST_LOCK_FLAG_READ); + PRINT_CONSTANT(GST_LOCK_FLAG_READWRITE); + PRINT_CONSTANT((guint) GST_LOCK_FLAG_WRITE); + PRINT_CONSTANT((guint) GST_MAP_FLAG_LAST); + PRINT_CONSTANT((guint) GST_MAP_READ); + PRINT_CONSTANT(GST_MAP_READWRITE); + PRINT_CONSTANT((guint) GST_MAP_WRITE); + PRINT_CONSTANT((guint) GST_MEMORY_FLAG_LAST); + PRINT_CONSTANT((guint) GST_MEMORY_FLAG_NOT_MAPPABLE); + PRINT_CONSTANT((guint) GST_MEMORY_FLAG_NO_SHARE); + PRINT_CONSTANT((guint) GST_MEMORY_FLAG_PHYSICALLY_CONTIGUOUS); + PRINT_CONSTANT((guint) GST_MEMORY_FLAG_READONLY); + PRINT_CONSTANT((guint) GST_MEMORY_FLAG_ZERO_PADDED); + PRINT_CONSTANT((guint) GST_MEMORY_FLAG_ZERO_PREFIXED); + PRINT_CONSTANT((guint) GST_MESSAGE_ANY); + PRINT_CONSTANT((guint) GST_MESSAGE_APPLICATION); + PRINT_CONSTANT((guint) GST_MESSAGE_ASYNC_DONE); + PRINT_CONSTANT((guint) GST_MESSAGE_ASYNC_START); + PRINT_CONSTANT((guint) GST_MESSAGE_BUFFERING); + PRINT_CONSTANT((guint) GST_MESSAGE_CLOCK_LOST); + PRINT_CONSTANT((guint) GST_MESSAGE_CLOCK_PROVIDE); + PRINT_CONSTANT((guint) GST_MESSAGE_DEVICE_ADDED); + PRINT_CONSTANT((guint) GST_MESSAGE_DEVICE_CHANGED); + PRINT_CONSTANT((guint) GST_MESSAGE_DEVICE_REMOVED); + PRINT_CONSTANT((guint) GST_MESSAGE_DURATION_CHANGED); + PRINT_CONSTANT((guint) GST_MESSAGE_ELEMENT); + PRINT_CONSTANT((guint) GST_MESSAGE_EOS); + PRINT_CONSTANT((guint) GST_MESSAGE_ERROR); + PRINT_CONSTANT((guint) GST_MESSAGE_EXTENDED); + PRINT_CONSTANT((guint) GST_MESSAGE_HAVE_CONTEXT); + PRINT_CONSTANT((guint) GST_MESSAGE_INFO); + PRINT_CONSTANT((guint) GST_MESSAGE_INSTANT_RATE_REQUEST); + PRINT_CONSTANT((guint) GST_MESSAGE_LATENCY); + PRINT_CONSTANT((guint) GST_MESSAGE_NEED_CONTEXT); + PRINT_CONSTANT((guint) GST_MESSAGE_NEW_CLOCK); + PRINT_CONSTANT((guint) GST_MESSAGE_PROGRESS); + PRINT_CONSTANT((guint) GST_MESSAGE_PROPERTY_NOTIFY); + PRINT_CONSTANT((guint) GST_MESSAGE_QOS); + PRINT_CONSTANT((guint) GST_MESSAGE_REDIRECT); + PRINT_CONSTANT((guint) GST_MESSAGE_REQUEST_STATE); + PRINT_CONSTANT((guint) GST_MESSAGE_RESET_TIME); + PRINT_CONSTANT((guint) GST_MESSAGE_SEGMENT_DONE); + PRINT_CONSTANT((guint) GST_MESSAGE_SEGMENT_START); + PRINT_CONSTANT((guint) GST_MESSAGE_STATE_CHANGED); + PRINT_CONSTANT((guint) GST_MESSAGE_STATE_DIRTY); + PRINT_CONSTANT((guint) GST_MESSAGE_STEP_DONE); + PRINT_CONSTANT((guint) GST_MESSAGE_STEP_START); + PRINT_CONSTANT((guint) GST_MESSAGE_STREAMS_SELECTED); + PRINT_CONSTANT((guint) GST_MESSAGE_STREAM_COLLECTION); + PRINT_CONSTANT((guint) GST_MESSAGE_STREAM_START); + PRINT_CONSTANT((guint) GST_MESSAGE_STREAM_STATUS); + PRINT_CONSTANT((guint) GST_MESSAGE_STRUCTURE_CHANGE); + PRINT_CONSTANT((guint) GST_MESSAGE_TAG); + PRINT_CONSTANT((guint) GST_MESSAGE_TOC); + PRINT_CONSTANT((guint) GST_MESSAGE_UNKNOWN); + PRINT_CONSTANT((guint) GST_MESSAGE_WARNING); + PRINT_CONSTANT((guint) GST_META_FLAG_LAST); + PRINT_CONSTANT((guint) GST_META_FLAG_LOCKED); + PRINT_CONSTANT((guint) GST_META_FLAG_NONE); + PRINT_CONSTANT((guint) GST_META_FLAG_POOLED); + PRINT_CONSTANT((guint) GST_META_FLAG_READONLY); + PRINT_CONSTANT(GST_META_TAG_MEMORY_STR); + PRINT_CONSTANT((guint) GST_MINI_OBJECT_FLAG_LAST); + PRINT_CONSTANT((guint) GST_MINI_OBJECT_FLAG_LOCKABLE); + PRINT_CONSTANT((guint) GST_MINI_OBJECT_FLAG_LOCK_READONLY); + PRINT_CONSTANT((guint) GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED); + PRINT_CONSTANT(GST_MSECOND); + PRINT_CONSTANT(GST_NSECOND); + PRINT_CONSTANT((guint) GST_OBJECT_FLAG_LAST); + PRINT_CONSTANT((guint) GST_OBJECT_FLAG_MAY_BE_LEAKED); + PRINT_CONSTANT((gint) GST_PAD_ALWAYS); + PRINT_CONSTANT((guint) GST_PAD_FLAG_ACCEPT_INTERSECT); + PRINT_CONSTANT((guint) GST_PAD_FLAG_ACCEPT_TEMPLATE); + PRINT_CONSTANT((guint) GST_PAD_FLAG_BLOCKED); + PRINT_CONSTANT((guint) GST_PAD_FLAG_BLOCKING); + PRINT_CONSTANT((guint) GST_PAD_FLAG_EOS); + PRINT_CONSTANT((guint) GST_PAD_FLAG_FIXED_CAPS); + PRINT_CONSTANT((guint) GST_PAD_FLAG_FLUSHING); + PRINT_CONSTANT((guint) GST_PAD_FLAG_LAST); + PRINT_CONSTANT((guint) GST_PAD_FLAG_NEED_PARENT); + PRINT_CONSTANT((guint) GST_PAD_FLAG_NEED_RECONFIGURE); + PRINT_CONSTANT((guint) GST_PAD_FLAG_PENDING_EVENTS); + PRINT_CONSTANT((guint) GST_PAD_FLAG_PROXY_ALLOCATION); + PRINT_CONSTANT((guint) GST_PAD_FLAG_PROXY_CAPS); + PRINT_CONSTANT((guint) GST_PAD_FLAG_PROXY_SCHEDULING); + PRINT_CONSTANT((guint) GST_PAD_LINK_CHECK_CAPS); + PRINT_CONSTANT((guint) GST_PAD_LINK_CHECK_DEFAULT); + PRINT_CONSTANT((guint) GST_PAD_LINK_CHECK_HIERARCHY); + PRINT_CONSTANT((guint) GST_PAD_LINK_CHECK_NOTHING); + PRINT_CONSTANT((guint) GST_PAD_LINK_CHECK_NO_RECONFIGURE); + PRINT_CONSTANT((guint) GST_PAD_LINK_CHECK_TEMPLATE_CAPS); + PRINT_CONSTANT((gint) GST_PAD_LINK_NOFORMAT); + PRINT_CONSTANT((gint) GST_PAD_LINK_NOSCHED); + PRINT_CONSTANT((gint) GST_PAD_LINK_OK); + PRINT_CONSTANT((gint) GST_PAD_LINK_REFUSED); + PRINT_CONSTANT((gint) GST_PAD_LINK_WAS_LINKED); + PRINT_CONSTANT((gint) GST_PAD_LINK_WRONG_DIRECTION); + PRINT_CONSTANT((gint) GST_PAD_LINK_WRONG_HIERARCHY); + PRINT_CONSTANT((gint) GST_PAD_MODE_NONE); + PRINT_CONSTANT((gint) GST_PAD_MODE_PULL); + PRINT_CONSTANT((gint) GST_PAD_MODE_PUSH); + PRINT_CONSTANT((gint) GST_PAD_PROBE_DROP); + PRINT_CONSTANT((gint) GST_PAD_PROBE_HANDLED); + PRINT_CONSTANT((gint) GST_PAD_PROBE_OK); + PRINT_CONSTANT((gint) GST_PAD_PROBE_PASS); + PRINT_CONSTANT((gint) GST_PAD_PROBE_REMOVE); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_ALL_BOTH); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_BLOCK); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_BLOCKING); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_BUFFER); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_BUFFER_LIST); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_DATA_BOTH); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_DATA_UPSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_EVENT_BOTH); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_EVENT_FLUSH); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_EVENT_UPSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_IDLE); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_INVALID); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_PULL); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_PUSH); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_QUERY_BOTH); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_QUERY_DOWNSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_QUERY_UPSTREAM); + PRINT_CONSTANT((guint) GST_PAD_PROBE_TYPE_SCHEDULING); + PRINT_CONSTANT((gint) GST_PAD_REQUEST); + PRINT_CONSTANT((gint) GST_PAD_SINK); + PRINT_CONSTANT((gint) GST_PAD_SOMETIMES); + PRINT_CONSTANT((gint) GST_PAD_SRC); + PRINT_CONSTANT((guint) GST_PAD_TEMPLATE_FLAG_LAST); + PRINT_CONSTANT((gint) GST_PAD_UNKNOWN); + PRINT_CONSTANT(GST_PARAM_CONDITIONALLY_AVAILABLE); + PRINT_CONSTANT(GST_PARAM_CONTROLLABLE); + PRINT_CONSTANT(GST_PARAM_DOC_SHOW_DEFAULT); + PRINT_CONSTANT(GST_PARAM_MUTABLE_PAUSED); + PRINT_CONSTANT(GST_PARAM_MUTABLE_PLAYING); + PRINT_CONSTANT(GST_PARAM_MUTABLE_READY); + PRINT_CONSTANT(GST_PARAM_USER_SHIFT); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_DELAYED_LINK); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_EMPTY); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_EMPTY_BIN); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_LINK); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_NO_SUCH_ELEMENT); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_NO_SUCH_PROPERTY); + PRINT_CONSTANT((gint) GST_PARSE_ERROR_SYNTAX); + PRINT_CONSTANT((guint) GST_PARSE_FLAG_FATAL_ERRORS); + PRINT_CONSTANT((guint) GST_PARSE_FLAG_NONE); + PRINT_CONSTANT((guint) GST_PARSE_FLAG_NO_SINGLE_ELEMENT_BINS); + PRINT_CONSTANT((guint) GST_PARSE_FLAG_PLACE_IN_BIN); + PRINT_CONSTANT((guint) GST_PIPELINE_FLAG_FIXED_CLOCK); + PRINT_CONSTANT((guint) GST_PIPELINE_FLAG_LAST); + PRINT_CONSTANT((guint) GST_PLUGIN_API_FLAG_IGNORE_ENUM_MEMBERS); + PRINT_CONSTANT((guint) GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX); + PRINT_CONSTANT((guint) GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX); + PRINT_CONSTANT((guint) GST_PLUGIN_DEPENDENCY_FLAG_NONE); + PRINT_CONSTANT((guint) GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY); + PRINT_CONSTANT((guint) GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_RELATIVE_TO_EXE); + PRINT_CONSTANT((guint) GST_PLUGIN_DEPENDENCY_FLAG_RECURSE); + PRINT_CONSTANT((gint) GST_PLUGIN_ERROR_DEPENDENCIES); + PRINT_CONSTANT((gint) GST_PLUGIN_ERROR_MODULE); + PRINT_CONSTANT((gint) GST_PLUGIN_ERROR_NAME_MISMATCH); + PRINT_CONSTANT((guint) GST_PLUGIN_FLAG_BLACKLISTED); + PRINT_CONSTANT((guint) GST_PLUGIN_FLAG_CACHED); + PRINT_CONSTANT((gint) GST_PROGRESS_TYPE_CANCELED); + PRINT_CONSTANT((gint) GST_PROGRESS_TYPE_COMPLETE); + PRINT_CONSTANT((gint) GST_PROGRESS_TYPE_CONTINUE); + PRINT_CONSTANT((gint) GST_PROGRESS_TYPE_ERROR); + PRINT_CONSTANT((gint) GST_PROGRESS_TYPE_START); + PRINT_CONSTANT((gint) GST_PROMISE_RESULT_EXPIRED); + PRINT_CONSTANT((gint) GST_PROMISE_RESULT_INTERRUPTED); + PRINT_CONSTANT((gint) GST_PROMISE_RESULT_PENDING); + PRINT_CONSTANT((gint) GST_PROMISE_RESULT_REPLIED); + PRINT_CONSTANT(GST_PROTECTION_SYSTEM_ID_CAPS_FIELD); + PRINT_CONSTANT(GST_PROTECTION_UNSPECIFIED_SYSTEM_ID); + PRINT_CONSTANT((gint) GST_QOS_TYPE_OVERFLOW); + PRINT_CONSTANT((gint) GST_QOS_TYPE_THROTTLE); + PRINT_CONSTANT((gint) GST_QOS_TYPE_UNDERFLOW); + PRINT_CONSTANT((gint) GST_QUERY_ACCEPT_CAPS); + PRINT_CONSTANT((gint) GST_QUERY_ALLOCATION); + PRINT_CONSTANT((gint) GST_QUERY_BITRATE); + PRINT_CONSTANT((gint) GST_QUERY_BUFFERING); + PRINT_CONSTANT((gint) GST_QUERY_CAPS); + PRINT_CONSTANT((gint) GST_QUERY_CONTEXT); + PRINT_CONSTANT((gint) GST_QUERY_CONVERT); + PRINT_CONSTANT((gint) GST_QUERY_CUSTOM); + PRINT_CONSTANT((gint) GST_QUERY_DRAIN); + PRINT_CONSTANT((gint) GST_QUERY_DURATION); + PRINT_CONSTANT((gint) GST_QUERY_FORMATS); + PRINT_CONSTANT((gint) GST_QUERY_JITTER); + PRINT_CONSTANT((gint) GST_QUERY_LATENCY); + PRINT_CONSTANT(GST_QUERY_NUM_SHIFT); + PRINT_CONSTANT((gint) GST_QUERY_POSITION); + PRINT_CONSTANT((gint) GST_QUERY_RATE); + PRINT_CONSTANT((gint) GST_QUERY_SCHEDULING); + PRINT_CONSTANT((gint) GST_QUERY_SEEKING); + PRINT_CONSTANT((gint) GST_QUERY_SEGMENT); + PRINT_CONSTANT(GST_QUERY_TYPE_BOTH); + PRINT_CONSTANT((guint) GST_QUERY_TYPE_DOWNSTREAM); + PRINT_CONSTANT((guint) GST_QUERY_TYPE_SERIALIZED); + PRINT_CONSTANT((guint) GST_QUERY_TYPE_UPSTREAM); + PRINT_CONSTANT((gint) GST_QUERY_UNKNOWN); + PRINT_CONSTANT((gint) GST_QUERY_URI); + PRINT_CONSTANT((gint) GST_RANK_MARGINAL); + PRINT_CONSTANT((gint) GST_RANK_NONE); + PRINT_CONSTANT((gint) GST_RANK_PRIMARY); + PRINT_CONSTANT((gint) GST_RANK_SECONDARY); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_BUSY); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_CLOSE); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_FAILED); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_NOT_AUTHORIZED); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_NOT_FOUND); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_NO_SPACE_LEFT); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_NUM_ERRORS); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_OPEN_READ); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_OPEN_READ_WRITE); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_OPEN_WRITE); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_READ); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_SEEK); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_SETTINGS); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_SYNC); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_TOO_LAZY); + PRINT_CONSTANT((gint) GST_RESOURCE_ERROR_WRITE); + PRINT_CONSTANT((guint) GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED); + PRINT_CONSTANT((guint) GST_SCHEDULING_FLAG_SEEKABLE); + PRINT_CONSTANT((guint) GST_SCHEDULING_FLAG_SEQUENTIAL); + PRINT_CONSTANT((gint) GST_SEARCH_MODE_AFTER); + PRINT_CONSTANT((gint) GST_SEARCH_MODE_BEFORE); + PRINT_CONSTANT((gint) GST_SEARCH_MODE_EXACT); + PRINT_CONSTANT(GST_SECOND); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_ACCURATE); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_FLUSH); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_INSTANT_RATE_CHANGE); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_KEY_UNIT); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_NONE); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_SEGMENT); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_SKIP); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_SNAP_AFTER); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_SNAP_BEFORE); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_SNAP_NEAREST); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_TRICKMODE); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_TRICKMODE_FORWARD_PREDICTED); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_TRICKMODE_KEY_UNITS); + PRINT_CONSTANT((guint) GST_SEEK_FLAG_TRICKMODE_NO_AUDIO); + PRINT_CONSTANT((gint) GST_SEEK_TYPE_END); + PRINT_CONSTANT((gint) GST_SEEK_TYPE_NONE); + PRINT_CONSTANT((gint) GST_SEEK_TYPE_SET); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_NONE); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_RESET); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_SEGMENT); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_SKIP); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_TRICKMODE); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_TRICKMODE_FORWARD_PREDICTED); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_TRICKMODE_KEY_UNITS); + PRINT_CONSTANT((guint) GST_SEGMENT_FLAG_TRICKMODE_NO_AUDIO); + PRINT_CONSTANT(GST_SEGMENT_INSTANT_FLAGS); + PRINT_CONSTANT(GST_SEQNUM_INVALID); + PRINT_CONSTANT((guint) GST_STACK_TRACE_SHOW_FULL); + PRINT_CONSTANT((guint) GST_STACK_TRACE_SHOW_NONE); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_ASYNC); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_FAILURE); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_NO_PREROLL); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_NULL_TO_NULL); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_NULL_TO_READY); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_PAUSED_TO_PAUSED); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_PAUSED_TO_PLAYING); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_PAUSED_TO_READY); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_PLAYING_TO_PAUSED); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_PLAYING_TO_PLAYING); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_READY_TO_NULL); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_READY_TO_PAUSED); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_READY_TO_READY); + PRINT_CONSTANT((gint) GST_STATE_CHANGE_SUCCESS); + PRINT_CONSTANT((gint) GST_STATE_NULL); + PRINT_CONSTANT((gint) GST_STATE_PAUSED); + PRINT_CONSTANT((gint) GST_STATE_PLAYING); + PRINT_CONSTANT((gint) GST_STATE_READY); + PRINT_CONSTANT((gint) GST_STATE_VOID_PENDING); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_CODEC_NOT_FOUND); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_DECODE); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_DECRYPT); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_DECRYPT_NOKEY); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_DEMUX); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_ENCODE); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_FAILED); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_FORMAT); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_MUX); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_NOT_IMPLEMENTED); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_NUM_ERRORS); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_TOO_LAZY); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_TYPE_NOT_FOUND); + PRINT_CONSTANT((gint) GST_STREAM_ERROR_WRONG_TYPE); + PRINT_CONSTANT((guint) GST_STREAM_FLAG_NONE); + PRINT_CONSTANT((guint) GST_STREAM_FLAG_SELECT); + PRINT_CONSTANT((guint) GST_STREAM_FLAG_SPARSE); + PRINT_CONSTANT((guint) GST_STREAM_FLAG_UNSELECT); + PRINT_CONSTANT((gint) GST_STREAM_STATUS_TYPE_CREATE); + PRINT_CONSTANT((gint) GST_STREAM_STATUS_TYPE_DESTROY); + PRINT_CONSTANT((gint) GST_STREAM_STATUS_TYPE_ENTER); + PRINT_CONSTANT((gint) GST_STREAM_STATUS_TYPE_LEAVE); + PRINT_CONSTANT((gint) GST_STREAM_STATUS_TYPE_PAUSE); + PRINT_CONSTANT((gint) GST_STREAM_STATUS_TYPE_START); + PRINT_CONSTANT((gint) GST_STREAM_STATUS_TYPE_STOP); + PRINT_CONSTANT((guint) GST_STREAM_TYPE_AUDIO); + PRINT_CONSTANT((guint) GST_STREAM_TYPE_CONTAINER); + PRINT_CONSTANT((guint) GST_STREAM_TYPE_TEXT); + PRINT_CONSTANT((guint) GST_STREAM_TYPE_UNKNOWN); + PRINT_CONSTANT((guint) GST_STREAM_TYPE_VIDEO); + PRINT_CONSTANT((gint) GST_STRUCTURE_CHANGE_TYPE_PAD_LINK); + PRINT_CONSTANT((gint) GST_STRUCTURE_CHANGE_TYPE_PAD_UNLINK); + PRINT_CONSTANT(GST_TAG_ALBUM); + PRINT_CONSTANT(GST_TAG_ALBUM_ARTIST); + PRINT_CONSTANT(GST_TAG_ALBUM_ARTIST_SORTNAME); + PRINT_CONSTANT(GST_TAG_ALBUM_GAIN); + PRINT_CONSTANT(GST_TAG_ALBUM_PEAK); + PRINT_CONSTANT(GST_TAG_ALBUM_SORTNAME); + PRINT_CONSTANT(GST_TAG_ALBUM_VOLUME_COUNT); + PRINT_CONSTANT(GST_TAG_ALBUM_VOLUME_NUMBER); + PRINT_CONSTANT(GST_TAG_APPLICATION_DATA); + PRINT_CONSTANT(GST_TAG_APPLICATION_NAME); + PRINT_CONSTANT(GST_TAG_ARTIST); + PRINT_CONSTANT(GST_TAG_ARTIST_SORTNAME); + PRINT_CONSTANT(GST_TAG_ATTACHMENT); + PRINT_CONSTANT(GST_TAG_AUDIO_CODEC); + PRINT_CONSTANT(GST_TAG_BEATS_PER_MINUTE); + PRINT_CONSTANT(GST_TAG_BITRATE); + PRINT_CONSTANT(GST_TAG_CODEC); + PRINT_CONSTANT(GST_TAG_COMMENT); + PRINT_CONSTANT(GST_TAG_COMPOSER); + PRINT_CONSTANT(GST_TAG_COMPOSER_SORTNAME); + PRINT_CONSTANT(GST_TAG_CONDUCTOR); + PRINT_CONSTANT(GST_TAG_CONTACT); + PRINT_CONSTANT(GST_TAG_CONTAINER_FORMAT); + PRINT_CONSTANT(GST_TAG_COPYRIGHT); + PRINT_CONSTANT(GST_TAG_COPYRIGHT_URI); + PRINT_CONSTANT(GST_TAG_DATE); + PRINT_CONSTANT(GST_TAG_DATE_TIME); + PRINT_CONSTANT(GST_TAG_DESCRIPTION); + PRINT_CONSTANT(GST_TAG_DEVICE_MANUFACTURER); + PRINT_CONSTANT(GST_TAG_DEVICE_MODEL); + PRINT_CONSTANT(GST_TAG_DURATION); + PRINT_CONSTANT(GST_TAG_ENCODED_BY); + PRINT_CONSTANT(GST_TAG_ENCODER); + PRINT_CONSTANT(GST_TAG_ENCODER_VERSION); + PRINT_CONSTANT(GST_TAG_EXTENDED_COMMENT); + PRINT_CONSTANT((gint) GST_TAG_FLAG_COUNT); + PRINT_CONSTANT((gint) GST_TAG_FLAG_DECODED); + PRINT_CONSTANT((gint) GST_TAG_FLAG_ENCODED); + PRINT_CONSTANT((gint) GST_TAG_FLAG_META); + PRINT_CONSTANT((gint) GST_TAG_FLAG_UNDEFINED); + PRINT_CONSTANT(GST_TAG_GENRE); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_CAPTURE_DIRECTION); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_CITY); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_COUNTRY); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_ELEVATION); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_HORIZONTAL_ERROR); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_LATITUDE); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_LONGITUDE); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_MOVEMENT_DIRECTION); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_MOVEMENT_SPEED); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_NAME); + PRINT_CONSTANT(GST_TAG_GEO_LOCATION_SUBLOCATION); + PRINT_CONSTANT(GST_TAG_GROUPING); + PRINT_CONSTANT(GST_TAG_HOMEPAGE); + PRINT_CONSTANT(GST_TAG_IMAGE); + PRINT_CONSTANT(GST_TAG_IMAGE_ORIENTATION); + PRINT_CONSTANT(GST_TAG_INTERPRETED_BY); + PRINT_CONSTANT(GST_TAG_ISRC); + PRINT_CONSTANT(GST_TAG_KEYWORDS); + PRINT_CONSTANT(GST_TAG_LANGUAGE_CODE); + PRINT_CONSTANT(GST_TAG_LANGUAGE_NAME); + PRINT_CONSTANT(GST_TAG_LICENSE); + PRINT_CONSTANT(GST_TAG_LICENSE_URI); + PRINT_CONSTANT(GST_TAG_LOCATION); + PRINT_CONSTANT(GST_TAG_LYRICS); + PRINT_CONSTANT(GST_TAG_MAXIMUM_BITRATE); + PRINT_CONSTANT((gint) GST_TAG_MERGE_APPEND); + PRINT_CONSTANT((gint) GST_TAG_MERGE_COUNT); + PRINT_CONSTANT((gint) GST_TAG_MERGE_KEEP); + PRINT_CONSTANT((gint) GST_TAG_MERGE_KEEP_ALL); + PRINT_CONSTANT((gint) GST_TAG_MERGE_PREPEND); + PRINT_CONSTANT((gint) GST_TAG_MERGE_REPLACE); + PRINT_CONSTANT((gint) GST_TAG_MERGE_REPLACE_ALL); + PRINT_CONSTANT((gint) GST_TAG_MERGE_UNDEFINED); + PRINT_CONSTANT(GST_TAG_MIDI_BASE_NOTE); + PRINT_CONSTANT(GST_TAG_MINIMUM_BITRATE); + PRINT_CONSTANT(GST_TAG_NOMINAL_BITRATE); + PRINT_CONSTANT(GST_TAG_ORGANIZATION); + PRINT_CONSTANT(GST_TAG_PERFORMER); + PRINT_CONSTANT(GST_TAG_PREVIEW_IMAGE); + PRINT_CONSTANT(GST_TAG_PRIVATE_DATA); + PRINT_CONSTANT(GST_TAG_PUBLISHER); + PRINT_CONSTANT(GST_TAG_REFERENCE_LEVEL); + PRINT_CONSTANT((gint) GST_TAG_SCOPE_GLOBAL); + PRINT_CONSTANT((gint) GST_TAG_SCOPE_STREAM); + PRINT_CONSTANT(GST_TAG_SERIAL); + PRINT_CONSTANT(GST_TAG_SHOW_EPISODE_NUMBER); + PRINT_CONSTANT(GST_TAG_SHOW_NAME); + PRINT_CONSTANT(GST_TAG_SHOW_SEASON_NUMBER); + PRINT_CONSTANT(GST_TAG_SHOW_SORTNAME); + PRINT_CONSTANT(GST_TAG_SUBTITLE_CODEC); + PRINT_CONSTANT(GST_TAG_TITLE); + PRINT_CONSTANT(GST_TAG_TITLE_SORTNAME); + PRINT_CONSTANT(GST_TAG_TRACK_COUNT); + PRINT_CONSTANT(GST_TAG_TRACK_GAIN); + PRINT_CONSTANT(GST_TAG_TRACK_NUMBER); + PRINT_CONSTANT(GST_TAG_TRACK_PEAK); + PRINT_CONSTANT(GST_TAG_USER_RATING); + PRINT_CONSTANT(GST_TAG_VERSION); + PRINT_CONSTANT(GST_TAG_VIDEO_CODEC); + PRINT_CONSTANT((gint) GST_TASK_PAUSED); + PRINT_CONSTANT((gint) GST_TASK_STARTED); + PRINT_CONSTANT((gint) GST_TASK_STOPPED); + PRINT_CONSTANT((gint) GST_TOC_ENTRY_TYPE_ANGLE); + PRINT_CONSTANT((gint) GST_TOC_ENTRY_TYPE_CHAPTER); + PRINT_CONSTANT((gint) GST_TOC_ENTRY_TYPE_EDITION); + PRINT_CONSTANT((gint) GST_TOC_ENTRY_TYPE_INVALID); + PRINT_CONSTANT((gint) GST_TOC_ENTRY_TYPE_TITLE); + PRINT_CONSTANT((gint) GST_TOC_ENTRY_TYPE_TRACK); + PRINT_CONSTANT((gint) GST_TOC_ENTRY_TYPE_VERSION); + PRINT_CONSTANT((gint) GST_TOC_LOOP_FORWARD); + PRINT_CONSTANT((gint) GST_TOC_LOOP_NONE); + PRINT_CONSTANT((gint) GST_TOC_LOOP_PING_PONG); + PRINT_CONSTANT((gint) GST_TOC_LOOP_REVERSE); + PRINT_CONSTANT(GST_TOC_REPEAT_COUNT_INFINITE); + PRINT_CONSTANT((gint) GST_TOC_SCOPE_CURRENT); + PRINT_CONSTANT((gint) GST_TOC_SCOPE_GLOBAL); + PRINT_CONSTANT((guint) GST_TRACER_VALUE_FLAGS_AGGREGATED); + PRINT_CONSTANT((guint) GST_TRACER_VALUE_FLAGS_NONE); + PRINT_CONSTANT((guint) GST_TRACER_VALUE_FLAGS_OPTIONAL); + PRINT_CONSTANT((gint) GST_TRACER_VALUE_SCOPE_ELEMENT); + PRINT_CONSTANT((gint) GST_TRACER_VALUE_SCOPE_PAD); + PRINT_CONSTANT((gint) GST_TRACER_VALUE_SCOPE_PROCESS); + PRINT_CONSTANT((gint) GST_TRACER_VALUE_SCOPE_THREAD); + PRINT_CONSTANT((gint) GST_TYPE_FIND_LIKELY); + PRINT_CONSTANT((gint) GST_TYPE_FIND_MAXIMUM); + PRINT_CONSTANT((gint) GST_TYPE_FIND_MINIMUM); + PRINT_CONSTANT((gint) GST_TYPE_FIND_NEARLY_CERTAIN); + PRINT_CONSTANT((gint) GST_TYPE_FIND_NONE); + PRINT_CONSTANT((gint) GST_TYPE_FIND_POSSIBLE); + PRINT_CONSTANT((gint) GST_URI_ERROR_BAD_REFERENCE); + PRINT_CONSTANT((gint) GST_URI_ERROR_BAD_STATE); + PRINT_CONSTANT((gint) GST_URI_ERROR_BAD_URI); + PRINT_CONSTANT((gint) GST_URI_ERROR_UNSUPPORTED_PROTOCOL); + PRINT_CONSTANT(GST_URI_NO_PORT); + PRINT_CONSTANT((gint) GST_URI_SINK); + PRINT_CONSTANT((gint) GST_URI_SRC); + PRINT_CONSTANT((gint) GST_URI_UNKNOWN); + PRINT_CONSTANT(GST_USECOND); + PRINT_CONSTANT(GST_VALUE_EQUAL); + PRINT_CONSTANT(GST_VALUE_GREATER_THAN); + PRINT_CONSTANT(GST_VALUE_LESS_THAN); + PRINT_CONSTANT(GST_VALUE_UNORDERED); return 0; } diff --git a/gstreamer/sys/tests/layout.c b/gstreamer/sys/tests/layout.c index 8414dd55f..e9969cf6c 100644 --- a/gstreamer/sys/tests/layout.c +++ b/gstreamer/sys/tests/layout.c @@ -1,5 +1,5 @@ -// This file was generated by gir (https://github.com/gtk-rs/gir @ c85699a) -// from gir-files (https://github.com/gtk-rs/gir-files @ 796f93f7) +// This file was generated by gir (https://github.com/gtk-rs/gir @ 1c7b41a) +// from gir-files (https://github.com/gtk-rs/gir-files @ 31b68201) // DO NOT EDIT #include "manual.h" @@ -7,6 +7,179 @@ #include int main() { - printf("%zu\n%zu", sizeof(ABI_TYPE_NAME), alignof(ABI_TYPE_NAME)); + printf("%s;%zu;%zu\n", "GstAllocationParams", sizeof(GstAllocationParams), alignof(GstAllocationParams)); + printf("%s;%zu;%zu\n", "GstAllocator", sizeof(GstAllocator), alignof(GstAllocator)); + printf("%s;%zu;%zu\n", "GstAllocatorClass", sizeof(GstAllocatorClass), alignof(GstAllocatorClass)); + printf("%s;%zu;%zu\n", "GstAllocatorFlags", sizeof(GstAllocatorFlags), alignof(GstAllocatorFlags)); + printf("%s;%zu;%zu\n", "GstBin", sizeof(GstBin), alignof(GstBin)); + printf("%s;%zu;%zu\n", "GstBinClass", sizeof(GstBinClass), alignof(GstBinClass)); + printf("%s;%zu;%zu\n", "GstBinFlags", sizeof(GstBinFlags), alignof(GstBinFlags)); + printf("%s;%zu;%zu\n", "GstBuffer", sizeof(GstBuffer), alignof(GstBuffer)); + printf("%s;%zu;%zu\n", "GstBufferCopyFlags", sizeof(GstBufferCopyFlags), alignof(GstBufferCopyFlags)); + printf("%s;%zu;%zu\n", "GstBufferFlags", sizeof(GstBufferFlags), alignof(GstBufferFlags)); + printf("%s;%zu;%zu\n", "GstBufferPool", sizeof(GstBufferPool), alignof(GstBufferPool)); + printf("%s;%zu;%zu\n", "GstBufferPoolAcquireFlags", sizeof(GstBufferPoolAcquireFlags), alignof(GstBufferPoolAcquireFlags)); + printf("%s;%zu;%zu\n", "GstBufferPoolAcquireParams", sizeof(GstBufferPoolAcquireParams), alignof(GstBufferPoolAcquireParams)); + printf("%s;%zu;%zu\n", "GstBufferPoolClass", sizeof(GstBufferPoolClass), alignof(GstBufferPoolClass)); + printf("%s;%zu;%zu\n", "GstBufferingMode", sizeof(GstBufferingMode), alignof(GstBufferingMode)); + printf("%s;%zu;%zu\n", "GstBus", sizeof(GstBus), alignof(GstBus)); + printf("%s;%zu;%zu\n", "GstBusClass", sizeof(GstBusClass), alignof(GstBusClass)); + printf("%s;%zu;%zu\n", "GstBusFlags", sizeof(GstBusFlags), alignof(GstBusFlags)); + printf("%s;%zu;%zu\n", "GstBusSyncReply", sizeof(GstBusSyncReply), alignof(GstBusSyncReply)); + printf("%s;%zu;%zu\n", "GstCaps", sizeof(GstCaps), alignof(GstCaps)); + printf("%s;%zu;%zu\n", "GstCapsFlags", sizeof(GstCapsFlags), alignof(GstCapsFlags)); + printf("%s;%zu;%zu\n", "GstCapsIntersectMode", sizeof(GstCapsIntersectMode), alignof(GstCapsIntersectMode)); + printf("%s;%zu;%zu\n", "GstChildProxyInterface", sizeof(GstChildProxyInterface), alignof(GstChildProxyInterface)); + printf("%s;%zu;%zu\n", "GstClock", sizeof(GstClock), alignof(GstClock)); + printf("%s;%zu;%zu\n", "GstClockClass", sizeof(GstClockClass), alignof(GstClockClass)); + printf("%s;%zu;%zu\n", "GstClockEntry", sizeof(GstClockEntry), alignof(GstClockEntry)); + printf("%s;%zu;%zu\n", "GstClockEntryType", sizeof(GstClockEntryType), alignof(GstClockEntryType)); + printf("%s;%zu;%zu\n", "GstClockFlags", sizeof(GstClockFlags), alignof(GstClockFlags)); + printf("%s;%zu;%zu\n", "GstClockID", sizeof(GstClockID), alignof(GstClockID)); + printf("%s;%zu;%zu\n", "GstClockReturn", sizeof(GstClockReturn), alignof(GstClockReturn)); + printf("%s;%zu;%zu\n", "GstClockTime", sizeof(GstClockTime), alignof(GstClockTime)); + printf("%s;%zu;%zu\n", "GstClockTimeDiff", sizeof(GstClockTimeDiff), alignof(GstClockTimeDiff)); + printf("%s;%zu;%zu\n", "GstClockType", sizeof(GstClockType), alignof(GstClockType)); + printf("%s;%zu;%zu\n", "GstControlBinding", sizeof(GstControlBinding), alignof(GstControlBinding)); + printf("%s;%zu;%zu\n", "GstControlBindingClass", sizeof(GstControlBindingClass), alignof(GstControlBindingClass)); + printf("%s;%zu;%zu\n", "GstControlSource", sizeof(GstControlSource), alignof(GstControlSource)); + printf("%s;%zu;%zu\n", "GstControlSourceClass", sizeof(GstControlSourceClass), alignof(GstControlSourceClass)); + printf("%s;%zu;%zu\n", "GstCoreError", sizeof(GstCoreError), alignof(GstCoreError)); + printf("%s;%zu;%zu\n", "GstDebugCategory", sizeof(GstDebugCategory), alignof(GstDebugCategory)); + printf("%s;%zu;%zu\n", "GstDebugColorFlags", sizeof(GstDebugColorFlags), alignof(GstDebugColorFlags)); + printf("%s;%zu;%zu\n", "GstDebugColorMode", sizeof(GstDebugColorMode), alignof(GstDebugColorMode)); + printf("%s;%zu;%zu\n", "GstDebugGraphDetails", sizeof(GstDebugGraphDetails), alignof(GstDebugGraphDetails)); + printf("%s;%zu;%zu\n", "GstDebugLevel", sizeof(GstDebugLevel), alignof(GstDebugLevel)); + printf("%s;%zu;%zu\n", "GstDevice", sizeof(GstDevice), alignof(GstDevice)); + printf("%s;%zu;%zu\n", "GstDeviceClass", sizeof(GstDeviceClass), alignof(GstDeviceClass)); + printf("%s;%zu;%zu\n", "GstDeviceMonitor", sizeof(GstDeviceMonitor), alignof(GstDeviceMonitor)); + printf("%s;%zu;%zu\n", "GstDeviceMonitorClass", sizeof(GstDeviceMonitorClass), alignof(GstDeviceMonitorClass)); + printf("%s;%zu;%zu\n", "GstDeviceProvider", sizeof(GstDeviceProvider), alignof(GstDeviceProvider)); + printf("%s;%zu;%zu\n", "GstDeviceProviderClass", sizeof(GstDeviceProviderClass), alignof(GstDeviceProviderClass)); + printf("%s;%zu;%zu\n", "GstElement", sizeof(GstElement), alignof(GstElement)); + printf("%s;%zu;%zu\n", "GstElementClass", sizeof(GstElementClass), alignof(GstElementClass)); + printf("%s;%zu;%zu\n", "GstElementFactoryListType", sizeof(GstElementFactoryListType), alignof(GstElementFactoryListType)); + printf("%s;%zu;%zu\n", "GstElementFlags", sizeof(GstElementFlags), alignof(GstElementFlags)); + printf("%s;%zu;%zu\n", "GstEvent", sizeof(GstEvent), alignof(GstEvent)); + printf("%s;%zu;%zu\n", "GstEventType", sizeof(GstEventType), alignof(GstEventType)); + printf("%s;%zu;%zu\n", "GstEventTypeFlags", sizeof(GstEventTypeFlags), alignof(GstEventTypeFlags)); + printf("%s;%zu;%zu\n", "GstFlowReturn", sizeof(GstFlowReturn), alignof(GstFlowReturn)); + printf("%s;%zu;%zu\n", "GstFormat", sizeof(GstFormat), alignof(GstFormat)); + printf("%s;%zu;%zu\n", "GstFormatDefinition", sizeof(GstFormatDefinition), alignof(GstFormatDefinition)); + printf("%s;%zu;%zu\n", "GstGhostPad", sizeof(GstGhostPad), alignof(GstGhostPad)); + printf("%s;%zu;%zu\n", "GstGhostPadClass", sizeof(GstGhostPadClass), alignof(GstGhostPadClass)); + printf("%s;%zu;%zu\n", "GstIterator", sizeof(GstIterator), alignof(GstIterator)); + printf("%s;%zu;%zu\n", "GstIteratorItem", sizeof(GstIteratorItem), alignof(GstIteratorItem)); + printf("%s;%zu;%zu\n", "GstIteratorResult", sizeof(GstIteratorResult), alignof(GstIteratorResult)); + printf("%s;%zu;%zu\n", "GstLibraryError", sizeof(GstLibraryError), alignof(GstLibraryError)); + printf("%s;%zu;%zu\n", "GstLockFlags", sizeof(GstLockFlags), alignof(GstLockFlags)); + printf("%s;%zu;%zu\n", "GstMapFlags", sizeof(GstMapFlags), alignof(GstMapFlags)); + printf("%s;%zu;%zu\n", "GstMapInfo", sizeof(GstMapInfo), alignof(GstMapInfo)); + printf("%s;%zu;%zu\n", "GstMemory", sizeof(GstMemory), alignof(GstMemory)); + printf("%s;%zu;%zu\n", "GstMemoryFlags", sizeof(GstMemoryFlags), alignof(GstMemoryFlags)); + printf("%s;%zu;%zu\n", "GstMessage", sizeof(GstMessage), alignof(GstMessage)); + printf("%s;%zu;%zu\n", "GstMessageType", sizeof(GstMessageType), alignof(GstMessageType)); + printf("%s;%zu;%zu\n", "GstMeta", sizeof(GstMeta), alignof(GstMeta)); + printf("%s;%zu;%zu\n", "GstMetaFlags", sizeof(GstMetaFlags), alignof(GstMetaFlags)); + printf("%s;%zu;%zu\n", "GstMetaInfo", sizeof(GstMetaInfo), alignof(GstMetaInfo)); + printf("%s;%zu;%zu\n", "GstMetaTransformCopy", sizeof(GstMetaTransformCopy), alignof(GstMetaTransformCopy)); + printf("%s;%zu;%zu\n", "GstMiniObject", sizeof(GstMiniObject), alignof(GstMiniObject)); + printf("%s;%zu;%zu\n", "GstMiniObjectFlags", sizeof(GstMiniObjectFlags), alignof(GstMiniObjectFlags)); + printf("%s;%zu;%zu\n", "GstObject", sizeof(GstObject), alignof(GstObject)); + printf("%s;%zu;%zu\n", "GstObjectClass", sizeof(GstObjectClass), alignof(GstObjectClass)); + printf("%s;%zu;%zu\n", "GstObjectFlags", sizeof(GstObjectFlags), alignof(GstObjectFlags)); + printf("%s;%zu;%zu\n", "GstPad", sizeof(GstPad), alignof(GstPad)); + printf("%s;%zu;%zu\n", "GstPadClass", sizeof(GstPadClass), alignof(GstPadClass)); + printf("%s;%zu;%zu\n", "GstPadDirection", sizeof(GstPadDirection), alignof(GstPadDirection)); + printf("%s;%zu;%zu\n", "GstPadFlags", sizeof(GstPadFlags), alignof(GstPadFlags)); + printf("%s;%zu;%zu\n", "GstPadLinkCheck", sizeof(GstPadLinkCheck), alignof(GstPadLinkCheck)); + printf("%s;%zu;%zu\n", "GstPadLinkReturn", sizeof(GstPadLinkReturn), alignof(GstPadLinkReturn)); + printf("%s;%zu;%zu\n", "GstPadMode", sizeof(GstPadMode), alignof(GstPadMode)); + printf("%s;%zu;%zu\n", "GstPadPresence", sizeof(GstPadPresence), alignof(GstPadPresence)); + printf("%s;%zu;%zu\n", "GstPadProbeInfo", sizeof(GstPadProbeInfo), alignof(GstPadProbeInfo)); + printf("%s;%zu;%zu\n", "GstPadProbeReturn", sizeof(GstPadProbeReturn), alignof(GstPadProbeReturn)); + printf("%s;%zu;%zu\n", "GstPadProbeType", sizeof(GstPadProbeType), alignof(GstPadProbeType)); + printf("%s;%zu;%zu\n", "GstPadTemplate", sizeof(GstPadTemplate), alignof(GstPadTemplate)); + printf("%s;%zu;%zu\n", "GstPadTemplateClass", sizeof(GstPadTemplateClass), alignof(GstPadTemplateClass)); + printf("%s;%zu;%zu\n", "GstPadTemplateFlags", sizeof(GstPadTemplateFlags), alignof(GstPadTemplateFlags)); + printf("%s;%zu;%zu\n", "GstParamSpecArray", sizeof(GstParamSpecArray), alignof(GstParamSpecArray)); + printf("%s;%zu;%zu\n", "GstParamSpecFraction", sizeof(GstParamSpecFraction), alignof(GstParamSpecFraction)); + printf("%s;%zu;%zu\n", "GstParentBufferMeta", sizeof(GstParentBufferMeta), alignof(GstParentBufferMeta)); + printf("%s;%zu;%zu\n", "GstParseError", sizeof(GstParseError), alignof(GstParseError)); + printf("%s;%zu;%zu\n", "GstParseFlags", sizeof(GstParseFlags), alignof(GstParseFlags)); + printf("%s;%zu;%zu\n", "GstPipeline", sizeof(GstPipeline), alignof(GstPipeline)); + printf("%s;%zu;%zu\n", "GstPipelineClass", sizeof(GstPipelineClass), alignof(GstPipelineClass)); + printf("%s;%zu;%zu\n", "GstPipelineFlags", sizeof(GstPipelineFlags), alignof(GstPipelineFlags)); + printf("%s;%zu;%zu\n", "GstPluginAPIFlags", sizeof(GstPluginAPIFlags), alignof(GstPluginAPIFlags)); + printf("%s;%zu;%zu\n", "GstPluginDependencyFlags", sizeof(GstPluginDependencyFlags), alignof(GstPluginDependencyFlags)); + printf("%s;%zu;%zu\n", "GstPluginDesc", sizeof(GstPluginDesc), alignof(GstPluginDesc)); + printf("%s;%zu;%zu\n", "GstPluginError", sizeof(GstPluginError), alignof(GstPluginError)); + printf("%s;%zu;%zu\n", "GstPluginFlags", sizeof(GstPluginFlags), alignof(GstPluginFlags)); + printf("%s;%zu;%zu\n", "GstPollFD", sizeof(GstPollFD), alignof(GstPollFD)); + printf("%s;%zu;%zu\n", "GstPresetInterface", sizeof(GstPresetInterface), alignof(GstPresetInterface)); + printf("%s;%zu;%zu\n", "GstProgressType", sizeof(GstProgressType), alignof(GstProgressType)); + printf("%s;%zu;%zu\n", "GstPromise", sizeof(GstPromise), alignof(GstPromise)); + printf("%s;%zu;%zu\n", "GstPromiseResult", sizeof(GstPromiseResult), alignof(GstPromiseResult)); + printf("%s;%zu;%zu\n", "GstProtectionMeta", sizeof(GstProtectionMeta), alignof(GstProtectionMeta)); + printf("%s;%zu;%zu\n", "GstProxyPad", sizeof(GstProxyPad), alignof(GstProxyPad)); + printf("%s;%zu;%zu\n", "GstProxyPadClass", sizeof(GstProxyPadClass), alignof(GstProxyPadClass)); + printf("%s;%zu;%zu\n", "GstQOSType", sizeof(GstQOSType), alignof(GstQOSType)); + printf("%s;%zu;%zu\n", "GstQuery", sizeof(GstQuery), alignof(GstQuery)); + printf("%s;%zu;%zu\n", "GstQueryType", sizeof(GstQueryType), alignof(GstQueryType)); + printf("%s;%zu;%zu\n", "GstQueryTypeFlags", sizeof(GstQueryTypeFlags), alignof(GstQueryTypeFlags)); + printf("%s;%zu;%zu\n", "GstRank", sizeof(GstRank), alignof(GstRank)); + printf("%s;%zu;%zu\n", "GstReferenceTimestampMeta", sizeof(GstReferenceTimestampMeta), alignof(GstReferenceTimestampMeta)); + printf("%s;%zu;%zu\n", "GstRegistry", sizeof(GstRegistry), alignof(GstRegistry)); + printf("%s;%zu;%zu\n", "GstRegistryClass", sizeof(GstRegistryClass), alignof(GstRegistryClass)); + printf("%s;%zu;%zu\n", "GstResourceError", sizeof(GstResourceError), alignof(GstResourceError)); + printf("%s;%zu;%zu\n", "GstSchedulingFlags", sizeof(GstSchedulingFlags), alignof(GstSchedulingFlags)); + printf("%s;%zu;%zu\n", "GstSearchMode", sizeof(GstSearchMode), alignof(GstSearchMode)); + printf("%s;%zu;%zu\n", "GstSeekFlags", sizeof(GstSeekFlags), alignof(GstSeekFlags)); + printf("%s;%zu;%zu\n", "GstSeekType", sizeof(GstSeekType), alignof(GstSeekType)); + printf("%s;%zu;%zu\n", "GstSegment", sizeof(GstSegment), alignof(GstSegment)); + printf("%s;%zu;%zu\n", "GstSegmentFlags", sizeof(GstSegmentFlags), alignof(GstSegmentFlags)); + printf("%s;%zu;%zu\n", "GstStackTraceFlags", sizeof(GstStackTraceFlags), alignof(GstStackTraceFlags)); + printf("%s;%zu;%zu\n", "GstState", sizeof(GstState), alignof(GstState)); + printf("%s;%zu;%zu\n", "GstStateChange", sizeof(GstStateChange), alignof(GstStateChange)); + printf("%s;%zu;%zu\n", "GstStateChangeReturn", sizeof(GstStateChangeReturn), alignof(GstStateChangeReturn)); + printf("%s;%zu;%zu\n", "GstStaticCaps", sizeof(GstStaticCaps), alignof(GstStaticCaps)); + printf("%s;%zu;%zu\n", "GstStaticPadTemplate", sizeof(GstStaticPadTemplate), alignof(GstStaticPadTemplate)); + printf("%s;%zu;%zu\n", "GstStream", sizeof(GstStream), alignof(GstStream)); + printf("%s;%zu;%zu\n", "GstStreamClass", sizeof(GstStreamClass), alignof(GstStreamClass)); + printf("%s;%zu;%zu\n", "GstStreamCollection", sizeof(GstStreamCollection), alignof(GstStreamCollection)); + printf("%s;%zu;%zu\n", "GstStreamCollectionClass", sizeof(GstStreamCollectionClass), alignof(GstStreamCollectionClass)); + printf("%s;%zu;%zu\n", "GstStreamError", sizeof(GstStreamError), alignof(GstStreamError)); + printf("%s;%zu;%zu\n", "GstStreamFlags", sizeof(GstStreamFlags), alignof(GstStreamFlags)); + printf("%s;%zu;%zu\n", "GstStreamStatusType", sizeof(GstStreamStatusType), alignof(GstStreamStatusType)); + printf("%s;%zu;%zu\n", "GstStreamType", sizeof(GstStreamType), alignof(GstStreamType)); + printf("%s;%zu;%zu\n", "GstStructure", sizeof(GstStructure), alignof(GstStructure)); + printf("%s;%zu;%zu\n", "GstStructureChangeType", sizeof(GstStructureChangeType), alignof(GstStructureChangeType)); + printf("%s;%zu;%zu\n", "GstSystemClock", sizeof(GstSystemClock), alignof(GstSystemClock)); + printf("%s;%zu;%zu\n", "GstSystemClockClass", sizeof(GstSystemClockClass), alignof(GstSystemClockClass)); + printf("%s;%zu;%zu\n", "GstTagFlag", sizeof(GstTagFlag), alignof(GstTagFlag)); + printf("%s;%zu;%zu\n", "GstTagList", sizeof(GstTagList), alignof(GstTagList)); + printf("%s;%zu;%zu\n", "GstTagMergeMode", sizeof(GstTagMergeMode), alignof(GstTagMergeMode)); + printf("%s;%zu;%zu\n", "GstTagScope", sizeof(GstTagScope), alignof(GstTagScope)); + printf("%s;%zu;%zu\n", "GstTagSetterInterface", sizeof(GstTagSetterInterface), alignof(GstTagSetterInterface)); + printf("%s;%zu;%zu\n", "GstTask", sizeof(GstTask), alignof(GstTask)); + printf("%s;%zu;%zu\n", "GstTaskClass", sizeof(GstTaskClass), alignof(GstTaskClass)); + printf("%s;%zu;%zu\n", "GstTaskPool", sizeof(GstTaskPool), alignof(GstTaskPool)); + printf("%s;%zu;%zu\n", "GstTaskPoolClass", sizeof(GstTaskPoolClass), alignof(GstTaskPoolClass)); + printf("%s;%zu;%zu\n", "GstTaskState", sizeof(GstTaskState), alignof(GstTaskState)); + printf("%s;%zu;%zu\n", "GstTimedValue", sizeof(GstTimedValue), alignof(GstTimedValue)); + printf("%s;%zu;%zu\n", "GstTocEntryType", sizeof(GstTocEntryType), alignof(GstTocEntryType)); + printf("%s;%zu;%zu\n", "GstTocLoopType", sizeof(GstTocLoopType), alignof(GstTocLoopType)); + printf("%s;%zu;%zu\n", "GstTocScope", sizeof(GstTocScope), alignof(GstTocScope)); + printf("%s;%zu;%zu\n", "GstTocSetterInterface", sizeof(GstTocSetterInterface), alignof(GstTocSetterInterface)); + printf("%s;%zu;%zu\n", "GstTracer", sizeof(GstTracer), alignof(GstTracer)); + printf("%s;%zu;%zu\n", "GstTracerClass", sizeof(GstTracerClass), alignof(GstTracerClass)); + printf("%s;%zu;%zu\n", "GstTracerValueFlags", sizeof(GstTracerValueFlags), alignof(GstTracerValueFlags)); + printf("%s;%zu;%zu\n", "GstTracerValueScope", sizeof(GstTracerValueScope), alignof(GstTracerValueScope)); + printf("%s;%zu;%zu\n", "GstTypeFind", sizeof(GstTypeFind), alignof(GstTypeFind)); + printf("%s;%zu;%zu\n", "GstTypeFindProbability", sizeof(GstTypeFindProbability), alignof(GstTypeFindProbability)); + printf("%s;%zu;%zu\n", "GstURIError", sizeof(GstURIError), alignof(GstURIError)); + printf("%s;%zu;%zu\n", "GstURIHandlerInterface", sizeof(GstURIHandlerInterface), alignof(GstURIHandlerInterface)); + printf("%s;%zu;%zu\n", "GstURIType", sizeof(GstURIType), alignof(GstURIType)); + printf("%s;%zu;%zu\n", "GstValueTable", sizeof(GstValueTable), alignof(GstValueTable)); return 0; }