From 70d95dca4cbaacd63c36c3f8a8f81015c72de09c Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Mon, 28 Feb 2022 11:03:21 +0000 Subject: [PATCH] validate: New crate for GstValidate bindings Co-authored-by: Thibault Saunier --- .gitlab-ci.yml | 16 +- Cargo.toml | 2 + ci/images_template.yml | 2 +- ci/install-gst.sh | 2 +- gstreamer-validate/CHANGELOG.md | 1 + gstreamer-validate/COPYRIGHT | 1 + gstreamer-validate/Cargo.toml | 31 + gstreamer-validate/Gir.toml | 55 + gstreamer-validate/LICENSE-APACHE | 1 + gstreamer-validate/LICENSE-MIT | 1 + gstreamer-validate/README.md | 202 ++ gstreamer-validate/src/auto/action.rs | 47 + gstreamer-validate/src/auto/alias.rs | 9 + gstreamer-validate/src/auto/bin_monitor.rs | 107 ++ .../src/auto/element_monitor.rs | 42 + gstreamer-validate/src/auto/enums.rs | 213 +++ gstreamer-validate/src/auto/flags.rs | 75 + gstreamer-validate/src/auto/issue.rs | 61 + gstreamer-validate/src/auto/mod.rs | 56 + gstreamer-validate/src/auto/monitor.rs | 208 ++ gstreamer-validate/src/auto/pad_monitor.rs | 43 + .../src/auto/pipeline_monitor.rs | 44 + gstreamer-validate/src/auto/report.rs | 208 ++ gstreamer-validate/src/auto/reporter.rs | 172 ++ gstreamer-validate/src/auto/runner.rs | 225 +++ gstreamer-validate/src/auto/scenario.rs | 240 +++ gstreamer-validate/src/auto/versions.txt | 3 + gstreamer-validate/src/functions.rs | 30 + gstreamer-validate/src/lib.rs | 58 + gstreamer-validate/sys/Cargo.toml | 51 + gstreamer-validate/sys/Gir.toml | 13 + gstreamer-validate/sys/build.rs | 18 + gstreamer-validate/sys/src/lib.rs | 1672 +++++++++++++++++ gstreamer-validate/sys/tests/abi.rs | 601 ++++++ gstreamer-validate/sys/tests/constant.c | 98 + gstreamer-validate/sys/tests/layout.c | 53 + gstreamer-validate/sys/tests/manual.h | 3 + 37 files changed, 4661 insertions(+), 3 deletions(-) create mode 120000 gstreamer-validate/CHANGELOG.md create mode 120000 gstreamer-validate/COPYRIGHT create mode 100644 gstreamer-validate/Cargo.toml create mode 100644 gstreamer-validate/Gir.toml create mode 120000 gstreamer-validate/LICENSE-APACHE create mode 120000 gstreamer-validate/LICENSE-MIT create mode 100644 gstreamer-validate/README.md create mode 100644 gstreamer-validate/src/auto/action.rs create mode 100644 gstreamer-validate/src/auto/alias.rs create mode 100644 gstreamer-validate/src/auto/bin_monitor.rs create mode 100644 gstreamer-validate/src/auto/element_monitor.rs create mode 100644 gstreamer-validate/src/auto/enums.rs create mode 100644 gstreamer-validate/src/auto/flags.rs create mode 100644 gstreamer-validate/src/auto/issue.rs create mode 100644 gstreamer-validate/src/auto/mod.rs create mode 100644 gstreamer-validate/src/auto/monitor.rs create mode 100644 gstreamer-validate/src/auto/pad_monitor.rs create mode 100644 gstreamer-validate/src/auto/pipeline_monitor.rs create mode 100644 gstreamer-validate/src/auto/report.rs create mode 100644 gstreamer-validate/src/auto/reporter.rs create mode 100644 gstreamer-validate/src/auto/runner.rs create mode 100644 gstreamer-validate/src/auto/scenario.rs create mode 100644 gstreamer-validate/src/auto/versions.txt create mode 100644 gstreamer-validate/src/functions.rs create mode 100644 gstreamer-validate/src/lib.rs create mode 100644 gstreamer-validate/sys/Cargo.toml create mode 100644 gstreamer-validate/sys/Gir.toml create mode 100644 gstreamer-validate/sys/build.rs create mode 100644 gstreamer-validate/sys/src/lib.rs create mode 100644 gstreamer-validate/sys/tests/abi.rs create mode 100644 gstreamer-validate/sys/tests/constant.c create mode 100644 gstreamer-validate/sys/tests/layout.c create mode 100644 gstreamer-validate/sys/tests/manual.h diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b4ef787c3..33b5d7219 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -234,6 +234,9 @@ plugins-update-nightly: gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer) echo "--features=ser_de,v1_22" ;; + gstreamer-validate) + echo "" + ;; *) echo "--features=v1_22" ;; @@ -322,7 +325,15 @@ test nightly all-features: - | get_features() { module=${1%%/sys} - echo "--features=v1_22" + case "$module" in + gstreamer-validate) + echo "" + ;; + *) + echo "--features=v1_22" + ;; + esac + } # First build and test all the crates with their relevant features # Keep features in sync with below @@ -419,6 +430,9 @@ clippy: gstreamer-audio|gstreamer-editing-services|gstreamer-gl|gstreamer-pbutils|gstreamer-rtp|gstreamer-rtsp|gstreamer-video|gstreamer) echo "--features=ser_de,v1_22" ;; + gstreamer-validate) + echo "" + ;; *) echo "--features=v1_22" ;; diff --git a/Cargo.toml b/Cargo.toml index bfecd54ea..449238a86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ default-members = [ "gstreamer-rtsp", "gstreamer-rtsp-server", "gstreamer-sdp", + "gstreamer-validate", "gstreamer-video", "gstreamer-webrtc", "examples", @@ -85,6 +86,7 @@ members = [ "gstreamer-rtsp", "gstreamer-rtsp-server", "gstreamer-sdp", + "gstreamer-validate", "gstreamer-video", "gstreamer-webrtc", "gstreamer-allocators", diff --git a/ci/images_template.yml b/ci/images_template.yml index 0619032e6..274d04fc5 100644 --- a/ci/images_template.yml +++ b/ci/images_template.yml @@ -1,4 +1,4 @@ variables: - GST_RS_IMG_TAG: '2022-08-19.0' + GST_RS_IMG_TAG: '2022-08-22.0' GST_RS_STABLE: '1.63.0' GST_RS_MSRV: '1.60.0' diff --git a/ci/install-gst.sh b/ci/install-gst.sh index 7c76e8e68..798dadeee 100755 --- a/ci/install-gst.sh +++ b/ci/install-gst.sh @@ -11,7 +11,7 @@ cd gstreamer # plugins required by tests PLUGINS="-D gst-plugins-base:ogg=enabled -D gst-plugins-base:vorbis=enabled -D gst-plugins-base:theora=enabled -D gst-plugins-good:matroska=enabled -D gst-plugins-good:vpx=enabled -D gst-plugins-bad:opus=enabled" -meson build -D prefix=/usr/local -D devtools=disabled -D examples=disabled -D gtk_doc=disabled -D introspection=disabled -D libav=disabled -D libnice=disabled -D python=disabled -D ugly=disabled -D vaapi=disabled $PLUGINS +meson build -D prefix=/usr/local -D examples=disabled -D gtk_doc=disabled -D introspection=disabled -D libav=disabled -D libnice=disabled -D python=disabled -D ugly=disabled -D vaapi=disabled $PLUGINS ninja -C build ninja -C build install diff --git a/gstreamer-validate/CHANGELOG.md b/gstreamer-validate/CHANGELOG.md new file mode 120000 index 000000000..670919a56 --- /dev/null +++ b/gstreamer-validate/CHANGELOG.md @@ -0,0 +1 @@ +../gstreamer/CHANGELOG.md \ No newline at end of file diff --git a/gstreamer-validate/COPYRIGHT b/gstreamer-validate/COPYRIGHT new file mode 120000 index 000000000..dc5f40a22 --- /dev/null +++ b/gstreamer-validate/COPYRIGHT @@ -0,0 +1 @@ +../COPYRIGHT \ No newline at end of file diff --git a/gstreamer-validate/Cargo.toml b/gstreamer-validate/Cargo.toml new file mode 100644 index 000000000..63f795e31 --- /dev/null +++ b/gstreamer-validate/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "gstreamer-validate" +version = "0.19.0" +authors = ["Philippe Normand "] +categories = ["api-bindings", "multimedia"] +description = "Rust bindings for GStreamer WebRTC library" +repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" +license = "MIT/Apache-2.0" +readme = "README.md" +homepage = "https://gstreamer.freedesktop.org" +documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_validate/" +keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"] +edition = "2021" +rust-version = "1.60" + +[dependencies] +libc = "0.2" +ffi = { package = "gstreamer-validate-sys", path = "sys" } +glib = { git = "https://github.com/gtk-rs/gtk-rs-core" } +gst = { package = "gstreamer", path = "../gstreamer", features = ["v1_22"] } +bitflags = "1.0" + +[dev-dependencies] +gir-format-check = "0.1" + +[features] +default = [] +dox = ["ffi/dox", "glib/dox", "gst/dox"] + +[package.metadata.docs.rs] +features = ["dox"] diff --git a/gstreamer-validate/Gir.toml b/gstreamer-validate/Gir.toml new file mode 100644 index 000000000..367a46519 --- /dev/null +++ b/gstreamer-validate/Gir.toml @@ -0,0 +1,55 @@ +[options] +girs_directories = ["../gir-files", "../gst-gir-files"] +library = "GstValidate" +version = "1.0" +min_cfg_version = "1.22" +work_mode = "normal" +concurrency = "send+sync" +generate_safety_asserts = true +single_version_file = true +generate_display_trait = false + +external_libraries = [ + "GLib", + "GObject", + "Gst", +] + +generate = [ + "GstValidate.Action", + "GstValidate.Reporter", + "GstValidate.BinMonitor", + "GstValidate.Monitor", + "GstValidate.ElementMonitor", + "GstValidate.PadMonitor", + "GstValidate.PipelineMonitor", + "GstValidate.Report", + "GstValidate.Runner", + "GstValidate.Issue", + "GstValidate.ReportingDetails", + "GstValidate.ReportLevel", + "GstValidate.IssueFlags", + "GstValidate.IssueId", +] + +manual = [ + "GLib.Bytes", + "GLib.Error", + "GObject.Object", + "Gst.Caps", + "Gst.Structure", + "Gst.Object", + "Gst.Bin", + "Gst.Element", + "Gst.Pipeline", + "Gst.State", + "Gst.Pad", + "Gst.Format", + "Gst.SeekFlags", + "Gst.SeekType", +] + +[[object]] +name = "GstValidate.Scenario" +status = "generate" +concurrency = "none" \ No newline at end of file diff --git a/gstreamer-validate/LICENSE-APACHE b/gstreamer-validate/LICENSE-APACHE new file mode 120000 index 000000000..965b606f3 --- /dev/null +++ b/gstreamer-validate/LICENSE-APACHE @@ -0,0 +1 @@ +../LICENSE-APACHE \ No newline at end of file diff --git a/gstreamer-validate/LICENSE-MIT b/gstreamer-validate/LICENSE-MIT new file mode 120000 index 000000000..76219eb72 --- /dev/null +++ b/gstreamer-validate/LICENSE-MIT @@ -0,0 +1 @@ +../LICENSE-MIT \ No newline at end of file diff --git a/gstreamer-validate/README.md b/gstreamer-validate/README.md new file mode 100644 index 000000000..3586bb239 --- /dev/null +++ b/gstreamer-validate/README.md @@ -0,0 +1,202 @@ +# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-validate.svg)](https://crates.io/crates/gstreamer-validate) [![pipeline status](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/badges/main/pipeline.svg)](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/main) + +[GStreamer](https://gstreamer.freedesktop.org/) (Validate library) bindings for Rust. +Documentation can be found [here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_validate/). + +These bindings are providing a safe API that can be used to interface with +GStreamer, e.g. for writing GStreamer-based applications and GStreamer plugins. + +The bindings are mostly autogenerated with [gir](https://github.com/gtk-rs/gir/) +based on the [GObject-Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection/) +API metadata provided by the GStreamer project. + +## Table of Contents +1. [Installation](#installation) + 1. [Linux/BSDs](#installation-linux) + 1. [macOS](#installation-macos) + 1. [Windows](#installation-windows) +1. [Getting Started](#getting-started) +1. [License](#license) +1. [Contribution](#contribution) + + + +## Installation + +To build the GStreamer bindings or anything depending on them, you need to +have at least GStreamer 1.8 and gst-plugins-base 1.8 installed. In addition, +some of the examples/tutorials require various GStreamer plugins to be +available, which can be found in gst-plugins-base, gst-plugins-good, +gst-plugins-bad, gst-plugins-ugly and/or gst-libav. + + + +### Linux/BSDs + +You need to install the above mentioned packages with your distributions +package manager, or build them from source. + +On Debian/Ubuntu they can be installed with + +```console +$ apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ + gstreamer1.0-plugins-base gstreamer1.0-plugins-good \ + gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ + gstreamer1.0-libav libgstrtspserver-1.0-dev libges-1.0-dev +``` + +The minimum required version of the above libraries is >= 1.8. If you +build the gstreamer-player sub-crate, or any of the examples that +depend on gstreamer-player, you must ensure that in addition to the +above packages, `libgstreamer-plugins-bad1.0-dev` is installed and +that the version is >= 1.12. See the `Cargo.toml` files for the full +details, + +```console +$ # Only if you wish to install gstreamer-player, make sure the version +$ # of this package is >= 1.12. +$ apt-get install libgstreamer-plugins-bad1.0-dev +``` + +Package names on other distributions should be similar. +Please submit a pull request with instructions for yours. + + + +### macOS + +You can install GStreamer and the plugins via [Homebrew](https://brew.sh/) or +by installing the [binaries](https://gstreamer.freedesktop.org/data/pkg/osx/) +provided by the GStreamer project. + +#### Homebrew + +Homebrew only installs various plugins if explicitly enabled, so some extra +`--with-*` flags may be required. + +```console +$ brew install gstreamer gst-plugins-base gst-plugins-good \ + gst-plugins-bad gst-plugins-ugly gst-libav gst-rtsp-server \ + gst-editing-services --with-orc --with-libogg --with-opus \ + --with-pango --with-theora --with-libvorbis --with-libvpx \ + --enable-gtk3 +``` + +If you wish to install the gstreamer-player sub-crate, make sure the +version of these libraries is >= 1.12. Otherwise, a version >= 1.8 is +sufficient. + +#### GStreamer Binaries + +You need to download the *two* `.pkg` files from the GStreamer website and +install them, e.g. `gstreamer-1.0-1.12.3-x86_64.pkg` and +`gstreamer-1.0-devel-1.12.3-x86_64.pkg`. + +After installation, you also need to install `pkg-config` (e.g. via Homebrew) +and set the `PKG_CONFIG_PATH` environment variable + +```console +$ export PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/Current/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" +``` + + + +### Windows + +You can install GStreamer and the plugins via [MSYS2](http://www.msys2.org/) +with `pacman` or by installing the +[binaries](https://gstreamer.freedesktop.org/data/pkg/windows/) provided by +the GStreamer project. + +#### MSYS2 / pacman + +```console +$ pacman -S glib2-devel pkg-config \ + mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-plugins-base \ + mingw-w64-x86_64-gst-plugins-good mingw-w64-x86_64-gst-plugins-bad \ + mingw-w64-x86_64-gst-plugins-ugly mingw-w64-x86_64-gst-libav \ + mingw-w64-x86_64-gst-rtsp-server +``` + +If you wish to install the gstreamer-player sub-crate, make sure the +version of these libraries is >= 1.12. Otherwise, a version >= 1.8 is +sufficient. + +Note that the version of `pkg-config` included in `MSYS2` is +[known to have problems](https://github.com/rust-lang/pkg-config-rs/issues/51#issuecomment-346300858) +compiling GStreamer, so you may need to install another version. One option +would be [`pkg-config-lite`](https://sourceforge.net/projects/pkgconfiglite/). + +#### GStreamer Binaries + +You need to download the *two* `.msi` files for your platform from the +GStreamer website and install them, e.g. `gstreamer-1.0-x86_64-1.12.3.msi` and +`gstreamer-1.0-devel-x86_64-1.12.3.msi`. + +After installation, you also need to install `pkg-config` (e.g. via MSYS2 or +from [here](https://sourceforge.net/projects/pkgconfiglite/)) +and set the `PKG_CONFIG_PATH` environment variable + +```console +$ export PKG_CONFIG_PATH="c:\\gstreamer\\1.0\\x86_64\\lib\\pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" +``` + + + +## Getting Started + +The API reference can be found +[here](https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer/), however it is +only the Rust API reference and does not explain any of the concepts. + +For getting started with GStreamer development, the best would be to follow +the [documentation](https://gstreamer.freedesktop.org/documentation/) on the +GStreamer website, especially the [Application Development +Manual](https://gstreamer.freedesktop.org/documentation/application-development/). +While being C-centric, it explains all the fundamental concepts of GStreamer +and the code examples should be relatively easily translatable to Rust. The +API is basically the same, function/struct names are the same and everything +is only more convenient (hopefully) and safer. + +In addition there are +[tutorials](https://gstreamer.freedesktop.org/documentation/tutorials/) on the +GStreamer website. Many of them were ported to Rust already and the code can +be found in the +[tutorials](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/tutorials) +directory. + +Some further examples for various aspects of GStreamer and how to use it from +Rust can be found in the +[examples](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/tree/main/examples) +directory. + +Various GStreamer plugins written in Rust can be found in the +[gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs) +repository. + + + +## LICENSE + +gstreamer-rs and all crates contained in here are licensed under either of + + * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or + http://www.apache.org/licenses/LICENSE-2.0) + * MIT license ([LICENSE-MIT](LICENSE-MIT) or + http://opensource.org/licenses/MIT) + +at your option. + +GStreamer itself is licensed under the Lesser General Public License version +2.1 or (at your option) any later version: +https://www.gnu.org/licenses/lgpl-2.1.html + + + +## Contribution + +Any kinds of contributions are welcome as a pull request. + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in gstreamer-rs by you, as defined in the Apache-2.0 license, shall be +dual licensed as above, without any additional terms or conditions. diff --git a/gstreamer-validate/src/auto/action.rs b/gstreamer-validate/src/auto/action.rs new file mode 100644 index 000000000..45b5b2922 --- /dev/null +++ b/gstreamer-validate/src/auto/action.rs @@ -0,0 +1,47 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::Scenario; +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct Action(Shared); + + match fn { + ref => |ptr| ffi::gst_validate_action_ref(ptr), + unref => |ptr| ffi::gst_validate_action_unref(ptr), + type_ => || ffi::gst_validate_action_get_type(), + } +} + +impl Action { + //#[doc(alias = "gst_validate_action_new")] + //pub fn new(scenario: Option<&impl IsA>, action_type: /*Ignored*/&mut ActionType, structure: &mut gst::Structure, add_to_lists: bool) -> Action { + // unsafe { TODO: call ffi:gst_validate_action_new() } + //} + + #[doc(alias = "gst_validate_action_get_scenario")] + #[doc(alias = "get_scenario")] + pub fn scenario(&self) -> Option { + unsafe { from_glib_full(ffi::gst_validate_action_get_scenario(self.to_glib_none().0)) } + } + + #[doc(alias = "gst_validate_action_set_done")] + pub fn set_done(&self) { + unsafe { + ffi::gst_validate_action_set_done(self.to_glib_none().0); + } + } + + //#[doc(alias = "gst_validate_action_get_clocktime")] + //#[doc(alias = "get_clocktime")] + //pub fn clocktime(scenario: &impl IsA, action: &Action, name: &str) -> Option { + // unsafe { TODO: call ffi:gst_validate_action_get_clocktime() } + //} +} + +unsafe impl Send for Action {} +unsafe impl Sync for Action {} diff --git a/gstreamer-validate/src/auto/alias.rs b/gstreamer-validate/src/auto/alias.rs new file mode 100644 index 000000000..cec847207 --- /dev/null +++ b/gstreamer-validate/src/auto/alias.rs @@ -0,0 +1,9 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +#[allow(unused_imports)] +use crate::auto::*; + +pub type IssueId = glib::Quark; diff --git a/gstreamer-validate/src/auto/bin_monitor.rs b/gstreamer-validate/src/auto/bin_monitor.rs new file mode 100644 index 000000000..857d70f3b --- /dev/null +++ b/gstreamer-validate/src/auto/bin_monitor.rs @@ -0,0 +1,107 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::ElementMonitor; +use crate::Monitor; +use crate::Reporter; +use crate::Runner; +use crate::Scenario; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use std::boxed::Box as Box_; +use std::mem::transmute; + +glib::wrapper! { + #[doc(alias = "GstValidateBinMonitor")] + pub struct BinMonitor(Object) @extends ElementMonitor, Monitor, gst::Object, @implements Reporter; + + match fn { + type_ => || ffi::gst_validate_bin_monitor_get_type(), + } +} + +impl BinMonitor { + pub const NONE: Option<&'static BinMonitor> = None; + + #[doc(alias = "gst_validate_bin_monitor_new")] + pub fn new( + bin: &impl IsA, + runner: &impl IsA, + parent: Option<&impl IsA>, + ) -> BinMonitor { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_validate_bin_monitor_new( + bin.as_ref().to_glib_none().0, + runner.as_ref().to_glib_none().0, + parent.map(|p| p.as_ref()).to_glib_none().0, + )) + } + } +} + +unsafe impl Send for BinMonitor {} +unsafe impl Sync for BinMonitor {} + +pub trait BinMonitorExt: 'static { + #[doc(alias = "gst_validate_bin_monitor_get_scenario")] + #[doc(alias = "get_scenario")] + fn scenario(&self) -> Option; + + #[doc(alias = "handles-states")] + fn is_handles_states(&self) -> bool; + + #[doc(alias = "handles-states")] + fn connect_handles_states_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> BinMonitorExt for O { + fn scenario(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_bin_monitor_get_scenario( + self.as_ref().to_glib_none().0, + )) + } + } + + fn is_handles_states(&self) -> bool { + glib::ObjectExt::property(self.as_ref(), "handles-states") + } + + fn connect_handles_states_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_handles_states_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut ffi::GstValidateBinMonitor, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(BinMonitor::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::handles-states\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_handles_states_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-validate/src/auto/element_monitor.rs b/gstreamer-validate/src/auto/element_monitor.rs new file mode 100644 index 000000000..c66647242 --- /dev/null +++ b/gstreamer-validate/src/auto/element_monitor.rs @@ -0,0 +1,42 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::Monitor; +use crate::Reporter; +use crate::Runner; +use glib::object::IsA; +use glib::translate::*; + +glib::wrapper! { + #[doc(alias = "GstValidateElementMonitor")] + pub struct ElementMonitor(Object) @extends Monitor, gst::Object, @implements Reporter; + + match fn { + type_ => || ffi::gst_validate_element_monitor_get_type(), + } +} + +impl ElementMonitor { + pub const NONE: Option<&'static ElementMonitor> = None; + + #[doc(alias = "gst_validate_element_monitor_new")] + pub fn new( + element: &impl IsA, + runner: &impl IsA, + parent: Option<&impl IsA>, + ) -> ElementMonitor { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_validate_element_monitor_new( + element.as_ref().to_glib_none().0, + runner.as_ref().to_glib_none().0, + parent.map(|p| p.as_ref()).to_glib_none().0, + )) + } + } +} + +unsafe impl Send for ElementMonitor {} +unsafe impl Sync for ElementMonitor {} diff --git a/gstreamer-validate/src/auto/enums.rs b/gstreamer-validate/src/auto/enums.rs new file mode 100644 index 000000000..628bdc4ef --- /dev/null +++ b/gstreamer-validate/src/auto/enums.rs @@ -0,0 +1,213 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use glib::translate::*; +use glib::value::FromValue; +use glib::value::ToValue; +use glib::StaticType; +use glib::Type; + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "GstValidateReportLevel")] +pub enum ReportLevel { + #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_CRITICAL")] + Critical, + #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_WARNING")] + Warning, + #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_ISSUE")] + Issue, + #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_IGNORE")] + Ignore, + #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_UNKNOWN")] + Unknown, + #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_EXPECTED")] + Expected, + #[doc(alias = "GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES")] + NumEntries, + #[doc(hidden)] + __Unknown(i32), +} + +impl ReportLevel { + #[doc(alias = "gst_validate_report_level_from_name")] + pub fn from_name(level_name: &str) -> ReportLevel { + assert_initialized_main_thread!(); + unsafe { + from_glib(ffi::gst_validate_report_level_from_name( + level_name.to_glib_none().0, + )) + } + } + + #[doc(alias = "gst_validate_report_level_get_name")] + #[doc(alias = "get_name")] + pub fn name(self) -> Option { + assert_initialized_main_thread!(); + unsafe { from_glib_none(ffi::gst_validate_report_level_get_name(self.into_glib())) } + } +} + +#[doc(hidden)] +impl IntoGlib for ReportLevel { + type GlibType = ffi::GstValidateReportLevel; + + fn into_glib(self) -> ffi::GstValidateReportLevel { + match self { + Self::Critical => ffi::GST_VALIDATE_REPORT_LEVEL_CRITICAL, + Self::Warning => ffi::GST_VALIDATE_REPORT_LEVEL_WARNING, + Self::Issue => ffi::GST_VALIDATE_REPORT_LEVEL_ISSUE, + Self::Ignore => ffi::GST_VALIDATE_REPORT_LEVEL_IGNORE, + Self::Unknown => ffi::GST_VALIDATE_REPORT_LEVEL_UNKNOWN, + Self::Expected => ffi::GST_VALIDATE_REPORT_LEVEL_EXPECTED, + Self::NumEntries => ffi::GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for ReportLevel { + unsafe fn from_glib(value: ffi::GstValidateReportLevel) -> Self { + skip_assert_initialized!(); + match value { + ffi::GST_VALIDATE_REPORT_LEVEL_CRITICAL => Self::Critical, + ffi::GST_VALIDATE_REPORT_LEVEL_WARNING => Self::Warning, + ffi::GST_VALIDATE_REPORT_LEVEL_ISSUE => Self::Issue, + ffi::GST_VALIDATE_REPORT_LEVEL_IGNORE => Self::Ignore, + ffi::GST_VALIDATE_REPORT_LEVEL_UNKNOWN => Self::Unknown, + ffi::GST_VALIDATE_REPORT_LEVEL_EXPECTED => Self::Expected, + ffi::GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES => Self::NumEntries, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for ReportLevel { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_validate_report_level_get_type()) } + } +} + +impl glib::value::ValueType for ReportLevel { + type Type = Self; +} + +unsafe impl<'a> FromValue<'a> for ReportLevel { + type Checker = glib::value::GenericValueTypeChecker; + + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for ReportLevel { + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[non_exhaustive] +#[doc(alias = "GstValidateReportingDetails")] +pub enum ReportingDetails { + #[doc(alias = "GST_VALIDATE_SHOW_UNKNOWN")] + Unknown, + #[doc(alias = "GST_VALIDATE_SHOW_NONE")] + None, + #[doc(alias = "GST_VALIDATE_SHOW_SYNTHETIC")] + Synthetic, + #[doc(alias = "GST_VALIDATE_SHOW_SUBCHAIN")] + Subchain, + #[doc(alias = "GST_VALIDATE_SHOW_MONITOR")] + Monitor, + #[doc(alias = "GST_VALIDATE_SHOW_ALL")] + All, + #[doc(alias = "GST_VALIDATE_SHOW_SMART")] + Smart, + #[doc(alias = "GST_VALIDATE_SHOW_COUNT")] + Count, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl IntoGlib for ReportingDetails { + type GlibType = ffi::GstValidateReportingDetails; + + fn into_glib(self) -> ffi::GstValidateReportingDetails { + match self { + Self::Unknown => ffi::GST_VALIDATE_SHOW_UNKNOWN, + Self::None => ffi::GST_VALIDATE_SHOW_NONE, + Self::Synthetic => ffi::GST_VALIDATE_SHOW_SYNTHETIC, + Self::Subchain => ffi::GST_VALIDATE_SHOW_SUBCHAIN, + Self::Monitor => ffi::GST_VALIDATE_SHOW_MONITOR, + Self::All => ffi::GST_VALIDATE_SHOW_ALL, + Self::Smart => ffi::GST_VALIDATE_SHOW_SMART, + Self::Count => ffi::GST_VALIDATE_SHOW_COUNT, + Self::__Unknown(value) => value, + } + } +} + +#[doc(hidden)] +impl FromGlib for ReportingDetails { + unsafe fn from_glib(value: ffi::GstValidateReportingDetails) -> Self { + skip_assert_initialized!(); + match value { + ffi::GST_VALIDATE_SHOW_UNKNOWN => Self::Unknown, + ffi::GST_VALIDATE_SHOW_NONE => Self::None, + ffi::GST_VALIDATE_SHOW_SYNTHETIC => Self::Synthetic, + ffi::GST_VALIDATE_SHOW_SUBCHAIN => Self::Subchain, + ffi::GST_VALIDATE_SHOW_MONITOR => Self::Monitor, + ffi::GST_VALIDATE_SHOW_ALL => Self::All, + ffi::GST_VALIDATE_SHOW_SMART => Self::Smart, + ffi::GST_VALIDATE_SHOW_COUNT => Self::Count, + value => Self::__Unknown(value), + } + } +} + +impl StaticType for ReportingDetails { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_validate_reporting_details_get_type()) } + } +} + +impl glib::value::ValueType for ReportingDetails { + type Type = Self; +} + +unsafe impl<'a> FromValue<'a> for ReportingDetails { + type Checker = glib::value::GenericValueTypeChecker; + + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl ToValue for ReportingDetails { + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} diff --git a/gstreamer-validate/src/auto/flags.rs b/gstreamer-validate/src/auto/flags.rs new file mode 100644 index 000000000..882824c47 --- /dev/null +++ b/gstreamer-validate/src/auto/flags.rs @@ -0,0 +1,75 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use bitflags::bitflags; +use glib::translate::*; +use glib::value::FromValue; +use glib::value::ToValue; +use glib::StaticType; +use glib::Type; + +bitflags! { + #[doc(alias = "GstValidateIssueFlags")] + pub struct IssueFlags: u32 { + #[doc(alias = "GST_VALIDATE_ISSUE_FLAGS_NONE")] + const NONE = ffi::GST_VALIDATE_ISSUE_FLAGS_NONE as u32; + #[doc(alias = "GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS")] + const FULL_DETAILS = ffi::GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS as u32; + #[doc(alias = "GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE")] + const NO_BACKTRACE = ffi::GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE as u32; + #[doc(alias = "GST_VALIDATE_ISSUE_FLAGS_FORCE_BACKTRACE")] + const FORCE_BACKTRACE = ffi::GST_VALIDATE_ISSUE_FLAGS_FORCE_BACKTRACE as u32; + } +} + +#[doc(hidden)] +impl IntoGlib for IssueFlags { + type GlibType = ffi::GstValidateIssueFlags; + + fn into_glib(self) -> ffi::GstValidateIssueFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for IssueFlags { + unsafe fn from_glib(value: ffi::GstValidateIssueFlags) -> Self { + skip_assert_initialized!(); + Self::from_bits_truncate(value) + } +} + +impl StaticType for IssueFlags { + fn static_type() -> Type { + unsafe { from_glib(ffi::gst_validate_issue_flags_get_type()) } + } +} + +impl glib::value::ValueType for IssueFlags { + type Type = Self; +} + +unsafe impl<'a> FromValue<'a> for IssueFlags { + type Checker = glib::value::GenericValueTypeChecker; + + unsafe fn from_value(value: &'a glib::Value) -> Self { + skip_assert_initialized!(); + from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl ToValue for IssueFlags { + fn to_value(&self) -> glib::Value { + let mut value = glib::Value::for_value_type::(); + unsafe { + glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib()); + } + value + } + + fn value_type(&self) -> glib::Type { + Self::static_type() + } +} diff --git a/gstreamer-validate/src/auto/issue.rs b/gstreamer-validate/src/auto/issue.rs new file mode 100644 index 000000000..08ffc7146 --- /dev/null +++ b/gstreamer-validate/src/auto/issue.rs @@ -0,0 +1,61 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::ReportLevel; +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct Issue(Boxed); + + match fn { + copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_validate_issue_get_type(), ptr as *mut _) as *mut ffi::GstValidateIssue, + free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_validate_issue_get_type(), ptr as *mut _), + type_ => || ffi::gst_validate_issue_get_type(), + } +} + +impl Issue { + //#[doc(alias = "gst_validate_issue_new")] + //pub fn new(issue_id: /*Ignored*/IssueId, summary: &str, description: &str, default_level: ReportLevel) -> Issue { + // unsafe { TODO: call ffi:gst_validate_issue_new() } + //} + + //#[doc(alias = "gst_validate_issue_new_full")] + //pub fn new_full(issue_id: /*Ignored*/IssueId, summary: &str, description: &str, default_level: ReportLevel, flags: IssueFlags) -> Issue { + // unsafe { TODO: call ffi:gst_validate_issue_new_full() } + //} + + #[doc(alias = "gst_validate_issue_get_id")] + #[doc(alias = "get_id")] + pub fn id(&mut self) -> u32 { + unsafe { ffi::gst_validate_issue_get_id(self.to_glib_none_mut().0) } + } + + #[doc(alias = "gst_validate_issue_register")] + pub fn register(&mut self) { + unsafe { + ffi::gst_validate_issue_register(self.to_glib_none_mut().0); + } + } + + #[doc(alias = "gst_validate_issue_set_default_level")] + pub fn set_default_level(&mut self, default_level: ReportLevel) { + unsafe { + ffi::gst_validate_issue_set_default_level( + self.to_glib_none_mut().0, + default_level.into_glib(), + ); + } + } + + //#[doc(alias = "gst_validate_issue_from_id")] + //pub fn from_id(issue_id: /*Ignored*/IssueId) -> Option { + // unsafe { TODO: call ffi:gst_validate_issue_from_id() } + //} +} + +unsafe impl Send for Issue {} +unsafe impl Sync for Issue {} diff --git a/gstreamer-validate/src/auto/mod.rs b/gstreamer-validate/src/auto/mod.rs new file mode 100644 index 000000000..a9b80d27e --- /dev/null +++ b/gstreamer-validate/src/auto/mod.rs @@ -0,0 +1,56 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +mod bin_monitor; +pub use self::bin_monitor::BinMonitor; + +mod element_monitor; +pub use self::element_monitor::ElementMonitor; + +mod monitor; +pub use self::monitor::Monitor; + +mod pad_monitor; +pub use self::pad_monitor::PadMonitor; + +mod pipeline_monitor; +pub use self::pipeline_monitor::PipelineMonitor; + +mod reporter; +pub use self::reporter::Reporter; + +mod runner; +pub use self::runner::Runner; + +mod scenario; +pub use self::scenario::Scenario; + +mod action; +pub use self::action::Action; + +mod issue; +pub use self::issue::Issue; + +mod report; +pub use self::report::Report; + +mod enums; +pub use self::enums::ReportLevel; +pub use self::enums::ReportingDetails; + +mod flags; +pub use self::flags::IssueFlags; + +mod alias; +pub use self::alias::IssueId; + +#[doc(hidden)] +pub mod traits { + pub use super::bin_monitor::BinMonitorExt; + pub use super::monitor::MonitorExt; + pub use super::reporter::ReporterExt; + pub use super::runner::RunnerExt; + pub use super::scenario::ScenarioExt; +} diff --git a/gstreamer-validate/src/auto/monitor.rs b/gstreamer-validate/src/auto/monitor.rs new file mode 100644 index 000000000..8d46a27d7 --- /dev/null +++ b/gstreamer-validate/src/auto/monitor.rs @@ -0,0 +1,208 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::Reporter; +use crate::Runner; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::ToValue; +use std::boxed::Box as Box_; +use std::mem::transmute; + +glib::wrapper! { + #[doc(alias = "GstValidateMonitor")] + pub struct Monitor(Object) @extends gst::Object, @implements Reporter; + + match fn { + type_ => || ffi::gst_validate_monitor_get_type(), + } +} + +impl Monitor { + pub const NONE: Option<&'static Monitor> = None; + + #[doc(alias = "gst_validate_monitor_factory_create")] + pub fn factory_create( + target: &impl IsA, + runner: &impl IsA, + parent: Option<&impl IsA>, + ) -> Option { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_validate_monitor_factory_create( + target.as_ref().to_glib_none().0, + runner.as_ref().to_glib_none().0, + parent.map(|p| p.as_ref()).to_glib_none().0, + )) + } + } +} + +unsafe impl Send for Monitor {} +unsafe impl Sync for Monitor {} + +pub trait MonitorExt: 'static { + //#[doc(alias = "gst_validate_monitor_attach_override")] + //fn attach_override(&self, override_: /*Ignored*/&Override); + + #[doc(alias = "gst_validate_monitor_get_element")] + #[doc(alias = "get_element")] + fn element(&self) -> Option; + + #[doc(alias = "gst_validate_monitor_get_element_name")] + #[doc(alias = "get_element_name")] + fn element_name(&self) -> Option; + + #[doc(alias = "gst_validate_monitor_get_target")] + #[doc(alias = "get_target")] + fn target(&self) -> Option; + + //#[doc(alias = "gst_validate_monitor_set_media_descriptor")] + //fn set_media_descriptor(&self, media_descriptor: /*Ignored*/&MediaDescriptor); + + fn object(&self) -> Option; + + fn set_pipeline>(&self, pipeline: Option<&P>); + + #[doc(alias = "validate-parent")] + fn validate_parent(&self) -> Option; + + #[doc(alias = "validate-runner")] + fn validate_runner(&self) -> Option; + + //fn verbosity(&self) -> /*Ignored*/VerbosityFlags; + + //fn set_verbosity(&self, verbosity: /*Ignored*/VerbosityFlags); + + #[doc(alias = "pipeline")] + fn connect_pipeline_notify( + &self, + f: F, + ) -> SignalHandlerId; + + #[doc(alias = "verbosity")] + fn connect_verbosity_notify( + &self, + f: F, + ) -> SignalHandlerId; +} + +impl> MonitorExt for O { + //fn attach_override(&self, override_: /*Ignored*/&Override) { + // unsafe { TODO: call ffi:gst_validate_monitor_attach_override() } + //} + + fn element(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_validate_monitor_get_element( + self.as_ref().to_glib_none().0, + )) + } + } + + fn element_name(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_monitor_get_element_name( + self.as_ref().to_glib_none().0, + )) + } + } + + fn target(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_monitor_get_target( + self.as_ref().to_glib_none().0, + )) + } + } + + //fn set_media_descriptor(&self, media_descriptor: /*Ignored*/&MediaDescriptor) { + // unsafe { TODO: call ffi:gst_validate_monitor_set_media_descriptor() } + //} + + fn object(&self) -> Option { + glib::ObjectExt::property(self.as_ref(), "object") + } + + fn set_pipeline>(&self, pipeline: Option<&P>) { + glib::ObjectExt::set_property(self.as_ref(), "pipeline", &pipeline) + } + + fn validate_parent(&self) -> Option { + glib::ObjectExt::property(self.as_ref(), "validate-parent") + } + + fn validate_runner(&self) -> Option { + glib::ObjectExt::property(self.as_ref(), "validate-runner") + } + + //fn verbosity(&self) -> /*Ignored*/VerbosityFlags { + // glib::ObjectExt::property(self.as_ref(), "verbosity") + //} + + //fn set_verbosity(&self, verbosity: /*Ignored*/VerbosityFlags) { + // glib::ObjectExt::set_property(self.as_ref(),"verbosity", &verbosity) + //} + + fn connect_pipeline_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_pipeline_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut ffi::GstValidateMonitor, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Monitor::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::pipeline\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_pipeline_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_verbosity_notify( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn notify_verbosity_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut ffi::GstValidateMonitor, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Monitor::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::verbosity\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_verbosity_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-validate/src/auto/pad_monitor.rs b/gstreamer-validate/src/auto/pad_monitor.rs new file mode 100644 index 000000000..a29706c9a --- /dev/null +++ b/gstreamer-validate/src/auto/pad_monitor.rs @@ -0,0 +1,43 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::ElementMonitor; +use crate::Monitor; +use crate::Reporter; +use crate::Runner; +use glib::object::IsA; +use glib::translate::*; + +glib::wrapper! { + #[doc(alias = "GstValidatePadMonitor")] + pub struct PadMonitor(Object) @extends Monitor, gst::Object, @implements Reporter; + + match fn { + type_ => || ffi::gst_validate_pad_monitor_get_type(), + } +} + +impl PadMonitor { + pub const NONE: Option<&'static PadMonitor> = None; + + #[doc(alias = "gst_validate_pad_monitor_new")] + pub fn new( + pad: &impl IsA, + runner: &impl IsA, + parent: Option<&impl IsA>, + ) -> PadMonitor { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_validate_pad_monitor_new( + pad.as_ref().to_glib_none().0, + runner.as_ref().to_glib_none().0, + parent.map(|p| p.as_ref()).to_glib_none().0, + )) + } + } +} + +unsafe impl Send for PadMonitor {} +unsafe impl Sync for PadMonitor {} diff --git a/gstreamer-validate/src/auto/pipeline_monitor.rs b/gstreamer-validate/src/auto/pipeline_monitor.rs new file mode 100644 index 000000000..23b167ee8 --- /dev/null +++ b/gstreamer-validate/src/auto/pipeline_monitor.rs @@ -0,0 +1,44 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::BinMonitor; +use crate::ElementMonitor; +use crate::Monitor; +use crate::Reporter; +use crate::Runner; +use glib::object::IsA; +use glib::translate::*; + +glib::wrapper! { + #[doc(alias = "GstValidatePipelineMonitor")] + pub struct PipelineMonitor(Object) @extends BinMonitor, ElementMonitor, Monitor, gst::Object, @implements Reporter; + + match fn { + type_ => || ffi::gst_validate_pipeline_monitor_get_type(), + } +} + +impl PipelineMonitor { + pub const NONE: Option<&'static PipelineMonitor> = None; + + #[doc(alias = "gst_validate_pipeline_monitor_new")] + pub fn new( + pipeline: &impl IsA, + runner: &impl IsA, + parent: Option<&impl IsA>, + ) -> PipelineMonitor { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_validate_pipeline_monitor_new( + pipeline.as_ref().to_glib_none().0, + runner.as_ref().to_glib_none().0, + parent.map(|p| p.as_ref()).to_glib_none().0, + )) + } + } +} + +unsafe impl Send for PipelineMonitor {} +unsafe impl Sync for PipelineMonitor {} diff --git a/gstreamer-validate/src/auto/report.rs b/gstreamer-validate/src/auto/report.rs new file mode 100644 index 000000000..fa90c445a --- /dev/null +++ b/gstreamer-validate/src/auto/report.rs @@ -0,0 +1,208 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::Issue; +use crate::ReportLevel; +use crate::Reporter; +use crate::ReportingDetails; +use glib::object::IsA; +use glib::translate::*; + +glib::wrapper! { + #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] + pub struct Report(Shared); + + match fn { + ref => |ptr| ffi::gst_validate_report_ref(ptr), + unref => |ptr| ffi::gst_validate_report_unref(ptr), + type_ => || ffi::gst_validate_report_get_type(), + } +} + +impl Report { + #[doc(alias = "gst_validate_report_new")] + pub fn new(issue: &mut Issue, reporter: &impl IsA, message: &str) -> Report { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_validate_report_new( + issue.to_glib_none_mut().0, + reporter.as_ref().to_glib_none().0, + message.to_glib_none().0, + )) + } + } + + #[doc(alias = "gst_validate_report_add_message")] + pub fn add_message(&self, message: &str) { + unsafe { + ffi::gst_validate_report_add_message(self.to_glib_none().0, message.to_glib_none().0); + } + } + + #[doc(alias = "gst_validate_report_add_repeated_report")] + pub fn add_repeated_report(&self, repeated_report: &Report) { + unsafe { + ffi::gst_validate_report_add_repeated_report( + self.to_glib_none().0, + repeated_report.to_glib_none().0, + ); + } + } + + #[doc(alias = "gst_validate_report_check_abort")] + pub fn check_abort(&self) -> bool { + unsafe { from_glib(ffi::gst_validate_report_check_abort(self.to_glib_none().0)) } + } + + #[doc(alias = "gst_validate_report_get_dotfile_name")] + #[doc(alias = "get_dotfile_name")] + pub fn dotfile_name(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_report_get_dotfile_name( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "gst_validate_report_get_issue")] + #[doc(alias = "get_issue")] + pub fn issue(&self) -> Option { + unsafe { from_glib_full(ffi::gst_validate_report_get_issue(self.to_glib_none().0)) } + } + + #[doc(alias = "gst_validate_report_get_issue_id")] + #[doc(alias = "get_issue_id")] + pub fn issue_id(&self) -> u32 { + unsafe { ffi::gst_validate_report_get_issue_id(self.to_glib_none().0) } + } + + #[doc(alias = "gst_validate_report_get_level")] + #[doc(alias = "get_level")] + pub fn level(&self) -> ReportLevel { + unsafe { from_glib(ffi::gst_validate_report_get_level(self.to_glib_none().0)) } + } + + #[doc(alias = "gst_validate_report_get_message")] + #[doc(alias = "get_message")] + pub fn message(&self) -> Option { + unsafe { from_glib_full(ffi::gst_validate_report_get_message(self.to_glib_none().0)) } + } + + #[doc(alias = "gst_validate_report_get_reporter")] + #[doc(alias = "get_reporter")] + pub fn reporter(&self) -> Option { + unsafe { from_glib_full(ffi::gst_validate_report_get_reporter(self.to_glib_none().0)) } + } + + #[doc(alias = "gst_validate_report_get_reporter_name")] + #[doc(alias = "get_reporter_name")] + pub fn reporter_name(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_report_get_reporter_name( + self.to_glib_none().0, + )) + } + } + + #[doc(alias = "gst_validate_report_get_reporting_level")] + #[doc(alias = "get_reporting_level")] + pub fn reporting_level(&self) -> ReportingDetails { + unsafe { + from_glib(ffi::gst_validate_report_get_reporting_level( + self.to_glib_none().0, + )) + } + } + + //#[doc(alias = "gst_validate_report_get_timestamp")] + //#[doc(alias = "get_timestamp")] + //pub fn timestamp(&self) -> /*Ignored*/gst::ClockTime { + // unsafe { TODO: call ffi:gst_validate_report_get_timestamp() } + //} + + #[doc(alias = "gst_validate_report_get_trace")] + #[doc(alias = "get_trace")] + pub fn trace(&self) -> Option { + unsafe { from_glib_full(ffi::gst_validate_report_get_trace(self.to_glib_none().0)) } + } + + #[doc(alias = "gst_validate_report_print_description")] + pub fn print_description(&self) { + unsafe { + ffi::gst_validate_report_print_description(self.to_glib_none().0); + } + } + + #[doc(alias = "gst_validate_report_print_details")] + pub fn print_details(&self) { + unsafe { + ffi::gst_validate_report_print_details(self.to_glib_none().0); + } + } + + #[doc(alias = "gst_validate_report_print_detected_on")] + pub fn print_detected_on(&self) { + unsafe { + ffi::gst_validate_report_print_detected_on(self.to_glib_none().0); + } + } + + #[doc(alias = "gst_validate_report_print_level")] + pub fn print_level(&self) { + unsafe { + ffi::gst_validate_report_print_level(self.to_glib_none().0); + } + } + + #[doc(alias = "gst_validate_report_printf")] + pub fn printf(&self) { + unsafe { + ffi::gst_validate_report_printf(self.to_glib_none().0); + } + } + + #[doc(alias = "gst_validate_report_set_master_report")] + pub fn set_master_report(&self, master_report: &Report) -> bool { + unsafe { + from_glib(ffi::gst_validate_report_set_master_report( + self.to_glib_none().0, + master_report.to_glib_none().0, + )) + } + } + + #[doc(alias = "gst_validate_report_set_reporting_level")] + pub fn set_reporting_level(&self, level: ReportingDetails) { + unsafe { + ffi::gst_validate_report_set_reporting_level(self.to_glib_none().0, level.into_glib()); + } + } + + #[doc(alias = "gst_validate_report_should_print")] + pub fn should_print(&self) -> bool { + unsafe { from_glib(ffi::gst_validate_report_should_print(self.to_glib_none().0)) } + } + + //#[doc(alias = "gst_validate_report_action")] + //pub fn action(reporter: &impl IsA, action: &Action, issue_id: /*Ignored*/IssueId, format: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { + // unsafe { TODO: call ffi:gst_validate_report_action() } + //} + + #[doc(alias = "gst_validate_report_init")] + pub fn init() { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_validate_report_init(); + } + } + + //#[doc(alias = "gst_validate_report_valist")] + //pub fn valist(reporter: &impl IsA, issue_id: /*Ignored*/IssueId, format: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) { + // unsafe { TODO: call ffi:gst_validate_report_valist() } + //} +} + +unsafe impl Send for Report {} +unsafe impl Sync for Report {} diff --git a/gstreamer-validate/src/auto/reporter.rs b/gstreamer-validate/src/auto/reporter.rs new file mode 100644 index 000000000..3e6aa0c56 --- /dev/null +++ b/gstreamer-validate/src/auto/reporter.rs @@ -0,0 +1,172 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::Report; +use crate::ReportingDetails; +use crate::Runner; +use glib::object::IsA; +use glib::translate::*; +use glib::StaticType; + +glib::wrapper! { + #[doc(alias = "GstValidateReporter")] + pub struct Reporter(Interface); + + match fn { + type_ => || ffi::gst_validate_reporter_get_type(), + } +} + +impl Reporter { + pub const NONE: Option<&'static Reporter> = None; +} + +unsafe impl Send for Reporter {} +unsafe impl Sync for Reporter {} + +pub trait ReporterExt: 'static { + #[doc(alias = "gst_validate_reporter_get_name")] + #[doc(alias = "get_name")] + fn name(&self) -> Option; + + #[doc(alias = "gst_validate_reporter_get_pipeline")] + #[doc(alias = "get_pipeline")] + fn pipeline(&self) -> Option; + + //#[doc(alias = "gst_validate_reporter_get_report")] + //#[doc(alias = "get_report")] + //fn report(&self, issue_id: /*Ignored*/IssueId) -> Option; + + #[doc(alias = "gst_validate_reporter_get_reporting_level")] + #[doc(alias = "get_reporting_level")] + fn reporting_level(&self) -> ReportingDetails; + + #[doc(alias = "gst_validate_reporter_get_reports")] + #[doc(alias = "get_reports")] + fn reports(&self) -> Vec; + + #[doc(alias = "gst_validate_reporter_get_reports_count")] + #[doc(alias = "get_reports_count")] + fn reports_count(&self) -> i32; + + #[doc(alias = "gst_validate_reporter_get_runner")] + #[doc(alias = "get_runner")] + fn runner(&self) -> Option; + + #[doc(alias = "gst_validate_reporter_init")] + fn init(&self, name: &str); + + #[doc(alias = "gst_validate_reporter_purge_reports")] + fn purge_reports(&self); + + //#[doc(alias = "gst_validate_reporter_report_simple")] + //fn report_simple(&self, issue_id: /*Ignored*/IssueId, message: &str); + + #[doc(alias = "gst_validate_reporter_set_handle_g_logs")] + fn set_handle_g_logs(&self); + + #[doc(alias = "gst_validate_reporter_set_name")] + fn set_name(&self, name: &str); + + #[doc(alias = "gst_validate_reporter_set_runner")] + fn set_runner(&self, runner: &impl IsA); + + #[doc(alias = "validate-runner")] + fn validate_runner(&self) -> Option; +} + +impl> ReporterExt for O { + fn name(&self) -> Option { + unsafe { + from_glib_none(ffi::gst_validate_reporter_get_name( + self.as_ref().to_glib_none().0, + )) + } + } + + fn pipeline(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_reporter_get_pipeline( + self.as_ref().to_glib_none().0, + )) + } + } + + //fn report(&self, issue_id: /*Ignored*/IssueId) -> Option { + // unsafe { TODO: call ffi:gst_validate_reporter_get_report() } + //} + + fn reporting_level(&self) -> ReportingDetails { + unsafe { + from_glib(ffi::gst_validate_reporter_get_reporting_level( + self.as_ref().to_glib_none().0, + )) + } + } + + fn reports(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::gst_validate_reporter_get_reports( + self.as_ref().to_glib_none().0, + )) + } + } + + fn reports_count(&self) -> i32 { + unsafe { ffi::gst_validate_reporter_get_reports_count(self.as_ref().to_glib_none().0) } + } + + fn runner(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_reporter_get_runner( + self.as_ref().to_glib_none().0, + )) + } + } + + fn init(&self, name: &str) { + unsafe { + ffi::gst_validate_reporter_init(self.as_ref().to_glib_none().0, name.to_glib_none().0); + } + } + + fn purge_reports(&self) { + unsafe { + ffi::gst_validate_reporter_purge_reports(self.as_ref().to_glib_none().0); + } + } + + //fn report_simple(&self, issue_id: /*Ignored*/IssueId, message: &str) { + // unsafe { TODO: call ffi:gst_validate_reporter_report_simple() } + //} + + fn set_handle_g_logs(&self) { + unsafe { + ffi::gst_validate_reporter_set_handle_g_logs(self.as_ref().to_glib_none().0); + } + } + + fn set_name(&self, name: &str) { + unsafe { + ffi::gst_validate_reporter_set_name( + self.as_ref().to_glib_none().0, + name.to_glib_full(), + ); + } + } + + fn set_runner(&self, runner: &impl IsA) { + unsafe { + ffi::gst_validate_reporter_set_runner( + self.as_ref().to_glib_none().0, + runner.as_ref().to_glib_none().0, + ); + } + } + + fn validate_runner(&self) -> Option { + glib::ObjectExt::property(self.as_ref(), "validate-runner") + } +} diff --git a/gstreamer-validate/src/auto/runner.rs b/gstreamer-validate/src/auto/runner.rs new file mode 100644 index 000000000..f285171b1 --- /dev/null +++ b/gstreamer-validate/src/auto/runner.rs @@ -0,0 +1,225 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::Report; +use crate::ReportingDetails; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::ToValue; +use std::boxed::Box as Box_; +use std::mem::transmute; + +glib::wrapper! { + #[doc(alias = "GstValidateRunner")] + pub struct Runner(Object) @extends gst::Object; + + match fn { + type_ => || ffi::gst_validate_runner_get_type(), + } +} + +impl Runner { + pub const NONE: Option<&'static Runner> = None; + + #[doc(alias = "gst_validate_runner_new")] + pub fn new() -> Runner { + assert_initialized_main_thread!(); + unsafe { from_glib_none(ffi::gst_validate_runner_new()) } + } +} + +impl Default for Runner { + fn default() -> Self { + Self::new() + } +} + +unsafe impl Send for Runner {} +unsafe impl Sync for Runner {} + +pub trait RunnerExt: 'static { + #[doc(alias = "gst_validate_runner_add_report")] + fn add_report(&self, report: &Report); + + #[doc(alias = "gst_validate_runner_exit")] + fn exit(&self, print_result: bool) -> i32; + + #[doc(alias = "gst_validate_runner_get_default_reporting_level")] + #[doc(alias = "get_default_reporting_level")] + fn default_reporting_level(&self) -> ReportingDetails; + + #[doc(alias = "gst_validate_runner_get_reporting_level_for_name")] + #[doc(alias = "get_reporting_level_for_name")] + fn reporting_level_for_name(&self, name: &str) -> ReportingDetails; + + #[doc(alias = "gst_validate_runner_get_reports")] + #[doc(alias = "get_reports")] + fn reports(&self) -> Vec; + + #[doc(alias = "gst_validate_runner_get_reports_count")] + #[doc(alias = "get_reports_count")] + fn reports_count(&self) -> u32; + + #[doc(alias = "gst_validate_runner_printf")] + fn printf(&self) -> i32; + + fn params(&self) -> Option; + + fn set_params(&self, params: Option<&str>); + + #[doc(alias = "report-added")] + fn connect_report_added( + &self, + f: F, + ) -> SignalHandlerId; + + #[doc(alias = "stopping")] + fn connect_stopping(&self, f: F) -> SignalHandlerId; + + #[doc(alias = "params")] + fn connect_params_notify(&self, f: F) -> SignalHandlerId; +} + +impl> RunnerExt for O { + fn add_report(&self, report: &Report) { + unsafe { + ffi::gst_validate_runner_add_report( + self.as_ref().to_glib_none().0, + report.to_glib_none().0, + ); + } + } + + fn exit(&self, print_result: bool) -> i32 { + unsafe { + ffi::gst_validate_runner_exit(self.as_ref().to_glib_none().0, print_result.into_glib()) + } + } + + fn default_reporting_level(&self) -> ReportingDetails { + unsafe { + from_glib(ffi::gst_validate_runner_get_default_reporting_level( + self.as_ref().to_glib_none().0, + )) + } + } + + fn reporting_level_for_name(&self, name: &str) -> ReportingDetails { + unsafe { + from_glib(ffi::gst_validate_runner_get_reporting_level_for_name( + self.as_ref().to_glib_none().0, + name.to_glib_none().0, + )) + } + } + + fn reports(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::gst_validate_runner_get_reports( + self.as_ref().to_glib_none().0, + )) + } + } + + fn reports_count(&self) -> u32 { + unsafe { ffi::gst_validate_runner_get_reports_count(self.as_ref().to_glib_none().0) } + } + + fn printf(&self) -> i32 { + unsafe { ffi::gst_validate_runner_printf(self.as_ref().to_glib_none().0) } + } + + fn params(&self) -> Option { + glib::ObjectExt::property(self.as_ref(), "params") + } + + fn set_params(&self, params: Option<&str>) { + glib::ObjectExt::set_property(self.as_ref(), "params", ¶ms) + } + + fn connect_report_added( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn report_added_trampoline< + P: IsA, + F: Fn(&P, &Report) + Send + Sync + 'static, + >( + this: *mut ffi::GstValidateRunner, + object: *mut ffi::GstValidateReport, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Runner::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(object), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"report-added\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + report_added_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_stopping(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn stopping_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut ffi::GstValidateRunner, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Runner::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"stopping\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + stopping_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_params_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_params_trampoline< + P: IsA, + F: Fn(&P) + Send + Sync + 'static, + >( + this: *mut ffi::GstValidateRunner, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Runner::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::params\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_params_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-validate/src/auto/scenario.rs b/gstreamer-validate/src/auto/scenario.rs new file mode 100644 index 000000000..1d6a96072 --- /dev/null +++ b/gstreamer-validate/src/auto/scenario.rs @@ -0,0 +1,240 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git) +// DO NOT EDIT + +use crate::Action; +use crate::Reporter; +use crate::Runner; +use glib::object::Cast; +use glib::object::IsA; +use glib::signal::connect_raw; +use glib::signal::SignalHandlerId; +use glib::translate::*; +use glib::StaticType; +use glib::ToValue; +use std::boxed::Box as Box_; +use std::mem::transmute; + +glib::wrapper! { + #[doc(alias = "GstValidateScenario")] + pub struct Scenario(Object) @extends gst::Object, @implements Reporter; + + match fn { + type_ => || ffi::gst_validate_scenario_get_type(), + } +} + +impl Scenario { + pub const NONE: Option<&'static Scenario> = None; + + #[doc(alias = "gst_validate_scenario_deinit")] + pub fn deinit() { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_validate_scenario_deinit(); + } + } + + #[doc(alias = "gst_validate_scenario_factory_create")] + pub fn factory_create( + runner: &impl IsA, + pipeline: &impl IsA, + scenario_name: &str, + ) -> Option { + skip_assert_initialized!(); + unsafe { + from_glib_full(ffi::gst_validate_scenario_factory_create( + runner.as_ref().to_glib_none().0, + pipeline.as_ref().to_glib_none().0, + scenario_name.to_glib_none().0, + )) + } + } +} + +pub trait ScenarioExt: 'static { + //#[doc(alias = "gst_validate_scenario_execute_seek")] + //fn execute_seek(&self, action: &Action, rate: f64, format: gst::Format, flags: gst::SeekFlags, start_type: gst::SeekType, start: /*Ignored*/gst::ClockTime, stop_type: gst::SeekType, stop: /*Ignored*/gst::ClockTime) -> i32; + + #[doc(alias = "gst_validate_scenario_get_actions")] + #[doc(alias = "get_actions")] + fn actions(&self) -> Vec; + + #[doc(alias = "gst_validate_scenario_get_pipeline")] + #[doc(alias = "get_pipeline")] + fn pipeline(&self) -> Option; + + #[doc(alias = "gst_validate_scenario_get_target_state")] + #[doc(alias = "get_target_state")] + fn target_state(&self) -> gst::State; + + #[doc(alias = "execute-on-idle")] + fn is_execute_on_idle(&self) -> bool; + + #[doc(alias = "execute-on-idle")] + fn set_execute_on_idle(&self, execute_on_idle: bool); + + #[doc(alias = "handles-states")] + fn is_handles_states(&self) -> bool; + + #[doc(alias = "validate-runner")] + fn validate_runner(&self) -> Option; + + #[doc(alias = "action-done")] + fn connect_action_done(&self, f: F) -> SignalHandlerId; + + #[doc(alias = "done")] + fn connect_done(&self, f: F) -> SignalHandlerId; + + #[doc(alias = "execute-on-idle")] + fn connect_execute_on_idle_notify(&self, f: F) -> SignalHandlerId; + + #[doc(alias = "handles-states")] + fn connect_handles_states_notify(&self, f: F) -> SignalHandlerId; +} + +impl> ScenarioExt for O { + //fn execute_seek(&self, action: &Action, rate: f64, format: gst::Format, flags: gst::SeekFlags, start_type: gst::SeekType, start: /*Ignored*/gst::ClockTime, stop_type: gst::SeekType, stop: /*Ignored*/gst::ClockTime) -> i32 { + // unsafe { TODO: call ffi:gst_validate_scenario_execute_seek() } + //} + + fn actions(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::gst_validate_scenario_get_actions( + self.as_ref().to_glib_none().0, + )) + } + } + + fn pipeline(&self) -> Option { + unsafe { + from_glib_full(ffi::gst_validate_scenario_get_pipeline( + self.as_ref().to_glib_none().0, + )) + } + } + + fn target_state(&self) -> gst::State { + unsafe { + from_glib(ffi::gst_validate_scenario_get_target_state( + self.as_ref().to_glib_none().0, + )) + } + } + + fn is_execute_on_idle(&self) -> bool { + glib::ObjectExt::property(self.as_ref(), "execute-on-idle") + } + + fn set_execute_on_idle(&self, execute_on_idle: bool) { + glib::ObjectExt::set_property(self.as_ref(), "execute-on-idle", &execute_on_idle) + } + + fn is_handles_states(&self) -> bool { + glib::ObjectExt::property(self.as_ref(), "handles-states") + } + + fn validate_runner(&self) -> Option { + glib::ObjectExt::property(self.as_ref(), "validate-runner") + } + + fn connect_action_done(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn action_done_trampoline< + P: IsA, + F: Fn(&P, &Action) + 'static, + >( + this: *mut ffi::GstValidateScenario, + action: *mut ffi::GstValidateAction, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f( + Scenario::from_glib_borrow(this).unsafe_cast_ref(), + &from_glib_borrow(action), + ) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"action-done\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + action_done_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_done(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn done_trampoline, F: Fn(&P) + 'static>( + this: *mut ffi::GstValidateScenario, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Scenario::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"done\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + done_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_execute_on_idle_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_execute_on_idle_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::GstValidateScenario, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Scenario::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::execute-on-idle\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_execute_on_idle_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } + + fn connect_handles_states_notify(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn notify_handles_states_trampoline< + P: IsA, + F: Fn(&P) + 'static, + >( + this: *mut ffi::GstValidateScenario, + _param_spec: glib::ffi::gpointer, + f: glib::ffi::gpointer, + ) { + let f: &F = &*(f as *const F); + f(Scenario::from_glib_borrow(this).unsafe_cast_ref()) + } + unsafe { + let f: Box_ = Box_::new(f); + connect_raw( + self.as_ptr() as *mut _, + b"notify::handles-states\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + notify_handles_states_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) + } + } +} diff --git a/gstreamer-validate/src/auto/versions.txt b/gstreamer-validate/src/auto/versions.txt new file mode 100644 index 000000000..0faf8e3f9 --- /dev/null +++ b/gstreamer-validate/src/auto/versions.txt @@ -0,0 +1,3 @@ +Generated by gir (https://github.com/gtk-rs/gir @ 9aa16ead87e1) +from gir-files (https://github.com/gtk-rs/gir-files @ b8b90867ab35) +from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ def5d67e738d) diff --git a/gstreamer-validate/src/functions.rs b/gstreamer-validate/src/functions.rs new file mode 100644 index 000000000..298f47d51 --- /dev/null +++ b/gstreamer-validate/src/functions.rs @@ -0,0 +1,30 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +use glib::translate::*; + +#[doc(alias = "gst_validate_init")] +pub fn init() { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_validate_init(); + } +} + +#[doc(alias = "gst_validate_init_debug")] +pub fn init_debug() { + assert_initialized_main_thread!(); + unsafe { + ffi::gst_validate_init_debug(); + } +} + +#[doc(alias = "gst_validate_setup_test_file")] +pub fn setup_test_file(test_file: &str, use_fakesinks: bool) -> gst::Structure { + assert_initialized_main_thread!(); + unsafe { + from_glib_full(ffi::gst_validate_setup_test_file( + test_file.to_glib_none().0, + use_fakesinks as i32, + )) + } +} diff --git a/gstreamer-validate/src/lib.rs b/gstreamer-validate/src/lib.rs new file mode 100644 index 000000000..454f53719 --- /dev/null +++ b/gstreamer-validate/src/lib.rs @@ -0,0 +1,58 @@ +// Take a look at the license at the top of the repository in the LICENSE file. + +#![cfg_attr(feature = "dox", feature(doc_cfg))] +#![allow(clippy::missing_safety_doc)] +#![allow(clippy::non_send_fields_in_send_ty)] +#![doc = include_str!("../README.md")] + +#[doc(hidden)] +pub static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); + +macro_rules! assert_initialized_main_thread { + () => { + if !gst::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) { + #[allow(unused_unsafe)] + if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE { + panic!("GStreamer has not been initialized. Call `gst::init` first."); + } else { + gst::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst); + } + } + + if !crate::INITIALIZED.load(std::sync::atomic::Ordering::SeqCst) { + if unsafe { ffi::gst_validate_is_initialized() } != glib::ffi::GTRUE { + panic!( + "GStreamer Validate has not been initialized. Call `gst_validate::init` first." + ); + } else { + crate::INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst); + } + } + }; +} + +macro_rules! skip_assert_initialized { + () => {}; +} + +#[allow(clippy::unreadable_literal)] +#[allow(clippy::too_many_arguments)] +#[allow(clippy::match_same_arms)] +#[allow(non_snake_case)] +#[allow(clippy::use_self)] +#[allow(unused_imports)] +mod auto; +pub use crate::auto::*; + +#[allow(dead_code)] +mod functions; +pub use functions::*; + +// Re-export all the traits in a prelude module, so that applications +// can always "use gst_validate::prelude::*" without getting conflicts +pub mod prelude { + #[doc(hidden)] + pub use gst::prelude::*; + + pub use crate::auto::traits::*; +} diff --git a/gstreamer-validate/sys/Cargo.toml b/gstreamer-validate/sys/Cargo.toml new file mode 100644 index 000000000..7bbb1cf2f --- /dev/null +++ b/gstreamer-validate/sys/Cargo.toml @@ -0,0 +1,51 @@ +[package] +authors = ["Philippe Normand "] +build = "build.rs" +description = "FFI bindings to libgstvalidate-1.0" +documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/stable/latest/docs/gstreamer_validate_sys/" +homepage = "https://gstreamer.freedesktop.org" +keywords = ["ffi", "gstreamer", "gnome", "multimedia"] +license = "MIT" +name = "gstreamer-validate-sys" +readme = "README.md" +repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" +version = "0.19.0" +edition = "2021" +rust-version = "1.57" +[package.metadata.docs.rs] +features = ["dox"] +[package.metadata.system-deps.gstreamer_validate_1_0] +name = "gstreamer-validate-1.0" +version = "1.21" + +[lib] +name = "gstreamer_validate_sys" + +[build-dependencies] +system-deps = "6" + +[dependencies] +libc = "0.2" + +[dependencies.glib] +package = "glib-sys" +git = "https://github.com/gtk-rs/gtk-rs-core" + +[dependencies.gobject] +package = "gobject-sys" +git = "https://github.com/gtk-rs/gtk-rs-core" + +[dependencies.gio] +package = "gio-sys" +git = "https://github.com/gtk-rs/gtk-rs-core" + +[dependencies.gst] +package = "gstreamer-sys" +path = "../../gstreamer/sys" + +[dev-dependencies] +shell-words = "1.0.0" +tempfile = "3" + +[features] +dox = [] diff --git a/gstreamer-validate/sys/Gir.toml b/gstreamer-validate/sys/Gir.toml new file mode 100644 index 000000000..a3d7bf305 --- /dev/null +++ b/gstreamer-validate/sys/Gir.toml @@ -0,0 +1,13 @@ +[options] +girs_directories = ["../../gir-files", "../../gst-gir-files"] +library = "GstValidate" +version = "1.0" +min_cfg_version = "1.22" +work_mode = "sys" + +external_libraries = [ + "GLib", + "Gio", + "GObject", + "GStreamer", +] diff --git a/gstreamer-validate/sys/build.rs b/gstreamer-validate/sys/build.rs new file mode 100644 index 000000000..7abc6b7a9 --- /dev/null +++ b/gstreamer-validate/sys/build.rs @@ -0,0 +1,18 @@ +// Generated by gir (https://github.com/gtk-rs/gir @ 9aa16ead87e1) +// from gir-files (https://github.com/gtk-rs/gir-files @ b8b90867ab35) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ def5d67e738d) +// DO NOT EDIT + +#[cfg(not(feature = "dox"))] +use std::process; + +#[cfg(feature = "dox")] +fn main() {} // prevent linking libraries to avoid documentation failure + +#[cfg(not(feature = "dox"))] +fn main() { + if let Err(s) = system_deps::Config::new().probe() { + println!("cargo:warning={}", s); + process::exit(1); + } +} diff --git a/gstreamer-validate/sys/src/lib.rs b/gstreamer-validate/sys/src/lib.rs new file mode 100644 index 000000000..cae080d9f --- /dev/null +++ b/gstreamer-validate/sys/src/lib.rs @@ -0,0 +1,1672 @@ +// Generated by gir (https://github.com/gtk-rs/gir @ 9aa16ead87e1) +// from gir-files (https://github.com/gtk-rs/gir-files @ b8b90867ab35) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ def5d67e738d) +// DO NOT EDIT + +#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] +#![allow( + clippy::approx_constant, + clippy::type_complexity, + clippy::unreadable_literal, + clippy::upper_case_acronyms +)] +#![cfg_attr(feature = "dox", feature(doc_cfg))] + +#[allow(unused_imports)] +use libc::{ + c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, + intptr_t, size_t, ssize_t, uintptr_t, FILE, +}; + +#[allow(unused_imports)] +use glib::{gboolean, gconstpointer, gpointer, GType}; + +// Aliases +pub type GstValidateIssueId = glib::GQuark; + +// Enums +pub type GstValidateActionReturn = c_int; +pub const GST_VALIDATE_EXECUTE_ACTION_ERROR: GstValidateActionReturn = 0; +pub const GST_VALIDATE_EXECUTE_ACTION_OK: GstValidateActionReturn = 1; +pub const GST_VALIDATE_EXECUTE_ACTION_ASYNC: GstValidateActionReturn = 2; +pub const GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING: GstValidateActionReturn = 3; +pub const GST_VALIDATE_EXECUTE_ACTION_INTERLACED: GstValidateActionReturn = 3; +pub const GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED: GstValidateActionReturn = 4; +pub const GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS: GstValidateActionReturn = 5; +pub const GST_VALIDATE_EXECUTE_ACTION_NONE: GstValidateActionReturn = 6; +pub const GST_VALIDATE_EXECUTE_ACTION_DONE: GstValidateActionReturn = 7; + +pub type GstValidateInterceptionReturn = c_int; +pub const GST_VALIDATE_REPORTER_DROP: GstValidateInterceptionReturn = 0; +pub const GST_VALIDATE_REPORTER_KEEP: GstValidateInterceptionReturn = 1; +pub const GST_VALIDATE_REPORTER_REPORT: GstValidateInterceptionReturn = 2; + +pub type GstValidateReportLevel = c_int; +pub const GST_VALIDATE_REPORT_LEVEL_CRITICAL: GstValidateReportLevel = 0; +pub const GST_VALIDATE_REPORT_LEVEL_WARNING: GstValidateReportLevel = 1; +pub const GST_VALIDATE_REPORT_LEVEL_ISSUE: GstValidateReportLevel = 2; +pub const GST_VALIDATE_REPORT_LEVEL_IGNORE: GstValidateReportLevel = 3; +pub const GST_VALIDATE_REPORT_LEVEL_UNKNOWN: GstValidateReportLevel = 4; +pub const GST_VALIDATE_REPORT_LEVEL_EXPECTED: GstValidateReportLevel = 5; +pub const GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES: GstValidateReportLevel = 6; + +pub type GstValidateReportingDetails = c_int; +pub const GST_VALIDATE_SHOW_UNKNOWN: GstValidateReportingDetails = 0; +pub const GST_VALIDATE_SHOW_NONE: GstValidateReportingDetails = 1; +pub const GST_VALIDATE_SHOW_SYNTHETIC: GstValidateReportingDetails = 2; +pub const GST_VALIDATE_SHOW_SUBCHAIN: GstValidateReportingDetails = 3; +pub const GST_VALIDATE_SHOW_MONITOR: GstValidateReportingDetails = 4; +pub const GST_VALIDATE_SHOW_ALL: GstValidateReportingDetails = 5; +pub const GST_VALIDATE_SHOW_SMART: GstValidateReportingDetails = 6; +pub const GST_VALIDATE_SHOW_COUNT: GstValidateReportingDetails = 7; + +// Constants +pub const GST_VALIDATE_UNKNOWN_BOOL: c_int = -1; +pub const GST_VALIDATE_UNKNOWN_UINT64: c_int = -1; + +// Flags +pub type GstValidateActionTypeFlags = c_uint; +pub const GST_VALIDATE_ACTION_TYPE_NONE: GstValidateActionTypeFlags = 0; +pub const GST_VALIDATE_ACTION_TYPE_CONFIG: GstValidateActionTypeFlags = 2; +pub const GST_VALIDATE_ACTION_TYPE_ASYNC: GstValidateActionTypeFlags = 4; +pub const GST_VALIDATE_ACTION_TYPE_NON_BLOCKING: GstValidateActionTypeFlags = 8; +pub const GST_VALIDATE_ACTION_TYPE_INTERLACED: GstValidateActionTypeFlags = 8; +pub const GST_VALIDATE_ACTION_TYPE_CAN_EXECUTE_ON_ADDITION: GstValidateActionTypeFlags = 16; +pub const GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK: GstValidateActionTypeFlags = 32; +pub const GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL: GstValidateActionTypeFlags = 64; +pub const GST_VALIDATE_ACTION_TYPE_CAN_BE_OPTIONAL: GstValidateActionTypeFlags = 128; +pub const GST_VALIDATE_ACTION_TYPE_DOESNT_NEED_PIPELINE: GstValidateActionTypeFlags = 256; +pub const GST_VALIDATE_ACTION_TYPE_HANDLED_IN_CONFIG: GstValidateActionTypeFlags = 512; + +pub type GstValidateDebugFlags = c_uint; +pub const GST_VALIDATE_FATAL_DEFAULT: GstValidateDebugFlags = 0; +pub const GST_VALIDATE_FATAL_ISSUES: GstValidateDebugFlags = 1; +pub const GST_VALIDATE_FATAL_WARNINGS: GstValidateDebugFlags = 2; +pub const GST_VALIDATE_FATAL_CRITICALS: GstValidateDebugFlags = 4; +pub const GST_VALIDATE_PRINT_ISSUES: GstValidateDebugFlags = 8; +pub const GST_VALIDATE_PRINT_WARNINGS: GstValidateDebugFlags = 16; +pub const GST_VALIDATE_PRINT_CRITICALS: GstValidateDebugFlags = 32; + +pub type GstValidateIssueFlags = c_uint; +pub const GST_VALIDATE_ISSUE_FLAGS_NONE: GstValidateIssueFlags = 0; +pub const GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS: GstValidateIssueFlags = 1; +pub const GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE: GstValidateIssueFlags = 2; +pub const GST_VALIDATE_ISSUE_FLAGS_FORCE_BACKTRACE: GstValidateIssueFlags = 4; + +pub type GstValidateMediaDescriptorWriterFlags = c_uint; +pub const GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NONE: GstValidateMediaDescriptorWriterFlags = + 1; +pub const GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NO_PARSER: + GstValidateMediaDescriptorWriterFlags = 2; +pub const GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_FULL: GstValidateMediaDescriptorWriterFlags = + 4; +pub const GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_HANDLE_GLOGS: + GstValidateMediaDescriptorWriterFlags = 8; + +pub type GstValidateStructureResolveVariablesFlags = c_uint; +pub const GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_ALL: GstValidateStructureResolveVariablesFlags = + 0; +pub const GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_LOCAL_ONLY: + GstValidateStructureResolveVariablesFlags = 1; +pub const GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_FAILURE: + GstValidateStructureResolveVariablesFlags = 2; +pub const GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_EXPRESSION: + GstValidateStructureResolveVariablesFlags = 2; + +pub type GstValidateVerbosityFlags = c_uint; +pub const GST_VALIDATE_VERBOSITY_NONE: GstValidateVerbosityFlags = 0; +pub const GST_VALIDATE_VERBOSITY_POSITION: GstValidateVerbosityFlags = 2; +pub const GST_VALIDATE_VERBOSITY_MESSAGES: GstValidateVerbosityFlags = 4; +pub const GST_VALIDATE_VERBOSITY_PROPS_CHANGES: GstValidateVerbosityFlags = 8; +pub const GST_VALIDATE_VERBOSITY_NEW_ELEMENTS: GstValidateVerbosityFlags = 16; +pub const GST_VALIDATE_VERBOSITY_ALL: GstValidateVerbosityFlags = 30; + +// Callbacks +pub type GstValidateExecuteAction = + Option c_int>; +pub type GstValidateGetIncludePathsFunc = + Option *mut *mut c_char>; +pub type GstValidateOverrideBufferHandler = Option< + unsafe extern "C" fn(*mut GstValidateOverride, *mut GstValidateMonitor, *mut gst::GstBuffer), +>; +pub type GstValidateOverrideElementAddedHandler = Option< + unsafe extern "C" fn(*mut GstValidateOverride, *mut GstValidateMonitor, *mut gst::GstElement), +>; +pub type GstValidateOverrideEventHandler = Option< + unsafe extern "C" fn(*mut GstValidateOverride, *mut GstValidateMonitor, *mut gst::GstEvent), +>; +pub type GstValidateOverrideGetCapsHandler = Option< + unsafe extern "C" fn(*mut GstValidateOverride, *mut GstValidateMonitor, *mut gst::GstCaps), +>; +pub type GstValidateOverrideQueryHandler = Option< + unsafe extern "C" fn(*mut GstValidateOverride, *mut GstValidateMonitor, *mut gst::GstQuery), +>; +pub type GstValidateOverrideSetCapsHandler = Option< + unsafe extern "C" fn(*mut GstValidateOverride, *mut GstValidateMonitor, *mut gst::GstCaps), +>; +pub type GstValidateParseVariableFunc = + Option c_int>; +pub type GstValidatePrepareAction = Option c_int>; + +// Records +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateAction { + pub mini_object: gst::GstMiniObject, + pub type_: *const c_char, + pub name: *const c_char, + pub structure: *mut gst::GstStructure, + pub action_number: c_uint, + pub repeat: c_int, + pub playback_time: gst::GstClockTime, + pub lineno: c_int, + pub filename: *mut c_char, + pub debug: *mut c_char, + pub n_repeats: c_int, + pub rangename: *const c_char, + pub priv_: *mut GstValidateActionPrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateAction { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateAction @ {:p}", self)) + .field("mini_object", &self.mini_object) + .field("type_", &self.type_) + .field("name", &self.name) + .field("structure", &self.structure) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateActionParameter { + pub name: *const c_char, + pub description: *const c_char, + pub mandatory: gboolean, + pub types: *const c_char, + pub possible_variables: *const c_char, + pub def: *const c_char, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateActionParameter { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateActionParameter @ {:p}", self)) + .field("name", &self.name) + .field("description", &self.description) + .field("mandatory", &self.mandatory) + .field("types", &self.types) + .field("possible_variables", &self.possible_variables) + .field("def", &self.def) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidateActionPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateActionPrivate = *mut _GstValidateActionPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateActionType { + pub mini_object: gst::GstMiniObject, + pub name: *mut c_char, + pub implementer_namespace: *mut c_char, + pub prepare: GstValidatePrepareAction, + pub execute: GstValidateExecuteAction, + pub parameters: *mut GstValidateActionParameter, + pub description: *mut c_char, + pub flags: GstValidateActionTypeFlags, + pub rank: gst::GstRank, + pub overriden_type: *mut GstValidateActionType, + pub priv_: *mut GstValidateActionTypePrivate, + pub _gst_reserved: [gpointer; 20], +} + +impl ::std::fmt::Debug for GstValidateActionType { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateActionType @ {:p}", self)) + .field("mini_object", &self.mini_object) + .field("name", &self.name) + .field("implementer_namespace", &self.implementer_namespace) + .field("prepare", &self.prepare) + .field("execute", &self.execute) + .field("parameters", &self.parameters) + .field("description", &self.description) + .field("flags", &self.flags) + .field("rank", &self.rank) + .field("overriden_type", &self.overriden_type) + .field("priv_", &self.priv_) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidateActionTypePrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateActionTypePrivate = *mut _GstValidateActionTypePrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateBinMonitorClass { + pub parent_class: GstValidateElementMonitorClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateBinMonitorClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateBinMonitorClass @ {:p}", self)) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateElementMonitorClass { + pub parent_class: GstValidateMonitorClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateElementMonitorClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateElementMonitorClass @ {:p}", self)) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateIssue { + pub issue_id: GstValidateIssueId, + pub summary: *mut c_char, + pub description: *mut c_char, + pub area: *mut c_char, + pub name: *mut c_char, + pub default_level: GstValidateReportLevel, + pub refcount: c_int, + pub flags: GstValidateIssueFlags, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateIssue { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateIssue @ {:p}", self)) + .field("issue_id", &self.issue_id) + .field("summary", &self.summary) + .field("description", &self.description) + .field("area", &self.area) + .field("name", &self.name) + .field("default_level", &self.default_level) + .field("refcount", &self.refcount) + .field("flags", &self.flags) + .field("_gst_reserved", &self._gst_reserved) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMediaDescriptorClass { + pub parent: gst::GstObjectClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMediaDescriptorClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateMediaDescriptorClass @ {:p}", self)) + .field("parent", &self.parent) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMediaDescriptorParserClass { + pub parent: GstValidateMediaDescriptorClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMediaDescriptorParserClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!( + "GstValidateMediaDescriptorParserClass @ {:p}", + self + )) + .field("parent", &self.parent) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidateMediaDescriptorParserPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateMediaDescriptorParserPrivate = *mut _GstValidateMediaDescriptorParserPrivate; + +#[repr(C)] +pub struct _GstValidateMediaDescriptorPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateMediaDescriptorPrivate = *mut _GstValidateMediaDescriptorPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMediaDescriptorWriterClass { + pub parent: GstValidateMediaDescriptorClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMediaDescriptorWriterClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!( + "GstValidateMediaDescriptorWriterClass @ {:p}", + self + )) + .field("parent", &self.parent) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidateMediaDescriptorWriterPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateMediaDescriptorWriterPrivate = *mut _GstValidateMediaDescriptorWriterPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMediaInfo { + pub duration: gst::GstClockTime, + pub is_image: gboolean, + pub file_size: u64, + pub seekable: gboolean, + pub playback_error: *mut c_char, + pub reverse_playback_error: *mut c_char, + pub track_switch_error: *mut c_char, + pub uri: *mut c_char, + pub discover_only: gboolean, + pub stream_info: *mut GstValidateStreamInfo, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMediaInfo { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateMediaInfo @ {:p}", self)) + .field("duration", &self.duration) + .field("is_image", &self.is_image) + .field("file_size", &self.file_size) + .field("seekable", &self.seekable) + .field("playback_error", &self.playback_error) + .field("reverse_playback_error", &self.reverse_playback_error) + .field("track_switch_error", &self.track_switch_error) + .field("uri", &self.uri) + .field("discover_only", &self.discover_only) + .field("stream_info", &self.stream_info) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMonitorClass { + pub parent_class: gst::GstObjectClass, + pub setup: Option gboolean>, + pub get_element: Option *mut gst::GstElement>, + pub set_media_descriptor: + Option, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMonitorClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateMonitorClass @ {:p}", self)) + .field("parent_class", &self.parent_class) + .field("setup", &self.setup) + .field("get_element", &self.get_element) + .field("set_media_descriptor", &self.set_media_descriptor) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateOverrideClass { + pub parent_class: gst::GstObjectClass, + pub can_attach: + Option gboolean>, + pub attached: Option, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateOverrideClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateOverrideClass @ {:p}", self)) + .field("can_attach", &self.can_attach) + .field("attached", &self.attached) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidateOverridePrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateOverridePrivate = *mut _GstValidateOverridePrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateOverrideRegistry { + pub mutex: glib::GMutex, + pub name_overrides: glib::GQueue, + pub gtype_overrides: glib::GQueue, + pub klass_overrides: glib::GQueue, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateOverrideRegistry { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateOverrideRegistry @ {:p}", self)) + .field("mutex", &self.mutex) + .field("name_overrides", &self.name_overrides) + .field("gtype_overrides", &self.gtype_overrides) + .field("klass_overrides", &self.klass_overrides) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidatePadMonitorClass { + pub parent_class: GstValidateMonitorClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidatePadMonitorClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidatePadMonitorClass @ {:p}", self)) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidatePadSeekData { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidatePadSeekData = *mut _GstValidatePadSeekData; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidatePipelineMonitorClass { + pub parent_class: GstValidateBinMonitorClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidatePipelineMonitorClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidatePipelineMonitorClass @ {:p}", self)) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateReport { + pub mini_object: gst::GstMiniObject, + pub issue: *mut GstValidateIssue, + pub level: GstValidateReportLevel, + pub reporter: *mut GstValidateReporter, + pub timestamp: gst::GstClockTime, + pub message: *mut c_char, + pub shadow_reports_lock: glib::GMutex, + pub master_report: *mut GstValidateReport, + pub shadow_reports: *mut glib::GList, + pub repeated_reports: *mut glib::GList, + pub reporting_level: GstValidateReportingDetails, + pub reporter_name: *mut c_char, + pub trace: *mut c_char, + pub dotfile_name: *mut c_char, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateReport { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateReport @ {:p}", self)) + .field("mini_object", &self.mini_object) + .field("issue", &self.issue) + .field("level", &self.level) + .field("reporter", &self.reporter) + .field("timestamp", &self.timestamp) + .field("message", &self.message) + .field("shadow_reports_lock", &self.shadow_reports_lock) + .field("master_report", &self.master_report) + .field("shadow_reports", &self.shadow_reports) + .field("repeated_reports", &self.repeated_reports) + .field("reporting_level", &self.reporting_level) + .field("reporter_name", &self.reporter_name) + .field("trace", &self.trace) + .field("dotfile_name", &self.dotfile_name) + .field("_gst_reserved", &self._gst_reserved) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateReporterInterface { + pub parent: gobject::GTypeInterface, + pub intercept_report: Option< + unsafe extern "C" fn( + *mut GstValidateReporter, + *mut GstValidateReport, + ) -> GstValidateInterceptionReturn, + >, + pub get_reporting_level: + Option GstValidateReportingDetails>, + pub get_pipeline: + Option *mut gst::GstPipeline>, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateReporterInterface { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateReporterInterface @ {:p}", self)) + .field("parent", &self.parent) + .field("intercept_report", &self.intercept_report) + .field("get_reporting_level", &self.get_reporting_level) + .field("get_pipeline", &self.get_pipeline) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateRunnerClass { + pub parent_class: gst::GstTracerClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateRunnerClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateRunnerClass @ {:p}", self)) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidateRunnerPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateRunnerPrivate = *mut _GstValidateRunnerPrivate; + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateScenarioClass { + pub parent_class: gst::GstObjectClass, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateScenarioClass { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateScenarioClass @ {:p}", self)) + .field("parent_class", &self.parent_class) + .finish() + } +} + +#[repr(C)] +pub struct _GstValidateScenarioPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateScenarioPrivate = *mut _GstValidateScenarioPrivate; + +#[repr(C)] +pub struct _GstValidateStreamInfo { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +pub type GstValidateStreamInfo = *mut _GstValidateStreamInfo; + +// Classes +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateBinMonitor { + pub parent: GstValidateElementMonitor, + pub element_monitors: *mut glib::GList, + pub scenario: *mut GstValidateScenario, + pub element_added_id: c_ulong, + pub element_removed_id: c_ulong, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateBinMonitor { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateBinMonitor @ {:p}", self)) + .field("parent", &self.parent) + .field("element_monitors", &self.element_monitors) + .field("scenario", &self.scenario) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateElementMonitor { + pub parent: GstValidateMonitor, + pub pad_added_id: c_ulong, + pub pad_monitors: *mut glib::GList, + pub is_decoder: gboolean, + pub is_encoder: gboolean, + pub is_demuxer: gboolean, + pub is_converter: gboolean, + pub is_sink: gboolean, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateElementMonitor { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateElementMonitor @ {:p}", self)) + .field("parent", &self.parent) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMediaDescriptor { + pub parent: gst::GstObject, + pub lock: glib::GMutex, + pub priv_: *mut GstValidateMediaDescriptorPrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMediaDescriptor { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateMediaDescriptor @ {:p}", self)) + .field("parent", &self.parent) + .field("lock", &self.lock) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMediaDescriptorParser { + pub parent: GstValidateMediaDescriptor, + pub priv_: *mut GstValidateMediaDescriptorParserPrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMediaDescriptorParser { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateMediaDescriptorParser @ {:p}", self)) + .field("parent", &self.parent) + .field("priv_", &self.priv_) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMediaDescriptorWriter { + pub parent: GstValidateMediaDescriptor, + pub priv_: *mut GstValidateMediaDescriptorWriterPrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMediaDescriptorWriter { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateMediaDescriptorWriter @ {:p}", self)) + .field("parent", &self.parent) + .field("priv_", &self.priv_) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateMonitor { + pub object: gst::GstObject, + pub target: gobject::GWeakRef, + pub pipeline: gobject::GWeakRef, + pub mutex: glib::GMutex, + pub target_name: *mut c_char, + pub parent: *mut GstValidateMonitor, + pub overrides_mutex: glib::GMutex, + pub overrides: glib::GQueue, + pub media_descriptor: *mut GstValidateMediaDescriptor, + pub level: GstValidateReportingDetails, + pub reports: *mut glib::GHashTable, + pub verbosity: GstValidateVerbosityFlags, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateMonitor { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateMonitor @ {:p}", self)) + .field("object", &self.object) + .field("target", &self.target) + .field("pipeline", &self.pipeline) + .field("mutex", &self.mutex) + .field("target_name", &self.target_name) + .field("parent", &self.parent) + .field("overrides_mutex", &self.overrides_mutex) + .field("overrides", &self.overrides) + .field("media_descriptor", &self.media_descriptor) + .field("level", &self.level) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateOverride { + pub parent: gst::GstObject, + pub buffer_handler: GstValidateOverrideBufferHandler, + pub event_handler: GstValidateOverrideEventHandler, + pub query_handler: GstValidateOverrideQueryHandler, + pub buffer_probe_handler: GstValidateOverrideBufferHandler, + pub getcaps_handler: GstValidateOverrideGetCapsHandler, + pub setcaps_handler: GstValidateOverrideSetCapsHandler, + pub element_added_handler: GstValidateOverrideElementAddedHandler, + pub priv_: *mut GstValidateOverridePrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateOverride { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateOverride @ {:p}", self)) + .field("parent", &self.parent) + .field("buffer_handler", &self.buffer_handler) + .field("event_handler", &self.event_handler) + .field("query_handler", &self.query_handler) + .field("buffer_probe_handler", &self.buffer_probe_handler) + .field("getcaps_handler", &self.getcaps_handler) + .field("setcaps_handler", &self.setcaps_handler) + .field("element_added_handler", &self.element_added_handler) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidatePadMonitor { + pub parent: GstValidateMonitor, + pub setup: gboolean, + pub chain_func: gst::GstPadChainFunction, + pub event_func: gst::GstPadEventFunction, + pub event_full_func: gst::GstPadEventFullFunction, + pub query_func: gst::GstPadQueryFunction, + pub activatemode_func: gst::GstPadActivateModeFunction, + pub get_range_func: gst::GstPadGetRangeFunction, + pub pad_probe_id: c_ulong, + pub last_caps: *mut gst::GstCaps, + pub caps_is_audio: gboolean, + pub caps_is_video: gboolean, + pub caps_is_raw: gboolean, + pub first_buffer: gboolean, + pub has_segment: gboolean, + pub is_eos: gboolean, + pub pending_flush_stop: gboolean, + pub pending_newsegment_seqnum: u32, + pub pending_eos_seqnum: u32, + pub seeks: *mut glib::GList, + pub current_seek: *mut GstValidatePadSeekData, + pub pending_buffer_discont: gboolean, + pub expected_segment: *mut gst::GstEvent, + pub serialized_events: *mut glib::GPtrArray, + pub expired_events: *mut glib::GList, + pub pending_setcaps_fields: *mut gst::GstStructure, + pub last_refused_caps: *mut gst::GstCaps, + pub last_query_filter: *mut gst::GstCaps, + pub last_query_res: *mut gst::GstCaps, + pub segment: gst::GstSegment, + pub current_timestamp: gst::GstClockTime, + pub current_duration: gst::GstClockTime, + pub timestamp_range_start: gst::GstClockTime, + pub timestamp_range_end: gst::GstClockTime, + pub all_bufs: *mut glib::GList, + pub current_buf: *mut glib::GList, + pub check_buffers: gboolean, + pub min_buf_freq: c_double, + pub buffers_pushed: c_int, + pub last_buffers_pushed: c_int, + pub min_buf_freq_interval_ts: gst::GstClockTime, + pub min_buf_freq_first_buffer_ts: gst::GstClockTime, + pub min_buf_freq_start: gst::GstClockTime, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidatePadMonitor { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidatePadMonitor @ {:p}", self)) + .field("parent", &self.parent) + .field("setup", &self.setup) + .field("chain_func", &self.chain_func) + .field("event_func", &self.event_func) + .field("event_full_func", &self.event_full_func) + .field("query_func", &self.query_func) + .field("activatemode_func", &self.activatemode_func) + .field("get_range_func", &self.get_range_func) + .field("pad_probe_id", &self.pad_probe_id) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidatePipelineMonitor { + pub parent: GstValidateBinMonitor, + pub element_added_id: c_ulong, + pub print_pos_srcid: c_uint, + pub buffering: gboolean, + pub got_error: gboolean, + pub is_playbin: gboolean, + pub is_playbin3: gboolean, + pub stream_collection: *mut gst::GstStreamCollection, + pub streams_selected: *mut glib::GList, + pub deep_notify_id: c_ulong, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidatePipelineMonitor { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidatePipelineMonitor @ {:p}", self)) + .field("parent", &self.parent) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateRunner { + pub object: gst::GstTracer, + pub priv_: *mut GstValidateRunnerPrivate, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateRunner { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateRunner @ {:p}", self)) + .field("object", &self.object) + .finish() + } +} + +#[derive(Copy, Clone)] +#[repr(C)] +pub struct GstValidateScenario { + pub parent: gst::GstObject, + pub description: *mut gst::GstStructure, + pub priv_: *mut GstValidateScenarioPrivate, + pub eos_handling_lock: glib::GMutex, + pub _gst_reserved: [gpointer; 4], +} + +impl ::std::fmt::Debug for GstValidateScenario { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + f.debug_struct(&format!("GstValidateScenario @ {:p}", self)) + .field("parent", &self.parent) + .field("description", &self.description) + .finish() + } +} + +// Interfaces +#[repr(C)] +pub struct GstValidateReporter { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} + +impl ::std::fmt::Debug for GstValidateReporter { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + write!(f, "GstValidateReporter @ {:p}", self) + } +} + +#[link(name = "gstvalidate-1.0")] +extern "C" { + + //========================================================================= + // GstValidateActionReturn + //========================================================================= + pub fn gst_validate_action_return_get_type() -> GType; + pub fn gst_validate_action_return_get_name(r: GstValidateActionReturn) -> *const c_char; + + //========================================================================= + // GstValidateInterceptionReturn + //========================================================================= + pub fn gst_validate_interception_return_get_type() -> GType; + + //========================================================================= + // GstValidateReportLevel + //========================================================================= + pub fn gst_validate_report_level_get_type() -> GType; + pub fn gst_validate_report_level_from_name(level_name: *const c_char) + -> GstValidateReportLevel; + pub fn gst_validate_report_level_get_name(level: GstValidateReportLevel) -> *const c_char; + + //========================================================================= + // GstValidateReportingDetails + //========================================================================= + pub fn gst_validate_reporting_details_get_type() -> GType; + + //========================================================================= + // GstValidateActionTypeFlags + //========================================================================= + pub fn gst_validate_action_type_flags_get_type() -> GType; + + //========================================================================= + // GstValidateDebugFlags + //========================================================================= + pub fn gst_validate_debug_flags_get_type() -> GType; + + //========================================================================= + // GstValidateIssueFlags + //========================================================================= + pub fn gst_validate_issue_flags_get_type() -> GType; + + //========================================================================= + // GstValidateMediaDescriptorWriterFlags + //========================================================================= + pub fn gst_validate_media_descriptor_writer_flags_get_type() -> GType; + + //========================================================================= + // GstValidateStructureResolveVariablesFlags + //========================================================================= + pub fn gst_validate_structure_resolve_variables_flags_get_type() -> GType; + + //========================================================================= + // GstValidateVerbosityFlags + //========================================================================= + pub fn gst_validate_verbosity_flags_get_type() -> GType; + + //========================================================================= + // GstValidateAction + //========================================================================= + pub fn gst_validate_action_get_type() -> GType; + pub fn gst_validate_action_new( + scenario: *mut GstValidateScenario, + action_type: *mut GstValidateActionType, + structure: *mut gst::GstStructure, + add_to_lists: gboolean, + ) -> *mut GstValidateAction; + pub fn gst_validate_action_get_scenario( + action: *mut GstValidateAction, + ) -> *mut GstValidateScenario; + pub fn gst_validate_action_ref(action: *mut GstValidateAction) -> *mut GstValidateAction; + pub fn gst_validate_action_set_done(action: *mut GstValidateAction); + pub fn gst_validate_action_unref(action: *mut GstValidateAction); + pub fn gst_validate_action_get_clocktime( + scenario: *mut GstValidateScenario, + action: *mut GstValidateAction, + name: *const c_char, + retval: *mut gst::GstClockTime, + ) -> gboolean; + + //========================================================================= + // GstValidateActionType + //========================================================================= + pub fn gst_validate_action_type_get_type() -> GType; + + //========================================================================= + // GstValidateIssue + //========================================================================= + pub fn gst_validate_issue_get_type() -> GType; + pub fn gst_validate_issue_new( + issue_id: GstValidateIssueId, + summary: *const c_char, + description: *const c_char, + default_level: GstValidateReportLevel, + ) -> *mut GstValidateIssue; + pub fn gst_validate_issue_new_full( + issue_id: GstValidateIssueId, + summary: *const c_char, + description: *const c_char, + default_level: GstValidateReportLevel, + flags: GstValidateIssueFlags, + ) -> *mut GstValidateIssue; + pub fn gst_validate_issue_get_id(issue: *mut GstValidateIssue) -> u32; + pub fn gst_validate_issue_register(issue: *mut GstValidateIssue); + pub fn gst_validate_issue_set_default_level( + issue: *mut GstValidateIssue, + default_level: GstValidateReportLevel, + ); + pub fn gst_validate_issue_from_id(issue_id: GstValidateIssueId) -> *mut GstValidateIssue; + + //========================================================================= + // GstValidateMediaInfo + //========================================================================= + pub fn gst_validate_media_info_clear(mi: *mut GstValidateMediaInfo); + pub fn gst_validate_media_info_compare( + expected: *mut GstValidateMediaInfo, + extracted: *mut GstValidateMediaInfo, + ) -> gboolean; + pub fn gst_validate_media_info_free(mi: *mut GstValidateMediaInfo); + pub fn gst_validate_media_info_init(mi: *mut GstValidateMediaInfo); + pub fn gst_validate_media_info_inspect_uri( + mi: *mut GstValidateMediaInfo, + uri: *const c_char, + discover_only: gboolean, + error: *mut *mut glib::GError, + ) -> gboolean; + pub fn gst_validate_media_info_save( + mi: *mut GstValidateMediaInfo, + path: *const c_char, + error: *mut *mut glib::GError, + ) -> gboolean; + pub fn gst_validate_media_info_to_string( + mi: *mut GstValidateMediaInfo, + length: *mut size_t, + ) -> *mut c_char; + pub fn gst_validate_media_info_load( + path: *const c_char, + error: *mut *mut glib::GError, + ) -> *mut GstValidateMediaInfo; + + //========================================================================= + // GstValidateOverrideRegistry + //========================================================================= + pub fn gst_validate_override_registry_get_override_for_names( + reg: *mut GstValidateOverrideRegistry, + name: *const c_char, + ... + ) -> *mut glib::GList; + pub fn gst_validate_override_registry_get_override_list( + registry: *mut GstValidateOverrideRegistry, + ) -> *mut glib::GList; + pub fn gst_validate_override_registry_attach_overrides(monitor: *mut GstValidateMonitor); + pub fn gst_validate_override_registry_get() -> *mut GstValidateOverrideRegistry; + pub fn gst_validate_override_registry_preload() -> c_int; + + //========================================================================= + // GstValidateReport + //========================================================================= + pub fn gst_validate_report_get_type() -> GType; + pub fn gst_validate_report_new( + issue: *mut GstValidateIssue, + reporter: *mut GstValidateReporter, + message: *const c_char, + ) -> *mut GstValidateReport; + pub fn gst_validate_report_add_message(report: *mut GstValidateReport, message: *const c_char); + pub fn gst_validate_report_add_repeated_report( + report: *mut GstValidateReport, + repeated_report: *mut GstValidateReport, + ); + pub fn gst_validate_report_check_abort(report: *mut GstValidateReport) -> gboolean; + pub fn gst_validate_report_get_dotfile_name(report: *mut GstValidateReport) -> *mut c_char; + pub fn gst_validate_report_get_issue(report: *mut GstValidateReport) -> *mut GstValidateIssue; + pub fn gst_validate_report_get_issue_id(report: *mut GstValidateReport) -> u32; + pub fn gst_validate_report_get_level(report: *mut GstValidateReport) -> GstValidateReportLevel; + pub fn gst_validate_report_get_message(report: *mut GstValidateReport) -> *mut c_char; + pub fn gst_validate_report_get_reporter( + report: *mut GstValidateReport, + ) -> *mut GstValidateReporter; + pub fn gst_validate_report_get_reporter_name(report: *mut GstValidateReport) -> *mut c_char; + pub fn gst_validate_report_get_reporting_level( + report: *mut GstValidateReport, + ) -> GstValidateReportingDetails; + pub fn gst_validate_report_get_timestamp(report: *mut GstValidateReport) -> gst::GstClockTime; + pub fn gst_validate_report_get_trace(report: *mut GstValidateReport) -> *mut c_char; + pub fn gst_validate_report_print_description(report: *mut GstValidateReport); + pub fn gst_validate_report_print_details(report: *mut GstValidateReport); + pub fn gst_validate_report_print_detected_on(report: *mut GstValidateReport); + pub fn gst_validate_report_print_level(report: *mut GstValidateReport); + pub fn gst_validate_report_printf(report: *mut GstValidateReport); + pub fn gst_validate_report_ref(report: *mut GstValidateReport) -> *mut GstValidateReport; + pub fn gst_validate_report_set_master_report( + report: *mut GstValidateReport, + master_report: *mut GstValidateReport, + ) -> gboolean; + pub fn gst_validate_report_set_reporting_level( + report: *mut GstValidateReport, + level: GstValidateReportingDetails, + ); + pub fn gst_validate_report_should_print(report: *mut GstValidateReport) -> gboolean; + pub fn gst_validate_report_unref(report: *mut GstValidateReport); + pub fn gst_validate_report_action( + reporter: *mut GstValidateReporter, + action: *mut GstValidateAction, + issue_id: GstValidateIssueId, + format: *const c_char, + ... + ); + pub fn gst_validate_report_init(); + //pub fn gst_validate_report_valist(reporter: *mut GstValidateReporter, issue_id: GstValidateIssueId, format: *const c_char, var_args: /*Unimplemented*/va_list); + + //========================================================================= + // GstValidateBinMonitor + //========================================================================= + pub fn gst_validate_bin_monitor_get_type() -> GType; + pub fn gst_validate_bin_monitor_new( + bin: *mut gst::GstBin, + runner: *mut GstValidateRunner, + parent: *mut GstValidateMonitor, + ) -> *mut GstValidateBinMonitor; + pub fn gst_validate_bin_monitor_get_scenario( + monitor: *mut GstValidateBinMonitor, + ) -> *mut GstValidateScenario; + + //========================================================================= + // GstValidateElementMonitor + //========================================================================= + pub fn gst_validate_element_monitor_get_type() -> GType; + pub fn gst_validate_element_monitor_new( + element: *mut gst::GstElement, + runner: *mut GstValidateRunner, + parent: *mut GstValidateMonitor, + ) -> *mut GstValidateElementMonitor; + + //========================================================================= + // GstValidateMediaDescriptor + //========================================================================= + pub fn gst_validate_media_descriptor_get_type() -> GType; + pub fn gst_validate_media_descriptor_detects_frames( + self_: *mut GstValidateMediaDescriptor, + ) -> gboolean; + pub fn gst_validate_media_descriptor_get_buffers( + self_: *mut GstValidateMediaDescriptor, + pad: *mut gst::GstPad, + compare_func: glib::GCompareFunc, + bufs: *mut *mut glib::GList, + ) -> gboolean; + pub fn gst_validate_media_descriptor_get_duration( + self_: *mut GstValidateMediaDescriptor, + ) -> gst::GstClockTime; + pub fn gst_validate_media_descriptor_get_pads( + self_: *mut GstValidateMediaDescriptor, + ) -> *mut glib::GList; + pub fn gst_validate_media_descriptor_get_seekable( + self_: *mut GstValidateMediaDescriptor, + ) -> gboolean; + pub fn gst_validate_media_descriptor_has_frame_info( + self_: *mut GstValidateMediaDescriptor, + ) -> gboolean; + + //========================================================================= + // GstValidateMediaDescriptorParser + //========================================================================= + pub fn gst_validate_media_descriptor_parser_get_type() -> GType; + pub fn gst_validate_media_descriptor_parser_new( + runner: *mut GstValidateRunner, + xmlpath: *const c_char, + error: *mut *mut glib::GError, + ) -> *mut GstValidateMediaDescriptorParser; + pub fn gst_validate_media_descriptor_parser_new_from_xml( + runner: *mut GstValidateRunner, + xml: *const c_char, + error: *mut *mut glib::GError, + ) -> *mut GstValidateMediaDescriptorParser; + pub fn gst_validate_media_descriptor_parser_add_stream( + parser: *mut GstValidateMediaDescriptorParser, + pad: *mut gst::GstPad, + ) -> gboolean; + pub fn gst_validate_media_descriptor_parser_add_taglist( + parser: *mut GstValidateMediaDescriptorParser, + taglist: *mut gst::GstTagList, + ) -> gboolean; + pub fn gst_validate_media_descriptor_parser_all_stream_found( + parser: *mut GstValidateMediaDescriptorParser, + ) -> gboolean; + pub fn gst_validate_media_descriptor_parser_all_tags_found( + parser: *mut GstValidateMediaDescriptorParser, + ) -> gboolean; + pub fn gst_validate_media_descriptor_parser_get_xml_path( + parser: *mut GstValidateMediaDescriptorParser, + ) -> *mut c_char; + + //========================================================================= + // GstValidateMediaDescriptorWriter + //========================================================================= + pub fn gst_validate_media_descriptor_writer_get_type() -> GType; + pub fn gst_validate_media_descriptor_writer_new( + runner: *mut GstValidateRunner, + location: *const c_char, + duration: gst::GstClockTime, + seekable: gboolean, + ) -> *mut GstValidateMediaDescriptorWriter; + pub fn gst_validate_media_descriptor_writer_new_discover( + runner: *mut GstValidateRunner, + uri: *const c_char, + flags: GstValidateMediaDescriptorWriterFlags, + error: *mut *mut glib::GError, + ) -> *mut GstValidateMediaDescriptorWriter; + pub fn gst_validate_media_descriptor_writer_add_frame( + writer: *mut GstValidateMediaDescriptorWriter, + pad: *mut gst::GstPad, + buf: *mut gst::GstBuffer, + ) -> gboolean; + pub fn gst_validate_media_descriptor_writer_add_pad( + writer: *mut GstValidateMediaDescriptorWriter, + pad: *mut gst::GstPad, + ) -> gboolean; + pub fn gst_validate_media_descriptor_writer_add_taglist( + writer: *mut GstValidateMediaDescriptorWriter, + taglist: *const gst::GstTagList, + ) -> gboolean; + pub fn gst_validate_media_descriptor_writer_add_tags( + writer: *mut GstValidateMediaDescriptorWriter, + stream_id: *const c_char, + taglist: *const gst::GstTagList, + ) -> gboolean; + pub fn gst_validate_media_descriptor_writer_detects_frames( + writer: *mut GstValidateMediaDescriptorWriter, + ) -> gboolean; + pub fn gst_validate_media_descriptor_writer_get_duration( + writer: *mut GstValidateMediaDescriptorWriter, + ) -> gst::GstClockTime; + pub fn gst_validate_media_descriptor_writer_get_seekable( + writer: *mut GstValidateMediaDescriptorWriter, + ) -> gboolean; + pub fn gst_validate_media_descriptor_writer_get_xml_path( + writer: *mut GstValidateMediaDescriptorWriter, + ) -> *mut c_char; + pub fn gst_validate_media_descriptor_writer_serialize( + writer: *mut GstValidateMediaDescriptorWriter, + ) -> *mut c_char; + pub fn gst_validate_media_descriptor_writer_write( + writer: *mut GstValidateMediaDescriptorWriter, + filename: *const c_char, + ) -> gboolean; + + //========================================================================= + // GstValidateMonitor + //========================================================================= + pub fn gst_validate_monitor_get_type() -> GType; + pub fn gst_validate_monitor_factory_create( + target: *mut gst::GstObject, + runner: *mut GstValidateRunner, + parent: *mut GstValidateMonitor, + ) -> *mut GstValidateMonitor; + pub fn gst_validate_monitor_attach_override( + monitor: *mut GstValidateMonitor, + override_: *mut GstValidateOverride, + ); + pub fn gst_validate_monitor_get_element( + monitor: *mut GstValidateMonitor, + ) -> *mut gst::GstElement; + pub fn gst_validate_monitor_get_element_name(monitor: *mut GstValidateMonitor) -> *mut c_char; + pub fn gst_validate_monitor_get_pipeline( + monitor: *mut GstValidateMonitor, + ) -> *mut gst::GstPipeline; + pub fn gst_validate_monitor_get_target(monitor: *mut GstValidateMonitor) + -> *mut gst::GstObject; + pub fn gst_validate_monitor_set_media_descriptor( + monitor: *mut GstValidateMonitor, + media_descriptor: *mut GstValidateMediaDescriptor, + ); + + //========================================================================= + // GstValidateOverride + //========================================================================= + pub fn gst_validate_override_get_type() -> GType; + pub fn gst_validate_override_new() -> *mut GstValidateOverride; + pub fn gst_validate_override_register_by_klass( + klass: *const c_char, + override_: *mut GstValidateOverride, + ); + pub fn gst_validate_override_register_by_name( + name: *const c_char, + override_: *mut GstValidateOverride, + ); + pub fn gst_validate_override_register_by_type( + gtype: GType, + override_: *mut GstValidateOverride, + ); + pub fn gst_validate_override_attached(override_: *mut GstValidateOverride); + pub fn gst_validate_override_buffer_handler( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + buffer: *mut gst::GstBuffer, + ); + pub fn gst_validate_override_buffer_probe_handler( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + buffer: *mut gst::GstBuffer, + ); + pub fn gst_validate_override_can_attach( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + ) -> gboolean; + pub fn gst_validate_override_change_severity( + override_: *mut GstValidateOverride, + issue_id: GstValidateIssueId, + new_level: GstValidateReportLevel, + ); + pub fn gst_validate_override_element_added_handler( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + child: *mut gst::GstElement, + ); + pub fn gst_validate_override_event_handler( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + event: *mut gst::GstEvent, + ); + pub fn gst_validate_override_free(override_: *mut GstValidateOverride); + pub fn gst_validate_override_get_severity( + override_: *mut GstValidateOverride, + issue_id: GstValidateIssueId, + default_level: GstValidateReportLevel, + ) -> GstValidateReportLevel; + pub fn gst_validate_override_getcaps_handler( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + caps: *mut gst::GstCaps, + ); + pub fn gst_validate_override_query_handler( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + query: *mut gst::GstQuery, + ); + pub fn gst_validate_override_set_buffer_handler( + override_: *mut GstValidateOverride, + handler: GstValidateOverrideBufferHandler, + ); + pub fn gst_validate_override_set_buffer_probe_handler( + override_: *mut GstValidateOverride, + handler: GstValidateOverrideBufferHandler, + ); + pub fn gst_validate_override_set_element_added_handler( + override_: *mut GstValidateOverride, + func: GstValidateOverrideElementAddedHandler, + ); + pub fn gst_validate_override_set_event_handler( + override_: *mut GstValidateOverride, + handler: GstValidateOverrideEventHandler, + ); + pub fn gst_validate_override_set_getcaps_handler( + override_: *mut GstValidateOverride, + handler: GstValidateOverrideGetCapsHandler, + ); + pub fn gst_validate_override_set_query_handler( + override_: *mut GstValidateOverride, + handler: GstValidateOverrideQueryHandler, + ); + pub fn gst_validate_override_set_setcaps_handler( + override_: *mut GstValidateOverride, + handler: GstValidateOverrideSetCapsHandler, + ); + pub fn gst_validate_override_setcaps_handler( + override_: *mut GstValidateOverride, + monitor: *mut GstValidateMonitor, + caps: *mut gst::GstCaps, + ); + + //========================================================================= + // GstValidatePadMonitor + //========================================================================= + pub fn gst_validate_pad_monitor_get_type() -> GType; + pub fn gst_validate_pad_monitor_new( + pad: *mut gst::GstPad, + runner: *mut GstValidateRunner, + parent: *mut GstValidateElementMonitor, + ) -> *mut GstValidatePadMonitor; + + //========================================================================= + // GstValidatePipelineMonitor + //========================================================================= + pub fn gst_validate_pipeline_monitor_get_type() -> GType; + pub fn gst_validate_pipeline_monitor_new( + pipeline: *mut gst::GstPipeline, + runner: *mut GstValidateRunner, + parent: *mut GstValidateMonitor, + ) -> *mut GstValidatePipelineMonitor; + + //========================================================================= + // GstValidateRunner + //========================================================================= + pub fn gst_validate_runner_get_type() -> GType; + pub fn gst_validate_runner_new() -> *mut GstValidateRunner; + pub fn gst_validate_runner_add_report( + runner: *mut GstValidateRunner, + report: *mut GstValidateReport, + ); + pub fn gst_validate_runner_exit( + runner: *mut GstValidateRunner, + print_result: gboolean, + ) -> c_int; + pub fn gst_validate_runner_get_default_reporting_level( + runner: *mut GstValidateRunner, + ) -> GstValidateReportingDetails; + pub fn gst_validate_runner_get_reporting_level_for_name( + runner: *mut GstValidateRunner, + name: *const c_char, + ) -> GstValidateReportingDetails; + pub fn gst_validate_runner_get_reports(runner: *mut GstValidateRunner) -> *mut glib::GList; + pub fn gst_validate_runner_get_reports_count(runner: *mut GstValidateRunner) -> c_uint; + pub fn gst_validate_runner_printf(runner: *mut GstValidateRunner) -> c_int; + + //========================================================================= + // GstValidateScenario + //========================================================================= + pub fn gst_validate_scenario_get_type() -> GType; + pub fn gst_validate_scenario_deinit(); + pub fn gst_validate_scenario_factory_create( + runner: *mut GstValidateRunner, + pipeline: *mut gst::GstElement, + scenario_name: *const c_char, + ) -> *mut GstValidateScenario; + pub fn gst_validate_scenario_execute_seek( + scenario: *mut GstValidateScenario, + action: *mut GstValidateAction, + rate: c_double, + format: gst::GstFormat, + flags: gst::GstSeekFlags, + start_type: gst::GstSeekType, + start: gst::GstClockTime, + stop_type: gst::GstSeekType, + stop: gst::GstClockTime, + ) -> c_int; + pub fn gst_validate_scenario_get_actions( + scenario: *mut GstValidateScenario, + ) -> *mut glib::GList; + pub fn gst_validate_scenario_get_pipeline( + scenario: *mut GstValidateScenario, + ) -> *mut gst::GstElement; + pub fn gst_validate_scenario_get_target_state( + scenario: *mut GstValidateScenario, + ) -> gst::GstState; + + //========================================================================= + // GstValidateReporter + //========================================================================= + pub fn gst_validate_reporter_get_type() -> GType; + pub fn gst_validate_reporter_get_name(reporter: *mut GstValidateReporter) -> *const c_char; + pub fn gst_validate_reporter_get_pipeline( + reporter: *mut GstValidateReporter, + ) -> *mut gst::GstPipeline; + pub fn gst_validate_reporter_get_report( + reporter: *mut GstValidateReporter, + issue_id: GstValidateIssueId, + ) -> *mut GstValidateReport; + pub fn gst_validate_reporter_get_reporting_level( + reporter: *mut GstValidateReporter, + ) -> GstValidateReportingDetails; + pub fn gst_validate_reporter_get_reports( + reporter: *mut GstValidateReporter, + ) -> *mut glib::GList; + pub fn gst_validate_reporter_get_reports_count(reporter: *mut GstValidateReporter) -> c_int; + pub fn gst_validate_reporter_get_runner( + reporter: *mut GstValidateReporter, + ) -> *mut GstValidateRunner; + pub fn gst_validate_reporter_init(reporter: *mut GstValidateReporter, name: *const c_char); + pub fn gst_validate_reporter_purge_reports(reporter: *mut GstValidateReporter); + pub fn gst_validate_reporter_report_simple( + reporter: *mut GstValidateReporter, + issue_id: GstValidateIssueId, + message: *const c_char, + ); + pub fn gst_validate_reporter_set_handle_g_logs(reporter: *mut GstValidateReporter); + pub fn gst_validate_reporter_set_name(reporter: *mut GstValidateReporter, name: *mut c_char); + pub fn gst_validate_reporter_set_runner( + reporter: *mut GstValidateReporter, + runner: *mut GstValidateRunner, + ); + + //========================================================================= + // Other functions + //========================================================================= + pub fn gst_validate_abort(format: *const c_char, ...); + pub fn gst_validate_deinit(); + pub fn gst_validate_element_has_klass( + element: *mut gst::GstElement, + klass: *const c_char, + ) -> gboolean; + pub fn gst_validate_element_matches_target( + element: *mut gst::GstElement, + s: *mut gst::GstStructure, + ) -> gboolean; + pub fn gst_validate_error_structure(action: gpointer, format: *const c_char, ...); + pub fn gst_validate_execute_action( + action_type: *mut GstValidateActionType, + action: *mut GstValidateAction, + ) -> c_int; + pub fn gst_validate_fail_on_missing_plugin() -> gboolean; + pub fn gst_validate_get_action_type(type_name: *const c_char) -> *mut GstValidateActionType; + pub fn gst_validate_has_colored_output() -> gboolean; + pub fn gst_validate_init(); + pub fn gst_validate_init_debug(); + pub fn gst_validate_is_initialized() -> gboolean; + pub fn gst_validate_list_scenarios( + scenarios: *mut *mut c_char, + num_scenarios: c_int, + output_file: *mut c_char, + ) -> gboolean; + pub fn gst_validate_media_descriptors_compare( + ref_: *mut GstValidateMediaDescriptor, + compared: *mut GstValidateMediaDescriptor, + ) -> gboolean; + pub fn gst_validate_object_set_property( + reporter: *mut GstValidateReporter, + object: *mut gobject::GObject, + property: *const c_char, + value: *const gobject::GValue, + optional: gboolean, + ) -> GstValidateActionReturn; + pub fn gst_validate_plugin_get_config(plugin: *mut gst::GstPlugin) -> *mut glib::GList; + pub fn gst_validate_print_action(action: *mut GstValidateAction, message: *const c_char); + pub fn gst_validate_print_action_types( + wanted_types: *mut *const c_char, + num_wanted_types: c_int, + ) -> gboolean; + pub fn gst_validate_print_issues(); + pub fn gst_validate_print_position( + position: gst::GstClockTime, + duration: gst::GstClockTime, + rate: c_double, + extra_info: *mut c_char, + ); + pub fn gst_validate_printf(source: gpointer, format: *const c_char, ...); + //pub fn gst_validate_printf_valist(source: gpointer, format: *const c_char, args: /*Unimplemented*/va_list); + pub fn gst_validate_register_action_type( + type_name: *const c_char, + implementer_namespace: *const c_char, + function: GstValidateExecuteAction, + parameters: *mut GstValidateActionParameter, + description: *const c_char, + flags: GstValidateActionTypeFlags, + ) -> *mut GstValidateActionType; + pub fn gst_validate_register_action_type_dynamic( + plugin: *mut gst::GstPlugin, + type_name: *const c_char, + rank: gst::GstRank, + function: GstValidateExecuteAction, + parameters: *mut GstValidateActionParameter, + description: *const c_char, + flags: GstValidateActionTypeFlags, + ) -> *mut GstValidateActionType; + pub fn gst_validate_replace_variables_in_string( + incom: gpointer, + local_vars: *mut gst::GstStructure, + in_string: *const c_char, + flags: GstValidateStructureResolveVariablesFlags, + ) -> *mut c_char; + pub fn gst_validate_report( + reporter: *mut GstValidateReporter, + issue_id: GstValidateIssueId, + format: *const c_char, + ... + ); + pub fn gst_validate_set_globals(structure: *mut gst::GstStructure); + pub fn gst_validate_setup_test_file( + testfile: *const c_char, + use_fakesinks: gboolean, + ) -> *mut gst::GstStructure; + pub fn gst_validate_skip_test(format: *const c_char, ...); + pub fn gst_validate_spin_on_fault_signals(); + pub fn gst_validate_structs_parse_from_gfile( + scenario_file: *mut gio::GFile, + get_include_paths_func: GstValidateGetIncludePathsFunc, + ) -> *mut glib::GList; + pub fn gst_validate_structure_resolve_variables( + source: gpointer, + structure: *mut gst::GstStructure, + local_variables: *mut gst::GstStructure, + flags: GstValidateStructureResolveVariablesFlags, + ); + pub fn gst_validate_structure_set_variables_from_struct_file( + vars: *mut gst::GstStructure, + struct_file: *const c_char, + ); + pub fn gst_validate_utils_enum_from_str( + type_: GType, + str_enum: *const c_char, + enum_value: *mut c_uint, + ) -> gboolean; + pub fn gst_validate_utils_flags_from_str(type_: GType, str_flags: *const c_char) -> c_uint; + pub fn gst_validate_utils_get_clocktime( + structure: *mut gst::GstStructure, + name: *const c_char, + retval: *mut gst::GstClockTime, + ) -> gboolean; + pub fn gst_validate_utils_get_strv( + str: *mut gst::GstStructure, + fieldname: *const c_char, + ) -> *mut *mut c_char; + pub fn gst_validate_utils_parse_expression( + expr: *const c_char, + variable_func: GstValidateParseVariableFunc, + user_data: gpointer, + error: *mut *mut c_char, + ) -> c_double; + pub fn gst_validate_utils_structs_parse_from_filename( + scenario_file: *const c_char, + get_include_paths_func: GstValidateGetIncludePathsFunc, + file_path: *mut *mut c_char, + ) -> *mut glib::GList; + pub fn gst_validate_utils_test_file_get_meta( + testfile: *const c_char, + use_fakesinks: gboolean, + ) -> *mut gst::GstStructure; + +} diff --git a/gstreamer-validate/sys/tests/abi.rs b/gstreamer-validate/sys/tests/abi.rs new file mode 100644 index 000000000..5e0bce645 --- /dev/null +++ b/gstreamer-validate/sys/tests/abi.rs @@ -0,0 +1,601 @@ +// Generated by gir (https://github.com/gtk-rs/gir @ 9aa16ead87e1) +// from gir-files (https://github.com/gtk-rs/gir-files @ b8b90867ab35) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ def5d67e738d) +// DO NOT EDIT + +use gstreamer_validate_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; +use std::str; +use tempfile::Builder; + +static PACKAGES: &[&str] = &["gstreamer-validate-1.0"]; + +#[derive(Clone, Debug)] +struct Compiler { + pub args: Vec, +} + +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", "")?); + args.extend(get_var("CPPFLAGS", "")?); + args.extend(pkg_config_cflags(PACKAGES)?); + Ok(Self { args }) + } + + pub fn compile(&self, src: &Path, out: &Path) -> Result<(), Box> { + let mut cmd = self.to_command(); + cmd.arg(src); + cmd.arg("-o"); + cmd.arg(out); + let status = cmd.spawn()?.wait()?; + if !status.success() { + return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + } + Ok(()) + } + + fn to_command(&self) -> Command { + let mut cmd = Command::new(&self.args[0]); + cmd.args(&self.args[1..]); + cmd + } +} + +fn get_var(name: &str, default: &str) -> Result, Box> { + match env::var(name) { + Ok(value) => Ok(shell_words::split(&value)?), + Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), + Err(err) => Err(format!("{} {}", name, err).into()), + } +} + +fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { + if packages.is_empty() { + return Ok(Vec::new()); + } + 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()?; + if !out.status.success() { + return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + } + let stdout = str::from_utf8(&out.stdout)?; + Ok(shell_words::split(stdout.trim())?) +} + +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +struct Layout { + size: usize, + alignment: usize, +} + +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq)] +struct Results { + /// Number of successfully completed tests. + passed: usize, + /// Total number of failed tests (including those that failed to compile). + failed: usize, +} + +impl Results { + fn record_passed(&mut self) { + self.passed += 1; + } + fn record_failed(&mut self) { + self.failed += 1; + } + fn summary(&self) -> String { + format!("{} passed; {} failed", self.passed, self.failed) + } + fn expect_total_success(&self) { + if self.failed == 0 { + println!("OK: {}", self.summary()); + } else { + panic!("FAILED: {}", self.summary()); + }; + } +} + +#[test] +#[cfg(target_os = "linux")] +fn cross_validate_constants_with_c() { + let mut c_constants: Vec<(String, String)> = Vec::new(); + + 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] +#[cfg(target_os = "linux")] +fn cross_validate_layout_with_c() { + let mut c_layouts = Vec::new(); + + 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_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()?; + if !output.status.success() { + return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + } + + Ok(String::from_utf8(output.stdout)?) +} + +const RUST_LAYOUTS: &[(&str, Layout)] = &[ + ( + "GstValidateAction", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateActionParameter", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateActionReturn", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateActionType", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateActionTypeFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateBinMonitor", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateBinMonitorClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateDebugFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateElementMonitor", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateElementMonitorClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateInterceptionReturn", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateIssue", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateIssueFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateIssueId", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaDescriptor", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaDescriptorClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaDescriptorParser", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaDescriptorParserClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaDescriptorWriter", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaDescriptorWriterClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaDescriptorWriterFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMediaInfo", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMonitor", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateMonitorClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateOverride", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateOverrideClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateOverrideRegistry", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidatePadMonitor", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidatePadMonitorClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidatePipelineMonitor", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidatePipelineMonitorClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateReport", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateReportLevel", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateReporterInterface", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateReportingDetails", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateRunner", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateRunnerClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateScenario", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateScenarioClass", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateStructureResolveVariablesFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), + ( + "GstValidateVerbosityFlags", + Layout { + size: size_of::(), + alignment: align_of::(), + }, + ), +]; + +const RUST_CONSTANTS: &[(&str, &str)] = &[ + ("(guint) GST_VALIDATE_ACTION_TYPE_ASYNC", "4"), + ("(guint) GST_VALIDATE_ACTION_TYPE_CAN_BE_OPTIONAL", "128"), + ( + "(guint) GST_VALIDATE_ACTION_TYPE_CAN_EXECUTE_ON_ADDITION", + "16", + ), + ("(guint) GST_VALIDATE_ACTION_TYPE_CONFIG", "2"), + ( + "(guint) GST_VALIDATE_ACTION_TYPE_DOESNT_NEED_PIPELINE", + "256", + ), + ("(guint) GST_VALIDATE_ACTION_TYPE_HANDLED_IN_CONFIG", "512"), + ("(guint) GST_VALIDATE_ACTION_TYPE_INTERLACED", "8"), + ("(guint) GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK", "32"), + ("(guint) GST_VALIDATE_ACTION_TYPE_NONE", "0"), + ("(guint) GST_VALIDATE_ACTION_TYPE_NON_BLOCKING", "8"), + ( + "(guint) GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL", + "64", + ), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_ASYNC", "2"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_DONE", "7"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_ERROR", "0"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED", "4"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_INTERLACED", "3"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS", "5"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_NONE", "6"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING", "3"), + ("(gint) GST_VALIDATE_EXECUTE_ACTION_OK", "1"), + ("(guint) GST_VALIDATE_FATAL_CRITICALS", "4"), + ("(guint) GST_VALIDATE_FATAL_DEFAULT", "0"), + ("(guint) GST_VALIDATE_FATAL_ISSUES", "1"), + ("(guint) GST_VALIDATE_FATAL_WARNINGS", "2"), + ("(guint) GST_VALIDATE_ISSUE_FLAGS_FORCE_BACKTRACE", "4"), + ("(guint) GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS", "1"), + ("(guint) GST_VALIDATE_ISSUE_FLAGS_NONE", "0"), + ("(guint) GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE", "2"), + ( + "(guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_FULL", + "4", + ), + ( + "(guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_HANDLE_GLOGS", + "8", + ), + ( + "(guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NONE", + "1", + ), + ( + "(guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NO_PARSER", + "2", + ), + ("(guint) GST_VALIDATE_PRINT_CRITICALS", "32"), + ("(guint) GST_VALIDATE_PRINT_ISSUES", "8"), + ("(guint) GST_VALIDATE_PRINT_WARNINGS", "16"), + ("(gint) GST_VALIDATE_REPORTER_DROP", "0"), + ("(gint) GST_VALIDATE_REPORTER_KEEP", "1"), + ("(gint) GST_VALIDATE_REPORTER_REPORT", "2"), + ("(gint) GST_VALIDATE_REPORT_LEVEL_CRITICAL", "0"), + ("(gint) GST_VALIDATE_REPORT_LEVEL_EXPECTED", "5"), + ("(gint) GST_VALIDATE_REPORT_LEVEL_IGNORE", "3"), + ("(gint) GST_VALIDATE_REPORT_LEVEL_ISSUE", "2"), + ("(gint) GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES", "6"), + ("(gint) GST_VALIDATE_REPORT_LEVEL_UNKNOWN", "4"), + ("(gint) GST_VALIDATE_REPORT_LEVEL_WARNING", "1"), + ("(gint) GST_VALIDATE_SHOW_ALL", "5"), + ("(gint) GST_VALIDATE_SHOW_COUNT", "7"), + ("(gint) GST_VALIDATE_SHOW_MONITOR", "4"), + ("(gint) GST_VALIDATE_SHOW_NONE", "1"), + ("(gint) GST_VALIDATE_SHOW_SMART", "6"), + ("(gint) GST_VALIDATE_SHOW_SUBCHAIN", "3"), + ("(gint) GST_VALIDATE_SHOW_SYNTHETIC", "2"), + ("(gint) GST_VALIDATE_SHOW_UNKNOWN", "0"), + ("(guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_ALL", "0"), + ( + "(guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_LOCAL_ONLY", + "1", + ), + ( + "(guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_EXPRESSION", + "2", + ), + ( + "(guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_FAILURE", + "2", + ), + ("GST_VALIDATE_UNKNOWN_BOOL", "-1"), + ("GST_VALIDATE_UNKNOWN_UINT64", "-1"), + ("(guint) GST_VALIDATE_VERBOSITY_ALL", "30"), + ("(guint) GST_VALIDATE_VERBOSITY_MESSAGES", "4"), + ("(guint) GST_VALIDATE_VERBOSITY_NEW_ELEMENTS", "16"), + ("(guint) GST_VALIDATE_VERBOSITY_NONE", "0"), + ("(guint) GST_VALIDATE_VERBOSITY_POSITION", "2"), + ("(guint) GST_VALIDATE_VERBOSITY_PROPS_CHANGES", "8"), +]; diff --git a/gstreamer-validate/sys/tests/constant.c b/gstreamer-validate/sys/tests/constant.c new file mode 100644 index 000000000..846dbda9a --- /dev/null +++ b/gstreamer-validate/sys/tests/constant.c @@ -0,0 +1,98 @@ +// Generated by gir (https://github.com/gtk-rs/gir @ 9aa16ead87e1) +// from gir-files (https://github.com/gtk-rs/gir-files @ b8b90867ab35) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ def5d67e738d) +// 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", \ + float: "%f", \ + double: "%f", \ + long double: "%ld"), \ + CONSTANT_NAME); \ + printf("\n"); + +int main() { + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_ASYNC); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_CAN_BE_OPTIONAL); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_CAN_EXECUTE_ON_ADDITION); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_CONFIG); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_DOESNT_NEED_PIPELINE); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_HANDLED_IN_CONFIG); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_INTERLACED); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_NEEDS_CLOCK); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_NONE); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_NON_BLOCKING); + PRINT_CONSTANT((guint) GST_VALIDATE_ACTION_TYPE_NO_EXECUTION_NOT_FATAL); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_ASYNC); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_DONE); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_ERROR); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_ERROR_REPORTED); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_INTERLACED); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_NONE); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_NON_BLOCKING); + PRINT_CONSTANT((gint) GST_VALIDATE_EXECUTE_ACTION_OK); + PRINT_CONSTANT((guint) GST_VALIDATE_FATAL_CRITICALS); + PRINT_CONSTANT((guint) GST_VALIDATE_FATAL_DEFAULT); + PRINT_CONSTANT((guint) GST_VALIDATE_FATAL_ISSUES); + PRINT_CONSTANT((guint) GST_VALIDATE_FATAL_WARNINGS); + PRINT_CONSTANT((guint) GST_VALIDATE_ISSUE_FLAGS_FORCE_BACKTRACE); + PRINT_CONSTANT((guint) GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS); + PRINT_CONSTANT((guint) GST_VALIDATE_ISSUE_FLAGS_NONE); + PRINT_CONSTANT((guint) GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE); + PRINT_CONSTANT((guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_FULL); + PRINT_CONSTANT((guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_HANDLE_GLOGS); + PRINT_CONSTANT((guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NONE); + PRINT_CONSTANT((guint) GST_VALIDATE_MEDIA_DESCRIPTOR_WRITER_FLAGS_NO_PARSER); + PRINT_CONSTANT((guint) GST_VALIDATE_PRINT_CRITICALS); + PRINT_CONSTANT((guint) GST_VALIDATE_PRINT_ISSUES); + PRINT_CONSTANT((guint) GST_VALIDATE_PRINT_WARNINGS); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORTER_DROP); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORTER_KEEP); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORTER_REPORT); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORT_LEVEL_CRITICAL); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORT_LEVEL_EXPECTED); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORT_LEVEL_IGNORE); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORT_LEVEL_ISSUE); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORT_LEVEL_NUM_ENTRIES); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORT_LEVEL_UNKNOWN); + PRINT_CONSTANT((gint) GST_VALIDATE_REPORT_LEVEL_WARNING); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_ALL); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_COUNT); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_MONITOR); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_NONE); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_SMART); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_SUBCHAIN); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_SYNTHETIC); + PRINT_CONSTANT((gint) GST_VALIDATE_SHOW_UNKNOWN); + PRINT_CONSTANT((guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_ALL); + PRINT_CONSTANT((guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_LOCAL_ONLY); + PRINT_CONSTANT((guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_EXPRESSION); + PRINT_CONSTANT((guint) GST_VALIDATE_STRUCTURE_RESOLVE_VARIABLES_NO_FAILURE); + PRINT_CONSTANT(GST_VALIDATE_UNKNOWN_BOOL); + PRINT_CONSTANT(GST_VALIDATE_UNKNOWN_UINT64); + PRINT_CONSTANT((guint) GST_VALIDATE_VERBOSITY_ALL); + PRINT_CONSTANT((guint) GST_VALIDATE_VERBOSITY_MESSAGES); + PRINT_CONSTANT((guint) GST_VALIDATE_VERBOSITY_NEW_ELEMENTS); + PRINT_CONSTANT((guint) GST_VALIDATE_VERBOSITY_NONE); + PRINT_CONSTANT((guint) GST_VALIDATE_VERBOSITY_POSITION); + PRINT_CONSTANT((guint) GST_VALIDATE_VERBOSITY_PROPS_CHANGES); + return 0; +} diff --git a/gstreamer-validate/sys/tests/layout.c b/gstreamer-validate/sys/tests/layout.c new file mode 100644 index 000000000..073604be1 --- /dev/null +++ b/gstreamer-validate/sys/tests/layout.c @@ -0,0 +1,53 @@ +// Generated by gir (https://github.com/gtk-rs/gir @ 9aa16ead87e1) +// from gir-files (https://github.com/gtk-rs/gir-files @ b8b90867ab35) +// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git @ def5d67e738d) +// DO NOT EDIT + +#include "manual.h" +#include +#include + +int main() { + printf("%s;%zu;%zu\n", "GstValidateAction", sizeof(GstValidateAction), alignof(GstValidateAction)); + printf("%s;%zu;%zu\n", "GstValidateActionParameter", sizeof(GstValidateActionParameter), alignof(GstValidateActionParameter)); + printf("%s;%zu;%zu\n", "GstValidateActionReturn", sizeof(GstValidateActionReturn), alignof(GstValidateActionReturn)); + printf("%s;%zu;%zu\n", "GstValidateActionType", sizeof(GstValidateActionType), alignof(GstValidateActionType)); + printf("%s;%zu;%zu\n", "GstValidateActionTypeFlags", sizeof(GstValidateActionTypeFlags), alignof(GstValidateActionTypeFlags)); + printf("%s;%zu;%zu\n", "GstValidateBinMonitor", sizeof(GstValidateBinMonitor), alignof(GstValidateBinMonitor)); + printf("%s;%zu;%zu\n", "GstValidateBinMonitorClass", sizeof(GstValidateBinMonitorClass), alignof(GstValidateBinMonitorClass)); + printf("%s;%zu;%zu\n", "GstValidateDebugFlags", sizeof(GstValidateDebugFlags), alignof(GstValidateDebugFlags)); + printf("%s;%zu;%zu\n", "GstValidateElementMonitor", sizeof(GstValidateElementMonitor), alignof(GstValidateElementMonitor)); + printf("%s;%zu;%zu\n", "GstValidateElementMonitorClass", sizeof(GstValidateElementMonitorClass), alignof(GstValidateElementMonitorClass)); + printf("%s;%zu;%zu\n", "GstValidateInterceptionReturn", sizeof(GstValidateInterceptionReturn), alignof(GstValidateInterceptionReturn)); + printf("%s;%zu;%zu\n", "GstValidateIssue", sizeof(GstValidateIssue), alignof(GstValidateIssue)); + printf("%s;%zu;%zu\n", "GstValidateIssueFlags", sizeof(GstValidateIssueFlags), alignof(GstValidateIssueFlags)); + printf("%s;%zu;%zu\n", "GstValidateIssueId", sizeof(GstValidateIssueId), alignof(GstValidateIssueId)); + printf("%s;%zu;%zu\n", "GstValidateMediaDescriptor", sizeof(GstValidateMediaDescriptor), alignof(GstValidateMediaDescriptor)); + printf("%s;%zu;%zu\n", "GstValidateMediaDescriptorClass", sizeof(GstValidateMediaDescriptorClass), alignof(GstValidateMediaDescriptorClass)); + printf("%s;%zu;%zu\n", "GstValidateMediaDescriptorParser", sizeof(GstValidateMediaDescriptorParser), alignof(GstValidateMediaDescriptorParser)); + printf("%s;%zu;%zu\n", "GstValidateMediaDescriptorParserClass", sizeof(GstValidateMediaDescriptorParserClass), alignof(GstValidateMediaDescriptorParserClass)); + printf("%s;%zu;%zu\n", "GstValidateMediaDescriptorWriter", sizeof(GstValidateMediaDescriptorWriter), alignof(GstValidateMediaDescriptorWriter)); + printf("%s;%zu;%zu\n", "GstValidateMediaDescriptorWriterClass", sizeof(GstValidateMediaDescriptorWriterClass), alignof(GstValidateMediaDescriptorWriterClass)); + printf("%s;%zu;%zu\n", "GstValidateMediaDescriptorWriterFlags", sizeof(GstValidateMediaDescriptorWriterFlags), alignof(GstValidateMediaDescriptorWriterFlags)); + printf("%s;%zu;%zu\n", "GstValidateMediaInfo", sizeof(GstValidateMediaInfo), alignof(GstValidateMediaInfo)); + printf("%s;%zu;%zu\n", "GstValidateMonitor", sizeof(GstValidateMonitor), alignof(GstValidateMonitor)); + printf("%s;%zu;%zu\n", "GstValidateMonitorClass", sizeof(GstValidateMonitorClass), alignof(GstValidateMonitorClass)); + printf("%s;%zu;%zu\n", "GstValidateOverride", sizeof(GstValidateOverride), alignof(GstValidateOverride)); + printf("%s;%zu;%zu\n", "GstValidateOverrideClass", sizeof(GstValidateOverrideClass), alignof(GstValidateOverrideClass)); + printf("%s;%zu;%zu\n", "GstValidateOverrideRegistry", sizeof(GstValidateOverrideRegistry), alignof(GstValidateOverrideRegistry)); + printf("%s;%zu;%zu\n", "GstValidatePadMonitor", sizeof(GstValidatePadMonitor), alignof(GstValidatePadMonitor)); + printf("%s;%zu;%zu\n", "GstValidatePadMonitorClass", sizeof(GstValidatePadMonitorClass), alignof(GstValidatePadMonitorClass)); + printf("%s;%zu;%zu\n", "GstValidatePipelineMonitor", sizeof(GstValidatePipelineMonitor), alignof(GstValidatePipelineMonitor)); + printf("%s;%zu;%zu\n", "GstValidatePipelineMonitorClass", sizeof(GstValidatePipelineMonitorClass), alignof(GstValidatePipelineMonitorClass)); + printf("%s;%zu;%zu\n", "GstValidateReport", sizeof(GstValidateReport), alignof(GstValidateReport)); + printf("%s;%zu;%zu\n", "GstValidateReportLevel", sizeof(GstValidateReportLevel), alignof(GstValidateReportLevel)); + printf("%s;%zu;%zu\n", "GstValidateReporterInterface", sizeof(GstValidateReporterInterface), alignof(GstValidateReporterInterface)); + printf("%s;%zu;%zu\n", "GstValidateReportingDetails", sizeof(GstValidateReportingDetails), alignof(GstValidateReportingDetails)); + printf("%s;%zu;%zu\n", "GstValidateRunner", sizeof(GstValidateRunner), alignof(GstValidateRunner)); + printf("%s;%zu;%zu\n", "GstValidateRunnerClass", sizeof(GstValidateRunnerClass), alignof(GstValidateRunnerClass)); + printf("%s;%zu;%zu\n", "GstValidateScenario", sizeof(GstValidateScenario), alignof(GstValidateScenario)); + printf("%s;%zu;%zu\n", "GstValidateScenarioClass", sizeof(GstValidateScenarioClass), alignof(GstValidateScenarioClass)); + printf("%s;%zu;%zu\n", "GstValidateStructureResolveVariablesFlags", sizeof(GstValidateStructureResolveVariablesFlags), alignof(GstValidateStructureResolveVariablesFlags)); + printf("%s;%zu;%zu\n", "GstValidateVerbosityFlags", sizeof(GstValidateVerbosityFlags), alignof(GstValidateVerbosityFlags)); + return 0; +} diff --git a/gstreamer-validate/sys/tests/manual.h b/gstreamer-validate/sys/tests/manual.h new file mode 100644 index 000000000..863078f65 --- /dev/null +++ b/gstreamer-validate/sys/tests/manual.h @@ -0,0 +1,3 @@ +// Feel free to edit this file, it won't be regenerated by gir generator unless removed. + +#include