mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-13 21:11:29 +00:00
325 lines
13 KiB
Rust
325 lines
13 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 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())
|
||
|
}
|