utils: Update to 2018 edition

This commit is contained in:
Sebastian Dröge 2020-11-22 18:59:46 +02:00
parent 7dcd51e2f1
commit 767ed3afae
24 changed files with 184 additions and 236 deletions

View file

@ -10,11 +10,8 @@ description = "Fallback Switcher Plugin"
[dependencies] [dependencies]
libc = { version = "0.2", optional = true } libc = { version = "0.2", optional = true }
glib = { git = "https://github.com/gtk-rs/gtk-rs" } glib = { git = "https://github.com/gtk-rs/gtk-rs" }
glib-sys = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] }
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_16"] } gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_16"] }
gst-sys = { package = "gstreamer-sys", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", optional = true }
gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] }
gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] } gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_14"] }
gtk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true } gtk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
@ -41,5 +38,5 @@ cc = "1.0"
pkg-config = "0.3" pkg-config = "0.3"
[features] [features]
default = ["glib-sys", "gobject-sys", "gst-sys", "libc"] default = ["libc"]
v1_18 = ["gst-base/v1_18"] v1_18 = ["gst-base/v1_18"]

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use super::gst_base_sys; use super::ffi;
use super::Aggregator; use super::Aggregator;
use glib::prelude::*; use glib::prelude::*;
use glib::signal::{connect_raw, SignalHandlerId}; use glib::signal::{connect_raw, SignalHandlerId};
@ -36,7 +36,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
unsafe { unsafe {
let mut allocator = ptr::null_mut(); let mut allocator = ptr::null_mut();
let mut params = mem::zeroed(); let mut params = mem::zeroed();
gst_base_sys::gst_aggregator_get_allocator( ffi::gst_aggregator_get_allocator(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
&mut allocator, &mut allocator,
&mut params, &mut params,
@ -47,7 +47,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> { fn finish_buffer(&self, buffer: gst::Buffer) -> Result<gst::FlowSuccess, gst::FlowError> {
let ret: gst::FlowReturn = unsafe { let ret: gst::FlowReturn = unsafe {
from_glib(gst_base_sys::gst_aggregator_finish_buffer( from_glib(ffi::gst_aggregator_finish_buffer(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
buffer.into_ptr(), buffer.into_ptr(),
)) ))
@ -58,8 +58,8 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
fn get_property_min_upstream_latency(&self) -> gst::ClockTime { fn get_property_min_upstream_latency(&self) -> gst::ClockTime {
unsafe { unsafe {
let mut value = Value::from_type(<gst::ClockTime as StaticType>::static_type()); let mut value = Value::from_type(<gst::ClockTime as StaticType>::static_type());
gobject_sys::g_object_get_property( glib::gobject_ffi::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject, self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"min-upstream-latency\0".as_ptr() as *const _, b"min-upstream-latency\0".as_ptr() as *const _,
value.to_glib_none_mut().0, value.to_glib_none_mut().0,
); );
@ -72,8 +72,8 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
fn set_property_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime) { fn set_property_min_upstream_latency(&self, min_upstream_latency: gst::ClockTime) {
unsafe { unsafe {
gobject_sys::g_object_set_property( glib::gobject_ffi::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject, self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"min-upstream-latency\0".as_ptr() as *const _, b"min-upstream-latency\0".as_ptr() as *const _,
Value::from(&min_upstream_latency).to_glib_none().0, Value::from(&min_upstream_latency).to_glib_none().0,
); );
@ -99,9 +99,9 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
} }
unsafe extern "C" fn notify_min_upstream_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( unsafe extern "C" fn notify_min_upstream_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_base_sys::GstAggregator, this: *mut ffi::GstAggregator,
_param_spec: glib_sys::gpointer, _param_spec: glib::ffi::gpointer,
f: glib_sys::gpointer, f: glib::ffi::gpointer,
) where ) where
P: IsA<Aggregator>, P: IsA<Aggregator>,
{ {

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use super::gst_base_sys; use super::ffi;
use super::AggregatorPad; use super::AggregatorPad;
use glib::object::IsA; use glib::object::IsA;
use glib::translate::*; use glib::translate::*;
@ -18,9 +18,9 @@ pub trait AggregatorPadExtManual: 'static {
impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O { impl<O: IsA<AggregatorPad>> AggregatorPadExtManual for O {
fn get_segment(&self) -> gst::Segment { fn get_segment(&self) -> gst::Segment {
unsafe { unsafe {
let ptr: &gst_base_sys::GstAggregatorPad = &*(self.as_ptr() as *const _); let ptr: &ffi::GstAggregatorPad = &*(self.as_ptr() as *const _);
let _guard = super::utils::MutexGuard::lock(&ptr.parent.object.lock); let _guard = super::utils::MutexGuard::lock(&ptr.parent.object.lock);
from_glib_none(&ptr.segment as *const gst_sys::GstSegment) from_glib_none(&ptr.segment as *const gst::ffi::GstSegment)
} }
} }
} }

View file

@ -2,7 +2,7 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use super::super::gst_base_sys; use super::super::ffi;
use glib::object::Cast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -13,11 +13,11 @@ use glib::Value;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib::glib_wrapper! {
pub struct Aggregator(Object<gst_base_sys::GstAggregator, gst_base_sys::GstAggregatorClass>) @extends gst::Element, gst::Object; pub struct Aggregator(Object<ffi::GstAggregator, ffi::GstAggregatorClass>) @extends gst::Element, gst::Object;
match fn { match fn {
get_type => || gst_base_sys::gst_aggregator_get_type(), get_type => || ffi::gst_aggregator_get_type(),
} }
} }
@ -58,12 +58,12 @@ pub trait AggregatorExt: 'static {
impl<O: IsA<Aggregator>> AggregatorExt for O { impl<O: IsA<Aggregator>> AggregatorExt for O {
//fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) { //fn get_allocator(&self, allocator: /*Ignored*/gst::Allocator, params: /*Ignored*/gst::AllocationParams) {
// unsafe { TODO: call gst_base_sys:gst_aggregator_get_allocator() } // unsafe { TODO: call ffi:gst_aggregator_get_allocator() }
//} //}
fn get_buffer_pool(&self) -> Option<gst::BufferPool> { fn get_buffer_pool(&self) -> Option<gst::BufferPool> {
unsafe { unsafe {
from_glib_full(gst_base_sys::gst_aggregator_get_buffer_pool( from_glib_full(ffi::gst_aggregator_get_buffer_pool(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -71,7 +71,7 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn get_latency(&self) -> gst::ClockTime { fn get_latency(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(gst_base_sys::gst_aggregator_get_latency( from_glib(ffi::gst_aggregator_get_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -79,7 +79,7 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) { fn set_latency(&self, min_latency: gst::ClockTime, max_latency: gst::ClockTime) {
unsafe { unsafe {
gst_base_sys::gst_aggregator_set_latency( ffi::gst_aggregator_set_latency(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
min_latency.to_glib(), min_latency.to_glib(),
max_latency.to_glib(), max_latency.to_glib(),
@ -89,16 +89,13 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn set_src_caps(&self, caps: &gst::Caps) { fn set_src_caps(&self, caps: &gst::Caps) {
unsafe { unsafe {
gst_base_sys::gst_aggregator_set_src_caps( ffi::gst_aggregator_set_src_caps(self.as_ref().to_glib_none().0, caps.to_glib_none().0);
self.as_ref().to_glib_none().0,
caps.to_glib_none().0,
);
} }
} }
fn simple_get_next_time(&self) -> gst::ClockTime { fn simple_get_next_time(&self) -> gst::ClockTime {
unsafe { unsafe {
from_glib(gst_base_sys::gst_aggregator_simple_get_next_time( from_glib(ffi::gst_aggregator_simple_get_next_time(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -107,8 +104,8 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn get_property_start_time(&self) -> u64 { fn get_property_start_time(&self) -> u64 {
unsafe { unsafe {
let mut value = Value::from_type(<u64 as StaticType>::static_type()); let mut value = Value::from_type(<u64 as StaticType>::static_type());
gobject_sys::g_object_get_property( glib::gobject_ffi::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject, self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"start-time\0".as_ptr() as *const _, b"start-time\0".as_ptr() as *const _,
value.to_glib_none_mut().0, value.to_glib_none_mut().0,
); );
@ -121,8 +118,8 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn set_property_start_time(&self, start_time: u64) { fn set_property_start_time(&self, start_time: u64) {
unsafe { unsafe {
gobject_sys::g_object_set_property( glib::gobject_ffi::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject, self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"start-time\0".as_ptr() as *const _, b"start-time\0".as_ptr() as *const _,
Value::from(&start_time).to_glib_none().0, Value::from(&start_time).to_glib_none().0,
); );
@ -134,9 +131,9 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
f: F, f: F,
) -> SignalHandlerId { ) -> SignalHandlerId {
unsafe extern "C" fn notify_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( unsafe extern "C" fn notify_latency_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_base_sys::GstAggregator, this: *mut ffi::GstAggregator,
_param_spec: glib_sys::gpointer, _param_spec: glib::ffi::gpointer,
f: glib_sys::gpointer, f: glib::ffi::gpointer,
) where ) where
P: IsA<Aggregator>, P: IsA<Aggregator>,
{ {
@ -159,9 +156,9 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
f: F, f: F,
) -> SignalHandlerId { ) -> SignalHandlerId {
unsafe extern "C" fn notify_start_time_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( unsafe extern "C" fn notify_start_time_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_base_sys::GstAggregator, this: *mut ffi::GstAggregator,
_param_spec: glib_sys::gpointer, _param_spec: glib::ffi::gpointer,
f: glib_sys::gpointer, f: glib::ffi::gpointer,
) where ) where
P: IsA<Aggregator>, P: IsA<Aggregator>,
{ {
@ -181,7 +178,7 @@ impl<O: IsA<Aggregator>> AggregatorExt for O {
fn negotiate(&self) -> bool { fn negotiate(&self) -> bool {
unsafe { unsafe {
from_glib(gst_base_sys::gst_aggregator_negotiate( from_glib(ffi::gst_aggregator_negotiate(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }

View file

@ -2,7 +2,7 @@
// from gir-files (https://github.com/gtk-rs/gir-files) // from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT // DO NOT EDIT
use super::super::gst_base_sys; use super::super::ffi;
use glib::object::Cast; use glib::object::Cast;
use glib::object::IsA; use glib::object::IsA;
use glib::signal::connect_raw; use glib::signal::connect_raw;
@ -13,11 +13,11 @@ use glib::Value;
use std::boxed::Box as Box_; use std::boxed::Box as Box_;
use std::mem::transmute; use std::mem::transmute;
glib_wrapper! { glib::glib_wrapper! {
pub struct AggregatorPad(Object<gst_base_sys::GstAggregatorPad, gst_base_sys::GstAggregatorPadClass>) @extends gst::Pad, gst::Object; pub struct AggregatorPad(Object<ffi::GstAggregatorPad, ffi::GstAggregatorPadClass>) @extends gst::Pad, gst::Object;
match fn { match fn {
get_type => || gst_base_sys::gst_aggregator_pad_get_type(), get_type => || ffi::gst_aggregator_pad_get_type(),
} }
} }
@ -55,7 +55,7 @@ pub trait AggregatorPadExt: 'static {
impl<O: IsA<AggregatorPad>> AggregatorPadExt for O { impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
fn drop_buffer(&self) -> bool { fn drop_buffer(&self) -> bool {
unsafe { unsafe {
from_glib(gst_base_sys::gst_aggregator_pad_drop_buffer( from_glib(ffi::gst_aggregator_pad_drop_buffer(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -63,7 +63,7 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
fn has_buffer(&self) -> bool { fn has_buffer(&self) -> bool {
unsafe { unsafe {
from_glib(gst_base_sys::gst_aggregator_pad_has_buffer( from_glib(ffi::gst_aggregator_pad_has_buffer(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -71,7 +71,7 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
fn is_eos(&self) -> bool { fn is_eos(&self) -> bool {
unsafe { unsafe {
from_glib(gst_base_sys::gst_aggregator_pad_is_eos( from_glib(ffi::gst_aggregator_pad_is_eos(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -79,7 +79,7 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
fn peek_buffer(&self) -> Option<gst::Buffer> { fn peek_buffer(&self) -> Option<gst::Buffer> {
unsafe { unsafe {
from_glib_full(gst_base_sys::gst_aggregator_pad_peek_buffer( from_glib_full(ffi::gst_aggregator_pad_peek_buffer(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -87,7 +87,7 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
fn pop_buffer(&self) -> Option<gst::Buffer> { fn pop_buffer(&self) -> Option<gst::Buffer> {
unsafe { unsafe {
from_glib_full(gst_base_sys::gst_aggregator_pad_pop_buffer( from_glib_full(ffi::gst_aggregator_pad_pop_buffer(
self.as_ref().to_glib_none().0, self.as_ref().to_glib_none().0,
)) ))
} }
@ -96,8 +96,8 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
fn get_property_emit_signals(&self) -> bool { fn get_property_emit_signals(&self) -> bool {
unsafe { unsafe {
let mut value = Value::from_type(<bool as StaticType>::static_type()); let mut value = Value::from_type(<bool as StaticType>::static_type());
gobject_sys::g_object_get_property( glib::gobject_ffi::g_object_get_property(
self.to_glib_none().0 as *mut gobject_sys::GObject, self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"emit-signals\0".as_ptr() as *const _, b"emit-signals\0".as_ptr() as *const _,
value.to_glib_none_mut().0, value.to_glib_none_mut().0,
); );
@ -110,8 +110,8 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
fn set_property_emit_signals(&self, emit_signals: bool) { fn set_property_emit_signals(&self, emit_signals: bool) {
unsafe { unsafe {
gobject_sys::g_object_set_property( glib::gobject_ffi::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject, self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
b"emit-signals\0".as_ptr() as *const _, b"emit-signals\0".as_ptr() as *const _,
Value::from(&emit_signals).to_glib_none().0, Value::from(&emit_signals).to_glib_none().0,
); );
@ -126,9 +126,9 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
P, P,
F: Fn(&P, &gst::Buffer) + Send + Sync + 'static, F: Fn(&P, &gst::Buffer) + Send + Sync + 'static,
>( >(
this: *mut gst_base_sys::GstAggregatorPad, this: *mut ffi::GstAggregatorPad,
object: *mut gst_sys::GstBuffer, object: *mut gst::ffi::GstBuffer,
f: glib_sys::gpointer, f: glib::ffi::gpointer,
) where ) where
P: IsA<AggregatorPad>, P: IsA<AggregatorPad>,
{ {
@ -154,9 +154,9 @@ impl<O: IsA<AggregatorPad>> AggregatorPadExt for O {
f: F, f: F,
) -> SignalHandlerId { ) -> SignalHandlerId {
unsafe extern "C" fn notify_emit_signals_trampoline<P, F: Fn(&P) + Send + Sync + 'static>( unsafe extern "C" fn notify_emit_signals_trampoline<P, F: Fn(&P) + Send + Sync + 'static>(
this: *mut gst_base_sys::GstAggregatorPad, this: *mut ffi::GstAggregatorPad,
_param_spec: glib_sys::gpointer, _param_spec: glib::ffi::gpointer,
f: glib_sys::gpointer, f: glib::ffi::gpointer,
) where ) where
P: IsA<AggregatorPad>, P: IsA<AggregatorPad>,
{ {

View file

@ -5,7 +5,7 @@
clippy::unreadable_literal clippy::unreadable_literal
)] )]
use gst_sys as gst; use gst::ffi as gst;
#[allow(unused_imports)] #[allow(unused_imports)]
use libc::{ use libc::{
@ -14,7 +14,7 @@ use libc::{
}; };
#[allow(unused_imports)] #[allow(unused_imports)]
use glib_sys::{gboolean, gconstpointer, gpointer, GType}; use glib::ffi::{gboolean, gconstpointer, gpointer, GType};
#[repr(C)] #[repr(C)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]

View file

@ -21,7 +21,6 @@ pub mod prelude {
pub mod subclass; pub mod subclass;
mod sys; mod ffi;
use sys as gst_base_sys;
pub const AGGREGATOR_FLOW_NEED_DATA: gst::FlowError = gst::FlowError::CustomError; pub const AGGREGATOR_FLOW_NEED_DATA: gst::FlowError = gst::FlowError::CustomError;

View file

@ -6,13 +6,14 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use super::super::gst_base_sys; use super::super::ffi;
use glib::prelude::*; use glib::prelude::*;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use glib::translate::*; use glib::translate::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use gst::{gst_error_msg, gst_panic_to_error, gst_result_from_gboolean};
use std::ptr; use std::ptr;
@ -245,8 +246,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError> { fn parent_flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class) (*parent_class)
.flush .flush
.map(|f| { .map(|f| {
@ -268,8 +268,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Option<gst::Buffer> { ) -> Option<gst::Buffer> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
match (*parent_class).clip { match (*parent_class).clip {
None => Some(buffer), None => Some(buffer),
Some(ref func) => from_glib_full(func( Some(ref func) => from_glib_full(func(
@ -288,8 +287,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.finish_buffer .finish_buffer
.expect("Missing parent function `finish_buffer`"); .expect("Missing parent function `finish_buffer`");
@ -309,8 +307,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.sink_event .sink_event
.expect("Missing parent function `sink_event`"); .expect("Missing parent function `sink_event`");
@ -330,8 +327,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.sink_event_pre_queue .sink_event_pre_queue
.expect("Missing parent function `sink_event_pre_queue`"); .expect("Missing parent function `sink_event_pre_queue`");
@ -352,8 +348,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.sink_query .sink_query
.expect("Missing parent function `sink_query`"); .expect("Missing parent function `sink_query`");
@ -373,8 +368,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.sink_query_pre_queue .sink_query_pre_queue
.expect("Missing parent function `sink_query`"); .expect("Missing parent function `sink_query`");
@ -389,8 +383,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_src_event(&self, aggregator: &Self::Type, event: gst::Event) -> bool { fn parent_src_event(&self, aggregator: &Self::Type, event: gst::Event) -> bool {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.src_event .src_event
.expect("Missing parent function `src_event`"); .expect("Missing parent function `src_event`");
@ -404,8 +397,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_src_query(&self, aggregator: &Self::Type, query: &mut gst::QueryRef) -> bool { fn parent_src_query(&self, aggregator: &Self::Type, query: &mut gst::QueryRef) -> bool {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.src_query .src_query
.expect("Missing parent function `src_query`"); .expect("Missing parent function `src_query`");
@ -424,8 +416,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Result<(), gst::LoggableError> { ) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
match (*parent_class).src_activate { match (*parent_class).src_activate {
None => Ok(()), None => Ok(()),
Some(f) => gst_result_from_gboolean!( Some(f) => gst_result_from_gboolean!(
@ -448,8 +439,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.aggregate .aggregate
.expect("Missing parent function `aggregate`"); .expect("Missing parent function `aggregate`");
@ -464,8 +454,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_start(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> { fn parent_start(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class) (*parent_class)
.start .start
.map(|f| { .map(|f| {
@ -489,8 +478,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> { fn parent_stop(&self, aggregator: &Self::Type) -> Result<(), gst::ErrorMessage> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class) (*parent_class)
.stop .stop
.map(|f| { .map(|f| {
@ -514,8 +502,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime { fn parent_get_next_time(&self, aggregator: &Self::Type) -> gst::ClockTime {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class) (*parent_class)
.get_next_time .get_next_time
.map(|f| { .map(|f| {
@ -537,8 +524,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Option<AggregatorPad> { ) -> Option<AggregatorPad> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.create_new_pad .create_new_pad
.expect("Missing parent function `create_new_pad`"); .expect("Missing parent function `create_new_pad`");
@ -558,8 +544,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Result<gst::Caps, gst::FlowError> { ) -> Result<gst::Caps, gst::FlowError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.update_src_caps .update_src_caps
.expect("Missing parent function `update_src_caps`"); .expect("Missing parent function `update_src_caps`");
@ -577,8 +562,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_fixate_src_caps(&self, aggregator: &Self::Type, caps: gst::Caps) -> gst::Caps { fn parent_fixate_src_caps(&self, aggregator: &Self::Type, caps: gst::Caps) -> gst::Caps {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
let f = (*parent_class) let f = (*parent_class)
.fixate_src_caps .fixate_src_caps
@ -597,8 +581,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
) -> Result<(), gst::LoggableError> { ) -> Result<(), gst::LoggableError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class) (*parent_class)
.negotiated_src_caps .negotiated_src_caps
.map(|f| { .map(|f| {
@ -618,8 +601,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
fn parent_negotiate(&self, aggregator: &Self::Type) -> bool { fn parent_negotiate(&self, aggregator: &Self::Type) -> bool {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorClass;
(*parent_class) (*parent_class)
.negotiate .negotiate
.map(|f| { .map(|f| {
@ -665,8 +647,8 @@ where
} }
unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>( unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
) -> gst_sys::GstFlowReturn ) -> gst::ffi::GstFlowReturn
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -681,10 +663,10 @@ where
} }
unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>( unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut gst_base_sys::GstAggregatorPad, aggregator_pad: *mut ffi::GstAggregatorPad,
buffer: *mut gst_sys::GstBuffer, buffer: *mut gst::ffi::GstBuffer,
) -> *mut gst_sys::GstBuffer ) -> *mut gst::ffi::GstBuffer
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -704,9 +686,9 @@ where
} }
unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>( unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
buffer: *mut gst_sys::GstBuffer, buffer: *mut gst::ffi::GstBuffer,
) -> gst_sys::GstFlowReturn ) -> gst::ffi::GstFlowReturn
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -722,10 +704,10 @@ where
} }
unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>( unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut gst_base_sys::GstAggregatorPad, aggregator_pad: *mut ffi::GstAggregatorPad,
event: *mut gst_sys::GstEvent, event: *mut gst::ffi::GstEvent,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -744,10 +726,10 @@ where
} }
unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>( unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut gst_base_sys::GstAggregatorPad, aggregator_pad: *mut ffi::GstAggregatorPad,
event: *mut gst_sys::GstEvent, event: *mut gst::ffi::GstEvent,
) -> gst_sys::GstFlowReturn ) -> gst::ffi::GstFlowReturn
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -767,10 +749,10 @@ where
} }
unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>( unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut gst_base_sys::GstAggregatorPad, aggregator_pad: *mut ffi::GstAggregatorPad,
query: *mut gst_sys::GstQuery, query: *mut gst::ffi::GstQuery,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -789,10 +771,10 @@ where
} }
unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>( unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
aggregator_pad: *mut gst_base_sys::GstAggregatorPad, aggregator_pad: *mut ffi::GstAggregatorPad,
query: *mut gst_sys::GstQuery, query: *mut gst::ffi::GstQuery,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -811,9 +793,9 @@ where
} }
unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>( unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
event: *mut gst_sys::GstEvent, event: *mut gst::ffi::GstEvent,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -828,9 +810,9 @@ where
} }
unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>( unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
query: *mut gst_sys::GstQuery, query: *mut gst::ffi::GstQuery,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -845,10 +827,10 @@ where
} }
unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>( unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
mode: gst_sys::GstPadMode, mode: gst::ffi::GstPadMode,
active: glib_sys::gboolean, active: glib::ffi::gboolean,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -869,9 +851,9 @@ where
} }
unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>( unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
timeout: glib_sys::gboolean, timeout: glib::ffi::gboolean,
) -> gst_sys::GstFlowReturn ) -> gst::ffi::GstFlowReturn
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -887,8 +869,8 @@ where
} }
unsafe extern "C" fn aggregator_start<T: AggregatorImpl>( unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -909,8 +891,8 @@ where
} }
unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>( unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -931,8 +913,8 @@ where
} }
unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>( unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
) -> gst_sys::GstClockTime ) -> gst::ffi::GstClockTime
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -947,11 +929,11 @@ where
} }
unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>( unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
templ: *mut gst_sys::GstPadTemplate, templ: *mut gst::ffi::GstPadTemplate,
req_name: *const libc::c_char, req_name: *const libc::c_char,
caps: *const gst_sys::GstCaps, caps: *const gst::ffi::GstCaps,
) -> *mut gst_base_sys::GstAggregatorPad ) -> *mut ffi::GstAggregatorPad
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -975,10 +957,10 @@ where
} }
unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>( unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
caps: *mut gst_sys::GstCaps, caps: *mut gst::ffi::GstCaps,
res: *mut *mut gst_sys::GstCaps, res: *mut *mut gst::ffi::GstCaps,
) -> gst_sys::GstFlowReturn ) -> gst::ffi::GstFlowReturn
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -1001,9 +983,9 @@ where
} }
unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>( unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
caps: *mut gst_sys::GstCaps, caps: *mut gst::ffi::GstCaps,
) -> *mut gst_sys::GstCaps ) -> *mut gst::ffi::GstCaps
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -1018,9 +1000,9 @@ where
} }
unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>( unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
caps: *mut gst_sys::GstCaps, caps: *mut gst::ffi::GstCaps,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {
@ -1041,8 +1023,8 @@ where
} }
unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>( unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>(
ptr: *mut gst_base_sys::GstAggregator, ptr: *mut ffi::GstAggregator,
) -> glib_sys::gboolean ) -> glib::ffi::gboolean
where where
T::Instance: PanicPoison, T::Instance: PanicPoison,
{ {

View file

@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use super::super::gst_base_sys; use super::super::ffi;
use glib::prelude::*; use glib::prelude::*;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
@ -59,8 +59,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorPadClass;
(*parent_class) (*parent_class)
.flush .flush
.map(|f| { .map(|f| {
@ -85,8 +84,7 @@ impl<T: AggregatorPadImpl> AggregatorPadImplExt for T {
) -> bool { ) -> bool {
unsafe { unsafe {
let data = T::type_data(); let data = T::type_data();
let parent_class = let parent_class = data.as_ref().get_parent_class() as *mut ffi::GstAggregatorPadClass;
data.as_ref().get_parent_class() as *mut gst_base_sys::GstAggregatorPadClass;
(*parent_class) (*parent_class)
.skip_buffer .skip_buffer
.map(|f| { .map(|f| {
@ -113,9 +111,9 @@ unsafe impl<T: AggregatorPadImpl> IsSubclassable<T> for AggregatorPad {
} }
unsafe extern "C" fn aggregator_pad_flush<T: AggregatorPadImpl>( unsafe extern "C" fn aggregator_pad_flush<T: AggregatorPadImpl>(
ptr: *mut gst_base_sys::GstAggregatorPad, ptr: *mut ffi::GstAggregatorPad,
aggregator: *mut gst_base_sys::GstAggregator, aggregator: *mut ffi::GstAggregator,
) -> gst_sys::GstFlowReturn { ) -> gst::ffi::GstFlowReturn {
let instance = &*(ptr as *mut T::Instance); let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr); let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);
@ -127,10 +125,10 @@ unsafe extern "C" fn aggregator_pad_flush<T: AggregatorPadImpl>(
} }
unsafe extern "C" fn aggregator_pad_skip_buffer<T: AggregatorPadImpl>( unsafe extern "C" fn aggregator_pad_skip_buffer<T: AggregatorPadImpl>(
ptr: *mut gst_base_sys::GstAggregatorPad, ptr: *mut ffi::GstAggregatorPad,
aggregator: *mut gst_base_sys::GstAggregator, aggregator: *mut ffi::GstAggregator,
buffer: *mut gst_sys::GstBuffer, buffer: *mut gst::ffi::GstBuffer,
) -> glib_sys::gboolean { ) -> glib::ffi::gboolean {
let instance = &*(ptr as *mut T::Instance); let instance = &*(ptr as *mut T::Instance);
let imp = instance.get_impl(); let imp = instance.get_impl();
let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr); let wrap: Borrowed<AggregatorPad> = from_glib_borrow(ptr);

View file

@ -9,13 +9,13 @@
use glib::translate::mut_override; use glib::translate::mut_override;
#[must_use = "if unused the Mutex will immediately unlock"] #[must_use = "if unused the Mutex will immediately unlock"]
pub struct MutexGuard<'a>(&'a glib_sys::GMutex); pub struct MutexGuard<'a>(&'a glib::ffi::GMutex);
impl<'a> MutexGuard<'a> { impl<'a> MutexGuard<'a> {
#[allow(clippy::trivially_copy_pass_by_ref)] #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn lock(mutex: &'a glib_sys::GMutex) -> Self { pub fn lock(mutex: &'a glib::ffi::GMutex) -> Self {
unsafe { unsafe {
glib_sys::g_mutex_lock(mut_override(mutex)); glib::ffi::g_mutex_lock(mut_override(mutex));
} }
MutexGuard(mutex) MutexGuard(mutex)
} }
@ -24,7 +24,7 @@ impl<'a> MutexGuard<'a> {
impl<'a> Drop for MutexGuard<'a> { impl<'a> Drop for MutexGuard<'a> {
fn drop(&mut self) { fn drop(&mut self) {
unsafe { unsafe {
glib_sys::g_mutex_unlock(mut_override(self.0)); glib::ffi::g_mutex_unlock(mut_override(self.0));
} }
} }
} }

View file

@ -20,6 +20,7 @@ use glib::subclass;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use gst::prelude::*; use gst::prelude::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_error, gst_error_msg};
use std::{mem, sync::Mutex}; use std::{mem, sync::Mutex};
@ -69,7 +70,7 @@ impl ObjectSubclass for CustomSource {
type Instance = gst::subclass::ElementInstanceStruct<Self>; type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>; type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!(); glib::glib_object_subclass!();
fn new() -> Self { fn new() -> Self {
Self { Self {

View file

@ -19,7 +19,7 @@ use glib::prelude::*;
mod imp; mod imp;
glib_wrapper! { glib::glib_wrapper! {
pub struct CustomSource(ObjectSubclass<imp::CustomSource>) @extends gst::Bin, gst::Element, gst::Object; pub struct CustomSource(ObjectSubclass<imp::CustomSource>) @extends gst::Bin, gst::Element, gst::Object;
} }

View file

@ -20,6 +20,10 @@ use glib::subclass;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use gst::prelude::*; use gst::prelude::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use gst::{
gst_debug, gst_element_error, gst_element_warning, gst_error, gst_error_msg, gst_info,
gst_warning,
};
use std::mem; use std::mem;
use std::sync::Mutex; use std::sync::Mutex;
@ -309,7 +313,7 @@ impl ObjectSubclass for FallbackSrc {
type Instance = gst::subclass::ElementInstanceStruct<Self>; type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>; type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!(); glib::glib_object_subclass!();
fn new() -> Self { fn new() -> Self {
Self { Self {

View file

@ -20,7 +20,7 @@ use glib::prelude::*;
mod custom_source; mod custom_source;
mod imp; mod imp;
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, GEnum)] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)]
#[repr(u32)] #[repr(u32)]
#[genum(type_name = "GstFallbackSourceRetryReason")] #[genum(type_name = "GstFallbackSourceRetryReason")]
enum RetryReason { enum RetryReason {
@ -31,7 +31,7 @@ enum RetryReason {
Timeout, Timeout,
} }
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, GEnum)] #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy, glib::GEnum)]
#[repr(u32)] #[repr(u32)]
#[genum(type_name = "GstFallbackSourceStatus")] #[genum(type_name = "GstFallbackSourceStatus")]
enum Status { enum Status {
@ -41,7 +41,7 @@ enum Status {
Running, Running,
} }
glib_wrapper! { glib::glib_wrapper! {
pub struct FallbackSrc(ObjectSubclass<imp::FallbackSrc>) @extends gst::Bin, gst::Element, gst::Object; pub struct FallbackSrc(ObjectSubclass<imp::FallbackSrc>) @extends gst::Bin, gst::Element, gst::Object;
} }

View file

@ -30,6 +30,7 @@ use gst_base::subclass::prelude::*;
use glib::subclass; use glib::subclass;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use gst::{gst_debug, gst_error, gst_info, gst_log};
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
@ -412,7 +413,7 @@ impl ObjectSubclass for FallbackSwitch {
type Instance = gst::subclass::ElementInstanceStruct<Self>; type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>; type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!(); glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap(); let templ = klass.get_pad_template("sink").unwrap();

View file

@ -22,7 +22,7 @@ use crate::gst_base_compat as gst_base;
mod imp; mod imp;
glib_wrapper! { glib::glib_wrapper! {
pub struct FallbackSwitch(ObjectSubclass<imp::FallbackSwitch>) @extends gst_base::Aggregator, gst::Element, gst::Object; pub struct FallbackSwitch(ObjectSubclass<imp::FallbackSwitch>) @extends gst_base::Aggregator, gst::Element, gst::Object;
} }

View file

@ -15,11 +15,6 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA. // Boston, MA 02110-1335, USA.
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gst;
#[cfg(not(feature = "v1_18"))] #[cfg(not(feature = "v1_18"))]
#[path = "base/mod.rs"] #[path = "base/mod.rs"]
pub mod gst_base_compat; pub mod gst_base_compat;
@ -33,7 +28,7 @@ fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
Ok(()) Ok(())
} }
gst_plugin_define!( gst::gst_plugin_define!(
fallbackswitch, fallbackswitch,
env!("CARGO_PKG_DESCRIPTION"), env!("CARGO_PKG_DESCRIPTION"),
plugin_init, plugin_init,

View file

@ -16,9 +16,7 @@
// Boston, MA 02110-1335, USA. // Boston, MA 02110-1335, USA.
use glib::prelude::*; use glib::prelude::*;
use gst::gst_debug;
#[macro_use]
extern crate gst;
use gst::prelude::*; use gst::prelude::*;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;

View file

@ -9,14 +9,14 @@ edition = "2018"
[dependencies] [dependencies]
glib = { git = "https://github.com/gtk-rs/gtk-rs" } glib = { git = "https://github.com/gtk-rs/gtk-rs" }
gstreamer = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-audio = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gstreamer-video = { git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" } gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs" }
gtk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true } gtk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
gio = { git = "https://github.com/gtk-rs/gtk-rs", optional = true } gio = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
parking_lot = "0.11" parking_lot = "0.11"
more-asserts = "0.2" more-asserts = "0.2"
lazy_static = "1.0" once_cell = "1.0"
[dev-dependencies] [dev-dependencies]
either = "1.0" either = "1.0"

View file

@ -15,17 +15,9 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA. // Boston, MA 02110-1335, USA.
extern crate glib;
use glib::prelude::*;
extern crate gio;
use gio::prelude::*;
extern crate gstreamer as gst;
use gst::prelude::*; use gst::prelude::*;
extern crate gsttogglerecord; use gio::prelude::*;
extern crate gtk;
use gtk::prelude::*; use gtk::prelude::*;
use std::cell::RefCell; use std::cell::RefCell;
use std::env; use std::env;

View file

@ -15,28 +15,13 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA. // Boston, MA 02110-1335, USA.
#[macro_use]
extern crate glib;
#[macro_use]
extern crate gstreamer as gst;
extern crate gstreamer_audio as gst_audio;
extern crate gstreamer_video as gst_video;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate more_asserts;
extern crate parking_lot;
mod togglerecord; mod togglerecord;
fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> { fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
togglerecord::register(plugin) togglerecord::register(plugin)
} }
gst_plugin_define!( gst::gst_plugin_define!(
togglerecord, togglerecord,
env!("CARGO_PKG_DESCRIPTION"), env!("CARGO_PKG_DESCRIPTION"),
plugin_init, plugin_init,

View file

@ -20,7 +20,11 @@ use glib::subclass;
use glib::subclass::prelude::*; use glib::subclass::prelude::*;
use gst::prelude::*; use gst::prelude::*;
use gst::subclass::prelude::*; use gst::subclass::prelude::*;
use gst::{gst_debug, gst_element_error, gst_log, gst_trace, gst_warning};
use more_asserts::{assert_ge, assert_le, assert_lt};
use once_cell::sync::Lazy;
use parking_lot::{Condvar, Mutex}; use parking_lot::{Condvar, Mutex};
use std::cmp; use std::cmp;
use std::collections::HashMap; use std::collections::HashMap;
@ -356,13 +360,13 @@ pub struct ToggleRecord {
pads: Mutex<HashMap<gst::Pad, Stream>>, pads: Mutex<HashMap<gst::Pad, Stream>>,
} }
lazy_static! { static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
static ref CAT: gst::DebugCategory = gst::DebugCategory::new( gst::DebugCategory::new(
"togglerecord", "togglerecord",
gst::DebugColorFlags::empty(), gst::DebugColorFlags::empty(),
Some("Toggle Record Element"), Some("Toggle Record Element"),
); )
} });
impl ToggleRecord { impl ToggleRecord {
fn handle_main_stream<T: HandleData>( fn handle_main_stream<T: HandleData>(
@ -1555,7 +1559,7 @@ impl ObjectSubclass for ToggleRecord {
type Instance = gst::subclass::ElementInstanceStruct<Self>; type Instance = gst::subclass::ElementInstanceStruct<Self>;
type Class = subclass::simple::ClassStruct<Self>; type Class = subclass::simple::ClassStruct<Self>;
glib_object_subclass!(); glib::glib_object_subclass!();
fn with_class(klass: &Self::Class) -> Self { fn with_class(klass: &Self::Class) -> Self {
let templ = klass.get_pad_template("sink").unwrap(); let templ = klass.get_pad_template("sink").unwrap();

View file

@ -19,7 +19,7 @@ use glib::prelude::*;
mod imp; mod imp;
glib_wrapper! { glib::glib_wrapper! {
pub struct ToggleRecord(ObjectSubclass<imp::ToggleRecord>) @extends gst::Element, gst::Object; pub struct ToggleRecord(ObjectSubclass<imp::ToggleRecord>) @extends gst::Element, gst::Object;
} }

View file

@ -15,20 +15,15 @@
// Free Software Foundation, Inc., 51 Franklin Street, Suite 500, // Free Software Foundation, Inc., 51 Franklin Street, Suite 500,
// Boston, MA 02110-1335, USA. // Boston, MA 02110-1335, USA.
extern crate glib;
use glib::prelude::*; use glib::prelude::*;
extern crate gstreamer as gst;
use gst::prelude::*; use gst::prelude::*;
extern crate either;
use either::*; use either::*;
use std::sync::{mpsc, Mutex}; use std::sync::{mpsc, Mutex};
use std::thread; use std::thread;
extern crate gsttogglerecord;
fn init() { fn init() {
use std::sync::Once; use std::sync::Once;
static INIT: Once = Once::new(); static INIT: Once = Once::new();