diff --git a/.rustfmt.toml b/.rustfmt.toml index edf40d279..7bcf7b401 100644 --- a/.rustfmt.toml +++ b/.rustfmt.toml @@ -11,4 +11,5 @@ ignore = [ "gstreamer-sdp/src/auto", "gstreamer-video/src/auto", "gstreamer-webrtc/src/auto", + "gstreamer-editing-services/src/auto", ] diff --git a/Cargo.toml b/Cargo.toml index d9da316bc..2c74db3a7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ members = [ "gstreamer-pbutils", "gstreamer-webrtc", "gstreamer-check", + "gstreamer-editing-services", "examples", "tutorials", ] diff --git a/Gir_GstEditingServices.toml b/Gir_GstEditingServices.toml new file mode 100644 index 000000000..8526c2a95 --- /dev/null +++ b/Gir_GstEditingServices.toml @@ -0,0 +1,110 @@ +[options] +girs_dir = "gir-files" +library = "GES" +version = "1.0" +min_cfg_version = "1.8" +target_path = "gstreamer-editing-services" +work_mode = "normal" +generate_safety_asserts = true +single_version_file = true + +external_libraries = [ + "GLib", + "GObject", + "Gio", + "Gst", + "GstPbutils", +] + +manual = [ + "GLib.Error", + "GLib.Source", + "GLib.DateTime", + "Gio.Cancellable", + "Gio.AsyncReadyCallback", + "GObject.Object", + "Gst.Segment", + "Gst.StaticCaps", + "Gst.StaticPadTemplate", + "GstPbutils.EncodingProfile", + "GstPbutils.DiscovererInfo", + "GstPbutils.DiscovererStreamInfo", + "Gst.Object", + "Gst.Element", + "Gst.Pad", + "Gst.Pipeline", +] + +generate = [ + "GES.EditMode", + "GES.PipelineFlags", + "GES.Edge", + "GES.Effect", + "GES.TrackType", + "GES.Pipeline", + "GES.BaseEffect", + "GES.TimelineElement", + "GES.Group", + "GES.TrackElement", + "GES.Track", + "GES.Layer", + "GES.Clip", + "GES.UriClip", + "GES.Asset", + "GES.UriClipAsset", + "GES.UriSourceAsset", + "GES.Extractable", + "GES.Project", +] + +[[object]] +name = "Gst.Structure" +status = "manual" +ref_mode = "ref-mut" + +[[object]] +name = "Gst.Caps" +status = "manual" +ref_mode = "ref" + +[[object]] +name = "Gst.Buffer" +status = "manual" +ref_mode = "ref" + +[[object]] +name = "Gst.BufferList" +status = "manual" +ref_mode = "ref" + +[[object]] +name = "Gst.Sample" +status = "manual" +ref_mode = "ref" + +[[object]] +name = "Gst.ClockTime" +status = "manual" +conversion_type = "scalar" + +[[object]] +name = "GES.Timeline" +status = "generate" + [[object.function]] + name = "append_layer" + [object.function.return] + nullable = false + +[[object]] +name = "GES.Container" +status = "generate" +trait_name = "GESContainerExt" + [[object.function]] + name = "add" + [object.function.return] + bool_return_is_error = "Failed to add element" + + [[object.function]] + name = "remove" + [object.function.return] + bool_return_is_error = "Failed to remove element" \ No newline at end of file diff --git a/docs/gstreamer-editing-services/docs.md b/docs/gstreamer-editing-services/docs.md new file mode 100644 index 000000000..e69de29bb diff --git a/examples/Cargo.toml b/examples/Cargo.toml index f7efd4937..87d4f0f0f 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -14,6 +14,7 @@ gstreamer-player = { version = "0.12", path = "../gstreamer-player", optional = gstreamer-rtsp = { version = "0.12", path = "../gstreamer-rtsp", optional = true } gstreamer-rtsp-server = { version = "0.12", path = "../gstreamer-rtsp-server", optional = true } gstreamer-rtsp-server-sys = { version = "0.6", features = ["v1_8"], optional = true } +gstreamer-editing-services = { version = "0.12", optional = true } gtk = { version = "0.5", features = ["v3_6"], optional = true } gdk = { version = "0.9", optional = true } gio = { version = "0.5", optional = true } @@ -27,6 +28,7 @@ pangocairo = { version = "0.6", optional = true } [features] gst-player = ["gstreamer-player"] +ges = ["gstreamer-editing-services"] gtksink = ["gtk", "gio"] gtkvideooverlay = ["gtk", "gdk", "gio"] gtkvideooverlay-x11 = ["gtkvideooverlay"] @@ -118,3 +120,7 @@ name = "discoverer" [[bin]] name = "pango-cairo" required-features = ["pango-cairo"] + +[[bin]] +name = "ges" +required-features = ["ges"] diff --git a/examples/src/bin/ges.rs b/examples/src/bin/ges.rs new file mode 100644 index 000000000..19fe39f73 --- /dev/null +++ b/examples/src/bin/ges.rs @@ -0,0 +1,105 @@ +extern crate gstreamer as gst; +use gst::prelude::*; + +extern crate gstreamer_editing_services as ges; +use ges::prelude::*; +use ges::PipelineExt; + +use std::env; + +#[allow(unused_imports)] +#[path = "../examples-common.rs"] +mod examples_common; + +extern crate failure; +#[allow(unused_imports)] +use failure::Error; + +extern crate glib; + +fn main_loop(uri: &str) -> Result<(), glib::BoolError> { + ges::init()?; + + let timeline = ges::Timeline::new_audio_video(); + let layer = timeline.append_layer(); + let pipeline = ges::Pipeline::new(); + pipeline.set_timeline(&timeline); + + let clip = ges::UriClip::new(uri); + layer.add_clip(&clip); + + let effect = ges::Effect::new("agingtv"); + clip.add(&effect).unwrap(); + + println!( + "Agingtv scratch-lines: {}", + clip.get_child_property("scratch-lines") + .unwrap() + .serialize() + .unwrap() + ); + + let asset = clip.get_asset().unwrap(); + let duration = asset + .downcast::() + .unwrap() + .get_duration(); + println!( + "Clip duration: {} - playing file from {} for {}", + duration, + duration / 2, + duration / 4 + ); + + clip.set_inpoint(duration / 2); + clip.set_duration(duration / 4); + + let ret = pipeline.set_state(gst::State::Playing); + assert_ne!(ret, gst::StateChangeReturn::Failure); + + let bus = pipeline.get_bus().unwrap(); + while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) { + use gst::MessageView; + + match msg.view() { + MessageView::Eos(..) => break, + MessageView::Error(err) => { + println!( + "Error from {:?}: {} ({:?})", + err.get_src().map(|s| s.get_path_string()), + err.get_error(), + err.get_debug() + ); + break; + } + _ => (), + } + } + + let ret = pipeline.set_state(gst::State::Null); + assert_ne!(ret, gst::StateChangeReturn::Failure); + + Ok(()) +} + +#[allow(unused_variables)] +fn example_main() { + let args: Vec<_> = env::args().collect(); + let uri: &str = if args.len() == 2 { + args[1].as_ref() + } else { + println!("Usage: ges launch"); + std::process::exit(-1) + }; + + match main_loop(uri) { + Ok(r) => r, + Err(e) => eprintln!("Error! {}", e), + } +} + +fn main() { + // tutorials_common::run is only required to set up the application environent on macOS + // (but not necessary in normal Cocoa applications where this is set up autmatically) + examples_common::run(example_main); +} diff --git a/gstreamer-editing-services/Cargo.toml b/gstreamer-editing-services/Cargo.toml new file mode 100644 index 000000000..78f11f070 --- /dev/null +++ b/gstreamer-editing-services/Cargo.toml @@ -0,0 +1,47 @@ +[package] +name = "gstreamer-editing-services" +version = "0.13.0" +authors = ["Thibault Saunier ", "Sebastian Dröge "] +categories = ["api-bindings", "multimedia"] +description = "Rust bindings for GStreamer Editing Services" +repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" +license = "MIT/Apache-2.0" +readme = "README.md" +homepage = "https://gstreamer.freedesktop.org" +documentation = "https://sdroege.github.io/rustdoc/gstreamer/gstreamer_editing_services" +keywords = ["gstreamer", "multimedia", "gnome", "nle", "video editing"] +build = "build.rs" + +[dependencies] +libc = "0.2" +bitflags = "1.0" +glib-sys = { git = "https://github.com/gtk-rs/sys" } +gio-sys = { git = "https://github.com/gtk-rs/sys" } +gobject-sys = { git = "https://github.com/gtk-rs/sys" } +gstreamer-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys" } +gstreamer-base-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys" } +gstreamer-pbutils-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys" } +gstreamer-editing-services-sys = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys", features = ["v1_8"]} + +glib = { git = "https://github.com/gtk-rs/glib" } +gio = { git = "https://github.com/gtk-rs/gio" } +gstreamer = { path = "../gstreamer" } +gstreamer-base = { path = "../gstreamer-base" } +gstreamer-pbutils = { path = "../gstreamer-pbutils" } + +[build-dependencies.rustdoc-stripper] +version = "0.1" +optional = true + +[features] +v1_8 = ["gstreamer-editing-services-sys/v1_8"] +v1_10 = ["gstreamer-editing-services-sys/v1_10"] +v1_12 = ["gstreamer-editing-services-sys/v1_12", "v1_10"] +v1_14 = ["gstreamer-editing-services-sys/v1_14", "v1_12"] +v1_16 = ["gstreamer-editing-services-sys/v1_16", "v1_14"] +embed-lgpl-docs = ["rustdoc-stripper"] +purge-lgpl-docs = ["rustdoc-stripper"] +dox = ["gstreamer-editing-services-sys/dox", "glib/dox", "gstreamer/dox"] + +[badges] +gitlab = { repository = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", branch = "master" } diff --git a/gstreamer-editing-services/README.md b/gstreamer-editing-services/README.md new file mode 100644 index 000000000..1802fa412 --- /dev/null +++ b/gstreamer-editing-services/README.md @@ -0,0 +1,175 @@ +# gstreamer-rs [![crates.io](https://img.shields.io/crates/v/gstreamer-editing-services.svg)](https://crates.io/crates/gstreamer-editing-services) [![pipeline status](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/badges/master/pipeline.svg)](https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/commits/master) + +[GStreamer Editing Services](https://gstreamer.freedesktop.org/) bindings for Rust. +Documentation can be found [here](https://sdroege.github.io/rustdoc/gstreamer/gstreamer/). + +NOTE: The GStreamer Editing Services API is not Thread Safe and before the 1.16 +release this was not properly expressed in the code, leading to possible data +unsafety even in the rust bindings. We strongly encourage you to run with +GES >= 1.16. + +These bindings are providing a safe API that can be used to interface with +GStreamer, e.g. for writing GStreamer-based applications. + +For background and motivation, see the [announcement blogpost](https://coaxion.net/blog/2017/07/writing-gstreamer-applications-in-rust/). + +The bindings (since 0.8.0) are 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. Older versions before 0.8.0 were manually +written and the repository can be found [here](https://github.com/arturoc/gstreamer1.0-rs). +The API of the two is incompatible. + +A crate for writing GStreamer plugins in Rust can be found here: https://github.com/sdroege/gst-plugin-rs + +## 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, gst-plugins-base 1.8 and gstreamer-editing-services +1.8 installed. + + + +### 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 + +``` +$ 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 libges-1.0 +``` + +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 + +``` +$ brew install gstreamer gst-plugins-base gst-plugins-good \ + gst-plugins-bad gst-plugins-ugly gst-libav gst-editing-services +``` + +#### 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 + +``` +$ export PKG_CONFIG_PATH="/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 + +``` +$ pacman -S 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-editing-services +``` + +#### 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 + +``` +$ 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://sdroege.github.io/rustdoc/gstreamer/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://github.com/sdroege/gstreamer-rs/tree/master/tutorials) +directory. + +Some further examples for various aspects of GStreamer and how to use it from +Rust can be found in the +[examples](https://github.com/sdroege/gstreamer-rs/tree/master/examples) +directory. + + + +## 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-editing-services/build.rs b/gstreamer-editing-services/build.rs new file mode 100644 index 000000000..e5c0fcfe1 --- /dev/null +++ b/gstreamer-editing-services/build.rs @@ -0,0 +1,34 @@ +fn main() { + manage_docs(); +} + +#[cfg(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs"))] +fn manage_docs() { + extern crate stripper_lib; + use std::io; + + let path = "src"; + let ignores: &[&str] = &[]; + + stripper_lib::loop_over_files( + path.as_ref(), + &mut |w, s| stripper_lib::strip_comments(w, s, &mut io::sink(), true), + &ignores, + false, + ); + + #[cfg(feature = "embed-lgpl-docs")] + { + let docs = include_str!("../docs/gstreamer-editing-services/docs.md"); + let mut infos = stripper_lib::parse_cmts(docs.lines(), true); + stripper_lib::loop_over_files( + path.as_ref(), + &mut |w, s| stripper_lib::regenerate_comments(w, s, &mut infos, true, true), + &ignores, + false, + ); + } +} + +#[cfg(not(any(feature = "embed-lgpl-docs", feature = "purge-lgpl-docs")))] +fn manage_docs() {} diff --git a/gstreamer-editing-services/src/auto/asset.rs b/gstreamer-editing-services/src/auto/asset.rs new file mode 100644 index 000000000..44337a392 --- /dev/null +++ b/gstreamer-editing-services/src/auto/asset.rs @@ -0,0 +1,245 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Error; +use Extractable; +use ffi; +#[cfg(feature = "futures")] +use futures_core; +use gio; +use gio_ffi; +use glib; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Asset(Object); + + match fn { + get_type => || ffi::ges_asset_get_type(), + } +} + +impl Asset { + pub fn needs_reload(extractable_type: glib::types::Type, id: &str) -> bool { + assert_initialized_main_thread!(); + unsafe { + from_glib(ffi::ges_asset_needs_reload(extractable_type.to_glib(), id.to_glib_none().0)) + } + } + + pub fn request<'a, P: Into>>(extractable_type: glib::types::Type, id: P) -> Result, Error> { + assert_initialized_main_thread!(); + let id = id.into(); + let id = id.to_glib_none(); + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::ges_asset_request(extractable_type.to_glib(), id.0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + } + } + + pub fn request_async<'a, P: Into>, Q: FnOnce(Result) + Send + 'static>(extractable_type: glib::types::Type, id: &str, cancellable: P, callback: Q) { + assert_initialized_main_thread!(); + let cancellable = cancellable.into(); + let cancellable = cancellable.to_glib_none(); + let user_data: Box> = Box::new(Box::new(callback)); + unsafe extern "C" fn request_async_trampoline) + Send + 'static>(_source_object: *mut gobject_ffi::GObject, res: *mut gio_ffi::GAsyncResult, user_data: glib_ffi::gpointer) + { + let mut error = ptr::null_mut(); + let ret = ffi::ges_asset_request_finish(res, &mut error); + let result = if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }; + let callback: Box> = Box::from_raw(user_data as *mut _); + callback(result); + } + let callback = request_async_trampoline::; + unsafe { + ffi::ges_asset_request_async(extractable_type.to_glib(), id.to_glib_none().0, cancellable.0, Some(callback), Box::into_raw(user_data) as *mut _); + } + } + + #[cfg(feature = "futures")] + pub fn request_async_future(extractable_type: glib::types::Type, id: &str) -> Box_> { + use gio::GioFuture; + use fragile::Fragile; + + let id = String::from(id); + GioFuture::new(&(), move |_obj, send| { + let cancellable = gio::Cancellable::new(); + let send = Fragile::new(send); + Self::request_async( + extractable_type, + &id, + Some(&cancellable), + move |res| { + let _ = send.into_inner().send(res); + }, + ); + + cancellable + }) + } +} + +pub trait AssetExt { + fn extract(&self) -> Result, Error>; + + fn get_error(&self) -> Option; + + fn get_extractable_type(&self) -> glib::types::Type; + + fn get_id(&self) -> Option; + + fn get_proxy(&self) -> Option; + + fn get_proxy_target(&self) -> Option; + + fn list_proxies(&self) -> Vec; + + fn set_proxy<'a, P: IsA + 'a, Q: Into>>(&self, proxy: Q) -> bool; + + fn unproxy>(&self, proxy: &P) -> bool; + + fn set_property_proxy_target + IsA + glib::value::SetValueOptional>(&self, proxy_target: Option<&P>); + + fn connect_property_extractable_type_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_id_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_proxy_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_proxy_target_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> AssetExt for O { + fn extract(&self) -> Result, Error> { + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::ges_asset_extract(self.to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + } + } + + fn get_error(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_asset_get_error(self.to_glib_none().0)) + } + } + + fn get_extractable_type(&self) -> glib::types::Type { + unsafe { + from_glib(ffi::ges_asset_get_extractable_type(self.to_glib_none().0)) + } + } + + fn get_id(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_asset_get_id(self.to_glib_none().0)) + } + } + + fn get_proxy(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_asset_get_proxy(self.to_glib_none().0)) + } + } + + fn get_proxy_target(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_asset_get_proxy_target(self.to_glib_none().0)) + } + } + + fn list_proxies(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::ges_asset_list_proxies(self.to_glib_none().0)) + } + } + + fn set_proxy<'a, P: IsA + 'a, Q: Into>>(&self, proxy: Q) -> bool { + let proxy = proxy.into(); + let proxy = proxy.to_glib_none(); + unsafe { + from_glib(ffi::ges_asset_set_proxy(self.to_glib_none().0, proxy.0)) + } + } + + fn unproxy>(&self, proxy: &P) -> bool { + unsafe { + from_glib(ffi::ges_asset_unproxy(self.to_glib_none().0, proxy.to_glib_none().0)) + } + } + + fn set_property_proxy_target + IsA + glib::value::SetValueOptional>(&self, proxy_target: Option<&P>) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "proxy-target".to_glib_none().0, Value::from(proxy_target).to_glib_none().0); + } + } + + fn connect_property_extractable_type_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::extractable-type", + transmute(notify_extractable_type_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_id_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::id", + transmute(notify_id_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_proxy_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::proxy", + transmute(notify_proxy_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_proxy_target_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::proxy-target", + transmute(notify_proxy_target_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_extractable_type_trampoline

(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Asset::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_id_trampoline

(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Asset::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_proxy_trampoline

(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Asset::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_proxy_target_trampoline

(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Asset::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/base_effect.rs b/gstreamer-editing-services/src/auto/base_effect.rs new file mode 100644 index 000000000..a2bd4206e --- /dev/null +++ b/gstreamer-editing-services/src/auto/base_effect.rs @@ -0,0 +1,23 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Extractable; +use TimelineElement; +use TrackElement; +use ffi; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct BaseEffect(Object): TrackElement, TimelineElement, Extractable; + + match fn { + get_type => || ffi::ges_base_effect_get_type(), + } +} + +impl BaseEffect {} diff --git a/gstreamer-editing-services/src/auto/clip.rs b/gstreamer-editing-services/src/auto/clip.rs new file mode 100644 index 000000000..960c701c5 --- /dev/null +++ b/gstreamer-editing-services/src/auto/clip.rs @@ -0,0 +1,178 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Asset; +use BaseEffect; +use Container; +use Extractable; +use Layer; +use TimelineElement; +use Track; +use TrackElement; +use TrackType; +use ffi; +use glib; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Clip(Object): Container, TimelineElement, Extractable; + + match fn { + get_type => || ffi::ges_clip_get_type(), + } +} + +pub trait ClipExt { + fn add_asset>(&self, asset: &P) -> Option; + + fn find_track_element<'a, P: IsA + 'a, Q: Into>>(&self, track: Q, type_: glib::types::Type) -> Option; + + fn find_track_elements<'a, P: IsA + 'a, Q: Into>>(&self, track: Q, track_type: TrackType, type_: glib::types::Type) -> Vec; + + fn get_layer(&self) -> Option; + + fn get_supported_formats(&self) -> TrackType; + + fn get_top_effect_index>(&self, effect: &P) -> i32; + + fn get_top_effect_position>(&self, effect: &P) -> i32; + + fn get_top_effects(&self) -> Vec; + + fn move_to_layer(&self, layer: &Layer) -> bool; + + fn set_supported_formats(&self, supportedformats: TrackType); + + fn set_top_effect_index>(&self, effect: &P, newindex: u32) -> bool; + + fn set_top_effect_priority>(&self, effect: &P, newpriority: u32) -> bool; + + fn split(&self, position: u64) -> Option; + + fn connect_property_layer_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> ClipExt for O { + fn add_asset>(&self, asset: &P) -> Option { + unsafe { + from_glib_none(ffi::ges_clip_add_asset(self.to_glib_none().0, asset.to_glib_none().0)) + } + } + + fn find_track_element<'a, P: IsA + 'a, Q: Into>>(&self, track: Q, type_: glib::types::Type) -> Option { + let track = track.into(); + let track = track.to_glib_none(); + unsafe { + from_glib_full(ffi::ges_clip_find_track_element(self.to_glib_none().0, track.0, type_.to_glib())) + } + } + + fn find_track_elements<'a, P: IsA + 'a, Q: Into>>(&self, track: Q, track_type: TrackType, type_: glib::types::Type) -> Vec { + let track = track.into(); + let track = track.to_glib_none(); + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_clip_find_track_elements(self.to_glib_none().0, track.0, track_type.to_glib(), type_.to_glib())) + } + } + + fn get_layer(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_clip_get_layer(self.to_glib_none().0)) + } + } + + fn get_supported_formats(&self) -> TrackType { + unsafe { + from_glib(ffi::ges_clip_get_supported_formats(self.to_glib_none().0)) + } + } + + fn get_top_effect_index>(&self, effect: &P) -> i32 { + unsafe { + ffi::ges_clip_get_top_effect_index(self.to_glib_none().0, effect.to_glib_none().0) + } + } + + fn get_top_effect_position>(&self, effect: &P) -> i32 { + unsafe { + ffi::ges_clip_get_top_effect_position(self.to_glib_none().0, effect.to_glib_none().0) + } + } + + fn get_top_effects(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_clip_get_top_effects(self.to_glib_none().0)) + } + } + + fn move_to_layer(&self, layer: &Layer) -> bool { + unsafe { + from_glib(ffi::ges_clip_move_to_layer(self.to_glib_none().0, layer.to_glib_none().0)) + } + } + + fn set_supported_formats(&self, supportedformats: TrackType) { + unsafe { + ffi::ges_clip_set_supported_formats(self.to_glib_none().0, supportedformats.to_glib()); + } + } + + fn set_top_effect_index>(&self, effect: &P, newindex: u32) -> bool { + unsafe { + from_glib(ffi::ges_clip_set_top_effect_index(self.to_glib_none().0, effect.to_glib_none().0, newindex)) + } + } + + fn set_top_effect_priority>(&self, effect: &P, newpriority: u32) -> bool { + unsafe { + from_glib(ffi::ges_clip_set_top_effect_priority(self.to_glib_none().0, effect.to_glib_none().0, newpriority)) + } + } + + fn split(&self, position: u64) -> Option { + unsafe { + from_glib_none(ffi::ges_clip_split(self.to_glib_none().0, position)) + } + } + + fn connect_property_layer_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::layer", + transmute(notify_layer_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::supported-formats", + transmute(notify_supported_formats_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_layer_trampoline

(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Clip::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_supported_formats_trampoline

(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Clip::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/container.rs b/gstreamer-editing-services/src/auto/container.rs new file mode 100644 index 000000000..ed925bdf9 --- /dev/null +++ b/gstreamer-editing-services/src/auto/container.rs @@ -0,0 +1,143 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Edge; +use EditMode; +use Extractable; +use Layer; +use TimelineElement; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Container(Object): TimelineElement, Extractable; + + match fn { + get_type => || ffi::ges_container_get_type(), + } +} + +impl Container { + pub fn group(containers: &[Container]) -> Option { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_container_group(containers.to_glib_none().0)) + } + } +} + +pub trait GESContainerExt { + fn add>(&self, child: &P) -> Result<(), glib::error::BoolError>; + + fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> bool; + + fn get_children(&self, recursive: bool) -> Vec; + + fn remove>(&self, child: &P) -> Result<(), glib::error::BoolError>; + + fn ungroup(&self, recursive: bool) -> Vec; + + fn get_property_height(&self) -> u32; + + fn connect_child_added(&self, f: F) -> SignalHandlerId; + + fn connect_child_removed(&self, f: F) -> SignalHandlerId; + + fn connect_property_height_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> GESContainerExt for O { + fn add>(&self, child: &P) -> Result<(), glib::error::BoolError> { + unsafe { + glib::error::BoolError::from_glib(ffi::ges_container_add(self.to_glib_none().0, child.to_glib_none().0), "Failed to add element") + } + } + + fn edit(&self, layers: &[Layer], new_layer_priority: i32, mode: EditMode, edge: Edge, position: u64) -> bool { + unsafe { + from_glib(ffi::ges_container_edit(self.to_glib_none().0, layers.to_glib_none().0, new_layer_priority, mode.to_glib(), edge.to_glib(), position)) + } + } + + fn get_children(&self, recursive: bool) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_container_get_children(self.to_glib_none().0, recursive.to_glib())) + } + } + + fn remove>(&self, child: &P) -> Result<(), glib::error::BoolError> { + unsafe { + glib::error::BoolError::from_glib(ffi::ges_container_remove(self.to_glib_none().0, child.to_glib_none().0), "Failed to remove element") + } + } + + fn ungroup(&self, recursive: bool) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_container_ungroup(self.to_glib_full(), recursive.to_glib())) + } + } + + fn get_property_height(&self) -> u32 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "height".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn connect_child_added(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "child-added", + transmute(child_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_child_removed(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "child-removed", + transmute(child_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_height_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::height", + transmute(notify_height_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn child_added_trampoline

(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f); + f(&Container::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) +} + +unsafe extern "C" fn child_removed_trampoline

(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &TimelineElement) + 'static) = transmute(f); + f(&Container::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(element)) +} + +unsafe extern "C" fn notify_height_trampoline

(this: *mut ffi::GESContainer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Container::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/effect.rs b/gstreamer-editing-services/src/auto/effect.rs new file mode 100644 index 000000000..a25e9dd5e --- /dev/null +++ b/gstreamer-editing-services/src/auto/effect.rs @@ -0,0 +1,70 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use BaseEffect; +use Extractable; +use TimelineElement; +use TrackElement; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Effect(Object): BaseEffect, TrackElement, TimelineElement, Extractable; + + match fn { + get_type => || ffi::ges_effect_get_type(), + } +} + +impl Effect { + pub fn new(bin_description: &str) -> Effect { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_effect_new(bin_description.to_glib_none().0)) + } + } +} + +pub trait EffectExt { + fn get_property_bin_description(&self) -> Option; + + fn connect_property_bin_description_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> EffectExt for O { + fn get_property_bin_description(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "bin-description".to_glib_none().0, value.to_glib_none_mut().0); + value.get() + } + } + + fn connect_property_bin_description_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::bin-description", + transmute(notify_bin_description_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_bin_description_trampoline

(this: *mut ffi::GESEffect, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Effect::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/enums.rs b/gstreamer-editing-services/src/auto/enums.rs new file mode 100644 index 000000000..1193220ba --- /dev/null +++ b/gstreamer-editing-services/src/auto/enums.rs @@ -0,0 +1,142 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use ffi; +use glib::StaticType; +use glib::Type; +use glib::translate::*; +use glib::value::FromValue; +use glib::value::FromValueOptional; +use glib::value::SetValue; +use glib::value::Value; +use gobject_ffi; + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] +pub enum Edge { + EdgeStart, + EdgeEnd, + EdgeNone, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for Edge { + type GlibType = ffi::GESEdge; + + fn to_glib(&self) -> ffi::GESEdge { + match *self { + Edge::EdgeStart => ffi::GES_EDGE_START, + Edge::EdgeEnd => ffi::GES_EDGE_END, + Edge::EdgeNone => ffi::GES_EDGE_NONE, + Edge::__Unknown(value) => value + } + } +} + +#[doc(hidden)] +impl FromGlib for Edge { + fn from_glib(value: ffi::GESEdge) -> Self { + skip_assert_initialized!(); + match value { + 0 => Edge::EdgeStart, + 1 => Edge::EdgeEnd, + 2 => Edge::EdgeNone, + value => Edge::__Unknown(value), + } + } +} + +impl StaticType for Edge { + fn static_type() -> Type { + unsafe { from_glib(ffi::ges_edge_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for Edge { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for Edge { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for Edge { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] +pub enum EditMode { + EditNormal, + EditRipple, + EditRoll, + EditTrim, + EditSlide, + #[doc(hidden)] + __Unknown(i32), +} + +#[doc(hidden)] +impl ToGlib for EditMode { + type GlibType = ffi::GESEditMode; + + fn to_glib(&self) -> ffi::GESEditMode { + match *self { + EditMode::EditNormal => ffi::GES_EDIT_MODE_NORMAL, + EditMode::EditRipple => ffi::GES_EDIT_MODE_RIPPLE, + EditMode::EditRoll => ffi::GES_EDIT_MODE_ROLL, + EditMode::EditTrim => ffi::GES_EDIT_MODE_TRIM, + EditMode::EditSlide => ffi::GES_EDIT_MODE_SLIDE, + EditMode::__Unknown(value) => value + } + } +} + +#[doc(hidden)] +impl FromGlib for EditMode { + fn from_glib(value: ffi::GESEditMode) -> Self { + skip_assert_initialized!(); + match value { + 0 => EditMode::EditNormal, + 1 => EditMode::EditRipple, + 2 => EditMode::EditRoll, + 3 => EditMode::EditTrim, + 4 => EditMode::EditSlide, + value => EditMode::__Unknown(value), + } + } +} + +impl StaticType for EditMode { + fn static_type() -> Type { + unsafe { from_glib(ffi::ges_edit_mode_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for EditMode { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for EditMode { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_ffi::g_value_get_enum(value.to_glib_none().0)) + } +} + +impl SetValue for EditMode { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, this.to_glib()) + } +} + diff --git a/gstreamer-editing-services/src/auto/extractable.rs b/gstreamer-editing-services/src/auto/extractable.rs new file mode 100644 index 000000000..ec4fdeede --- /dev/null +++ b/gstreamer-editing-services/src/auto/extractable.rs @@ -0,0 +1,48 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Asset; +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct Extractable(Object); + + match fn { + get_type => || ffi::ges_extractable_get_type(), + } +} + +pub trait ExtractableExt { + fn get_asset(&self) -> Option; + + fn get_id(&self) -> Option; + + fn set_asset>(&self, asset: &P) -> bool; +} + +impl> ExtractableExt for O { + fn get_asset(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_extractable_get_asset(self.to_glib_none().0)) + } + } + + fn get_id(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_extractable_get_id(self.to_glib_none().0)) + } + } + + fn set_asset>(&self, asset: &P) -> bool { + unsafe { + from_glib(ffi::ges_extractable_set_asset(self.to_glib_none().0, asset.to_glib_none().0)) + } + } +} diff --git a/gstreamer-editing-services/src/auto/flags.rs b/gstreamer-editing-services/src/auto/flags.rs new file mode 100644 index 000000000..29909f240 --- /dev/null +++ b/gstreamer-editing-services/src/auto/flags.rs @@ -0,0 +1,116 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use ffi; +use glib::StaticType; +use glib::Type; +use glib::translate::*; +use glib::value::FromValue; +use glib::value::FromValueOptional; +use glib::value::SetValue; +use glib::value::Value; +use gobject_ffi; + +bitflags! { + pub struct PipelineFlags: u32 { + const AUDIO_PREVIEW = 1; + const VIDEO_PREVIEW = 2; + const FULL_PREVIEW = 3; + const RENDER = 4; + const SMART_RENDER = 8; + } +} + +#[doc(hidden)] +impl ToGlib for PipelineFlags { + type GlibType = ffi::GESPipelineFlags; + + fn to_glib(&self) -> ffi::GESPipelineFlags { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for PipelineFlags { + fn from_glib(value: ffi::GESPipelineFlags) -> PipelineFlags { + skip_assert_initialized!(); + PipelineFlags::from_bits_truncate(value) + } +} + +impl StaticType for PipelineFlags { + fn static_type() -> Type { + unsafe { from_glib(ffi::ges_pipeline_flags_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for PipelineFlags { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for PipelineFlags { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl SetValue for PipelineFlags { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) + } +} + +bitflags! { + pub struct TrackType: u32 { + const UNKNOWN = 1; + const AUDIO = 2; + const VIDEO = 4; + const TEXT = 8; + const CUSTOM = 16; + } +} + +#[doc(hidden)] +impl ToGlib for TrackType { + type GlibType = ffi::GESTrackType; + + fn to_glib(&self) -> ffi::GESTrackType { + self.bits() + } +} + +#[doc(hidden)] +impl FromGlib for TrackType { + fn from_glib(value: ffi::GESTrackType) -> TrackType { + skip_assert_initialized!(); + TrackType::from_bits_truncate(value) + } +} + +impl StaticType for TrackType { + fn static_type() -> Type { + unsafe { from_glib(ffi::ges_track_type_get_type()) } + } +} + +impl<'a> FromValueOptional<'a> for TrackType { + unsafe fn from_value_optional(value: &Value) -> Option { + Some(FromValue::from_value(value)) + } +} + +impl<'a> FromValue<'a> for TrackType { + unsafe fn from_value(value: &Value) -> Self { + from_glib(gobject_ffi::g_value_get_flags(value.to_glib_none().0)) + } +} + +impl SetValue for TrackType { + unsafe fn set_value(value: &mut Value, this: &Self) { + gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, this.to_glib()) + } +} + diff --git a/gstreamer-editing-services/src/auto/group.rs b/gstreamer-editing-services/src/auto/group.rs new file mode 100644 index 000000000..d0f897c38 --- /dev/null +++ b/gstreamer-editing-services/src/auto/group.rs @@ -0,0 +1,219 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Container; +use Extractable; +use TimelineElement; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Group(Object): Container, TimelineElement, Extractable; + + match fn { + get_type => || ffi::ges_group_get_type(), + } +} + +impl Group { + pub fn new() -> Group { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_group_new()) + } + } +} + +impl Default for Group { + fn default() -> Self { + Self::new() + } +} + +pub trait GroupExt { + fn get_property_duration(&self) -> u64; + + fn set_property_duration(&self, duration: u64); + + fn get_property_in_point(&self) -> u64; + + fn set_property_in_point(&self, in_point: u64); + + fn get_property_max_duration(&self) -> u64; + + fn set_property_max_duration(&self, max_duration: u64); + + fn get_property_priority(&self) -> u32; + + fn set_property_priority(&self, priority: u32); + + fn get_property_start(&self) -> u64; + + fn set_property_start(&self, start: u64); + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_start_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> GroupExt for O { + fn get_property_duration(&self) -> u64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "duration".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn set_property_duration(&self, duration: u64) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "duration".to_glib_none().0, Value::from(&duration).to_glib_none().0); + } + } + + fn get_property_in_point(&self) -> u64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "in-point".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn set_property_in_point(&self, in_point: u64) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "in-point".to_glib_none().0, Value::from(&in_point).to_glib_none().0); + } + } + + fn get_property_max_duration(&self) -> u64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "max-duration".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn set_property_max_duration(&self, max_duration: u64) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "max-duration".to_glib_none().0, Value::from(&max_duration).to_glib_none().0); + } + } + + fn get_property_priority(&self) -> u32 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "priority".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn set_property_priority(&self, priority: u32) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "priority".to_glib_none().0, Value::from(&priority).to_glib_none().0); + } + } + + fn get_property_start(&self) -> u64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "start".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn set_property_start(&self, start: u64) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "start".to_glib_none().0, Value::from(&start).to_glib_none().0); + } + } + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::duration", + transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::in-point", + transmute(notify_in_point_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::max-duration", + transmute(notify_max_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::priority", + transmute(notify_priority_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_start_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::start", + transmute(notify_start_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Group::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_in_point_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Group::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_max_duration_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Group::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_priority_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Group::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_start_trampoline

(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Group::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/layer.rs b/gstreamer-editing-services/src/auto/layer.rs new file mode 100644 index 000000000..acf9fd276 --- /dev/null +++ b/gstreamer-editing-services/src/auto/layer.rs @@ -0,0 +1,220 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Asset; +use Clip; +use Extractable; +use Timeline; +use TrackType; +use ffi; +use glib; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Layer(Object): Extractable; + + match fn { + get_type => || ffi::ges_layer_get_type(), + } +} + +impl Layer { + pub fn new() -> Layer { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_layer_new()) + } + } +} + +impl Default for Layer { + fn default() -> Self { + Self::new() + } +} + +pub trait LayerExt { + fn add_asset>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option; + + fn add_clip>(&self, clip: &P) -> bool; + + fn get_auto_transition(&self) -> bool; + + fn get_clips(&self) -> Vec; + + fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec; + + fn get_duration(&self) -> gst::ClockTime; + + fn get_priority(&self) -> u32; + + fn get_timeline(&self) -> Option; + + fn is_empty(&self) -> bool; + + fn remove_clip>(&self, clip: &P) -> bool; + + fn set_auto_transition(&self, auto_transition: bool); + + #[cfg_attr(feature = "v1_16", deprecated)] + fn set_priority(&self, priority: u32); + + fn set_timeline(&self, timeline: &Timeline); + + fn connect_clip_added(&self, f: F) -> SignalHandlerId; + + fn connect_clip_removed(&self, f: F) -> SignalHandlerId; + + fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId; + + #[cfg_attr(feature = "v1_16", deprecated)] + fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> LayerExt for O { + fn add_asset>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option { + unsafe { + from_glib_none(ffi::ges_layer_add_asset(self.to_glib_none().0, asset.to_glib_none().0, start.to_glib(), inpoint.to_glib(), duration.to_glib(), track_types.to_glib())) + } + } + + fn add_clip>(&self, clip: &P) -> bool { + unsafe { + from_glib(ffi::ges_layer_add_clip(self.to_glib_none().0, clip.to_glib_none().0)) + } + } + + fn get_auto_transition(&self) -> bool { + unsafe { + from_glib(ffi::ges_layer_get_auto_transition(self.to_glib_none().0)) + } + } + + fn get_clips(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips(self.to_glib_none().0)) + } + } + + fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_layer_get_clips_in_interval(self.to_glib_none().0, start.to_glib(), end.to_glib())) + } + } + + fn get_duration(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_layer_get_duration(self.to_glib_none().0)) + } + } + + fn get_priority(&self) -> u32 { + unsafe { + ffi::ges_layer_get_priority(self.to_glib_none().0) + } + } + + fn get_timeline(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_layer_get_timeline(self.to_glib_none().0)) + } + } + + fn is_empty(&self) -> bool { + unsafe { + from_glib(ffi::ges_layer_is_empty(self.to_glib_none().0)) + } + } + + fn remove_clip>(&self, clip: &P) -> bool { + unsafe { + from_glib(ffi::ges_layer_remove_clip(self.to_glib_none().0, clip.to_glib_none().0)) + } + } + + fn set_auto_transition(&self, auto_transition: bool) { + unsafe { + ffi::ges_layer_set_auto_transition(self.to_glib_none().0, auto_transition.to_glib()); + } + } + + fn set_priority(&self, priority: u32) { + unsafe { + ffi::ges_layer_set_priority(self.to_glib_none().0, priority); + } + } + + fn set_timeline(&self, timeline: &Timeline) { + unsafe { + ffi::ges_layer_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0); + } + } + + fn connect_clip_added(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "clip-added", + transmute(clip_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_clip_removed(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "clip-removed", + transmute(clip_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::auto-transition", + transmute(notify_auto_transition_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::priority", + transmute(notify_priority_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn clip_added_trampoline

(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Clip) + 'static) = transmute(f); + f(&Layer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(clip)) +} + +unsafe extern "C" fn clip_removed_trampoline

(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Clip) + 'static) = transmute(f); + f(&Layer::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(clip)) +} + +unsafe extern "C" fn notify_auto_transition_trampoline

(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Layer::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_priority_trampoline

(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Layer::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/mod.rs b/gstreamer-editing-services/src/auto/mod.rs new file mode 100644 index 000000000..0dfe2234f --- /dev/null +++ b/gstreamer-editing-services/src/auto/mod.rs @@ -0,0 +1,98 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +mod asset; +pub use self::asset::Asset; +pub use self::asset::AssetExt; + +mod base_effect; +pub use self::base_effect::BaseEffect; + +mod clip; +pub use self::clip::Clip; +pub use self::clip::ClipExt; + +mod container; +pub use self::container::Container; +pub use self::container::GESContainerExt; + +mod effect; +pub use self::effect::Effect; +pub use self::effect::EffectExt; + +mod extractable; +pub use self::extractable::Extractable; +pub use self::extractable::ExtractableExt; + +mod group; +pub use self::group::Group; +pub use self::group::GroupExt; + +mod layer; +pub use self::layer::Layer; +pub use self::layer::LayerExt; + +mod pipeline; +pub use self::pipeline::Pipeline; +pub use self::pipeline::PipelineExt; + +mod project; +pub use self::project::Project; +pub use self::project::ProjectExt; + +mod timeline; +pub use self::timeline::Timeline; +pub use self::timeline::TimelineExt; + +mod timeline_element; +pub use self::timeline_element::TimelineElement; +pub use self::timeline_element::TimelineElementExt; + +mod track; +pub use self::track::Track; +pub use self::track::TrackExt; + +mod track_element; +pub use self::track_element::TrackElement; +pub use self::track_element::TrackElementExt; + +mod uri_clip; +pub use self::uri_clip::UriClip; +pub use self::uri_clip::UriClipExt; + +mod uri_clip_asset; +pub use self::uri_clip_asset::UriClipAsset; +pub use self::uri_clip_asset::UriClipAssetExt; + +mod uri_source_asset; +pub use self::uri_source_asset::UriSourceAsset; +pub use self::uri_source_asset::UriSourceAssetExt; + +mod enums; +pub use self::enums::Edge; +pub use self::enums::EditMode; + +mod flags; +pub use self::flags::PipelineFlags; +pub use self::flags::TrackType; + +#[doc(hidden)] +pub mod traits { + pub use super::AssetExt; + pub use super::ClipExt; + pub use super::GESContainerExt; + pub use super::EffectExt; + pub use super::ExtractableExt; + pub use super::GroupExt; + pub use super::LayerExt; + pub use super::PipelineExt; + pub use super::ProjectExt; + pub use super::TimelineExt; + pub use super::TimelineElementExt; + pub use super::TrackExt; + pub use super::TrackElementExt; + pub use super::UriClipExt; + pub use super::UriClipAssetExt; + pub use super::UriSourceAssetExt; +} diff --git a/gstreamer-editing-services/src/auto/pipeline.rs b/gstreamer-editing-services/src/auto/pipeline.rs new file mode 100644 index 000000000..f1b1417bc --- /dev/null +++ b/gstreamer-editing-services/src/auto/pipeline.rs @@ -0,0 +1,324 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Error; +use PipelineFlags; +use Timeline; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use gst_ffi; +use gst_pbutils; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Pipeline(Object): [ + gst::Pipeline => gst_ffi::GstPipeline, + gst::Element => gst_ffi::GstElement, + gst::Object => gst_ffi::GstObject, + ]; + + match fn { + get_type => || ffi::ges_pipeline_get_type(), + } +} + +impl Pipeline { + pub fn new() -> Pipeline { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_pipeline_new()) + } + } +} + +impl Default for Pipeline { + fn default() -> Self { + Self::new() + } +} + +pub trait PipelineExt { + fn get_mode(&self) -> PipelineFlags; + + fn get_thumbnail(&self, caps: &gst::Caps) -> Option; + + fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option; + + fn preview_get_audio_sink(&self) -> Option; + + fn preview_get_video_sink(&self) -> Option; + + fn preview_set_audio_sink>(&self, sink: &P); + + fn preview_set_video_sink>(&self, sink: &P); + + fn save_thumbnail(&self, width: i32, height: i32, format: &str, location: &str) -> Result<(), Error>; + + fn set_mode(&self, mode: PipelineFlags) -> bool; + + fn set_render_settings>(&self, output_uri: &str, profile: &P) -> bool; + + fn set_timeline(&self, timeline: &Timeline) -> bool; + + fn get_property_audio_filter(&self) -> Option; + + fn set_property_audio_filter + IsA + glib::value::SetValueOptional>(&self, audio_filter: Option<&P>); + + fn get_property_audio_sink(&self) -> Option; + + fn set_property_audio_sink + IsA + glib::value::SetValueOptional>(&self, audio_sink: Option<&P>); + + fn get_property_timeline(&self) -> Option; + + fn get_property_video_filter(&self) -> Option; + + fn set_property_video_filter + IsA + glib::value::SetValueOptional>(&self, video_filter: Option<&P>); + + fn get_property_video_sink(&self) -> Option; + + fn set_property_video_sink + IsA + glib::value::SetValueOptional>(&self, video_sink: Option<&P>); + + fn connect_property_audio_filter_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_audio_sink_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_mode_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_video_filter_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> PipelineExt for O { + fn get_mode(&self) -> PipelineFlags { + unsafe { + from_glib(ffi::ges_pipeline_get_mode(self.to_glib_none().0)) + } + } + + fn get_thumbnail(&self, caps: &gst::Caps) -> Option { + unsafe { + from_glib_full(ffi::ges_pipeline_get_thumbnail(self.to_glib_none().0, caps.to_glib_none().0)) + } + } + + fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option { + unsafe { + from_glib_full(ffi::ges_pipeline_get_thumbnail_rgb24(self.to_glib_none().0, width, height)) + } + } + + fn preview_get_audio_sink(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_pipeline_preview_get_audio_sink(self.to_glib_none().0)) + } + } + + fn preview_get_video_sink(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_pipeline_preview_get_video_sink(self.to_glib_none().0)) + } + } + + fn preview_set_audio_sink>(&self, sink: &P) { + unsafe { + ffi::ges_pipeline_preview_set_audio_sink(self.to_glib_none().0, sink.to_glib_none().0); + } + } + + fn preview_set_video_sink>(&self, sink: &P) { + unsafe { + ffi::ges_pipeline_preview_set_video_sink(self.to_glib_none().0, sink.to_glib_none().0); + } + } + + fn save_thumbnail(&self, width: i32, height: i32, format: &str, location: &str) -> Result<(), Error> { + unsafe { + let mut error = ptr::null_mut(); + let _ = ffi::ges_pipeline_save_thumbnail(self.to_glib_none().0, width, height, format.to_glib_none().0, location.to_glib_none().0, &mut error); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + + fn set_mode(&self, mode: PipelineFlags) -> bool { + unsafe { + from_glib(ffi::ges_pipeline_set_mode(self.to_glib_none().0, mode.to_glib())) + } + } + + fn set_render_settings>(&self, output_uri: &str, profile: &P) -> bool { + unsafe { + from_glib(ffi::ges_pipeline_set_render_settings(self.to_glib_none().0, output_uri.to_glib_none().0, profile.to_glib_none().0)) + } + } + + fn set_timeline(&self, timeline: &Timeline) -> bool { + unsafe { + from_glib(ffi::ges_pipeline_set_timeline(self.to_glib_none().0, timeline.to_glib_full())) + } + } + + fn get_property_audio_filter(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "audio-filter".to_glib_none().0, value.to_glib_none_mut().0); + value.get() + } + } + + fn set_property_audio_filter + IsA + glib::value::SetValueOptional>(&self, audio_filter: Option<&P>) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "audio-filter".to_glib_none().0, Value::from(audio_filter).to_glib_none().0); + } + } + + fn get_property_audio_sink(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "audio-sink".to_glib_none().0, value.to_glib_none_mut().0); + value.get() + } + } + + fn set_property_audio_sink + IsA + glib::value::SetValueOptional>(&self, audio_sink: Option<&P>) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "audio-sink".to_glib_none().0, Value::from(audio_sink).to_glib_none().0); + } + } + + fn get_property_timeline(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "timeline".to_glib_none().0, value.to_glib_none_mut().0); + value.get() + } + } + + fn get_property_video_filter(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "video-filter".to_glib_none().0, value.to_glib_none_mut().0); + value.get() + } + } + + fn set_property_video_filter + IsA + glib::value::SetValueOptional>(&self, video_filter: Option<&P>) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "video-filter".to_glib_none().0, Value::from(video_filter).to_glib_none().0); + } + } + + fn get_property_video_sink(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "video-sink".to_glib_none().0, value.to_glib_none_mut().0); + value.get() + } + } + + fn set_property_video_sink + IsA + glib::value::SetValueOptional>(&self, video_sink: Option<&P>) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "video-sink".to_glib_none().0, Value::from(video_sink).to_glib_none().0); + } + } + + fn connect_property_audio_filter_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::audio-filter", + transmute(notify_audio_filter_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_audio_sink_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::audio-sink", + transmute(notify_audio_sink_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_mode_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::mode", + transmute(notify_mode_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::timeline", + transmute(notify_timeline_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_video_filter_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::video-filter", + transmute(notify_video_filter_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_video_sink_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::video-sink", + transmute(notify_video_sink_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_audio_filter_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_audio_sink_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_mode_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_timeline_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_video_filter_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_video_sink_trampoline

(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Pipeline::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/project.rs b/gstreamer-editing-services/src/auto/project.rs new file mode 100644 index 000000000..e6c6d4da0 --- /dev/null +++ b/gstreamer-editing-services/src/auto/project.rs @@ -0,0 +1,265 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Asset; +use Error; +use Timeline; +use ffi; +use glib; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst_pbutils; +use libc; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Project(Object): Asset; + + match fn { + get_type => || ffi::ges_project_get_type(), + } +} + +impl Project { + pub fn new<'a, P: Into>>(uri: P) -> Project { + assert_initialized_main_thread!(); + let uri = uri.into(); + let uri = uri.to_glib_none(); + unsafe { + from_glib_full(ffi::ges_project_new(uri.0)) + } + } +} + +pub trait ProjectExt { + fn add_asset>(&self, asset: &P) -> bool; + + fn add_encoding_profile>(&self, profile: &P) -> bool; + + fn create_asset<'a, P: Into>>(&self, id: P, extractable_type: glib::types::Type) -> bool; + + fn create_asset_sync<'a, P: Into>>(&self, id: P, extractable_type: glib::types::Type) -> Result, Error>; + + fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option; + + fn get_loading_assets(&self) -> Vec; + + fn get_uri(&self) -> Option; + + fn list_assets(&self, filter: glib::types::Type) -> Vec; + + fn list_encoding_profiles(&self) -> Vec; + + fn load(&self, timeline: &Timeline) -> Result<(), Error>; + + fn remove_asset>(&self, asset: &P) -> bool; + + fn save<'a, P: IsA + 'a, Q: Into>>(&self, timeline: &Timeline, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error>; + + fn connect_asset_added(&self, f: F) -> SignalHandlerId; + + fn connect_asset_loading(&self, f: F) -> SignalHandlerId; + + fn connect_asset_removed(&self, f: F) -> SignalHandlerId; + + fn connect_error_loading_asset(&self, f: F) -> SignalHandlerId; + + fn connect_loaded(&self, f: F) -> SignalHandlerId; + + fn connect_missing_uri Option + 'static>(&self, f: F) -> SignalHandlerId; + + fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> ProjectExt for O { + fn add_asset>(&self, asset: &P) -> bool { + unsafe { + from_glib(ffi::ges_project_add_asset(self.to_glib_none().0, asset.to_glib_none().0)) + } + } + + fn add_encoding_profile>(&self, profile: &P) -> bool { + unsafe { + from_glib(ffi::ges_project_add_encoding_profile(self.to_glib_none().0, profile.to_glib_none().0)) + } + } + + fn create_asset<'a, P: Into>>(&self, id: P, extractable_type: glib::types::Type) -> bool { + let id = id.into(); + let id = id.to_glib_none(); + unsafe { + from_glib(ffi::ges_project_create_asset(self.to_glib_none().0, id.0, extractable_type.to_glib())) + } + } + + fn create_asset_sync<'a, P: Into>>(&self, id: P, extractable_type: glib::types::Type) -> Result, Error> { + let id = id.into(); + let id = id.to_glib_none(); + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::ges_project_create_asset_sync(self.to_glib_none().0, id.0, extractable_type.to_glib(), &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + } + } + + fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option { + unsafe { + from_glib_full(ffi::ges_project_get_asset(self.to_glib_none().0, id.to_glib_none().0, extractable_type.to_glib())) + } + } + + fn get_loading_assets(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_project_get_loading_assets(self.to_glib_none().0)) + } + } + + fn get_uri(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_project_get_uri(self.to_glib_none().0)) + } + } + + fn list_assets(&self, filter: glib::types::Type) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_project_list_assets(self.to_glib_none().0, filter.to_glib())) + } + } + + fn list_encoding_profiles(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::ges_project_list_encoding_profiles(self.to_glib_none().0)) + } + } + + fn load(&self, timeline: &Timeline) -> Result<(), Error> { + unsafe { + let mut error = ptr::null_mut(); + let _ = ffi::ges_project_load(self.to_glib_none().0, timeline.to_glib_none().0, &mut error); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + + fn remove_asset>(&self, asset: &P) -> bool { + unsafe { + from_glib(ffi::ges_project_remove_asset(self.to_glib_none().0, asset.to_glib_none().0)) + } + } + + fn save<'a, P: IsA + 'a, Q: Into>>(&self, timeline: &Timeline, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error> { + let formatter_asset = formatter_asset.into(); + let formatter_asset = formatter_asset.to_glib_none(); + unsafe { + let mut error = ptr::null_mut(); + let _ = ffi::ges_project_save(self.to_glib_none().0, timeline.to_glib_none().0, uri.to_glib_none().0, formatter_asset.0, overwrite.to_glib(), &mut error); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + + fn connect_asset_added(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "asset-added", + transmute(asset_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_asset_loading(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "asset-loading", + transmute(asset_loading_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_asset_removed(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "asset-removed", + transmute(asset_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_error_loading_asset(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "error-loading-asset", + transmute(error_loading_asset_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_loaded(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "loaded", + transmute(loaded_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_missing_uri Option + 'static>(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_ Option + 'static>> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "missing-uri", + transmute(missing_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::uri", + transmute(notify_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn asset_added_trampoline

(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); + f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) +} + +unsafe extern "C" fn asset_loading_trampoline

(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); + f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) +} + +unsafe extern "C" fn asset_removed_trampoline

(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Asset) + 'static) = transmute(f); + f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(asset)) +} + +unsafe extern "C" fn error_loading_asset_trampoline

(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, id: *mut libc::c_char, extractable_type: glib_ffi::GType, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Error, &str, glib::types::Type) + 'static) = transmute(f); + f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(error), &String::from_glib_none(id), from_glib(extractable_type)) +} + +unsafe extern "C" fn loaded_trampoline

(this: *mut ffi::GESProject, timeline: *mut ffi::GESTimeline, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Timeline) + 'static) = transmute(f); + f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(timeline)) +} + +unsafe extern "C" fn missing_uri_trampoline

(this: *mut ffi::GESProject, error: *mut glib_ffi::GError, wrong_asset: *mut ffi::GESAsset, f: glib_ffi::gpointer) -> *mut libc::c_char +where P: IsA { + let f: &&(Fn(&P, &Error, &Asset) -> Option + 'static) = transmute(f); + f(&Project::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(error), &from_glib_borrow(wrong_asset)).to_glib_full() +} + +unsafe extern "C" fn notify_uri_trampoline

(this: *mut ffi::GESProject, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Project::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/timeline.rs b/gstreamer-editing-services/src/auto/timeline.rs new file mode 100644 index 000000000..86e2f2926 --- /dev/null +++ b/gstreamer-editing-services/src/auto/timeline.rs @@ -0,0 +1,460 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Asset; +use Error; +use Extractable; +use Group; +use Layer; +use TimelineElement; +use Track; +use TrackElement; +use ffi; +use glib; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use gst_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Timeline(Object): [ + gst::Element => gst_ffi::GstElement, + gst::Object => gst_ffi::GstObject, + Extractable, + ]; + + match fn { + get_type => || ffi::ges_timeline_get_type(), + } +} + +impl Timeline { + pub fn new() -> Timeline { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_timeline_new()) + } + } + + pub fn new_audio_video() -> Timeline { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_timeline_new_audio_video()) + } + } + + pub fn new_from_uri(uri: &str) -> Result, Error> { + assert_initialized_main_thread!(); + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::ges_timeline_new_from_uri(uri.to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + } + } +} + +impl Default for Timeline { + fn default() -> Self { + Self::new() + } +} + +pub trait TimelineExt { + fn add_layer(&self, layer: &Layer) -> bool; + + fn add_track>(&self, track: &P) -> bool; + + fn append_layer(&self) -> Layer; + + fn commit(&self) -> bool; + + fn commit_sync(&self) -> bool; + + fn get_auto_transition(&self) -> bool; + + fn get_duration(&self) -> gst::ClockTime; + + fn get_element(&self, name: &str) -> Option; + + fn get_groups(&self) -> Vec; + + fn get_layer(&self, priority: u32) -> Option; + + fn get_layers(&self) -> Vec; + + fn get_pad_for_track>(&self, track: &P) -> Option; + + fn get_snapping_distance(&self) -> gst::ClockTime; + + fn get_track_for_pad>(&self, pad: &P) -> Option; + + fn get_tracks(&self) -> Vec; + + fn is_empty(&self) -> bool; + + fn load_from_uri(&self, uri: &str) -> Result<(), Error>; + + fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> bool; + + fn paste_element>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option; + + fn remove_layer(&self, layer: &Layer) -> bool; + + fn remove_track>(&self, track: &P) -> bool; + + fn save_to_uri<'a, P: IsA + 'a, Q: Into>>(&self, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error>; + + fn set_auto_transition(&self, auto_transition: bool); + + fn set_snapping_distance(&self, snapping_distance: gst::ClockTime); + + fn connect_commited(&self, f: F) -> SignalHandlerId; + + fn connect_group_added(&self, f: F) -> SignalHandlerId; + + //fn connect_group_removed(&self, f: F) -> SignalHandlerId; + + fn connect_layer_added(&self, f: F) -> SignalHandlerId; + + fn connect_layer_removed(&self, f: F) -> SignalHandlerId; + + //fn connect_select_tracks_for_object(&self, f: F) -> SignalHandlerId; + + fn connect_snapping_ended(&self, f: F) -> SignalHandlerId; + + fn connect_snapping_started(&self, f: F) -> SignalHandlerId; + + fn connect_track_added(&self, f: F) -> SignalHandlerId; + + fn connect_track_removed(&self, f: F) -> SignalHandlerId; + + fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_snapping_distance_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> TimelineExt for O { + fn add_layer(&self, layer: &Layer) -> bool { + unsafe { + from_glib(ffi::ges_timeline_add_layer(self.to_glib_none().0, layer.to_glib_none().0)) + } + } + + fn add_track>(&self, track: &P) -> bool { + unsafe { + from_glib(ffi::ges_timeline_add_track(self.to_glib_none().0, track.to_glib_full())) + } + } + + fn append_layer(&self) -> Layer { + unsafe { + from_glib_none(ffi::ges_timeline_append_layer(self.to_glib_none().0)) + } + } + + fn commit(&self) -> bool { + unsafe { + from_glib(ffi::ges_timeline_commit(self.to_glib_none().0)) + } + } + + fn commit_sync(&self) -> bool { + unsafe { + from_glib(ffi::ges_timeline_commit_sync(self.to_glib_none().0)) + } + } + + fn get_auto_transition(&self) -> bool { + unsafe { + from_glib(ffi::ges_timeline_get_auto_transition(self.to_glib_none().0)) + } + } + + fn get_duration(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_timeline_get_duration(self.to_glib_none().0)) + } + } + + fn get_element(&self, name: &str) -> Option { + unsafe { + from_glib_full(ffi::ges_timeline_get_element(self.to_glib_none().0, name.to_glib_none().0)) + } + } + + fn get_groups(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(self.to_glib_none().0)) + } + } + + fn get_layer(&self, priority: u32) -> Option { + unsafe { + from_glib_full(ffi::ges_timeline_get_layer(self.to_glib_none().0, priority)) + } + } + + fn get_layers(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(self.to_glib_none().0)) + } + } + + fn get_pad_for_track>(&self, track: &P) -> Option { + unsafe { + from_glib_none(ffi::ges_timeline_get_pad_for_track(self.to_glib_none().0, track.to_glib_none().0)) + } + } + + fn get_snapping_distance(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_timeline_get_snapping_distance(self.to_glib_none().0)) + } + } + + fn get_track_for_pad>(&self, pad: &P) -> Option { + unsafe { + from_glib_none(ffi::ges_timeline_get_track_for_pad(self.to_glib_none().0, pad.to_glib_none().0)) + } + } + + fn get_tracks(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_tracks(self.to_glib_none().0)) + } + } + + fn is_empty(&self) -> bool { + unsafe { + from_glib(ffi::ges_timeline_is_empty(self.to_glib_none().0)) + } + } + + fn load_from_uri(&self, uri: &str) -> Result<(), Error> { + unsafe { + let mut error = ptr::null_mut(); + let _ = ffi::ges_timeline_load_from_uri(self.to_glib_none().0, uri.to_glib_none().0, &mut error); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + + fn move_layer(&self, layer: &Layer, new_layer_priority: u32) -> bool { + unsafe { + from_glib(ffi::ges_timeline_move_layer(self.to_glib_none().0, layer.to_glib_none().0, new_layer_priority)) + } + } + + fn paste_element>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option { + unsafe { + from_glib_none(ffi::ges_timeline_paste_element(self.to_glib_none().0, element.to_glib_none().0, position.to_glib(), layer_priority)) + } + } + + fn remove_layer(&self, layer: &Layer) -> bool { + unsafe { + from_glib(ffi::ges_timeline_remove_layer(self.to_glib_none().0, layer.to_glib_none().0)) + } + } + + fn remove_track>(&self, track: &P) -> bool { + unsafe { + from_glib(ffi::ges_timeline_remove_track(self.to_glib_none().0, track.to_glib_none().0)) + } + } + + fn save_to_uri<'a, P: IsA + 'a, Q: Into>>(&self, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error> { + let formatter_asset = formatter_asset.into(); + let formatter_asset = formatter_asset.to_glib_none(); + unsafe { + let mut error = ptr::null_mut(); + let _ = ffi::ges_timeline_save_to_uri(self.to_glib_none().0, uri.to_glib_none().0, formatter_asset.0, overwrite.to_glib(), &mut error); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + + fn set_auto_transition(&self, auto_transition: bool) { + unsafe { + ffi::ges_timeline_set_auto_transition(self.to_glib_none().0, auto_transition.to_glib()); + } + } + + fn set_snapping_distance(&self, snapping_distance: gst::ClockTime) { + unsafe { + ffi::ges_timeline_set_snapping_distance(self.to_glib_none().0, snapping_distance.to_glib()); + } + } + + fn connect_commited(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "commited", + transmute(commited_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_group_added(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "group-added", + transmute(group_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + //fn connect_group_removed(&self, f: F) -> SignalHandlerId { + // Empty ctype children: *.PtrArray TypeId { ns_id: 1, id: 51 } + //} + + fn connect_layer_added(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "layer-added", + transmute(layer_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_layer_removed(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "layer-removed", + transmute(layer_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + //fn connect_select_tracks_for_object(&self, f: F) -> SignalHandlerId { + // Empty ctype return value *.PtrArray TypeId { ns_id: 1, id: 16 } + //} + + fn connect_snapping_ended(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "snapping-ended", + transmute(snapping_ended_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_snapping_started(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "snapping-started", + transmute(snapping_started_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_track_added(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "track-added", + transmute(track_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_track_removed(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "track-removed", + transmute(track_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_auto_transition_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::auto-transition", + transmute(notify_auto_transition_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::duration", + transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_snapping_distance_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::snapping-distance", + transmute(notify_snapping_distance_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn commited_trampoline

(this: *mut ffi::GESTimeline, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn group_added_trampoline

(this: *mut ffi::GESTimeline, group: *mut ffi::GESGroup, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Group) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(group)) +} + +unsafe extern "C" fn layer_added_trampoline

(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Layer) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(layer)) +} + +unsafe extern "C" fn layer_removed_trampoline

(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Layer) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(layer)) +} + +unsafe extern "C" fn snapping_ended_trampoline

(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) +} + +unsafe extern "C" fn snapping_started_trampoline

(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &TrackElement, &TrackElement, u64) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(object), &from_glib_borrow(p0), p1) +} + +unsafe extern "C" fn track_added_trampoline

(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Track) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(track)) +} + +unsafe extern "C" fn track_removed_trampoline

(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &Track) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(track)) +} + +unsafe extern "C" fn notify_auto_transition_trampoline

(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_snapping_distance_trampoline

(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Timeline::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/timeline_element.rs b/gstreamer-editing-services/src/auto/timeline_element.rs new file mode 100644 index 000000000..626c14389 --- /dev/null +++ b/gstreamer-editing-services/src/auto/timeline_element.rs @@ -0,0 +1,495 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Extractable; +use Timeline; +use TrackType; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct TimelineElement(Object): Extractable; + + match fn { + get_type => || ffi::ges_timeline_element_get_type(), + } +} + +pub trait TimelineElementExt { + //fn add_child_property, Q: IsA>(&self, pspec: &P, child: &Q) -> bool; + + fn copy(&self, deep: bool) -> Option; + + //fn get_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); + + //fn get_child_property(&self, property_name: &str, value: /*Ignored*/glib::Value) -> bool; + + //fn get_child_property_by_pspec>(&self, pspec: &P, value: /*Ignored*/glib::Value); + + //fn get_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); + + fn get_duration(&self) -> gst::ClockTime; + + fn get_inpoint(&self) -> gst::ClockTime; + + fn get_max_duration(&self) -> gst::ClockTime; + + fn get_name(&self) -> Option; + + fn get_parent(&self) -> Option; + + fn get_priority(&self) -> u32; + + fn get_start(&self) -> gst::ClockTime; + + fn get_timeline(&self) -> Option; + + fn get_toplevel_parent(&self) -> Option; + + fn get_track_types(&self) -> TrackType; + + //fn list_children_properties(&self) -> /*Ignored*/Vec; + + //fn lookup_child(&self, prop_name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option; + + fn paste(&self, paste_position: gst::ClockTime) -> Option; + + //fn remove_child_property>(&self, pspec: &P) -> bool; + + fn ripple(&self, start: gst::ClockTime) -> bool; + + fn ripple_end(&self, end: gst::ClockTime) -> bool; + + fn roll_end(&self, end: gst::ClockTime) -> bool; + + fn roll_start(&self, start: gst::ClockTime) -> bool; + + //fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs); + + //fn set_child_property(&self, property_name: &str, value: /*Ignored*/&mut glib::Value) -> bool; + + //fn set_child_property_by_pspec>(&self, pspec: &P, value: /*Ignored*/&mut glib::Value); + + //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported); + + fn set_duration(&self, duration: gst::ClockTime); + + fn set_inpoint(&self, inpoint: gst::ClockTime); + + fn set_max_duration(&self, maxduration: gst::ClockTime); + + fn set_name<'a, P: Into>>(&self, name: P) -> bool; + + fn set_parent>(&self, parent: &P) -> bool; + + fn set_priority(&self, priority: u32); + + fn set_start(&self, start: gst::ClockTime); + + fn set_timeline(&self, timeline: &Timeline) -> bool; + + fn trim(&self, start: gst::ClockTime) -> bool; + + fn get_property_in_point(&self) -> u64; + + fn set_property_in_point(&self, in_point: u64); + + fn get_property_serialize(&self) -> bool; + + fn set_property_serialize(&self, serialize: bool); + + //fn connect_deep_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_name_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_parent_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_serialize_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_start_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> TimelineElementExt for O { + //fn add_child_property, Q: IsA>(&self, pspec: &P, child: &Q) -> bool { + // unsafe { TODO: call ffi::ges_timeline_element_add_child_property() } + //} + + fn copy(&self, deep: bool) -> Option { + unsafe { + from_glib_none(ffi::ges_timeline_element_copy(self.to_glib_none().0, deep.to_glib())) + } + } + + //fn get_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { + // unsafe { TODO: call ffi::ges_timeline_element_get_child_properties() } + //} + + //fn get_child_property(&self, property_name: &str, value: /*Ignored*/glib::Value) -> bool { + // unsafe { TODO: call ffi::ges_timeline_element_get_child_property() } + //} + + //fn get_child_property_by_pspec>(&self, pspec: &P, value: /*Ignored*/glib::Value) { + // unsafe { TODO: call ffi::ges_timeline_element_get_child_property_by_pspec() } + //} + + //fn get_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) { + // unsafe { TODO: call ffi::ges_timeline_element_get_child_property_valist() } + //} + + fn get_duration(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_timeline_element_get_duration(self.to_glib_none().0)) + } + } + + fn get_inpoint(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_timeline_element_get_inpoint(self.to_glib_none().0)) + } + } + + fn get_max_duration(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_timeline_element_get_max_duration(self.to_glib_none().0)) + } + } + + fn get_name(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_timeline_element_get_name(self.to_glib_none().0)) + } + } + + fn get_parent(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_timeline_element_get_parent(self.to_glib_none().0)) + } + } + + fn get_priority(&self) -> u32 { + unsafe { + ffi::ges_timeline_element_get_priority(self.to_glib_none().0) + } + } + + fn get_start(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_timeline_element_get_start(self.to_glib_none().0)) + } + } + + fn get_timeline(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_timeline_element_get_timeline(self.to_glib_none().0)) + } + } + + fn get_toplevel_parent(&self) -> Option { + unsafe { + from_glib_full(ffi::ges_timeline_element_get_toplevel_parent(self.to_glib_none().0)) + } + } + + fn get_track_types(&self) -> TrackType { + unsafe { + from_glib(ffi::ges_timeline_element_get_track_types(self.to_glib_none().0)) + } + } + + //fn list_children_properties(&self) -> /*Ignored*/Vec { + // unsafe { TODO: call ffi::ges_timeline_element_list_children_properties() } + //} + + //fn lookup_child(&self, prop_name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option { + // unsafe { TODO: call ffi::ges_timeline_element_lookup_child() } + //} + + fn paste(&self, paste_position: gst::ClockTime) -> Option { + unsafe { + from_glib_none(ffi::ges_timeline_element_paste(self.to_glib_none().0, paste_position.to_glib())) + } + } + + //fn remove_child_property>(&self, pspec: &P) -> bool { + // unsafe { TODO: call ffi::ges_timeline_element_remove_child_property() } + //} + + fn ripple(&self, start: gst::ClockTime) -> bool { + unsafe { + from_glib(ffi::ges_timeline_element_ripple(self.to_glib_none().0, start.to_glib())) + } + } + + fn ripple_end(&self, end: gst::ClockTime) -> bool { + unsafe { + from_glib(ffi::ges_timeline_element_ripple_end(self.to_glib_none().0, end.to_glib())) + } + } + + fn roll_end(&self, end: gst::ClockTime) -> bool { + unsafe { + from_glib(ffi::ges_timeline_element_roll_end(self.to_glib_none().0, end.to_glib())) + } + } + + fn roll_start(&self, start: gst::ClockTime) -> bool { + unsafe { + from_glib(ffi::ges_timeline_element_roll_start(self.to_glib_none().0, start.to_glib())) + } + } + + //fn set_child_properties(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { + // unsafe { TODO: call ffi::ges_timeline_element_set_child_properties() } + //} + + //fn set_child_property(&self, property_name: &str, value: /*Ignored*/&mut glib::Value) -> bool { + // unsafe { TODO: call ffi::ges_timeline_element_set_child_property() } + //} + + //fn set_child_property_by_pspec>(&self, pspec: &P, value: /*Ignored*/&mut glib::Value) { + // unsafe { TODO: call ffi::ges_timeline_element_set_child_property_by_pspec() } + //} + + //fn set_child_property_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) { + // unsafe { TODO: call ffi::ges_timeline_element_set_child_property_valist() } + //} + + fn set_duration(&self, duration: gst::ClockTime) { + unsafe { + ffi::ges_timeline_element_set_duration(self.to_glib_none().0, duration.to_glib()); + } + } + + fn set_inpoint(&self, inpoint: gst::ClockTime) { + unsafe { + ffi::ges_timeline_element_set_inpoint(self.to_glib_none().0, inpoint.to_glib()); + } + } + + fn set_max_duration(&self, maxduration: gst::ClockTime) { + unsafe { + ffi::ges_timeline_element_set_max_duration(self.to_glib_none().0, maxduration.to_glib()); + } + } + + fn set_name<'a, P: Into>>(&self, name: P) -> bool { + let name = name.into(); + let name = name.to_glib_none(); + unsafe { + from_glib(ffi::ges_timeline_element_set_name(self.to_glib_none().0, name.0)) + } + } + + fn set_parent>(&self, parent: &P) -> bool { + unsafe { + from_glib(ffi::ges_timeline_element_set_parent(self.to_glib_none().0, parent.to_glib_none().0)) + } + } + + fn set_priority(&self, priority: u32) { + unsafe { + ffi::ges_timeline_element_set_priority(self.to_glib_none().0, priority); + } + } + + fn set_start(&self, start: gst::ClockTime) { + unsafe { + ffi::ges_timeline_element_set_start(self.to_glib_none().0, start.to_glib()); + } + } + + fn set_timeline(&self, timeline: &Timeline) -> bool { + unsafe { + from_glib(ffi::ges_timeline_element_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0)) + } + } + + fn trim(&self, start: gst::ClockTime) -> bool { + unsafe { + from_glib(ffi::ges_timeline_element_trim(self.to_glib_none().0, start.to_glib())) + } + } + + fn get_property_in_point(&self) -> u64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "in-point".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn set_property_in_point(&self, in_point: u64) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "in-point".to_glib_none().0, Value::from(&in_point).to_glib_none().0); + } + } + + fn get_property_serialize(&self) -> bool { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "serialize".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn set_property_serialize(&self, serialize: bool) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "serialize".to_glib_none().0, Value::from(&serialize).to_glib_none().0); + } + } + + //fn connect_deep_notify(&self, f: F) -> SignalHandlerId { + // Ignored prop: GObject.ParamSpec + //} + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::duration", + transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_in_point_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::in-point", + transmute(notify_in_point_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_max_duration_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::max-duration", + transmute(notify_max_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_name_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::name", + transmute(notify_name_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_parent_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::parent", + transmute(notify_parent_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_priority_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::priority", + transmute(notify_priority_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_serialize_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::serialize", + transmute(notify_serialize_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_start_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::start", + transmute(notify_start_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_timeline_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::timeline", + transmute(notify_timeline_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_in_point_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_max_duration_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_name_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_parent_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_priority_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_serialize_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_start_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_timeline_trampoline

(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TimelineElement::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/track.rs b/gstreamer-editing-services/src/auto/track.rs new file mode 100644 index 000000000..95f81764b --- /dev/null +++ b/gstreamer-editing-services/src/auto/track.rs @@ -0,0 +1,300 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Timeline; +use TrackElement; +use TrackType; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use gst_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct Track(Object): [ + gst::Element => gst_ffi::GstElement, + gst::Object => gst_ffi::GstObject, + ]; + + match fn { + get_type => || ffi::ges_track_get_type(), + } +} + +impl Track { + pub fn new(type_: TrackType, caps: &gst::Caps) -> Track { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_track_new(type_.to_glib(), caps.to_glib_full())) + } + } +} + +pub trait TrackExt { + fn add_element>(&self, object: &P) -> bool; + + fn commit(&self) -> bool; + + fn get_caps(&self) -> Option; + + fn get_elements(&self) -> Vec; + + fn get_mixing(&self) -> bool; + + fn get_timeline(&self) -> Option; + + fn remove_element>(&self, object: &P) -> bool; + + //fn set_create_element_for_gap_func(&self, func: /*Unknown conversion*//*Unimplemented*/CreateElementForGapFunc); + + fn set_mixing(&self, mixing: bool); + + fn set_restriction_caps(&self, caps: &gst::Caps); + + fn set_timeline(&self, timeline: &Timeline); + + fn update_restriction_caps(&self, caps: &gst::Caps); + + fn get_property_duration(&self) -> u64; + + fn get_property_restriction_caps(&self) -> Option; + + fn get_property_track_type(&self) -> TrackType; + + fn connect_commited(&self, f: F) -> SignalHandlerId; + + fn connect_track_element_added(&self, f: F) -> SignalHandlerId; + + fn connect_track_element_removed(&self, f: F) -> SignalHandlerId; + + fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_mixing_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_restriction_caps_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_track_type_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> TrackExt for O { + fn add_element>(&self, object: &P) -> bool { + unsafe { + from_glib(ffi::ges_track_add_element(self.to_glib_none().0, object.to_glib_none().0)) + } + } + + fn commit(&self) -> bool { + unsafe { + from_glib(ffi::ges_track_commit(self.to_glib_none().0)) + } + } + + fn get_caps(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_track_get_caps(self.to_glib_none().0)) + } + } + + fn get_elements(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ges_track_get_elements(self.to_glib_none().0)) + } + } + + fn get_mixing(&self) -> bool { + unsafe { + from_glib(ffi::ges_track_get_mixing(self.to_glib_none().0)) + } + } + + fn get_timeline(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_track_get_timeline(self.to_glib_none().0)) + } + } + + fn remove_element>(&self, object: &P) -> bool { + unsafe { + from_glib(ffi::ges_track_remove_element(self.to_glib_none().0, object.to_glib_none().0)) + } + } + + //fn set_create_element_for_gap_func(&self, func: /*Unknown conversion*//*Unimplemented*/CreateElementForGapFunc) { + // unsafe { TODO: call ffi::ges_track_set_create_element_for_gap_func() } + //} + + fn set_mixing(&self, mixing: bool) { + unsafe { + ffi::ges_track_set_mixing(self.to_glib_none().0, mixing.to_glib()); + } + } + + fn set_restriction_caps(&self, caps: &gst::Caps) { + unsafe { + ffi::ges_track_set_restriction_caps(self.to_glib_none().0, caps.to_glib_none().0); + } + } + + fn set_timeline(&self, timeline: &Timeline) { + unsafe { + ffi::ges_track_set_timeline(self.to_glib_none().0, timeline.to_glib_none().0); + } + } + + fn update_restriction_caps(&self, caps: &gst::Caps) { + unsafe { + ffi::ges_track_update_restriction_caps(self.to_glib_none().0, caps.to_glib_none().0); + } + } + + fn get_property_duration(&self) -> u64 { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "duration".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn get_property_restriction_caps(&self) -> Option { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "restriction-caps".to_glib_none().0, value.to_glib_none_mut().0); + value.get() + } + } + + fn get_property_track_type(&self) -> TrackType { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "track-type".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn connect_commited(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "commited", + transmute(commited_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_track_element_added(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "track-element-added", + transmute(track_element_added_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_track_element_removed(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "track-element-removed", + transmute(track_element_removed_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_caps_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::caps", + transmute(notify_caps_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::duration", + transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_mixing_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::mixing", + transmute(notify_mixing_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_restriction_caps_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::restriction-caps", + transmute(notify_restriction_caps_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_track_type_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::track-type", + transmute(notify_track_type_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn commited_trampoline

(this: *mut ffi::GESTrack, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn track_element_added_trampoline

(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(effect)) +} + +unsafe extern "C" fn track_element_removed_trampoline

(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P, &TrackElement) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked(), &from_glib_borrow(effect)) +} + +unsafe extern "C" fn notify_caps_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_mixing_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_restriction_caps_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_track_type_trampoline

(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&Track::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/track_element.rs b/gstreamer-editing-services/src/auto/track_element.rs new file mode 100644 index 000000000..6d4d88ef0 --- /dev/null +++ b/gstreamer-editing-services/src/auto/track_element.rs @@ -0,0 +1,221 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Edge; +use EditMode; +use Extractable; +use Layer; +use TimelineElement; +use Track; +use TrackType; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct TrackElement(Object): TimelineElement, Extractable; + + match fn { + get_type => || ffi::ges_track_element_get_type(), + } +} + +pub trait TrackElementExt { + fn add_children_props>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]); + + fn edit(&self, layers: &[Layer], mode: EditMode, edge: Edge, position: u64) -> bool; + + //fn get_all_control_bindings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 6, id: 83 }; + + //fn get_control_binding(&self, property_name: &str) -> /*Ignored*/Option; + + fn get_element(&self) -> Option; + + fn get_gnlobject(&self) -> Option; + + fn get_nleobject(&self) -> Option; + + fn get_track(&self) -> Option; + + fn get_track_type(&self) -> TrackType; + + fn is_active(&self) -> bool; + + //fn lookup_child(&self, prop_name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option; + + fn remove_control_binding(&self, property_name: &str) -> bool; + + fn set_active(&self, active: bool) -> bool; + + //fn set_control_source(&self, source: /*Ignored*/&gst::ControlSource, property_name: &str, binding_type: &str) -> bool; + + fn set_track_type(&self, type_: TrackType); + + fn get_property_active(&self) -> bool; + + //fn connect_control_binding_added(&self, f: F) -> SignalHandlerId; + + //fn connect_control_binding_removed(&self, f: F) -> SignalHandlerId; + + fn connect_property_active_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_track_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_track_type_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> TrackElementExt for O { + fn add_children_props>(&self, element: &P, wanted_categories: &[&str], blacklist: &[&str], whitelist: &[&str]) { + unsafe { + ffi::ges_track_element_add_children_props(self.to_glib_none().0, element.to_glib_none().0, wanted_categories.to_glib_none().0, blacklist.to_glib_none().0, whitelist.to_glib_none().0); + } + } + + fn edit(&self, layers: &[Layer], mode: EditMode, edge: Edge, position: u64) -> bool { + unsafe { + from_glib(ffi::ges_track_element_edit(self.to_glib_none().0, layers.to_glib_none().0, mode.to_glib(), edge.to_glib(), position)) + } + } + + //fn get_all_control_bindings(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 6, id: 83 } { + // unsafe { TODO: call ffi::ges_track_element_get_all_control_bindings() } + //} + + //fn get_control_binding(&self, property_name: &str) -> /*Ignored*/Option { + // unsafe { TODO: call ffi::ges_track_element_get_control_binding() } + //} + + fn get_element(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_track_element_get_element(self.to_glib_none().0)) + } + } + + fn get_gnlobject(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_track_element_get_gnlobject(self.to_glib_none().0)) + } + } + + fn get_nleobject(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_track_element_get_nleobject(self.to_glib_none().0)) + } + } + + fn get_track(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_track_element_get_track(self.to_glib_none().0)) + } + } + + fn get_track_type(&self) -> TrackType { + unsafe { + from_glib(ffi::ges_track_element_get_track_type(self.to_glib_none().0)) + } + } + + fn is_active(&self) -> bool { + unsafe { + from_glib(ffi::ges_track_element_is_active(self.to_glib_none().0)) + } + } + + //fn lookup_child(&self, prop_name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option { + // unsafe { TODO: call ffi::ges_track_element_lookup_child() } + //} + + fn remove_control_binding(&self, property_name: &str) -> bool { + unsafe { + from_glib(ffi::ges_track_element_remove_control_binding(self.to_glib_none().0, property_name.to_glib_none().0)) + } + } + + fn set_active(&self, active: bool) -> bool { + unsafe { + from_glib(ffi::ges_track_element_set_active(self.to_glib_none().0, active.to_glib())) + } + } + + //fn set_control_source(&self, source: /*Ignored*/&gst::ControlSource, property_name: &str, binding_type: &str) -> bool { + // unsafe { TODO: call ffi::ges_track_element_set_control_source() } + //} + + fn set_track_type(&self, type_: TrackType) { + unsafe { + ffi::ges_track_element_set_track_type(self.to_glib_none().0, type_.to_glib()); + } + } + + fn get_property_active(&self) -> bool { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "active".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + //fn connect_control_binding_added(&self, f: F) -> SignalHandlerId { + // Ignored control_binding: Gst.ControlBinding + //} + + //fn connect_control_binding_removed(&self, f: F) -> SignalHandlerId { + // Ignored control_binding: Gst.ControlBinding + //} + + fn connect_property_active_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::active", + transmute(notify_active_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_track_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::track", + transmute(notify_track_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_track_type_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::track-type", + transmute(notify_track_type_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_active_trampoline

(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_track_trampoline

(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_track_type_trampoline

(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&TrackElement::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/uri_clip.rs b/gstreamer-editing-services/src/auto/uri_clip.rs new file mode 100644 index 000000000..1679623d9 --- /dev/null +++ b/gstreamer-editing-services/src/auto/uri_clip.rs @@ -0,0 +1,168 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Clip; +use Container; +use Extractable; +use TimelineElement; +use ffi; +use glib; +use glib::StaticType; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct UriClip(Object): Clip, Container, TimelineElement, Extractable; + + match fn { + get_type => || ffi::ges_uri_clip_get_type(), + } +} + +impl UriClip { + pub fn new(uri: &str) -> UriClip { + assert_initialized_main_thread!(); + unsafe { + from_glib_none(ffi::ges_uri_clip_new(uri.to_glib_none().0)) + } + } +} + +pub trait UriClipExt { + fn get_uri(&self) -> Option; + + fn is_image(&self) -> bool; + + fn is_muted(&self) -> bool; + + fn set_is_image(&self, is_image: bool); + + fn set_mute(&self, mute: bool); + + fn get_property_is_image(&self) -> bool; + + fn get_property_mute(&self) -> bool; + + fn connect_property_is_image_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId; + + fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> UriClipExt for O { + fn get_uri(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_uri_clip_get_uri(self.to_glib_none().0)) + } + } + + fn is_image(&self) -> bool { + unsafe { + from_glib(ffi::ges_uri_clip_is_image(self.to_glib_none().0)) + } + } + + fn is_muted(&self) -> bool { + unsafe { + from_glib(ffi::ges_uri_clip_is_muted(self.to_glib_none().0)) + } + } + + fn set_is_image(&self, is_image: bool) { + unsafe { + ffi::ges_uri_clip_set_is_image(self.to_glib_none().0, is_image.to_glib()); + } + } + + fn set_mute(&self, mute: bool) { + unsafe { + ffi::ges_uri_clip_set_mute(self.to_glib_none().0, mute.to_glib()); + } + } + + fn get_property_is_image(&self) -> bool { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "is-image".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn get_property_mute(&self) -> bool { + unsafe { + let mut value = Value::from_type(::static_type()); + gobject_ffi::g_object_get_property(self.to_glib_none().0, "mute".to_glib_none().0, value.to_glib_none_mut().0); + value.get().unwrap() + } + } + + fn connect_property_is_image_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::is-image", + transmute(notify_is_image_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_mute_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::mute", + transmute(notify_mute_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_supported_formats_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::supported-formats", + transmute(notify_supported_formats_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } + + fn connect_property_uri_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::uri", + transmute(notify_uri_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_is_image_trampoline

(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&UriClip::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_mute_trampoline

(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&UriClip::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_supported_formats_trampoline

(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&UriClip::from_glib_borrow(this).downcast_unchecked()) +} + +unsafe extern "C" fn notify_uri_trampoline

(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&UriClip::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/uri_clip_asset.rs b/gstreamer-editing-services/src/auto/uri_clip_asset.rs new file mode 100644 index 000000000..188a805eb --- /dev/null +++ b/gstreamer-editing-services/src/auto/uri_clip_asset.rs @@ -0,0 +1,106 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Asset; +use Error; +use UriSourceAsset; +use ffi; +use glib; +use glib::Value; +use glib::object::Downcast; +use glib::object::IsA; +use glib::signal::SignalHandlerId; +use glib::signal::connect; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst; +use gst_pbutils; +use std::boxed::Box as Box_; +use std::mem; +use std::mem::transmute; +use std::ptr; + +glib_wrapper! { + pub struct UriClipAsset(Object): Asset; + + match fn { + get_type => || ffi::ges_uri_clip_asset_get_type(), + } +} + +impl UriClipAsset { + //pub fn new<'a, P: Into>, Q: /*Unimplemented*/gio::AsyncReadyCallback>(uri: &str, cancellable: P, callback: Q) { + // unsafe { TODO: call ffi::ges_uri_clip_asset_new() } + //} + + pub fn request_sync(uri: &str) -> Result, Error> { + assert_initialized_main_thread!(); + unsafe { + let mut error = ptr::null_mut(); + let ret = ffi::ges_uri_clip_asset_request_sync(uri.to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + } + } +} + +pub trait UriClipAssetExt { + fn get_duration(&self) -> gst::ClockTime; + + fn get_info(&self) -> Option; + + fn get_stream_assets(&self) -> Vec; + + fn is_image(&self) -> bool; + + fn set_property_duration(&self, duration: u64); + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId; +} + +impl + IsA> UriClipAssetExt for O { + fn get_duration(&self) -> gst::ClockTime { + unsafe { + from_glib(ffi::ges_uri_clip_asset_get_duration(self.to_glib_none().0)) + } + } + + fn get_info(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_uri_clip_asset_get_info(const_override(self.to_glib_none().0))) + } + } + + fn get_stream_assets(&self) -> Vec { + unsafe { + FromGlibPtrContainer::from_glib_none(ffi::ges_uri_clip_asset_get_stream_assets(self.to_glib_none().0)) + } + } + + fn is_image(&self) -> bool { + unsafe { + from_glib(ffi::ges_uri_clip_asset_is_image(self.to_glib_none().0)) + } + } + + fn set_property_duration(&self, duration: u64) { + unsafe { + gobject_ffi::g_object_set_property(self.to_glib_none().0, "duration".to_glib_none().0, Value::from(&duration).to_glib_none().0); + } + } + + fn connect_property_duration_notify(&self, f: F) -> SignalHandlerId { + unsafe { + let f: Box_> = Box_::new(Box_::new(f)); + connect(self.to_glib_none().0, "notify::duration", + transmute(notify_duration_trampoline:: as usize), Box_::into_raw(f) as *mut _) + } + } +} + +unsafe extern "C" fn notify_duration_trampoline

(this: *mut ffi::GESUriClipAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer) +where P: IsA { + let f: &&(Fn(&P) + 'static) = transmute(f); + f(&UriClipAsset::from_glib_borrow(this).downcast_unchecked()) +} diff --git a/gstreamer-editing-services/src/auto/uri_source_asset.rs b/gstreamer-editing-services/src/auto/uri_source_asset.rs new file mode 100644 index 000000000..135027ee0 --- /dev/null +++ b/gstreamer-editing-services/src/auto/uri_source_asset.rs @@ -0,0 +1,50 @@ +// This file was generated by gir (https://github.com/gtk-rs/gir) +// from gir-files (https://github.com/gtk-rs/gir-files) +// DO NOT EDIT + +use Asset; +use UriClipAsset; +use ffi; +use glib::object::IsA; +use glib::translate::*; +use glib_ffi; +use gobject_ffi; +use gst_pbutils; +use std::mem; +use std::ptr; + +glib_wrapper! { + pub struct UriSourceAsset(Object): Asset; + + match fn { + get_type => || ffi::ges_uri_source_asset_get_type(), + } +} + +pub trait UriSourceAssetExt { + fn get_filesource_asset(&self) -> Option; + + fn get_stream_info(&self) -> Option; + + fn get_stream_uri(&self) -> Option; +} + +impl> UriSourceAssetExt for O { + fn get_filesource_asset(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_uri_source_asset_get_filesource_asset(self.to_glib_none().0)) + } + } + + fn get_stream_info(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_uri_source_asset_get_stream_info(self.to_glib_none().0)) + } + } + + fn get_stream_uri(&self) -> Option { + unsafe { + from_glib_none(ffi::ges_uri_source_asset_get_stream_uri(self.to_glib_none().0)) + } + } +} diff --git a/gstreamer-editing-services/src/auto/versions.txt b/gstreamer-editing-services/src/auto/versions.txt new file mode 100644 index 000000000..8cf93d600 --- /dev/null +++ b/gstreamer-editing-services/src/auto/versions.txt @@ -0,0 +1,2 @@ +Generated by gir (https://github.com/gtk-rs/gir @ f5fca82) +from gir-files (https://github.com/gtk-rs/gir-files @ ???) diff --git a/gstreamer-editing-services/src/lib.rs b/gstreamer-editing-services/src/lib.rs new file mode 100644 index 000000000..ffb62175d --- /dev/null +++ b/gstreamer-editing-services/src/lib.rs @@ -0,0 +1,90 @@ +// Copyright (C) 2018 Thibault Saunier +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate libc; + +use std::sync::{Once, ONCE_INIT}; + +extern crate gio_sys as gio_ffi; +extern crate glib_sys as glib_ffi; +extern crate gobject_sys as gobject_ffi; +extern crate gstreamer as gst; +extern crate gstreamer_base as gst_base; +extern crate gstreamer_base_sys as gst_base_ffi; +extern crate gstreamer_editing_services_sys as ffi; +extern crate gstreamer_pbutils as gst_pbutils; +extern crate gstreamer_pbutils_sys as gst_pbutils_ffi; +extern crate gstreamer_sys as gst_ffi; + +use glib::translate::from_glib; + +#[macro_use] +extern crate glib; +extern crate gio; + +static GES_INIT: Once = ONCE_INIT; + +pub use glib::{ + BoolError, Cast, Continue, Error, IsA, StaticType, ToValue, Type, TypedValue, Value, +}; + +pub fn init() -> Result<(), BoolError> { + if gst::init().is_err() { + return Err(BoolError("Could not initialize GStreamer.")); + } + + unsafe { + if from_glib(ffi::ges_init()) { + Ok(()) + } else { + Err(BoolError("Could not initialize GES.")) + } + } +} + +pub unsafe fn deinit() { + ffi::ges_deinit(); +} + +macro_rules! assert_initialized_main_thread { + () => { + if unsafe { ::gst_ffi::gst_is_initialized() } != ::glib_ffi::GTRUE { + panic!("GStreamer has not been initialized. Call `gst::init` first."); + } + ::GES_INIT.call_once(|| { + unsafe { ::ffi::ges_init() }; + }); + }; +} + +macro_rules! skip_assert_initialized { + () => {}; +} + +#[cfg_attr(feature = "cargo-clippy", allow(unreadable_literal))] +#[cfg_attr(feature = "cargo-clippy", allow(transmute_ptr_to_ref))] +#[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] +#[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))] +mod auto; +pub use auto::*; + +#[macro_use] +extern crate bitflags; + +mod timeline_element; +pub use timeline_element::TimelineElementExtManual; + +// Re-export all the traits in a prelude module, so that applications +// can always "use gst::prelude::*" without getting conflicts +pub mod prelude { + pub use glib::prelude::*; + pub use gst::prelude::*; + pub use timeline_element::TimelineElementExtManual; + + pub use auto::traits::*; +} diff --git a/gstreamer-editing-services/src/timeline_element.rs b/gstreamer-editing-services/src/timeline_element.rs new file mode 100644 index 000000000..dd8b6e577 --- /dev/null +++ b/gstreamer-editing-services/src/timeline_element.rs @@ -0,0 +1,66 @@ +// Copyright (C) 2018 Thibault Saunier +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use ffi; +use glib; +use glib::object::IsA; +use glib::translate::*; +use std::ptr; +use TimelineElement; + +pub trait TimelineElementExtManual { + fn get_child_property(&self, name: &str) -> Option; + fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError>; +} + +impl> TimelineElementExtManual for O { + fn get_child_property(&self, name: &str) -> Option { + unsafe { + let found: bool = from_glib(ffi::ges_timeline_element_lookup_child( + self.to_glib_none().0, + name.to_glib_none().0, + ptr::null_mut(), + ptr::null_mut(), + )); + if !found { + return None; + } + + let mut value = glib::Value::uninitialized(); + ffi::ges_timeline_element_get_child_property( + self.to_glib_none().0, + name.to_glib_none().0, + value.to_glib_none_mut().0, + ); + Some(value) + } + } + + fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError> { + unsafe { + let found: bool = from_glib(ffi::ges_timeline_element_lookup_child( + self.to_glib_none().0, + name.to_glib_none().0, + ptr::null_mut(), + ptr::null_mut(), + )); + if !found { + return Err(glib::BoolError("Child property not found")); + } + + let value = value.to_value(); + ffi::ges_timeline_element_set_child_property( + self.to_glib_none().0, + name.to_glib_none().0, + value.to_glib_none().0, + ); + + Ok(()) + } + } +}