mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-09-29 15:22:08 +00:00
524 lines
17 KiB
Rust
524 lines
17 KiB
Rust
// 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 crate::Asset;
|
|
use crate::Timeline;
|
|
use glib::object::Cast;
|
|
use glib::object::IsA;
|
|
use glib::signal::connect_raw;
|
|
use glib::signal::SignalHandlerId;
|
|
use glib::translate::*;
|
|
use std::boxed::Box as Box_;
|
|
use std::mem::transmute;
|
|
use std::ptr;
|
|
|
|
glib::wrapper! {
|
|
pub struct Project(Object<ffi::GESProject, ffi::GESProjectClass>) @extends Asset;
|
|
|
|
match fn {
|
|
get_type => || ffi::ges_project_get_type(),
|
|
}
|
|
}
|
|
|
|
impl Project {
|
|
#[doc(alias = "ges_project_new")]
|
|
pub fn new(uri: Option<&str>) -> Project {
|
|
assert_initialized_main_thread!();
|
|
unsafe { from_glib_full(ffi::ges_project_new(uri.to_glib_none().0)) }
|
|
}
|
|
}
|
|
|
|
pub const NONE_PROJECT: Option<&Project> = None;
|
|
|
|
pub trait ProjectExt: 'static {
|
|
#[doc(alias = "ges_project_add_asset")]
|
|
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> bool;
|
|
|
|
#[doc(alias = "ges_project_add_encoding_profile")]
|
|
fn add_encoding_profile<P: IsA<gst_pbutils::EncodingProfile>>(
|
|
&self,
|
|
profile: &P,
|
|
) -> Result<(), glib::error::BoolError>;
|
|
|
|
//#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
|
//#[doc(alias = "ges_project_add_formatter")]
|
|
//fn add_formatter(&self, formatter: /*Ignored*/&Formatter);
|
|
|
|
#[doc(alias = "ges_project_create_asset")]
|
|
fn create_asset(&self, id: Option<&str>, extractable_type: glib::types::Type) -> bool;
|
|
|
|
#[doc(alias = "ges_project_create_asset_sync")]
|
|
fn create_asset_sync(
|
|
&self,
|
|
id: Option<&str>,
|
|
extractable_type: glib::types::Type,
|
|
) -> Result<Option<Asset>, glib::Error>;
|
|
|
|
#[doc(alias = "ges_project_get_asset")]
|
|
fn get_asset(&self, id: &str, extractable_type: glib::types::Type) -> Option<Asset>;
|
|
|
|
#[doc(alias = "ges_project_get_loading_assets")]
|
|
fn get_loading_assets(&self) -> Vec<Asset>;
|
|
|
|
#[doc(alias = "ges_project_get_uri")]
|
|
fn get_uri(&self) -> Option<glib::GString>;
|
|
|
|
#[doc(alias = "ges_project_list_assets")]
|
|
fn list_assets(&self, filter: glib::types::Type) -> Vec<Asset>;
|
|
|
|
#[doc(alias = "ges_project_list_encoding_profiles")]
|
|
fn list_encoding_profiles(&self) -> Vec<gst_pbutils::EncodingProfile>;
|
|
|
|
#[doc(alias = "ges_project_load")]
|
|
fn load<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), glib::Error>;
|
|
|
|
#[doc(alias = "ges_project_remove_asset")]
|
|
fn remove_asset<P: IsA<Asset>>(&self, asset: &P) -> Result<(), glib::error::BoolError>;
|
|
|
|
#[doc(alias = "ges_project_save")]
|
|
fn save<P: IsA<Timeline>, Q: IsA<Asset>>(
|
|
&self,
|
|
timeline: &P,
|
|
uri: &str,
|
|
formatter_asset: Option<&Q>,
|
|
overwrite: bool,
|
|
) -> Result<(), glib::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;
|
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
|
fn connect_error_loading<F: Fn(&Self, &Timeline, &glib::Error) + 'static>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId;
|
|
|
|
fn connect_error_loading_asset<F: Fn(&Self, &glib::Error, &str, glib::types::Type) + 'static>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId;
|
|
|
|
fn connect_loaded<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId;
|
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
|
fn connect_loading<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId;
|
|
|
|
fn connect_missing_uri<F: Fn(&Self, &glib::Error, &Asset) -> Option<glib::GString> + 'static>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId;
|
|
}
|
|
|
|
impl<O: IsA<Project>> ProjectExt for O {
|
|
fn add_asset<P: IsA<Asset>>(&self, asset: &P) -> bool {
|
|
unsafe {
|
|
from_glib(ffi::ges_project_add_asset(
|
|
self.as_ref().to_glib_none().0,
|
|
asset.as_ref().to_glib_none().0,
|
|
))
|
|
}
|
|
}
|
|
|
|
fn add_encoding_profile<P: IsA<gst_pbutils::EncodingProfile>>(
|
|
&self,
|
|
profile: &P,
|
|
) -> Result<(), glib::error::BoolError> {
|
|
unsafe {
|
|
glib::result_from_gboolean!(
|
|
ffi::ges_project_add_encoding_profile(
|
|
self.as_ref().to_glib_none().0,
|
|
profile.as_ref().to_glib_none().0
|
|
),
|
|
"Failed to add profile"
|
|
)
|
|
}
|
|
}
|
|
|
|
//#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
|
//fn add_formatter(&self, formatter: /*Ignored*/&Formatter) {
|
|
// unsafe { TODO: call ffi:ges_project_add_formatter() }
|
|
//}
|
|
|
|
fn create_asset(&self, id: Option<&str>, extractable_type: glib::types::Type) -> bool {
|
|
unsafe {
|
|
from_glib(ffi::ges_project_create_asset(
|
|
self.as_ref().to_glib_none().0,
|
|
id.to_glib_none().0,
|
|
extractable_type.to_glib(),
|
|
))
|
|
}
|
|
}
|
|
|
|
fn create_asset_sync(
|
|
&self,
|
|
id: Option<&str>,
|
|
extractable_type: glib::types::Type,
|
|
) -> Result<Option<Asset>, glib::Error> {
|
|
unsafe {
|
|
let mut error = ptr::null_mut();
|
|
let ret = ffi::ges_project_create_asset_sync(
|
|
self.as_ref().to_glib_none().0,
|
|
id.to_glib_none().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.as_ref().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.as_ref().to_glib_none().0,
|
|
))
|
|
}
|
|
}
|
|
|
|
fn get_uri(&self) -> Option<glib::GString> {
|
|
unsafe { from_glib_full(ffi::ges_project_get_uri(self.as_ref().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.as_ref().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.as_ref().to_glib_none().0,
|
|
))
|
|
}
|
|
}
|
|
|
|
fn load<P: IsA<Timeline>>(&self, timeline: &P) -> Result<(), glib::Error> {
|
|
unsafe {
|
|
let mut error = ptr::null_mut();
|
|
let _ = ffi::ges_project_load(
|
|
self.as_ref().to_glib_none().0,
|
|
timeline.as_ref().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) -> Result<(), glib::error::BoolError> {
|
|
unsafe {
|
|
glib::result_from_gboolean!(
|
|
ffi::ges_project_remove_asset(
|
|
self.as_ref().to_glib_none().0,
|
|
asset.as_ref().to_glib_none().0
|
|
),
|
|
"Failed to remove asset"
|
|
)
|
|
}
|
|
}
|
|
|
|
fn save<P: IsA<Timeline>, Q: IsA<Asset>>(
|
|
&self,
|
|
timeline: &P,
|
|
uri: &str,
|
|
formatter_asset: Option<&Q>,
|
|
overwrite: bool,
|
|
) -> Result<(), glib::Error> {
|
|
unsafe {
|
|
let mut error = ptr::null_mut();
|
|
let _ = ffi::ges_project_save(
|
|
self.as_ref().to_glib_none().0,
|
|
timeline.as_ref().to_glib_none().0,
|
|
uri.to_glib_none().0,
|
|
formatter_asset.map(|p| p.as_ref()).to_glib_full(),
|
|
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 extern "C" fn asset_added_trampoline<P, F: Fn(&P, &Asset) + 'static>(
|
|
this: *mut ffi::GESProject,
|
|
asset: *mut ffi::GESAsset,
|
|
f: glib::ffi::gpointer,
|
|
) where
|
|
P: IsA<Project>,
|
|
{
|
|
let f: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(asset),
|
|
)
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"asset-added\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
asset_added_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
fn connect_asset_loading<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
unsafe extern "C" fn asset_loading_trampoline<P, F: Fn(&P, &Asset) + 'static>(
|
|
this: *mut ffi::GESProject,
|
|
asset: *mut ffi::GESAsset,
|
|
f: glib::ffi::gpointer,
|
|
) where
|
|
P: IsA<Project>,
|
|
{
|
|
let f: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(asset),
|
|
)
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"asset-loading\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
asset_loading_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
fn connect_asset_removed<F: Fn(&Self, &Asset) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
unsafe extern "C" fn asset_removed_trampoline<P, F: Fn(&P, &Asset) + 'static>(
|
|
this: *mut ffi::GESProject,
|
|
asset: *mut ffi::GESAsset,
|
|
f: glib::ffi::gpointer,
|
|
) where
|
|
P: IsA<Project>,
|
|
{
|
|
let f: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(asset),
|
|
)
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"asset-removed\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
asset_removed_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
|
fn connect_error_loading<F: Fn(&Self, &Timeline, &glib::Error) + 'static>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId {
|
|
unsafe extern "C" fn error_loading_trampoline<
|
|
P,
|
|
F: Fn(&P, &Timeline, &glib::Error) + 'static,
|
|
>(
|
|
this: *mut ffi::GESProject,
|
|
timeline: *mut ffi::GESTimeline,
|
|
error: *mut glib::ffi::GError,
|
|
f: glib::ffi::gpointer,
|
|
) where
|
|
P: IsA<Project>,
|
|
{
|
|
let f: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(timeline),
|
|
&from_glib_borrow(error),
|
|
)
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"error-loading\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
error_loading_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
fn connect_error_loading_asset<
|
|
F: Fn(&Self, &glib::Error, &str, glib::types::Type) + 'static,
|
|
>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId {
|
|
unsafe extern "C" fn error_loading_asset_trampoline<
|
|
P,
|
|
F: Fn(&P, &glib::Error, &str, glib::types::Type) + 'static,
|
|
>(
|
|
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: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(error),
|
|
&glib::GString::from_glib_borrow(id),
|
|
from_glib(extractable_type),
|
|
)
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"error-loading-asset\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
error_loading_asset_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
fn connect_loaded<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
unsafe extern "C" fn loaded_trampoline<P, F: Fn(&P, &Timeline) + 'static>(
|
|
this: *mut ffi::GESProject,
|
|
timeline: *mut ffi::GESTimeline,
|
|
f: glib::ffi::gpointer,
|
|
) where
|
|
P: IsA<Project>,
|
|
{
|
|
let f: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(timeline),
|
|
)
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"loaded\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
loaded_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
|
fn connect_loading<F: Fn(&Self, &Timeline) + 'static>(&self, f: F) -> SignalHandlerId {
|
|
unsafe extern "C" fn loading_trampoline<P, F: Fn(&P, &Timeline) + 'static>(
|
|
this: *mut ffi::GESProject,
|
|
timeline: *mut ffi::GESTimeline,
|
|
f: glib::ffi::gpointer,
|
|
) where
|
|
P: IsA<Project>,
|
|
{
|
|
let f: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(timeline),
|
|
)
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"loading\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
loading_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
|
|
fn connect_missing_uri<
|
|
F: Fn(&Self, &glib::Error, &Asset) -> Option<glib::GString> + 'static,
|
|
>(
|
|
&self,
|
|
f: F,
|
|
) -> SignalHandlerId {
|
|
unsafe extern "C" fn missing_uri_trampoline<
|
|
P,
|
|
F: Fn(&P, &glib::Error, &Asset) -> Option<glib::GString> + 'static,
|
|
>(
|
|
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: &F = &*(f as *const F);
|
|
f(
|
|
&Project::from_glib_borrow(this).unsafe_cast_ref(),
|
|
&from_glib_borrow(error),
|
|
&from_glib_borrow(wrong_asset),
|
|
)
|
|
.to_glib_full()
|
|
}
|
|
unsafe {
|
|
let f: Box_<F> = Box_::new(f);
|
|
connect_raw(
|
|
self.as_ptr() as *mut _,
|
|
b"missing-uri\0".as_ptr() as *const _,
|
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
missing_uri_trampoline::<Self, F> as *const (),
|
|
)),
|
|
Box_::into_raw(f),
|
|
)
|
|
}
|
|
}
|
|
}
|