Generate bindings for the GStreamer Editing Services

This commit is contained in:
Thibault Saunier 2018-10-31 13:10:30 -03:00 committed by Sebastian Dröge
parent a17449e2be
commit 0d5ea8e452
32 changed files with 4528 additions and 0 deletions

View file

@ -11,4 +11,5 @@ ignore = [
"gstreamer-sdp/src/auto", "gstreamer-sdp/src/auto",
"gstreamer-video/src/auto", "gstreamer-video/src/auto",
"gstreamer-webrtc/src/auto", "gstreamer-webrtc/src/auto",
"gstreamer-editing-services/src/auto",
] ]

View file

@ -14,6 +14,7 @@ members = [
"gstreamer-pbutils", "gstreamer-pbutils",
"gstreamer-webrtc", "gstreamer-webrtc",
"gstreamer-check", "gstreamer-check",
"gstreamer-editing-services",
"examples", "examples",
"tutorials", "tutorials",
] ]

110
Gir_GstEditingServices.toml Normal file
View file

@ -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"

View file

View file

@ -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 = { version = "0.12", path = "../gstreamer-rtsp", optional = true }
gstreamer-rtsp-server = { version = "0.12", path = "../gstreamer-rtsp-server", 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-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 } gtk = { version = "0.5", features = ["v3_6"], optional = true }
gdk = { version = "0.9", optional = true } gdk = { version = "0.9", optional = true }
gio = { version = "0.5", optional = true } gio = { version = "0.5", optional = true }
@ -27,6 +28,7 @@ pangocairo = { version = "0.6", optional = true }
[features] [features]
gst-player = ["gstreamer-player"] gst-player = ["gstreamer-player"]
ges = ["gstreamer-editing-services"]
gtksink = ["gtk", "gio"] gtksink = ["gtk", "gio"]
gtkvideooverlay = ["gtk", "gdk", "gio"] gtkvideooverlay = ["gtk", "gdk", "gio"]
gtkvideooverlay-x11 = ["gtkvideooverlay"] gtkvideooverlay-x11 = ["gtkvideooverlay"]
@ -118,3 +120,7 @@ name = "discoverer"
[[bin]] [[bin]]
name = "pango-cairo" name = "pango-cairo"
required-features = ["pango-cairo"] required-features = ["pango-cairo"]
[[bin]]
name = "ges"
required-features = ["ges"]

105
examples/src/bin/ges.rs Normal file
View file

@ -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::<ges::UriClipAsset>()
.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);
}

View file

@ -0,0 +1,47 @@
[package]
name = "gstreamer-editing-services"
version = "0.13.0"
authors = ["Thibault Saunier <tsaunier@igalia.com>", "Sebastian Dröge <sebastian@centricular.com>"]
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" }

View file

@ -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)
<a name="installation"/>
## 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.
<a name="installation-linux"/>
### 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.
<a name="installation-macos"/>
### 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}"
```
<a name="installation-windows"/>
### 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}"
```
<a name="getting-started"/>
## 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.
<a name="license"/>
## 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
<a name="contribution"/>
## 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.

View file

@ -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() {}

View file

@ -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<ffi::GESAsset, ffi::GESAssetClass>);
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<Option<&'a str>>>(extractable_type: glib::types::Type, id: P) -> Result<Option<Asset>, 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<Option<&'a gio::Cancellable>>, Q: FnOnce(Result<Asset, Error>) + 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<Q>> = Box::new(Box::new(callback));
unsafe extern "C" fn request_async_trampoline<Q: FnOnce(Result<Asset, Error>) + 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<Q>> = Box::from_raw(user_data as *mut _);
callback(result);
}
let callback = request_async_trampoline::<Q>;
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_<futures_core::Future<Item = Asset, Error = Error>> {
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<Option<Extractable>, Error>;
fn get_error(&self) -> Option<Error>;
fn get_extractable_type(&self) -> glib::types::Type;
fn get_id(&self) -> Option<String>;
fn get_proxy(&self) -> Option<Asset>;
fn get_proxy_target(&self) -> Option<Asset>;
fn list_proxies(&self) -> Vec<Asset>;
fn set_proxy<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, proxy: Q) -> bool;
fn unproxy<P: IsA<Asset>>(&self, proxy: &P) -> bool;
fn set_property_proxy_target<P: IsA<Asset> + IsA<glib::object::Object> + glib::value::SetValueOptional>(&self, proxy_target: Option<&P>);
fn connect_property_extractable_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_proxy_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Asset> + IsA<glib::object::Object>> AssetExt for O {
fn extract(&self) -> Result<Option<Extractable>, 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<Error> {
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<String> {
unsafe {
from_glib_none(ffi::ges_asset_get_id(self.to_glib_none().0))
}
}
fn get_proxy(&self) -> Option<Asset> {
unsafe {
from_glib_none(ffi::ges_asset_get_proxy(self.to_glib_none().0))
}
}
fn get_proxy_target(&self) -> Option<Asset> {
unsafe {
from_glib_none(ffi::ges_asset_get_proxy_target(self.to_glib_none().0))
}
}
fn list_proxies(&self) -> Vec<Asset> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::ges_asset_list_proxies(self.to_glib_none().0))
}
}
fn set_proxy<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&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<P: IsA<Asset>>(&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<P: IsA<Asset> + IsA<glib::object::Object> + 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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::extractable-type",
transmute(notify_extractable_type_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::id",
transmute(notify_id_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_proxy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::proxy",
transmute(notify_proxy_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_proxy_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::proxy-target",
transmute(notify_proxy_target_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_extractable_type_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Asset> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Asset::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_id_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Asset> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Asset::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_proxy_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Asset> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Asset::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_proxy_target_trampoline<P>(this: *mut ffi::GESAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Asset> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Asset::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESBaseEffect, ffi::GESBaseEffectClass>): TrackElement, TimelineElement, Extractable;
match fn {
get_type => || ffi::ges_base_effect_get_type(),
}
}
impl BaseEffect {}

View file

@ -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<ffi::GESClip, ffi::GESClipClass>): Container, TimelineElement, Extractable;
match fn {
get_type => || ffi::ges_clip_get_type(),
}
}
pub trait ClipExt {
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Option<TrackElement>;
fn find_track_element<'a, P: IsA<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, type_: glib::types::Type) -> Option<TrackElement>;
fn find_track_elements<'a, P: IsA<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, track_type: TrackType, type_: glib::types::Type) -> Vec<TrackElement>;
fn get_layer(&self) -> Option<Layer>;
fn get_supported_formats(&self) -> TrackType;
fn get_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P) -> i32;
fn get_top_effect_position<P: IsA<BaseEffect>>(&self, effect: &P) -> i32;
fn get_top_effects(&self) -> Vec<TrackElement>;
fn move_to_layer(&self, layer: &Layer) -> bool;
fn set_supported_formats(&self, supportedformats: TrackType);
fn set_top_effect_index<P: IsA<BaseEffect>>(&self, effect: &P, newindex: u32) -> bool;
fn set_top_effect_priority<P: IsA<BaseEffect>>(&self, effect: &P, newpriority: u32) -> bool;
fn split(&self, position: u64) -> Option<Clip>;
fn connect_property_layer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Clip> + IsA<glib::object::Object>> ClipExt for O {
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> Option<TrackElement> {
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<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, type_: glib::types::Type) -> Option<TrackElement> {
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<Track> + 'a, Q: Into<Option<&'a P>>>(&self, track: Q, track_type: TrackType, type_: glib::types::Type) -> Vec<TrackElement> {
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<Layer> {
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<P: IsA<BaseEffect>>(&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<P: IsA<BaseEffect>>(&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<TrackElement> {
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<P: IsA<BaseEffect>>(&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<P: IsA<BaseEffect>>(&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<Clip> {
unsafe {
from_glib_none(ffi::ges_clip_split(self.to_glib_none().0, position))
}
}
fn connect_property_layer_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::layer",
transmute(notify_layer_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::supported-formats",
transmute(notify_supported_formats_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_layer_trampoline<P>(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Clip> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Clip::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_supported_formats_trampoline<P>(this: *mut ffi::GESClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Clip> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Clip::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESContainer, ffi::GESContainerClass>): TimelineElement, Extractable;
match fn {
get_type => || ffi::ges_container_get_type(),
}
}
impl Container {
pub fn group(containers: &[Container]) -> Option<Container> {
assert_initialized_main_thread!();
unsafe {
from_glib_none(ffi::ges_container_group(containers.to_glib_none().0))
}
}
}
pub trait GESContainerExt {
fn add<P: IsA<TimelineElement>>(&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<TimelineElement>;
fn remove<P: IsA<TimelineElement>>(&self, child: &P) -> Result<(), glib::error::BoolError>;
fn ungroup(&self, recursive: bool) -> Vec<Container>;
fn get_property_height(&self) -> u32;
fn connect_child_added<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_child_removed<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Container> + IsA<glib::object::Object>> GESContainerExt for O {
fn add<P: IsA<TimelineElement>>(&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<TimelineElement> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_container_get_children(self.to_glib_none().0, recursive.to_glib()))
}
}
fn remove<P: IsA<TimelineElement>>(&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<Container> {
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(<u32 as StaticType>::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<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &TimelineElement) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "child-added",
transmute(child_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_child_removed<F: Fn(&Self, &TimelineElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &TimelineElement) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "child-removed",
transmute(child_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::height",
transmute(notify_height_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn child_added_trampoline<P>(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer)
where P: IsA<Container> {
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<P>(this: *mut ffi::GESContainer, element: *mut ffi::GESTimelineElement, f: glib_ffi::gpointer)
where P: IsA<Container> {
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<P>(this: *mut ffi::GESContainer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Container> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Container::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESEffect, ffi::GESEffectClass>): 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<String>;
fn connect_property_bin_description_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Effect> + IsA<glib::object::Object>> EffectExt for O {
fn get_property_bin_description(&self) -> Option<String> {
unsafe {
let mut value = Value::from_type(<String as StaticType>::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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::bin-description",
transmute(notify_bin_description_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_bin_description_trampoline<P>(this: *mut ffi::GESEffect, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Effect> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Effect::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESEdge> 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<Self> {
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<ffi::GESEditMode> 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<Self> {
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())
}
}

View file

@ -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<ffi::GESExtractable, ffi::GESExtractableInterface>);
match fn {
get_type => || ffi::ges_extractable_get_type(),
}
}
pub trait ExtractableExt {
fn get_asset(&self) -> Option<Asset>;
fn get_id(&self) -> Option<String>;
fn set_asset<P: IsA<Asset>>(&self, asset: &P) -> bool;
}
impl<O: IsA<Extractable>> ExtractableExt for O {
fn get_asset(&self) -> Option<Asset> {
unsafe {
from_glib_none(ffi::ges_extractable_get_asset(self.to_glib_none().0))
}
}
fn get_id(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::ges_extractable_get_id(self.to_glib_none().0))
}
}
fn set_asset<P: IsA<Asset>>(&self, asset: &P) -> bool {
unsafe {
from_glib(ffi::ges_extractable_set_asset(self.to_glib_none().0, asset.to_glib_none().0))
}
}
}

View file

@ -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<ffi::GESPipelineFlags> 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<Self> {
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<ffi::GESTrackType> 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<Self> {
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())
}
}

View file

@ -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<ffi::GESGroup, ffi::GESGroupClass>): 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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Group> + IsA<glib::object::Object>> GroupExt for O {
fn get_property_duration(&self) -> u64 {
unsafe {
let mut value = Value::from_type(<u64 as StaticType>::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(<u64 as StaticType>::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(<u64 as StaticType>::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(<u32 as StaticType>::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(<u64 as StaticType>::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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::duration",
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::in-point",
transmute(notify_in_point_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::max-duration",
transmute(notify_max_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::priority",
transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::start",
transmute(notify_start_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_in_point_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_max_duration_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_start_trampoline<P>(this: *mut ffi::GESGroup, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Group> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Group::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESLayer, ffi::GESLayerClass>): 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<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip>;
fn add_clip<P: IsA<Clip>>(&self, clip: &P) -> bool;
fn get_auto_transition(&self) -> bool;
fn get_clips(&self) -> Vec<Clip>;
fn get_clips_in_interval(&self, start: gst::ClockTime, end: gst::ClockTime) -> Vec<Clip>;
fn get_duration(&self) -> gst::ClockTime;
fn get_priority(&self) -> u32;
fn get_timeline(&self) -> Option<Timeline>;
fn is_empty(&self) -> bool;
fn remove_clip<P: IsA<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<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_clip_removed<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
#[cfg_attr(feature = "v1_16", deprecated)]
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Layer> + IsA<glib::object::Object>> LayerExt for O {
fn add_asset<P: IsA<Asset>>(&self, asset: &P, start: gst::ClockTime, inpoint: gst::ClockTime, duration: gst::ClockTime, track_types: TrackType) -> Option<Clip> {
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<P: IsA<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<Clip> {
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<Clip> {
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<Timeline> {
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<P: IsA<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<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "clip-added",
transmute(clip_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_clip_removed<F: Fn(&Self, &Clip) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Clip) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "clip-removed",
transmute(clip_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::auto-transition",
transmute(notify_auto_transition_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::priority",
transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn clip_added_trampoline<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer)
where P: IsA<Layer> {
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<P>(this: *mut ffi::GESLayer, clip: *mut ffi::GESClip, f: glib_ffi::gpointer)
where P: IsA<Layer> {
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<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Layer> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Layer::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESLayer, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Layer> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Layer::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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;
}

View file

@ -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<ffi::GESPipeline, ffi::GESPipelineClass>): [
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<gst::Sample>;
fn get_thumbnail_rgb24(&self, width: i32, height: i32) -> Option<gst::Sample>;
fn preview_get_audio_sink(&self) -> Option<gst::Element>;
fn preview_get_video_sink(&self) -> Option<gst::Element>;
fn preview_set_audio_sink<P: IsA<gst::Element>>(&self, sink: &P);
fn preview_set_video_sink<P: IsA<gst::Element>>(&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<P: IsA<gst_pbutils::EncodingProfile>>(&self, output_uri: &str, profile: &P) -> bool;
fn set_timeline(&self, timeline: &Timeline) -> bool;
fn get_property_audio_filter(&self) -> Option<gst::Element>;
fn set_property_audio_filter<P: IsA<gst::Element> + IsA<glib::object::Object> + glib::value::SetValueOptional>(&self, audio_filter: Option<&P>);
fn get_property_audio_sink(&self) -> Option<gst::Element>;
fn set_property_audio_sink<P: IsA<gst::Element> + IsA<glib::object::Object> + glib::value::SetValueOptional>(&self, audio_sink: Option<&P>);
fn get_property_timeline(&self) -> Option<Timeline>;
fn get_property_video_filter(&self) -> Option<gst::Element>;
fn set_property_video_filter<P: IsA<gst::Element> + IsA<glib::object::Object> + glib::value::SetValueOptional>(&self, video_filter: Option<&P>);
fn get_property_video_sink(&self) -> Option<gst::Element>;
fn set_property_video_sink<P: IsA<gst::Element> + IsA<glib::object::Object> + glib::value::SetValueOptional>(&self, video_sink: Option<&P>);
fn connect_property_audio_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_video_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Pipeline> + IsA<glib::object::Object>> 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<gst::Sample> {
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<gst::Sample> {
unsafe {
from_glib_full(ffi::ges_pipeline_get_thumbnail_rgb24(self.to_glib_none().0, width, height))
}
}
fn preview_get_audio_sink(&self) -> Option<gst::Element> {
unsafe {
from_glib_full(ffi::ges_pipeline_preview_get_audio_sink(self.to_glib_none().0))
}
}
fn preview_get_video_sink(&self) -> Option<gst::Element> {
unsafe {
from_glib_full(ffi::ges_pipeline_preview_get_video_sink(self.to_glib_none().0))
}
}
fn preview_set_audio_sink<P: IsA<gst::Element>>(&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<P: IsA<gst::Element>>(&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<P: IsA<gst_pbutils::EncodingProfile>>(&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<gst::Element> {
unsafe {
let mut value = Value::from_type(<gst::Element as StaticType>::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<P: IsA<gst::Element> + IsA<glib::object::Object> + 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<gst::Element> {
unsafe {
let mut value = Value::from_type(<gst::Element as StaticType>::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<P: IsA<gst::Element> + IsA<glib::object::Object> + 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<Timeline> {
unsafe {
let mut value = Value::from_type(<Timeline as StaticType>::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<gst::Element> {
unsafe {
let mut value = Value::from_type(<gst::Element as StaticType>::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<P: IsA<gst::Element> + IsA<glib::object::Object> + 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<gst::Element> {
unsafe {
let mut value = Value::from_type(<gst::Element as StaticType>::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<P: IsA<gst::Element> + IsA<glib::object::Object> + 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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::audio-filter",
transmute(notify_audio_filter_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_audio_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::audio-sink",
transmute(notify_audio_sink_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::mode",
transmute(notify_mode_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::timeline",
transmute(notify_timeline_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_video_filter_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::video-filter",
transmute(notify_video_filter_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_video_sink_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::video-sink",
transmute(notify_video_sink_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_audio_filter_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_audio_sink_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_mode_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_timeline_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_video_filter_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_video_sink_trampoline<P>(this: *mut ffi::GESPipeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Pipeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Pipeline::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESProject, ffi::GESProjectClass>): Asset;
match fn {
get_type => || ffi::ges_project_get_type(),
}
}
impl Project {
pub fn new<'a, P: Into<Option<&'a str>>>(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<P: IsA<Asset>>(&self, asset: &P) -> bool;
fn add_encoding_profile<P: IsA<gst_pbutils::EncodingProfile>>(&self, profile: &P) -> bool;
fn create_asset<'a, P: Into<Option<&'a str>>>(&self, id: P, extractable_type: glib::types::Type) -> bool;
fn create_asset_sync<'a, P: Into<Option<&'a str>>>(&self, id: P, extractable_type: glib::types::Type) -> Result<Option<Asset>, Error>;
fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option<Asset>;
fn get_loading_assets(&self) -> Vec<Asset>;
fn get_uri(&self) -> Option<String>;
fn list_assets(&self, filter: glib::types::Type) -> Vec<Asset>;
fn list_encoding_profiles(&self) -> Vec<gst_pbutils::EncodingProfile>;
fn load(&self, timeline: &Timeline) -> Result<(), Error>;
fn remove_asset<P: IsA<Asset>>(&self, asset: &P) -> bool;
fn save<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&self, timeline: &Timeline, uri: &str, formatter_asset: Q, overwrite: bool) -> Result<(), Error>;
fn connect_asset_added<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_asset_loading<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_asset_removed<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_error_loading_asset<F: Fn(&Self, &Error, &str, glib::types::Type) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_loaded<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_missing_uri<F: Fn(&Self, &Error, &Asset) -> Option<String> + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Project> + IsA<glib::object::Object>> ProjectExt for O {
fn add_asset<P: IsA<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<P: IsA<gst_pbutils::EncodingProfile>>(&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<Option<&'a str>>>(&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<Option<&'a str>>>(&self, id: P, extractable_type: glib::types::Type) -> Result<Option<Asset>, 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<Asset> {
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<Asset> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_project_get_loading_assets(self.to_glib_none().0))
}
}
fn get_uri(&self) -> Option<String> {
unsafe {
from_glib_full(ffi::ges_project_get_uri(self.to_glib_none().0))
}
}
fn list_assets(&self, filter: glib::types::Type) -> Vec<Asset> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_project_list_assets(self.to_glib_none().0, filter.to_glib()))
}
}
fn list_encoding_profiles(&self) -> Vec<gst_pbutils::EncodingProfile> {
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<P: IsA<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<Asset> + 'a, Q: Into<Option<&'a P>>>(&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<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "asset-added",
transmute(asset_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_asset_loading<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "asset-loading",
transmute(asset_loading_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_asset_removed<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Asset) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "asset-removed",
transmute(asset_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_error_loading_asset<F: Fn(&Self, &Error, &str, glib::types::Type) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Error, &str, glib::types::Type) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "error-loading-asset",
transmute(error_loading_asset_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_loaded<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Timeline) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "loaded",
transmute(loaded_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_missing_uri<F: Fn(&Self, &Error, &Asset) -> Option<String> + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Error, &Asset) -> Option<String> + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "missing-uri",
transmute(missing_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::uri",
transmute(notify_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn asset_added_trampoline<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer)
where P: IsA<Project> {
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<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer)
where P: IsA<Project> {
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<P>(this: *mut ffi::GESProject, asset: *mut ffi::GESAsset, f: glib_ffi::gpointer)
where P: IsA<Project> {
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<P>(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<Project> {
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<P>(this: *mut ffi::GESProject, timeline: *mut ffi::GESTimeline, f: glib_ffi::gpointer)
where P: IsA<Project> {
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<P>(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<Project> {
let f: &&(Fn(&P, &Error, &Asset) -> Option<String> + '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<P>(this: *mut ffi::GESProject, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Project> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Project::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESTimeline, ffi::GESTimelineClass>): [
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<Option<Timeline>, 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<P: IsA<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<TimelineElement>;
fn get_groups(&self) -> Vec<Group>;
fn get_layer(&self, priority: u32) -> Option<Layer>;
fn get_layers(&self) -> Vec<Layer>;
fn get_pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<gst::Pad>;
fn get_snapping_distance(&self) -> gst::ClockTime;
fn get_track_for_pad<P: IsA<gst::Pad>>(&self, pad: &P) -> Option<Track>;
fn get_tracks(&self) -> Vec<Track>;
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<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement>;
fn remove_layer(&self, layer: &Layer) -> bool;
fn remove_track<P: IsA<Track>>(&self, track: &P) -> bool;
fn save_to_uri<'a, P: IsA<Asset> + 'a, Q: Into<Option<&'a P>>>(&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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId;
//fn connect_group_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId;
//fn connect_select_tracks_for_object<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Timeline> + IsA<glib::object::Object>> 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<P: IsA<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<TimelineElement> {
unsafe {
from_glib_full(ffi::ges_timeline_get_element(self.to_glib_none().0, name.to_glib_none().0))
}
}
fn get_groups(&self) -> Vec<Group> {
unsafe {
FromGlibPtrContainer::from_glib_none(ffi::ges_timeline_get_groups(self.to_glib_none().0))
}
}
fn get_layer(&self, priority: u32) -> Option<Layer> {
unsafe {
from_glib_full(ffi::ges_timeline_get_layer(self.to_glib_none().0, priority))
}
}
fn get_layers(&self) -> Vec<Layer> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::ges_timeline_get_layers(self.to_glib_none().0))
}
}
fn get_pad_for_track<P: IsA<Track>>(&self, track: &P) -> Option<gst::Pad> {
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<P: IsA<gst::Pad>>(&self, pad: &P) -> Option<Track> {
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<Track> {
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<P: IsA<TimelineElement>>(&self, element: &P, position: gst::ClockTime, layer_priority: i32) -> Option<TimelineElement> {
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<P: IsA<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<Asset> + 'a, Q: Into<Option<&'a P>>>(&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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "commited",
transmute(commited_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_group_added<F: Fn(&Self, &Group) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Group) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "group-added",
transmute(group_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
//fn connect_group_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Empty ctype children: *.PtrArray TypeId { ns_id: 1, id: 51 }
//}
fn connect_layer_added<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Layer) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "layer-added",
transmute(layer_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_layer_removed<F: Fn(&Self, &Layer) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Layer) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "layer-removed",
transmute(layer_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
//fn connect_select_tracks_for_object<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Empty ctype return value *.PtrArray TypeId { ns_id: 1, id: 16 }
//}
fn connect_snapping_ended<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "snapping-ended",
transmute(snapping_ended_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_snapping_started<F: Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement, &TrackElement, u64) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "snapping-started",
transmute(snapping_started_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_track_added<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Track) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "track-added",
transmute(track_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_track_removed<F: Fn(&Self, &Track) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &Track) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "track-removed",
transmute(track_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_auto_transition_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::auto-transition",
transmute(notify_auto_transition_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::duration",
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_snapping_distance_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::snapping-distance",
transmute(notify_snapping_distance_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn commited_trampoline<P>(this: *mut ffi::GESTimeline, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn group_added_trampoline<P>(this: *mut ffi::GESTimeline, group: *mut ffi::GESGroup, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
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<P>(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
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<P>(this: *mut ffi::GESTimeline, layer: *mut ffi::GESLayer, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
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<P>(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
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<P>(this: *mut ffi::GESTimeline, object: *mut ffi::GESTrackElement, p0: *mut ffi::GESTrackElement, p1: u64, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
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<P>(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
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<P>(this: *mut ffi::GESTimeline, track: *mut ffi::GESTrack, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
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<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_snapping_distance_trampoline<P>(this: *mut ffi::GESTimeline, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Timeline> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Timeline::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESTimelineElement, ffi::GESTimelineElementClass>): Extractable;
match fn {
get_type => || ffi::ges_timeline_element_get_type(),
}
}
pub trait TimelineElementExt {
//fn add_child_property<P: IsA</*Ignored*/glib::ParamSpec>, Q: IsA<glib::Object>>(&self, pspec: &P, child: &Q) -> bool;
fn copy(&self, deep: bool) -> Option<TimelineElement>;
//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<P: IsA</*Ignored*/glib::ParamSpec>>(&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<String>;
fn get_parent(&self) -> Option<TimelineElement>;
fn get_priority(&self) -> u32;
fn get_start(&self) -> gst::ClockTime;
fn get_timeline(&self) -> Option<Timeline>;
fn get_toplevel_parent(&self) -> Option<TimelineElement>;
fn get_track_types(&self) -> TrackType;
//fn list_children_properties(&self) -> /*Ignored*/Vec<glib::ParamSpec>;
//fn lookup_child(&self, prop_name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option<glib::Object>;
fn paste(&self, paste_position: gst::ClockTime) -> Option<TimelineElement>;
//fn remove_child_property<P: IsA</*Ignored*/glib::ParamSpec>>(&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<P: IsA</*Ignored*/glib::ParamSpec>>(&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<Option<&'a str>>>(&self, name: P) -> bool;
fn set_parent<P: IsA<TimelineElement>>(&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<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_serialize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<TimelineElement> + IsA<glib::object::Object>> TimelineElementExt for O {
//fn add_child_property<P: IsA</*Ignored*/glib::ParamSpec>, Q: IsA<glib::Object>>(&self, pspec: &P, child: &Q) -> bool {
// unsafe { TODO: call ffi::ges_timeline_element_add_child_property() }
//}
fn copy(&self, deep: bool) -> Option<TimelineElement> {
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<P: IsA</*Ignored*/glib::ParamSpec>>(&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<String> {
unsafe {
from_glib_full(ffi::ges_timeline_element_get_name(self.to_glib_none().0))
}
}
fn get_parent(&self) -> Option<TimelineElement> {
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<Timeline> {
unsafe {
from_glib_full(ffi::ges_timeline_element_get_timeline(self.to_glib_none().0))
}
}
fn get_toplevel_parent(&self) -> Option<TimelineElement> {
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<glib::ParamSpec> {
// unsafe { TODO: call ffi::ges_timeline_element_list_children_properties() }
//}
//fn lookup_child(&self, prop_name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option<glib::Object> {
// unsafe { TODO: call ffi::ges_timeline_element_lookup_child() }
//}
fn paste(&self, paste_position: gst::ClockTime) -> Option<TimelineElement> {
unsafe {
from_glib_none(ffi::ges_timeline_element_paste(self.to_glib_none().0, paste_position.to_glib()))
}
}
//fn remove_child_property<P: IsA</*Ignored*/glib::ParamSpec>>(&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<P: IsA</*Ignored*/glib::ParamSpec>>(&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<Option<&'a str>>>(&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<P: IsA<TimelineElement>>(&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(<u64 as StaticType>::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(<bool as StaticType>::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<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored prop: GObject.ParamSpec
//}
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::duration",
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_in_point_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::in-point",
transmute(notify_in_point_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_max_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::max-duration",
transmute(notify_max_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::name",
transmute(notify_name_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::parent",
transmute(notify_parent_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_priority_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::priority",
transmute(notify_priority_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_serialize_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::serialize",
transmute(notify_serialize_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::start",
transmute(notify_start_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_timeline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::timeline",
transmute(notify_timeline_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_in_point_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_max_duration_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_name_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_parent_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_priority_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_serialize_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_start_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_timeline_trampoline<P>(this: *mut ffi::GESTimelineElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TimelineElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TimelineElement::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESTrack, ffi::GESTrackClass>): [
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<P: IsA<TrackElement>>(&self, object: &P) -> bool;
fn commit(&self) -> bool;
fn get_caps(&self) -> Option<gst::Caps>;
fn get_elements(&self) -> Vec<TrackElement>;
fn get_mixing(&self) -> bool;
fn get_timeline(&self) -> Option<Timeline>;
fn remove_element<P: IsA<TrackElement>>(&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<gst::Caps>;
fn get_property_track_type(&self) -> TrackType;
fn connect_commited<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_track_element_added<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_track_element_removed<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_mixing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_restriction_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<Track> + IsA<glib::object::Object>> TrackExt for O {
fn add_element<P: IsA<TrackElement>>(&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<gst::Caps> {
unsafe {
from_glib_none(ffi::ges_track_get_caps(self.to_glib_none().0))
}
}
fn get_elements(&self) -> Vec<TrackElement> {
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<Timeline> {
unsafe {
from_glib_none(ffi::ges_track_get_timeline(self.to_glib_none().0))
}
}
fn remove_element<P: IsA<TrackElement>>(&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(<u64 as StaticType>::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<gst::Caps> {
unsafe {
let mut value = Value::from_type(<gst::Caps as StaticType>::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(<TrackType as StaticType>::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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "commited",
transmute(commited_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_track_element_added<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "track-element-added",
transmute(track_element_added_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_track_element_removed<F: Fn(&Self, &TrackElement) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self, &TrackElement) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "track-element-removed",
transmute(track_element_removed_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::caps",
transmute(notify_caps_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::duration",
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_mixing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::mixing",
transmute(notify_mixing_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_restriction_caps_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::restriction-caps",
transmute(notify_restriction_caps_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::track-type",
transmute(notify_track_type_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn commited_trampoline<P>(this: *mut ffi::GESTrack, f: glib_ffi::gpointer)
where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn track_element_added_trampoline<P>(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer)
where P: IsA<Track> {
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<P>(this: *mut ffi::GESTrack, effect: *mut ffi::GESTrackElement, f: glib_ffi::gpointer)
where P: IsA<Track> {
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<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_mixing_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_restriction_caps_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_track_type_trampoline<P>(this: *mut ffi::GESTrack, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<Track> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&Track::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESTrackElement, ffi::GESTrackElementClass>): TimelineElement, Extractable;
match fn {
get_type => || ffi::ges_track_element_get_type(),
}
}
pub trait TrackElementExt {
fn add_children_props<P: IsA<gst::Element>>(&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<gst::ControlBinding>;
fn get_element(&self) -> Option<gst::Element>;
fn get_gnlobject(&self) -> Option<gst::Element>;
fn get_nleobject(&self) -> Option<gst::Element>;
fn get_track(&self) -> Option<Track>;
fn get_track_type(&self) -> TrackType;
fn is_active(&self) -> bool;
//fn lookup_child(&self, prop_name: &str, pspec: /*Ignored*/glib::ParamSpec) -> Option<gst::Element>;
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<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
//fn connect_control_binding_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
fn connect_property_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<TrackElement> + IsA<glib::object::Object>> TrackElementExt for O {
fn add_children_props<P: IsA<gst::Element>>(&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<gst::ControlBinding> {
// unsafe { TODO: call ffi::ges_track_element_get_control_binding() }
//}
fn get_element(&self) -> Option<gst::Element> {
unsafe {
from_glib_none(ffi::ges_track_element_get_element(self.to_glib_none().0))
}
}
fn get_gnlobject(&self) -> Option<gst::Element> {
unsafe {
from_glib_none(ffi::ges_track_element_get_gnlobject(self.to_glib_none().0))
}
}
fn get_nleobject(&self) -> Option<gst::Element> {
unsafe {
from_glib_none(ffi::ges_track_element_get_nleobject(self.to_glib_none().0))
}
}
fn get_track(&self) -> Option<Track> {
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<gst::Element> {
// 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(<bool as StaticType>::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<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored control_binding: Gst.ControlBinding
//}
//fn connect_control_binding_removed<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
// Ignored control_binding: Gst.ControlBinding
//}
fn connect_property_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::active",
transmute(notify_active_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_track_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::track",
transmute(notify_track_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_track_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::track-type",
transmute(notify_track_type_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_active_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TrackElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TrackElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_track_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TrackElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TrackElement::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_track_type_trampoline<P>(this: *mut ffi::GESTrackElement, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<TrackElement> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&TrackElement::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESUriClip, ffi::GESUriClipClass>): 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<String>;
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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
fn connect_property_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<UriClip> + IsA<glib::object::Object>> UriClipExt for O {
fn get_uri(&self) -> Option<String> {
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(<bool as StaticType>::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(<bool as StaticType>::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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::is-image",
transmute(notify_is_image_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_mute_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::mute",
transmute(notify_mute_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_supported_formats_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::supported-formats",
transmute(notify_supported_formats_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
fn connect_property_uri_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::uri",
transmute(notify_uri_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_is_image_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClip> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClip::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_mute_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClip> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClip::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_supported_formats_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClip> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClip::from_glib_borrow(this).downcast_unchecked())
}
unsafe extern "C" fn notify_uri_trampoline<P>(this: *mut ffi::GESUriClip, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClip> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClip::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESUriClipAsset, ffi::GESUriClipAssetClass>): Asset;
match fn {
get_type => || ffi::ges_uri_clip_asset_get_type(),
}
}
impl UriClipAsset {
//pub fn new<'a, P: Into<Option<&'a gio::Cancellable>>, 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<Option<UriClipAsset>, 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<gst_pbutils::DiscovererInfo>;
fn get_stream_assets(&self) -> Vec<UriSourceAsset>;
fn is_image(&self) -> bool;
fn set_property_duration(&self, duration: u64);
fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
}
impl<O: IsA<UriClipAsset> + IsA<glib::object::Object>> 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<gst_pbutils::DiscovererInfo> {
unsafe {
from_glib_none(ffi::ges_uri_clip_asset_get_info(const_override(self.to_glib_none().0)))
}
}
fn get_stream_assets(&self) -> Vec<UriSourceAsset> {
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<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe {
let f: Box_<Box_<Fn(&Self) + 'static>> = Box_::new(Box_::new(f));
connect(self.to_glib_none().0, "notify::duration",
transmute(notify_duration_trampoline::<Self> as usize), Box_::into_raw(f) as *mut _)
}
}
}
unsafe extern "C" fn notify_duration_trampoline<P>(this: *mut ffi::GESUriClipAsset, _param_spec: glib_ffi::gpointer, f: glib_ffi::gpointer)
where P: IsA<UriClipAsset> {
let f: &&(Fn(&P) + 'static) = transmute(f);
f(&UriClipAsset::from_glib_borrow(this).downcast_unchecked())
}

View file

@ -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<ffi::GESUriSourceAsset, ffi::GESUriSourceAssetClass>): Asset;
match fn {
get_type => || ffi::ges_uri_source_asset_get_type(),
}
}
pub trait UriSourceAssetExt {
fn get_filesource_asset(&self) -> Option<UriClipAsset>;
fn get_stream_info(&self) -> Option<gst_pbutils::DiscovererStreamInfo>;
fn get_stream_uri(&self) -> Option<String>;
}
impl<O: IsA<UriSourceAsset>> UriSourceAssetExt for O {
fn get_filesource_asset(&self) -> Option<UriClipAsset> {
unsafe {
from_glib_none(ffi::ges_uri_source_asset_get_filesource_asset(self.to_glib_none().0))
}
}
fn get_stream_info(&self) -> Option<gst_pbutils::DiscovererStreamInfo> {
unsafe {
from_glib_none(ffi::ges_uri_source_asset_get_stream_info(self.to_glib_none().0))
}
}
fn get_stream_uri(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::ges_uri_source_asset_get_stream_uri(self.to_glib_none().0))
}
}
}

View file

@ -0,0 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ f5fca82)
from gir-files (https://github.com/gtk-rs/gir-files @ ???)

View file

@ -0,0 +1,90 @@
// Copyright (C) 2018 Thibault Saunier <tsaunier@igalia.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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::*;
}

View file

@ -0,0 +1,66 @@
// Copyright (C) 2018 Thibault Saunier <tsaunier@igalia.com>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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<glib::Value>;
fn set_child_property(&self, name: &str, value: &glib::ToValue) -> Result<(), glib::BoolError>;
}
impl<O: IsA<TimelineElement>> TimelineElementExtManual for O {
fn get_child_property(&self, name: &str) -> Option<glib::Value> {
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(())
}
}
}