mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-12-23 00:26:31 +00:00
gstreamer-base: Update manual code to 2018 edition
This commit is contained in:
parent
80b4cb590e
commit
88a7c18746
20 changed files with 602 additions and 773 deletions
|
@ -11,31 +11,29 @@ homepage = "https://gstreamer.freedesktop.org"
|
||||||
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/gstreamer_base/"
|
documentation = "https://gstreamer.pages.freedesktop.org/gstreamer-rs/gstreamer_base/"
|
||||||
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
|
keywords = ["gstreamer", "multimedia", "audio", "video", "gnome"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
bitflags = "1.0"
|
bitflags = "1.0"
|
||||||
glib-sys = { git = "https://github.com/gtk-rs/gtk-rs" }
|
ffi = { package = "gstreamer-base-sys", path = "../gstreamer-base/sys", features = ["v1_8"] }
|
||||||
gobject-sys = { git = "https://github.com/gtk-rs/gtk-rs" }
|
|
||||||
gstreamer-sys = { path = "../gstreamer/sys", features = ["v1_8"] }
|
|
||||||
gstreamer-base-sys = { path = "../gstreamer-base/sys", features = ["v1_8"] }
|
|
||||||
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
||||||
gstreamer = { path = "../gstreamer" }
|
gst = { package = "gstreamer", path = "../gstreamer" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
gstreamer-rs-lgpl-docs = { path = "../docs", optional = true }
|
gstreamer-rs-lgpl-docs = { path = "../docs", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
v1_10 = ["gstreamer/v1_10", "gstreamer-base-sys/v1_10"]
|
v1_10 = ["gst/v1_10", "ffi/v1_10"]
|
||||||
v1_12 = ["gstreamer/v1_12", "gstreamer-base-sys/v1_12", "v1_10"]
|
v1_12 = ["gst/v1_12", "ffi/v1_12", "v1_10"]
|
||||||
v1_14 = ["gstreamer/v1_14", "gstreamer-base-sys/v1_14", "v1_12"]
|
v1_14 = ["gst/v1_14", "ffi/v1_14", "v1_12"]
|
||||||
v1_14_1 = ["gstreamer/v1_14", "gstreamer-base-sys/v1_14_1", "v1_14"]
|
v1_14_1 = ["gst/v1_14", "ffi/v1_14_1", "v1_14"]
|
||||||
v1_16 = ["gstreamer/v1_16", "gstreamer-base-sys/v1_16", "v1_14_1"]
|
v1_16 = ["gst/v1_16", "ffi/v1_16", "v1_14_1"]
|
||||||
v1_18 = ["gstreamer/v1_18", "gstreamer-base-sys/v1_18", "v1_16"]
|
v1_18 = ["gst/v1_18", "ffi/v1_18", "v1_16"]
|
||||||
embed-lgpl-docs = ["gstreamer-rs-lgpl-docs"]
|
embed-lgpl-docs = ["gstreamer-rs-lgpl-docs"]
|
||||||
purge-lgpl-docs = ["gstreamer-rs-lgpl-docs"]
|
purge-lgpl-docs = ["gstreamer-rs-lgpl-docs"]
|
||||||
dox = ["v1_18", "gstreamer-base-sys/dox", "glib/dox", "gstreamer/dox"]
|
dox = ["v1_18", "ffi/dox", "glib/dox", "gst/dox"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = ["dox", "embed-lgpl-docs"]
|
features = ["dox", "embed-lgpl-docs"]
|
||||||
|
|
|
@ -6,18 +6,16 @@
|
||||||
// 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 crate::Adapter;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::ops;
|
use std::ops;
|
||||||
use Adapter;
|
|
||||||
|
|
||||||
impl Adapter {
|
impl Adapter {
|
||||||
pub fn copy(&self, offset: usize, dest: &mut [u8]) {
|
pub fn copy(&self, offset: usize, dest: &mut [u8]) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let size = dest.len();
|
let size = dest.len();
|
||||||
gst_base_sys::gst_adapter_copy(
|
ffi::gst_adapter_copy(
|
||||||
self.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
dest.as_mut_ptr() as *mut _,
|
dest.as_mut_ptr() as *mut _,
|
||||||
offset,
|
offset,
|
||||||
|
@ -28,7 +26,7 @@ impl Adapter {
|
||||||
|
|
||||||
pub fn push(&self, buf: gst::Buffer) {
|
pub fn push(&self, buf: gst::Buffer) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_adapter_push(self.to_glib_none().0, buf.into_ptr());
|
ffi::gst_adapter_push(self.to_glib_none().0, buf.into_ptr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,9 +191,9 @@ impl UniqueAdapter {
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = gst_base_sys::gst_adapter_map(self.0.to_glib_none().0, nbytes);
|
let ptr = ffi::gst_adapter_map(self.0.to_glib_none().0, nbytes);
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
Err(glib_bool_error!("size bytes are not available"))
|
Err(glib::glib_bool_error!("size bytes are not available"))
|
||||||
} else {
|
} else {
|
||||||
Ok(UniqueAdapterMap(
|
Ok(UniqueAdapterMap(
|
||||||
self,
|
self,
|
||||||
|
@ -212,7 +210,7 @@ pub struct UniqueAdapterMap<'a>(&'a UniqueAdapter, &'a [u8]);
|
||||||
impl<'a> Drop for UniqueAdapterMap<'a> {
|
impl<'a> Drop for UniqueAdapterMap<'a> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_adapter_unmap((self.0).0.to_glib_none().0);
|
ffi::gst_adapter_unmap((self.0).0.to_glib_none().0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +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 crate::Aggregator;
|
||||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
|
@ -17,8 +18,6 @@ use glib::IsA;
|
||||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||||
use glib::Value;
|
use glib::Value;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||||
use std::boxed::Box as Box_;
|
use std::boxed::Box as Box_;
|
||||||
|
@ -27,7 +26,6 @@ use std::mem;
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||||
use std::mem::transmute;
|
use std::mem::transmute;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use Aggregator;
|
|
||||||
|
|
||||||
pub trait AggregatorExtManual: 'static {
|
pub trait AggregatorExtManual: 'static {
|
||||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||||
|
@ -96,7 +94,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,
|
||||||
|
@ -107,7 +105,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(),
|
||||||
))
|
))
|
||||||
|
@ -122,7 +120,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||||
bufferlist: gst::BufferList,
|
bufferlist: gst::BufferList,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn = unsafe {
|
||||||
from_glib(gst_base_sys::gst_aggregator_finish_buffer_list(
|
from_glib(ffi::gst_aggregator_finish_buffer_list(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
bufferlist.into_ptr(),
|
bufferlist.into_ptr(),
|
||||||
))
|
))
|
||||||
|
@ -135,8 +133,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,
|
||||||
);
|
);
|
||||||
|
@ -151,8 +149,8 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||||
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,
|
||||||
);
|
);
|
||||||
|
@ -181,7 +179,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
fn update_segment<F: gst::FormattedValue>(&self, segment: &gst::FormattedSegment<F>) {
|
fn update_segment<F: gst::FormattedValue>(&self, segment: &gst::FormattedSegment<F>) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_aggregator_update_segment(
|
ffi::gst_aggregator_update_segment(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
mut_override(segment.to_glib_none().0),
|
mut_override(segment.to_glib_none().0),
|
||||||
)
|
)
|
||||||
|
@ -198,7 +196,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||||
info: Option<&gst::StructureRef>,
|
info: Option<&gst::StructureRef>,
|
||||||
) {
|
) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_aggregator_selected_samples(
|
ffi::gst_aggregator_selected_samples(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
pts.to_glib(),
|
pts.to_glib(),
|
||||||
dts.to_glib(),
|
dts.to_glib(),
|
||||||
|
@ -242,13 +240,13 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||||
) + Send
|
) + Send
|
||||||
+ 'static,
|
+ 'static,
|
||||||
>(
|
>(
|
||||||
this: *mut gst_base_sys::GstAggregator,
|
this: *mut ffi::GstAggregator,
|
||||||
segment: *mut gst_sys::GstSegment,
|
segment: *mut gst::ffi::GstSegment,
|
||||||
pts: gst_sys::GstClockTime,
|
pts: gst::ffi::GstClockTime,
|
||||||
dts: gst_sys::GstClockTime,
|
dts: gst::ffi::GstClockTime,
|
||||||
duration: gst_sys::GstClockTime,
|
duration: gst::ffi::GstClockTime,
|
||||||
info: *mut gst_sys::GstStructure,
|
info: *mut gst::ffi::GstStructure,
|
||||||
f: glib_sys::gpointer,
|
f: glib::ffi::gpointer,
|
||||||
) where
|
) where
|
||||||
P: IsA<Aggregator>,
|
P: IsA<Aggregator>,
|
||||||
{
|
{
|
||||||
|
@ -284,9 +282,9 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
|
||||||
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
#[cfg(any(feature = "v1_16", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_16")))]
|
||||||
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>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,12 +6,9 @@
|
||||||
// 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 crate::AggregatorPad;
|
||||||
use glib::object::IsA;
|
use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
use AggregatorPad;
|
|
||||||
|
|
||||||
pub trait AggregatorPadExtManual: 'static {
|
pub trait AggregatorPadExtManual: 'static {
|
||||||
fn get_segment(&self) -> gst::Segment;
|
fn get_segment(&self) -> gst::Segment;
|
||||||
|
@ -20,9 +17,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 = ::utils::MutexGuard::lock(&ptr.parent.object.lock);
|
let _guard = crate::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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,13 @@
|
||||||
// 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 crate::BaseParse;
|
||||||
|
use crate::BaseParseFrame;
|
||||||
use glib::object::IsA;
|
use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst::FormattedValue;
|
use gst::FormattedValue;
|
||||||
use gst_base_sys;
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use BaseParse;
|
|
||||||
use BaseParseFrame;
|
|
||||||
|
|
||||||
pub trait BaseParseExtManual: 'static {
|
pub trait BaseParseExtManual: 'static {
|
||||||
fn get_sink_pad(&self) -> gst::Pad;
|
fn get_sink_pad(&self) -> gst::Pad;
|
||||||
|
@ -43,14 +41,14 @@ pub trait BaseParseExtManual: 'static {
|
||||||
impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||||
fn get_sink_pad(&self) -> gst::Pad {
|
fn get_sink_pad(&self) -> gst::Pad {
|
||||||
unsafe {
|
unsafe {
|
||||||
let elt: &gst_base_sys::GstBaseParse = &*(self.as_ptr() as *const _);
|
let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _);
|
||||||
from_glib_none(elt.sinkpad)
|
from_glib_none(elt.sinkpad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_src_pad(&self) -> gst::Pad {
|
fn get_src_pad(&self) -> gst::Pad {
|
||||||
unsafe {
|
unsafe {
|
||||||
let elt: &gst_base_sys::GstBaseParse = &*(self.as_ptr() as *const _);
|
let elt: &ffi::GstBaseParse = &*(self.as_ptr() as *const _);
|
||||||
from_glib_none(elt.srcpad)
|
from_glib_none(elt.srcpad)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +56,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||||
fn set_duration<V: Into<gst::GenericFormattedValue>>(&self, duration: V, interval: u32) {
|
fn set_duration<V: Into<gst::GenericFormattedValue>>(&self, duration: V, interval: u32) {
|
||||||
let duration = duration.into();
|
let duration = duration.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_base_parse_set_duration(
|
ffi::gst_base_parse_set_duration(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
duration.get_format().to_glib(),
|
duration.get_format().to_glib(),
|
||||||
duration.get_value(),
|
duration.get_value(),
|
||||||
|
@ -70,7 +68,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||||
fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32) {
|
fn set_frame_rate(&self, fps: gst::Fraction, lead_in: u32, lead_out: u32) {
|
||||||
let (fps_num, fps_den) = fps.into();
|
let (fps_num, fps_den) = fps.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_base_parse_set_frame_rate(
|
ffi::gst_base_parse_set_frame_rate(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
fps_num as u32,
|
fps_num as u32,
|
||||||
fps_den as u32,
|
fps_den as u32,
|
||||||
|
@ -87,7 +85,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||||
let src_val = src_val.into();
|
let src_val = src_val.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut dest_val = mem::MaybeUninit::uninit();
|
let mut dest_val = mem::MaybeUninit::uninit();
|
||||||
let ret = from_glib(gst_base_sys::gst_base_parse_convert_default(
|
let ret = from_glib(ffi::gst_base_parse_convert_default(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
src_val.get_format().to_glib(),
|
src_val.get_format().to_glib(),
|
||||||
src_val.to_raw_value(),
|
src_val.to_raw_value(),
|
||||||
|
@ -110,7 +108,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||||
let src_val = src_val.into();
|
let src_val = src_val.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut dest_val = mem::MaybeUninit::uninit();
|
let mut dest_val = mem::MaybeUninit::uninit();
|
||||||
let ret = from_glib(gst_base_sys::gst_base_parse_convert_default(
|
let ret = from_glib(ffi::gst_base_parse_convert_default(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
src_val.get_format().to_glib(),
|
src_val.get_format().to_glib(),
|
||||||
src_val.to_raw_value(),
|
src_val.to_raw_value(),
|
||||||
|
@ -134,7 +132,7 @@ impl<O: IsA<BaseParse>> BaseParseExtManual for O {
|
||||||
size: u32,
|
size: u32,
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst::FlowReturn::from_glib(gst_base_sys::gst_base_parse_finish_frame(
|
gst::FlowReturn::from_glib(ffi::gst_base_parse_finish_frame(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
frame.to_glib_none().0,
|
frame.to_glib_none().0,
|
||||||
i32::try_from(size).expect("size higher than i32::MAX"),
|
i32::try_from(size).expect("size higher than i32::MAX"),
|
||||||
|
|
|
@ -7,18 +7,16 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use BaseParse;
|
use crate::BaseParse;
|
||||||
use BaseParseFrameFlags;
|
use crate::BaseParseFrameFlags;
|
||||||
|
|
||||||
pub struct BaseParseFrame<'a>(
|
pub struct BaseParseFrame<'a>(
|
||||||
ptr::NonNull<gst_base_sys::GstBaseParseFrame>,
|
ptr::NonNull<ffi::GstBaseParseFrame>,
|
||||||
PhantomData<&'a BaseParse>,
|
PhantomData<&'a BaseParse>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -59,18 +57,14 @@ impl FromGlib<i32> for Overhead {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<'a> ::glib::translate::ToGlibPtr<'a, *mut gst_base_sys::GstBaseParseFrame>
|
impl<'a> ::glib::translate::ToGlibPtr<'a, *mut ffi::GstBaseParseFrame> for BaseParseFrame<'a> {
|
||||||
for BaseParseFrame<'a>
|
|
||||||
{
|
|
||||||
type Storage = &'a Self;
|
type Storage = &'a Self;
|
||||||
|
|
||||||
fn to_glib_none(
|
fn to_glib_none(&'a self) -> ::glib::translate::Stash<*mut ffi::GstBaseParseFrame, Self> {
|
||||||
&'a self,
|
|
||||||
) -> ::glib::translate::Stash<*mut gst_base_sys::GstBaseParseFrame, Self> {
|
|
||||||
Stash(self.0.as_ptr(), self)
|
Stash(self.0.as_ptr(), self)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_glib_full(&self) -> *mut gst_base_sys::GstBaseParseFrame {
|
fn to_glib_full(&self) -> *mut ffi::GstBaseParseFrame {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +85,7 @@ impl<'a> fmt::Debug for BaseParseFrame<'a> {
|
||||||
|
|
||||||
impl<'a> BaseParseFrame<'a> {
|
impl<'a> BaseParseFrame<'a> {
|
||||||
pub(crate) unsafe fn new(
|
pub(crate) unsafe fn new(
|
||||||
frame: *mut gst_base_sys::GstBaseParseFrame,
|
frame: *mut ffi::GstBaseParseFrame,
|
||||||
_parse: &'a BaseParse,
|
_parse: &'a BaseParse,
|
||||||
) -> BaseParseFrame<'a> {
|
) -> BaseParseFrame<'a> {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
@ -116,8 +110,8 @@ impl<'a> BaseParseFrame<'a> {
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let writable: bool = from_glib(gst_sys::gst_mini_object_is_writable(
|
let writable: bool = from_glib(gst::ffi::gst_mini_object_is_writable(
|
||||||
ptr as *const gst_sys::GstMiniObject,
|
ptr as *const gst::ffi::GstMiniObject,
|
||||||
));
|
));
|
||||||
assert!(writable);
|
assert!(writable);
|
||||||
|
|
||||||
|
@ -143,8 +137,8 @@ impl<'a> BaseParseFrame<'a> {
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let writable: bool = from_glib(gst_sys::gst_mini_object_is_writable(
|
let writable: bool = from_glib(gst::ffi::gst_mini_object_is_writable(
|
||||||
ptr as *const gst_sys::GstMiniObject,
|
ptr as *const gst::ffi::GstMiniObject,
|
||||||
));
|
));
|
||||||
assert!(writable);
|
assert!(writable);
|
||||||
|
|
||||||
|
@ -158,12 +152,12 @@ impl<'a> BaseParseFrame<'a> {
|
||||||
let prev = (*self.to_glib_none().0).out_buffer;
|
let prev = (*self.to_glib_none().0).out_buffer;
|
||||||
|
|
||||||
if !prev.is_null() {
|
if !prev.is_null() {
|
||||||
gst_sys::gst_mini_object_unref(prev as *mut gst_sys::GstMiniObject);
|
gst::ffi::gst_mini_object_unref(prev as *mut gst::ffi::GstMiniObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ptr = output_buffer.into_ptr();
|
let ptr = output_buffer.into_ptr();
|
||||||
let writable: bool = from_glib(gst_sys::gst_mini_object_is_writable(
|
let writable: bool = from_glib(gst::ffi::gst_mini_object_is_writable(
|
||||||
ptr as *const gst_sys::GstMiniObject,
|
ptr as *const gst::ffi::GstMiniObject,
|
||||||
));
|
));
|
||||||
assert!(writable);
|
assert!(writable);
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,10 @@
|
||||||
// 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 crate::BaseSink;
|
||||||
use glib::object::IsA;
|
use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use BaseSink;
|
|
||||||
|
|
||||||
pub trait BaseSinkExtManual: 'static {
|
pub trait BaseSinkExtManual: 'static {
|
||||||
fn get_segment(&self) -> gst::Segment;
|
fn get_segment(&self) -> gst::Segment;
|
||||||
|
@ -38,8 +36,8 @@ pub trait BaseSinkExtManual: 'static {
|
||||||
impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||||
fn get_segment(&self) -> gst::Segment {
|
fn get_segment(&self) -> gst::Segment {
|
||||||
unsafe {
|
unsafe {
|
||||||
let sink: &gst_base_sys::GstBaseSink = &*(self.as_ptr() as *const _);
|
let sink: &ffi::GstBaseSink = &*(self.as_ptr() as *const _);
|
||||||
let _guard = ::utils::MutexGuard::lock(&sink.element.object.lock);
|
let _guard = crate::utils::MutexGuard::lock(&sink.element.object.lock);
|
||||||
from_glib_none(&sink.segment as *const _)
|
from_glib_none(&sink.segment as *const _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +48,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||||
) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) {
|
) -> (Result<gst::FlowSuccess, gst::FlowError>, gst::ClockTimeDiff) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut jitter = 0;
|
let mut jitter = 0;
|
||||||
let ret: gst::FlowReturn = from_glib(gst_base_sys::gst_base_sink_wait(
|
let ret: gst::FlowReturn = from_glib(ffi::gst_base_sink_wait(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
time.to_glib(),
|
time.to_glib(),
|
||||||
&mut jitter,
|
&mut jitter,
|
||||||
|
@ -61,7 +59,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||||
|
|
||||||
fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
fn wait_preroll(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn = unsafe {
|
||||||
from_glib(gst_base_sys::gst_base_sink_wait_preroll(
|
from_glib(ffi::gst_base_sink_wait_preroll(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
@ -77,7 +75,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||||
) {
|
) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut jitter = 0;
|
let mut jitter = 0;
|
||||||
let ret: gst::ClockReturn = from_glib(gst_base_sys::gst_base_sink_wait_clock(
|
let ret: gst::ClockReturn = from_glib(ffi::gst_base_sink_wait_clock(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
time.to_glib(),
|
time.to_glib(),
|
||||||
&mut jitter,
|
&mut jitter,
|
||||||
|
@ -94,7 +92,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||||
let mut upstream_live = mem::MaybeUninit::uninit();
|
let mut upstream_live = mem::MaybeUninit::uninit();
|
||||||
let mut min_latency = mem::MaybeUninit::uninit();
|
let mut min_latency = mem::MaybeUninit::uninit();
|
||||||
let mut max_latency = mem::MaybeUninit::uninit();
|
let mut max_latency = mem::MaybeUninit::uninit();
|
||||||
let ret = from_glib(gst_base_sys::gst_base_sink_query_latency(
|
let ret = from_glib(ffi::gst_base_sink_query_latency(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
live.as_mut_ptr(),
|
live.as_mut_ptr(),
|
||||||
upstream_live.as_mut_ptr(),
|
upstream_live.as_mut_ptr(),
|
||||||
|
@ -113,7 +111,7 @@ impl<O: IsA<BaseSink>> BaseSinkExtManual for O {
|
||||||
from_glib(max_latency),
|
from_glib(max_latency),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
Err(glib_bool_error!("Failed to query latency"))
|
Err(glib::glib_bool_error!("Failed to query latency"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,12 +8,10 @@
|
||||||
|
|
||||||
use glib::object::IsA;
|
use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use BaseSrc;
|
use crate::BaseSrc;
|
||||||
|
|
||||||
pub trait BaseSrcExtManual: 'static {
|
pub trait BaseSrcExtManual: 'static {
|
||||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||||
|
@ -38,7 +36,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual 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_base_src_get_allocator(
|
ffi::gst_base_src_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
&mut params,
|
||||||
|
@ -49,8 +47,8 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||||
|
|
||||||
fn get_segment(&self) -> gst::Segment {
|
fn get_segment(&self) -> gst::Segment {
|
||||||
unsafe {
|
unsafe {
|
||||||
let src: &gst_base_sys::GstBaseSrc = &*(self.as_ptr() as *const _);
|
let src: &ffi::GstBaseSrc = &*(self.as_ptr() as *const _);
|
||||||
let _guard = ::utils::MutexGuard::lock(&src.element.object.lock);
|
let _guard = crate::utils::MutexGuard::lock(&src.element.object.lock);
|
||||||
from_glib_none(&src.segment as *const _)
|
from_glib_none(&src.segment as *const _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,25 +56,19 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||||
fn start_complete(&self, ret: Result<gst::FlowSuccess, gst::FlowError>) {
|
fn start_complete(&self, ret: Result<gst::FlowSuccess, gst::FlowError>) {
|
||||||
let ret: gst::FlowReturn = ret.into();
|
let ret: gst::FlowReturn = ret.into();
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_base_src_start_complete(
|
ffi::gst_base_src_start_complete(self.as_ref().to_glib_none().0, ret.to_glib());
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
ret.to_glib(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_wait(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
fn start_wait(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn =
|
||||||
from_glib(gst_base_sys::gst_base_src_start_wait(
|
unsafe { from_glib(ffi::gst_base_src_start_wait(self.as_ref().to_glib_none().0)) };
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
))
|
|
||||||
};
|
|
||||||
ret.into_result()
|
ret.into_result()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
fn wait_playing(&self) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn = unsafe {
|
||||||
from_glib(gst_base_sys::gst_base_src_wait_playing(
|
from_glib(ffi::gst_base_src_wait_playing(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
@ -88,7 +80,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||||
let mut live = mem::MaybeUninit::uninit();
|
let mut live = mem::MaybeUninit::uninit();
|
||||||
let mut min_latency = mem::MaybeUninit::uninit();
|
let mut min_latency = mem::MaybeUninit::uninit();
|
||||||
let mut max_latency = mem::MaybeUninit::uninit();
|
let mut max_latency = mem::MaybeUninit::uninit();
|
||||||
let ret = from_glib(gst_base_sys::gst_base_src_query_latency(
|
let ret = from_glib(ffi::gst_base_src_query_latency(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
live.as_mut_ptr(),
|
live.as_mut_ptr(),
|
||||||
min_latency.as_mut_ptr(),
|
min_latency.as_mut_ptr(),
|
||||||
|
@ -104,7 +96,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||||
from_glib(max_latency),
|
from_glib(max_latency),
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
Err(glib_bool_error!("Failed to query latency"))
|
Err(glib::glib_bool_error!("Failed to query latency"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +105,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
fn new_segment(&self, segment: &gst::Segment) -> Result<(), glib::BoolError> {
|
fn new_segment(&self, segment: &gst::Segment) -> Result<(), glib::BoolError> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ret = from_glib(gst_base_sys::gst_base_src_new_segment(
|
let ret = from_glib(ffi::gst_base_src_new_segment(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
segment.to_glib_none().0,
|
segment.to_glib_none().0,
|
||||||
));
|
));
|
||||||
|
@ -121,7 +113,7 @@ impl<O: IsA<BaseSrc>> BaseSrcExtManual for O {
|
||||||
if ret {
|
if ret {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(glib_bool_error!("Failed to configure new segment"))
|
Err(glib::glib_bool_error!("Failed to configure new segment"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,11 @@
|
||||||
// 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 crate::BaseTransform;
|
||||||
use glib::object::IsA;
|
use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use BaseTransform;
|
|
||||||
|
|
||||||
pub trait BaseTransformExtManual: 'static {
|
pub trait BaseTransformExtManual: 'static {
|
||||||
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
fn get_allocator(&self) -> (Option<gst::Allocator>, gst::AllocationParams);
|
||||||
|
@ -25,7 +23,7 @@ impl<O: IsA<BaseTransform>> BaseTransformExtManual 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_base_transform_get_allocator(
|
ffi::gst_base_transform_get_allocator(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
&mut allocator,
|
&mut allocator,
|
||||||
&mut params,
|
&mut params,
|
||||||
|
@ -36,8 +34,8 @@ impl<O: IsA<BaseTransform>> BaseTransformExtManual for O {
|
||||||
|
|
||||||
fn get_segment(&self) -> gst::Segment {
|
fn get_segment(&self) -> gst::Segment {
|
||||||
unsafe {
|
unsafe {
|
||||||
let trans: &gst_base_sys::GstBaseTransform = &*(self.as_ptr() as *const _);
|
let trans: &ffi::GstBaseTransform = &*(self.as_ptr() as *const _);
|
||||||
let _guard = ::utils::MutexGuard::lock(&trans.element.object.lock);
|
let _guard = crate::utils::MutexGuard::lock(&trans.element.object.lock);
|
||||||
from_glib_none(&trans.segment as *const _)
|
from_glib_none(&trans.segment as *const _)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,54 +8,45 @@
|
||||||
|
|
||||||
use glib::object::IsA;
|
use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gobject_sys;
|
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
|
|
||||||
glib_wrapper! {
|
glib::glib_wrapper! {
|
||||||
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct FlowCombiner(Shared<gst_base_sys::GstFlowCombiner>);
|
pub struct FlowCombiner(Shared<ffi::GstFlowCombiner>);
|
||||||
|
|
||||||
match fn {
|
match fn {
|
||||||
ref => |ptr| gobject_sys::g_boxed_copy(gst_base_sys::gst_flow_combiner_get_type(), ptr as *mut _),
|
ref => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gst_flow_combiner_get_type(), ptr as *mut _),
|
||||||
unref => |ptr| gobject_sys::g_boxed_free(gst_base_sys::gst_flow_combiner_get_type(), ptr as *mut _),
|
unref => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gst_flow_combiner_get_type(), ptr as *mut _),
|
||||||
get_type => || gst_base_sys::gst_flow_combiner_get_type(),
|
get_type => || ffi::gst_flow_combiner_get_type(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlowCombiner {
|
impl FlowCombiner {
|
||||||
pub fn new() -> FlowCombiner {
|
pub fn new() -> FlowCombiner {
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe { from_glib_full(gst_base_sys::gst_flow_combiner_new()) }
|
unsafe { from_glib_full(ffi::gst_flow_combiner_new()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_pad<P: IsA<gst::Pad>>(&self, pad: &P) {
|
pub fn add_pad<P: IsA<gst::Pad>>(&self, pad: &P) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_flow_combiner_add_pad(
|
ffi::gst_flow_combiner_add_pad(self.to_glib_none().0, pad.as_ref().to_glib_none().0);
|
||||||
self.to_glib_none().0,
|
|
||||||
pad.as_ref().to_glib_none().0,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear(&self) {
|
pub fn clear(&self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_flow_combiner_clear(self.to_glib_none().0);
|
ffi::gst_flow_combiner_clear(self.to_glib_none().0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_pad<P: IsA<gst::Pad>>(&self, pad: &P) {
|
pub fn remove_pad<P: IsA<gst::Pad>>(&self, pad: &P) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_flow_combiner_remove_pad(
|
ffi::gst_flow_combiner_remove_pad(self.to_glib_none().0, pad.as_ref().to_glib_none().0);
|
||||||
self.to_glib_none().0,
|
|
||||||
pad.as_ref().to_glib_none().0,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset(&self) {
|
pub fn reset(&self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
gst_base_sys::gst_flow_combiner_reset(self.to_glib_none().0);
|
ffi::gst_flow_combiner_reset(self.to_glib_none().0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +56,7 @@ impl FlowCombiner {
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let fret: gst::FlowReturn = fret.into();
|
let fret: gst::FlowReturn = fret.into();
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn = unsafe {
|
||||||
from_glib(gst_base_sys::gst_flow_combiner_update_flow(
|
from_glib(ffi::gst_flow_combiner_update_flow(
|
||||||
self.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
fret.to_glib(),
|
fret.to_glib(),
|
||||||
))
|
))
|
||||||
|
@ -80,7 +71,7 @@ impl FlowCombiner {
|
||||||
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
let fret: gst::FlowReturn = fret.into();
|
let fret: gst::FlowReturn = fret.into();
|
||||||
let ret: gst::FlowReturn = unsafe {
|
let ret: gst::FlowReturn = unsafe {
|
||||||
from_glib(gst_base_sys::gst_flow_combiner_update_pad_flow(
|
from_glib(ffi::gst_flow_combiner_update_pad_flow(
|
||||||
self.to_glib_none().0,
|
self.to_glib_none().0,
|
||||||
pad.as_ref().to_glib_none().0,
|
pad.as_ref().to_glib_none().0,
|
||||||
fret.to_glib(),
|
fret.to_glib(),
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
|
|
||||||
use glib::object::IsA;
|
use glib::object::IsA;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use gst;
|
|
||||||
use gst_base_sys;
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
||||||
|
@ -21,14 +19,14 @@ pub fn type_find_helper_for_data<P: IsA<gst::Object>, R: AsRef<[u8]>>(
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
let data = data.as_ref();
|
let data = data.as_ref();
|
||||||
let (ptr, len) = (data.as_ptr(), data.len());
|
let (ptr, len) = (data.as_ptr(), data.len());
|
||||||
let ret = gst_base_sys::gst_type_find_helper_for_data(
|
let ret = ffi::gst_type_find_helper_for_data(
|
||||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
mut_override(ptr),
|
mut_override(ptr),
|
||||||
len,
|
len,
|
||||||
prob.as_mut_ptr(),
|
prob.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
Err(glib_bool_error!("No type could be found"))
|
Err(glib::glib_bool_error!("No type could be found"))
|
||||||
} else {
|
} else {
|
||||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||||
}
|
}
|
||||||
|
@ -47,7 +45,7 @@ pub fn type_find_helper_for_data_with_extension<P: IsA<gst::Object>, R: AsRef<[u
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
let data = data.as_ref();
|
let data = data.as_ref();
|
||||||
let (ptr, len) = (data.as_ptr(), data.len());
|
let (ptr, len) = (data.as_ptr(), data.len());
|
||||||
let ret = gst_base_sys::gst_type_find_helper_for_data_with_extension(
|
let ret = ffi::gst_type_find_helper_for_data_with_extension(
|
||||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
mut_override(ptr),
|
mut_override(ptr),
|
||||||
len,
|
len,
|
||||||
|
@ -55,7 +53,7 @@ pub fn type_find_helper_for_data_with_extension<P: IsA<gst::Object>, R: AsRef<[u
|
||||||
prob.as_mut_ptr(),
|
prob.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
Err(glib_bool_error!("No type could be found"))
|
Err(glib::glib_bool_error!("No type could be found"))
|
||||||
} else {
|
} else {
|
||||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||||
}
|
}
|
||||||
|
@ -69,13 +67,13 @@ pub fn type_find_helper_for_buffer<P: IsA<gst::Object>>(
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
let ret = gst_base_sys::gst_type_find_helper_for_buffer(
|
let ret = ffi::gst_type_find_helper_for_buffer(
|
||||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
buf.to_glib_none().0,
|
buf.to_glib_none().0,
|
||||||
prob.as_mut_ptr(),
|
prob.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
Err(glib_bool_error!("No type could be found"))
|
Err(glib::glib_bool_error!("No type could be found"))
|
||||||
} else {
|
} else {
|
||||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||||
}
|
}
|
||||||
|
@ -92,14 +90,14 @@ pub fn type_find_helper_for_buffer_with_extension<P: IsA<gst::Object>>(
|
||||||
assert_initialized_main_thread!();
|
assert_initialized_main_thread!();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut prob = mem::MaybeUninit::uninit();
|
let mut prob = mem::MaybeUninit::uninit();
|
||||||
let ret = gst_base_sys::gst_type_find_helper_for_buffer_with_extension(
|
let ret = ffi::gst_type_find_helper_for_buffer_with_extension(
|
||||||
obj.map(|p| p.as_ref()).to_glib_none().0,
|
obj.map(|p| p.as_ref()).to_glib_none().0,
|
||||||
buf.to_glib_none().0,
|
buf.to_glib_none().0,
|
||||||
extension.to_glib_none().0,
|
extension.to_glib_none().0,
|
||||||
prob.as_mut_ptr(),
|
prob.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
if ret.is_null() {
|
if ret.is_null() {
|
||||||
Err(glib_bool_error!("No type could be found"))
|
Err(glib::glib_bool_error!("No type could be found"))
|
||||||
} else {
|
} else {
|
||||||
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
Ok((from_glib_full(ret), from_glib(prob.assume_init())))
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,23 +8,11 @@
|
||||||
|
|
||||||
#![cfg_attr(feature = "dox", feature(doc_cfg))]
|
#![cfg_attr(feature = "dox", feature(doc_cfg))]
|
||||||
|
|
||||||
extern crate glib_sys;
|
pub use ffi;
|
||||||
extern crate gobject_sys;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate gstreamer as gst;
|
|
||||||
extern crate gstreamer_base_sys as gst_base_sys;
|
|
||||||
extern crate gstreamer_sys as gst_sys;
|
|
||||||
|
|
||||||
extern crate libc;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate bitflags;
|
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate glib;
|
|
||||||
|
|
||||||
macro_rules! assert_initialized_main_thread {
|
macro_rules! assert_initialized_main_thread {
|
||||||
() => {
|
() => {
|
||||||
if unsafe { ::gst_sys::gst_is_initialized() } != ::glib_sys::GTRUE {
|
if unsafe { gst::ffi::gst_is_initialized() } != glib::ffi::GTRUE {
|
||||||
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
panic!("GStreamer has not been initialized. Call `gst::init` first.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -40,16 +28,16 @@ macro_rules! skip_assert_initialized {
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
mod auto;
|
mod auto;
|
||||||
pub use auto::functions::*;
|
pub use crate::auto::functions::*;
|
||||||
pub use auto::*;
|
pub use crate::auto::*;
|
||||||
|
|
||||||
pub mod functions;
|
pub mod functions;
|
||||||
pub use functions::*;
|
pub use crate::functions::*;
|
||||||
|
|
||||||
mod adapter;
|
mod adapter;
|
||||||
pub use adapter::*;
|
pub use crate::adapter::*;
|
||||||
mod flow_combiner;
|
mod flow_combiner;
|
||||||
pub use flow_combiner::*;
|
pub use crate::flow_combiner::*;
|
||||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
mod aggregator;
|
mod aggregator;
|
||||||
|
@ -63,16 +51,16 @@ mod aggregator_pad;
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
pub use aggregator_pad::AggregatorPadExtManual;
|
pub use aggregator_pad::AggregatorPadExtManual;
|
||||||
mod base_parse;
|
mod base_parse;
|
||||||
pub use base_parse::BaseParseExtManual;
|
pub use crate::base_parse::BaseParseExtManual;
|
||||||
mod base_sink;
|
mod base_sink;
|
||||||
pub use base_sink::BaseSinkExtManual;
|
pub use crate::base_sink::BaseSinkExtManual;
|
||||||
mod base_src;
|
mod base_src;
|
||||||
pub use base_src::BaseSrcExtManual;
|
pub use crate::base_src::BaseSrcExtManual;
|
||||||
mod base_transform;
|
mod base_transform;
|
||||||
pub use base_transform::BaseTransformExtManual;
|
pub use crate::base_transform::BaseTransformExtManual;
|
||||||
|
|
||||||
pub mod base_parse_frame;
|
pub mod base_parse_frame;
|
||||||
pub use base_parse_frame::BaseParseFrame;
|
pub use crate::base_parse_frame::BaseParseFrame;
|
||||||
|
|
||||||
pub const BASE_TRANSFORM_FLOW_DROPPED: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
pub const BASE_TRANSFORM_FLOW_DROPPED: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
||||||
pub const BASE_PARSE_FLOW_DROPPED: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
pub const BASE_PARSE_FLOW_DROPPED: gst::FlowSuccess = gst::FlowSuccess::CustomSuccess;
|
||||||
|
@ -86,15 +74,15 @@ pub mod prelude {
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
pub use aggregator::AggregatorExtManual;
|
pub use crate::aggregator::AggregatorExtManual;
|
||||||
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
#[cfg(any(feature = "v1_14", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))]
|
||||||
pub use aggregator_pad::AggregatorPadExtManual;
|
pub use crate::aggregator_pad::AggregatorPadExtManual;
|
||||||
pub use auto::traits::*;
|
pub use crate::auto::traits::*;
|
||||||
pub use base_parse::BaseParseExtManual;
|
pub use crate::base_parse::BaseParseExtManual;
|
||||||
pub use base_sink::BaseSinkExtManual;
|
pub use crate::base_sink::BaseSinkExtManual;
|
||||||
pub use base_src::BaseSrcExtManual;
|
pub use crate::base_src::BaseSrcExtManual;
|
||||||
pub use base_transform::BaseTransformExtManual;
|
pub use crate::base_transform::BaseTransformExtManual;
|
||||||
}
|
}
|
||||||
|
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
|
@ -6,23 +6,16 @@
|
||||||
// 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 libc;
|
|
||||||
|
|
||||||
use glib_sys;
|
|
||||||
use gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use Aggregator;
|
use crate::Aggregator;
|
||||||
use AggregatorPad;
|
use crate::AggregatorPad;
|
||||||
|
|
||||||
pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
pub trait AggregatorImpl: AggregatorImplExt + ElementImpl {
|
||||||
fn flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError> {
|
fn flush(&self, aggregator: &Self::Type) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
@ -298,8 +291,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| {
|
||||||
|
@ -321,8 +313,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(
|
||||||
|
@ -341,8 +332,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`");
|
||||||
|
@ -363,8 +353,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_list
|
.finish_buffer_list
|
||||||
.expect("Missing parent function `finish_buffer_list`");
|
.expect("Missing parent function `finish_buffer_list`");
|
||||||
|
@ -384,8 +373,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`");
|
||||||
|
@ -407,8 +395,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`");
|
||||||
|
@ -429,8 +416,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`");
|
||||||
|
@ -452,8 +438,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`");
|
||||||
|
@ -468,8 +453,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`");
|
||||||
|
@ -483,8 +467,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`");
|
||||||
|
@ -503,11 +486,10 @@ 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::gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
mode.to_glib(),
|
mode.to_glib(),
|
||||||
|
@ -527,8 +509,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`");
|
||||||
|
@ -543,8 +524,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| {
|
||||||
|
@ -555,7 +535,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
{
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::Failed,
|
gst::CoreError::Failed,
|
||||||
["Parent function `start` failed"]
|
["Parent function `start` failed"]
|
||||||
))
|
))
|
||||||
|
@ -568,8 +548,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| {
|
||||||
|
@ -580,7 +559,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
{
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::Failed,
|
gst::CoreError::Failed,
|
||||||
["Parent function `stop` failed"]
|
["Parent function `stop` failed"]
|
||||||
))
|
))
|
||||||
|
@ -593,8 +572,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| {
|
||||||
|
@ -616,8 +594,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`");
|
||||||
|
@ -637,8 +614,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`");
|
||||||
|
@ -656,8 +632,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
|
||||||
|
@ -676,12 +651,11 @@ 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| {
|
||||||
gst_result_from_gboolean!(
|
gst::gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
aggregator.unsafe_cast_ref::<Aggregator>().to_glib_none().0,
|
||||||
caps.to_glib_none().0
|
caps.to_glib_none().0
|
||||||
|
@ -699,8 +673,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| {
|
||||||
|
@ -722,8 +695,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
) -> Option<gst::Sample> {
|
) -> Option<gst::Sample> {
|
||||||
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)
|
||||||
.peek_next_sample
|
.peek_next_sample
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -772,8 +744,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,
|
||||||
{
|
{
|
||||||
|
@ -781,17 +753,17 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.flush(wrap.unsafe_cast_ref()).into()
|
imp.flush(wrap.unsafe_cast_ref()).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -799,7 +771,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
let ret = gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
let ret = gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.clip(
|
imp.clip(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
|
@ -811,9 +783,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,
|
||||||
{
|
{
|
||||||
|
@ -821,7 +793,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
|
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
@ -831,9 +803,9 @@ where
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
unsafe extern "C" fn aggregator_finish_buffer_list<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_finish_buffer_list<T: AggregatorImpl>(
|
||||||
ptr: *mut gst_base_sys::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
buffer_list: *mut gst_sys::GstBufferList,
|
buffer_list: *mut gst::ffi::GstBufferList,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -841,7 +813,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list))
|
imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list))
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
@ -849,10 +821,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,
|
||||||
{
|
{
|
||||||
|
@ -860,7 +832,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(wrap, &instance.panicked(), false, {
|
||||||
imp.sink_event(
|
imp.sink_event(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
|
@ -873,10 +845,10 @@ where
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -884,7 +856,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.sink_event_pre_queue(
|
imp.sink_event_pre_queue(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
|
@ -896,10 +868,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,
|
||||||
{
|
{
|
||||||
|
@ -907,7 +879,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.sink_query(
|
imp.sink_query(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
|
@ -920,10 +892,10 @@ where
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -931,7 +903,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.sink_query_pre_queue(
|
imp.sink_query_pre_queue(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
|
@ -942,9 +914,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,
|
||||||
{
|
{
|
||||||
|
@ -952,16 +924,16 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -969,17 +941,17 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -987,7 +959,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) {
|
match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1000,9 +972,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,
|
||||||
{
|
{
|
||||||
|
@ -1010,7 +982,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
|
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
@ -1018,8 +990,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,
|
||||||
{
|
{
|
||||||
|
@ -1027,7 +999,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1040,8 +1012,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,
|
||||||
{
|
{
|
||||||
|
@ -1049,7 +1021,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1062,8 +1034,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,
|
||||||
{
|
{
|
||||||
|
@ -1071,18 +1043,18 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::CLOCK_TIME_NONE, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::CLOCK_TIME_NONE, {
|
||||||
imp.get_next_time(wrap.unsafe_cast_ref())
|
imp.get_next_time(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -1090,7 +1062,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name);
|
let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name);
|
||||||
|
|
||||||
imp.create_new_pad(
|
imp.create_new_pad(
|
||||||
|
@ -1106,10 +1078,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,
|
||||||
{
|
{
|
||||||
|
@ -1119,7 +1091,7 @@ where
|
||||||
|
|
||||||
*res = ptr::null_mut();
|
*res = ptr::null_mut();
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||||
Ok(res_caps) => {
|
Ok(res_caps) => {
|
||||||
*res = res_caps.into_ptr();
|
*res = res_caps.into_ptr();
|
||||||
|
@ -1132,9 +1104,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,
|
||||||
{
|
{
|
||||||
|
@ -1142,16 +1114,16 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps))
|
imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps))
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -1159,7 +1131,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1174,8 +1146,8 @@ where
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -1183,7 +1155,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.negotiate(wrap.unsafe_cast_ref())
|
imp.negotiate(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -1192,9 +1164,9 @@ where
|
||||||
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
#[cfg(any(feature = "v1_18", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_18")))]
|
||||||
unsafe extern "C" fn aggregator_peek_next_sample<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_peek_next_sample<T: AggregatorImpl>(
|
||||||
ptr: *mut gst_base_sys::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
pad: *mut gst_base_sys::GstAggregatorPad,
|
pad: *mut ffi::GstAggregatorPad,
|
||||||
) -> *mut gst_sys::GstSample
|
) -> *mut gst::ffi::GstSample
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1202,7 +1174,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad))
|
imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad))
|
||||||
})
|
})
|
||||||
.to_glib_full()
|
.to_glib_full()
|
||||||
|
|
|
@ -6,19 +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 glib_sys;
|
|
||||||
use gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use Aggregator;
|
use crate::Aggregator;
|
||||||
use AggregatorPad;
|
use crate::AggregatorPad;
|
||||||
|
|
||||||
pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
|
pub trait AggregatorPadImpl: AggregatorPadImplExt + PadImpl {
|
||||||
fn flush(
|
fn flush(
|
||||||
|
@ -62,8 +57,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| {
|
||||||
|
@ -88,8 +82,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| {
|
||||||
|
@ -116,9 +109,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);
|
||||||
|
@ -130,10 +123,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);
|
||||||
|
|
|
@ -6,22 +6,18 @@
|
||||||
// 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 glib_sys;
|
|
||||||
use gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use BaseParse;
|
use crate::BaseParse;
|
||||||
use BaseParseFrame;
|
use crate::BaseParseFrame;
|
||||||
|
|
||||||
pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
|
pub trait BaseParseImpl: BaseParseImplExt + ElementImpl {
|
||||||
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
|
@ -87,15 +83,14 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &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::GstBaseParseClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `start` failed"]
|
["Parent function `start` failed"]
|
||||||
))
|
))
|
||||||
|
@ -108,15 +103,14 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &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::GstBaseParseClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseParse>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `stop` failed"]
|
["Parent function `stop` failed"]
|
||||||
))
|
))
|
||||||
|
@ -133,8 +127,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
) -> Result<(), gst::ErrorMessage> {
|
) -> 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::GstBaseParseClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.set_sink_caps
|
.set_sink_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -144,7 +137,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
)) {
|
)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `set_sink_caps` failed"]
|
["Parent function `set_sink_caps` failed"]
|
||||||
))
|
))
|
||||||
|
@ -161,8 +154,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
) -> Result<(gst::FlowSuccess, u32), gst::FlowError> {
|
) -> Result<(gst::FlowSuccess, u32), 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::GstBaseParseClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass;
|
|
||||||
let mut skipsize = 0;
|
let mut skipsize = 0;
|
||||||
let res = (*parent_class).handle_frame.map(|f| {
|
let res = (*parent_class).handle_frame.map(|f| {
|
||||||
let res = gst::FlowReturn::from_glib(f(
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
|
@ -191,8 +183,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
) -> Option<gst::GenericFormattedValue> {
|
) -> Option<gst::GenericFormattedValue> {
|
||||||
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::GstBaseParseClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseParseClass;
|
|
||||||
let src_val = src_val.into();
|
let src_val = src_val.into();
|
||||||
let res = (*parent_class).convert.map(|f| {
|
let res = (*parent_class).convert.map(|f| {
|
||||||
let mut dest_val = mem::MaybeUninit::uninit();
|
let mut dest_val = mem::MaybeUninit::uninit();
|
||||||
|
@ -234,8 +225,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_parse_start<T: BaseParseImpl>(
|
unsafe extern "C" fn base_parse_start<T: BaseParseImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -243,7 +234,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -256,8 +247,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>(
|
unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -265,7 +256,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -278,9 +269,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_parse_set_sink_caps<T: BaseParseImpl>(
|
unsafe extern "C" fn base_parse_set_sink_caps<T: BaseParseImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -289,7 +280,7 @@ where
|
||||||
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
let caps: Borrowed<gst::Caps> = from_glib_borrow(caps);
|
let caps: Borrowed<gst::Caps> = from_glib_borrow(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) {
|
match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -302,10 +293,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>(
|
unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
frame: *mut gst_base_sys::GstBaseParseFrame,
|
frame: *mut ffi::GstBaseParseFrame,
|
||||||
skipsize: *mut i32,
|
skipsize: *mut i32,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -314,7 +305,7 @@ where
|
||||||
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
let wrap_frame = BaseParseFrame::new(frame, &wrap);
|
let wrap_frame = BaseParseFrame::new(frame, &wrap);
|
||||||
|
|
||||||
let res = gst_panic_to_error!(&wrap, &instance.panicked(), Err(gst::FlowError::Error), {
|
let res = gst::gst_panic_to_error!(&wrap, &instance.panicked(), Err(gst::FlowError::Error), {
|
||||||
imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame)
|
imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -329,12 +320,12 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_parse_convert<T: BaseParseImpl>(
|
unsafe extern "C" fn base_parse_convert<T: BaseParseImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
source_format: gst_sys::GstFormat,
|
source_format: gst::ffi::GstFormat,
|
||||||
source_value: i64,
|
source_value: i64,
|
||||||
dest_format: gst_sys::GstFormat,
|
dest_format: gst::ffi::GstFormat,
|
||||||
dest_value: *mut i64,
|
dest_value: *mut i64,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -343,7 +334,7 @@ where
|
||||||
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value);
|
let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value);
|
||||||
|
|
||||||
let res = gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
let res = gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format))
|
imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,20 +6,15 @@
|
||||||
// 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 glib_sys;
|
|
||||||
use gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use BaseSink;
|
use crate::BaseSink;
|
||||||
|
|
||||||
pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
pub trait BaseSinkImpl: BaseSinkImplExt + ElementImpl {
|
||||||
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
|
@ -147,15 +142,14 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `start` failed"]
|
["Parent function `start` failed"]
|
||||||
))
|
))
|
||||||
|
@ -168,15 +162,14 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `stop` failed"]
|
["Parent function `stop` failed"]
|
||||||
))
|
))
|
||||||
|
@ -193,8 +186,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt 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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.render
|
.render
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -215,8 +207,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt 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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.prepare
|
.prepare
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -237,8 +228,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt 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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.render_list
|
.render_list
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -264,8 +254,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt 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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.prepare_list
|
.prepare_list
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -287,8 +276,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
fn parent_query(&self, element: &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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.query
|
.query
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -304,8 +292,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
fn parent_event(&self, element: &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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.event
|
.event
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -325,8 +312,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
) -> Option<gst::Caps> {
|
) -> Option<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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.get_caps
|
.get_caps
|
||||||
|
@ -347,12 +333,11 @@ impl<T: BaseSinkImpl> BaseSinkImplExt 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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.set_caps
|
.set_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst::gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseSink>().to_glib_none().0,
|
||||||
caps.to_glib_none().0
|
caps.to_glib_none().0
|
||||||
|
@ -368,8 +353,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
fn parent_fixate(&self, element: &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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
|
|
||||||
match (*parent_class).fixate {
|
match (*parent_class).fixate {
|
||||||
Some(fixate) => from_glib_full(fixate(
|
Some(fixate) => from_glib_full(fixate(
|
||||||
|
@ -384,15 +368,14 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock(&self, element: &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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock
|
.unlock
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::Failed,
|
gst::CoreError::Failed,
|
||||||
["Parent function `unlock` failed"]
|
["Parent function `unlock` failed"]
|
||||||
))
|
))
|
||||||
|
@ -405,15 +388,14 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock_stop(&self, element: &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::GstBaseSinkClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSinkClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock_stop
|
.unlock_stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSink>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::Failed,
|
gst::CoreError::Failed,
|
||||||
["Parent function `unlock_stop` failed"]
|
["Parent function `unlock_stop` failed"]
|
||||||
))
|
))
|
||||||
|
@ -448,8 +430,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_start<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_start<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -457,7 +439,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -470,8 +452,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -479,7 +461,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -492,9 +474,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
buffer: *mut gst_sys::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -503,16 +485,16 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let buffer = from_glib_borrow(buffer);
|
let buffer = from_glib_borrow(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.render(wrap.unsafe_cast_ref(), &buffer).into()
|
imp.render(wrap.unsafe_cast_ref(), &buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
buffer: *mut gst_sys::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -521,16 +503,16 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let buffer = from_glib_borrow(buffer);
|
let buffer = from_glib_borrow(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
|
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
list: *mut gst_sys::GstBufferList,
|
list: *mut gst::ffi::GstBufferList,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -539,16 +521,16 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let list = from_glib_borrow(list);
|
let list = from_glib_borrow(list);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.render_list(wrap.unsafe_cast_ref(), &list).into()
|
imp.render_list(wrap.unsafe_cast_ref(), &list).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
list: *mut gst_sys::GstBufferList,
|
list: *mut gst::ffi::GstBufferList,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -557,16 +539,16 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let list = from_glib_borrow(list);
|
let list = from_glib_borrow(list);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.prepare_list(wrap.unsafe_cast_ref(), &list).into()
|
imp.prepare_list(wrap.unsafe_cast_ref(), &list).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
query_ptr: *mut gst_sys::GstQuery,
|
query_ptr: *mut gst::ffi::GstQuery,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -575,16 +557,16 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
event_ptr: *mut gst_sys::GstEvent,
|
event_ptr: *mut gst::ffi::GstEvent,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -592,16 +574,16 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr))
|
imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
filter: *mut gst_sys::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst_sys::GstCaps
|
) -> *mut gst::ffi::GstCaps
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -610,7 +592,7 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||||
})
|
})
|
||||||
.map(|caps| caps.into_ptr())
|
.map(|caps| caps.into_ptr())
|
||||||
|
@ -618,9 +600,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_set_caps<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_set_caps<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -629,7 +611,7 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let caps = from_glib_borrow(caps);
|
let caps = from_glib_borrow(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
|
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -642,9 +624,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_fixate<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_fixate<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -653,15 +635,15 @@ where
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
let caps = from_glib_full(caps);
|
let caps = from_glib_full(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_unlock<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_unlock<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -669,7 +651,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock(wrap.unsafe_cast_ref()) {
|
match imp.unlock(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -682,8 +664,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -691,7 +673,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock_stop(wrap.unsafe_cast_ref()) {
|
match imp.unlock_stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -6,21 +6,16 @@
|
||||||
// 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 glib_sys;
|
|
||||||
use gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use BaseSrc;
|
use crate::BaseSrc;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum CreateSuccess {
|
pub enum CreateSuccess {
|
||||||
|
@ -188,15 +183,14 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `start` failed"]
|
["Parent function `start` failed"]
|
||||||
))
|
))
|
||||||
|
@ -209,15 +203,14 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `stop` failed"]
|
["Parent function `stop` failed"]
|
||||||
))
|
))
|
||||||
|
@ -230,8 +223,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_is_seekable(&self, element: &Self::Type) -> bool {
|
fn parent_is_seekable(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.is_seekable
|
.is_seekable
|
||||||
.map(|f| from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)))
|
.map(|f| from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)))
|
||||||
|
@ -242,8 +234,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_get_size(&self, element: &Self::Type) -> Option<u64> {
|
fn parent_get_size(&self, element: &Self::Type) -> Option<u64> {
|
||||||
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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.get_size
|
.get_size
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -268,8 +259,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
) -> (gst::ClockTime, gst::ClockTime) {
|
) -> (gst::ClockTime, 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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.get_times
|
.get_times
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -299,8 +289,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt 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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.fill
|
.fill
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -324,16 +313,15 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
) -> Result<gst::Buffer, gst::FlowError> {
|
) -> Result<gst::Buffer, 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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.alloc
|
.alloc
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
let mut buffer_ptr: *mut gst_sys::GstBuffer = ptr::null_mut();
|
let mut buffer_ptr: *mut gst::ffi::GstBuffer = ptr::null_mut();
|
||||||
|
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
let res = gst::FlowReturn::from_glib(f(
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
|
@ -356,8 +344,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
) -> Result<CreateSuccess, gst::FlowError> {
|
) -> Result<CreateSuccess, 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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.create
|
.create
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -369,7 +356,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
|
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst::FlowReturn::from_glib(
|
gst::FlowReturn::from_glib(
|
||||||
f(
|
f(
|
||||||
|
@ -384,7 +371,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
if buffer_ptr != orig_buffer_ptr {
|
if buffer_ptr != orig_buffer_ptr {
|
||||||
let new_buffer = gst::BufferRef::from_ptr(buffer_ptr);
|
let new_buffer = gst::BufferRef::from_ptr(buffer_ptr);
|
||||||
|
|
||||||
gst_debug!(
|
gst::gst_debug!(
|
||||||
gst::CAT_PERFORMANCE,
|
gst::CAT_PERFORMANCE,
|
||||||
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
||||||
"Returned new buffer from parent create function, copying into passed buffer"
|
"Returned new buffer from parent create function, copying into passed buffer"
|
||||||
|
@ -393,7 +380,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
let mut map = match passed_buffer.map_writable() {
|
let mut map = match passed_buffer.map_writable() {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
gst_error!(
|
gst::gst_error!(
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
||||||
"Failed to map passed buffer writable"
|
"Failed to map passed buffer writable"
|
||||||
|
@ -412,7 +399,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
match new_buffer.copy_into(passed_buffer, gst::BUFFER_COPY_METADATA, 0, None) {
|
match new_buffer.copy_into(passed_buffer, gst::BUFFER_COPY_METADATA, 0, None) {
|
||||||
Ok(_) => Ok(CreateSuccess::FilledBuffer),
|
Ok(_) => Ok(CreateSuccess::FilledBuffer),
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
gst_error!(
|
gst::gst_error!(
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
obj: element.unsafe_cast_ref::<BaseSrc>(),
|
||||||
"Failed to copy buffer metadata"
|
"Failed to copy buffer metadata"
|
||||||
|
@ -435,8 +422,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_do_seek(&self, element: &Self::Type, segment: &mut gst::Segment) -> bool {
|
fn parent_do_seek(&self, element: &Self::Type, segment: &mut gst::Segment) -> 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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.do_seek
|
.do_seek
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -452,8 +438,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_query(&self, element: &Self::Type, query: &mut gst::QueryRef) -> bool {
|
fn parent_query(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.query
|
.query
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -469,8 +454,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_event(&self, element: &Self::Type, event: &gst::Event) -> bool {
|
fn parent_event(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.event
|
.event
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -490,8 +474,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
) -> Option<gst::Caps> {
|
) -> Option<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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.get_caps
|
.get_caps
|
||||||
|
@ -508,12 +491,11 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_negotiate(&self, element: &Self::Type) -> Result<(), gst::LoggableError> {
|
fn parent_negotiate(&self, element: &Self::Type) -> 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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.negotiate
|
.negotiate
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst::gst_result_from_gboolean!(
|
||||||
f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0),
|
f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0),
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
"Parent function `negotiate` failed"
|
"Parent function `negotiate` failed"
|
||||||
|
@ -530,12 +512,11 @@ impl<T: BaseSrcImpl> BaseSrcImplExt 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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.set_caps
|
.set_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst::gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0,
|
||||||
caps.to_glib_none().0
|
caps.to_glib_none().0
|
||||||
|
@ -551,8 +532,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_fixate(&self, element: &Self::Type, caps: gst::Caps) -> gst::Caps {
|
fn parent_fixate(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
|
|
||||||
match (*parent_class).fixate {
|
match (*parent_class).fixate {
|
||||||
Some(fixate) => from_glib_full(fixate(
|
Some(fixate) => from_glib_full(fixate(
|
||||||
|
@ -567,15 +547,14 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_unlock(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock
|
.unlock
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::Failed,
|
gst::CoreError::Failed,
|
||||||
["Parent function `unlock` failed"]
|
["Parent function `unlock` failed"]
|
||||||
))
|
))
|
||||||
|
@ -588,15 +567,14 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
fn parent_unlock_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_unlock_stop(&self, element: &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::GstBaseSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.unlock_stop
|
.unlock_stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
if from_glib(f(element.unsafe_cast_ref::<BaseSrc>().to_glib_none().0)) {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::Failed,
|
gst::CoreError::Failed,
|
||||||
["Parent function `unlock_stop` failed"]
|
["Parent function `unlock_stop` failed"]
|
||||||
))
|
))
|
||||||
|
@ -635,8 +613,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_start<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_start<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -644,7 +622,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -656,9 +634,7 @@ where
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>(ptr: *mut ffi::GstBaseSrc) -> glib::ffi::gboolean
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
|
||||||
) -> glib_sys::gboolean
|
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -666,7 +642,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -679,8 +655,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -688,16 +664,16 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.is_seekable(wrap.unsafe_cast_ref())
|
imp.is_seekable(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
size: *mut u64,
|
size: *mut u64,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -705,7 +681,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.get_size(wrap.unsafe_cast_ref()) {
|
match imp.get_size(wrap.unsafe_cast_ref()) {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
*size = s;
|
*size = s;
|
||||||
|
@ -718,10 +694,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
buffer: *mut gst_sys::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
start: *mut gst_sys::GstClockTime,
|
start: *mut gst::ffi::GstClockTime,
|
||||||
stop: *mut gst_sys::GstClockTime,
|
stop: *mut gst::ffi::GstClockTime,
|
||||||
) where
|
) where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -730,10 +706,10 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
let buffer = gst::BufferRef::from_ptr(buffer);
|
let buffer = gst::BufferRef::from_ptr(buffer);
|
||||||
|
|
||||||
*start = gst_sys::GST_CLOCK_TIME_NONE;
|
*start = gst::ffi::GST_CLOCK_TIME_NONE;
|
||||||
*stop = gst_sys::GST_CLOCK_TIME_NONE;
|
*stop = gst::ffi::GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
||||||
let (start_, stop_) = imp.get_times(wrap.unsafe_cast_ref(), buffer);
|
let (start_, stop_) = imp.get_times(wrap.unsafe_cast_ref(), buffer);
|
||||||
*start = start_.to_glib();
|
*start = start_.to_glib();
|
||||||
*stop = stop_.to_glib();
|
*stop = stop_.to_glib();
|
||||||
|
@ -741,11 +717,11 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_fill<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_fill<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer: *mut gst_sys::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -754,7 +730,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
|
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
@ -762,11 +738,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_alloc<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_alloc<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer_ptr: *mut gst_sys::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -775,9 +751,9 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.alloc(wrap.unsafe_cast_ref(), offset, length) {
|
match imp.alloc(wrap.unsafe_cast_ref(), offset, length) {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
*buffer_ptr = buffer.into_ptr();
|
*buffer_ptr = buffer.into_ptr();
|
||||||
|
@ -790,11 +766,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer_ptr: *mut gst_sys::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -803,7 +779,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
let mut buffer = if (*buffer_ptr).is_null() {
|
let mut buffer = if (*buffer_ptr).is_null() {
|
||||||
None
|
None
|
||||||
|
@ -811,7 +787,7 @@ where
|
||||||
Some(gst::BufferRef::from_mut_ptr(*buffer_ptr))
|
Some(gst::BufferRef::from_mut_ptr(*buffer_ptr))
|
||||||
};
|
};
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.create(
|
match imp.create(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
offset,
|
offset,
|
||||||
|
@ -821,7 +797,7 @@ where
|
||||||
Ok(CreateSuccess::NewBuffer(new_buffer)) => {
|
Ok(CreateSuccess::NewBuffer(new_buffer)) => {
|
||||||
if let Some(passed_buffer) = buffer {
|
if let Some(passed_buffer) = buffer {
|
||||||
if passed_buffer.as_ptr() != new_buffer.as_ptr() {
|
if passed_buffer.as_ptr() != new_buffer.as_ptr() {
|
||||||
gst_debug!(
|
gst::gst_debug!(
|
||||||
gst::CAT_PERFORMANCE,
|
gst::CAT_PERFORMANCE,
|
||||||
obj: &*wrap,
|
obj: &*wrap,
|
||||||
"Returned new buffer from create function, copying into passed buffer"
|
"Returned new buffer from create function, copying into passed buffer"
|
||||||
|
@ -830,7 +806,7 @@ where
|
||||||
let mut map = match passed_buffer.map_writable() {
|
let mut map = match passed_buffer.map_writable() {
|
||||||
Ok(map) => map,
|
Ok(map) => map,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
gst_error!(
|
gst::gst_error!(
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
obj: &*wrap,
|
obj: &*wrap,
|
||||||
"Failed to map passed buffer writable"
|
"Failed to map passed buffer writable"
|
||||||
|
@ -854,7 +830,7 @@ where
|
||||||
) {
|
) {
|
||||||
Ok(_) => gst::FlowReturn::Ok,
|
Ok(_) => gst::FlowReturn::Ok,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
gst_error!(
|
gst::gst_error!(
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
obj: &*wrap,
|
obj: &*wrap,
|
||||||
"Failed to copy buffer metadata"
|
"Failed to copy buffer metadata"
|
||||||
|
@ -879,9 +855,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
segment: *mut gst_sys::GstSegment,
|
segment: *mut gst::ffi::GstSegment,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -889,7 +865,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
let mut s = from_glib_none(segment);
|
let mut s = from_glib_none(segment);
|
||||||
let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s);
|
let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s);
|
||||||
ptr::write(segment, *(s.to_glib_none().0));
|
ptr::write(segment, *(s.to_glib_none().0));
|
||||||
|
@ -900,9 +876,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_query<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_query<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
query_ptr: *mut gst_sys::GstQuery,
|
query_ptr: *mut gst::ffi::GstQuery,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -911,16 +887,16 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
let query = gst::QueryRef::from_mut_ptr(query_ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_event<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_event<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
event_ptr: *mut gst_sys::GstEvent,
|
event_ptr: *mut gst::ffi::GstEvent,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -928,16 +904,16 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr))
|
imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
filter: *mut gst_sys::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst_sys::GstCaps
|
) -> *mut gst::ffi::GstCaps
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -946,7 +922,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
let filter = Option::<gst::Caps>::from_glib_borrow(filter);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
imp.get_caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
|
||||||
})
|
})
|
||||||
.map(|caps| caps.into_ptr())
|
.map(|caps| caps.into_ptr())
|
||||||
|
@ -954,8 +930,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_negotiate<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_negotiate<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -963,7 +939,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -976,9 +952,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -987,7 +963,7 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
let caps = from_glib_borrow(caps);
|
let caps = from_glib_borrow(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
|
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1000,9 +976,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_fixate<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_fixate<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
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,
|
||||||
{
|
{
|
||||||
|
@ -1011,15 +987,15 @@ where
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
let caps = from_glib_full(caps);
|
let caps = from_glib_full(caps);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_unlock<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_unlock<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1027,7 +1003,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock(wrap.unsafe_cast_ref()) {
|
match imp.unlock(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1040,8 +1016,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1049,7 +1025,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.unlock_stop(wrap.unsafe_cast_ref()) {
|
match imp.unlock_stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -6,22 +6,17 @@
|
||||||
// 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 glib_sys;
|
use crate::prelude::*;
|
||||||
use gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
|
|
||||||
use prelude::*;
|
|
||||||
|
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use BaseTransform;
|
use crate::BaseTransform;
|
||||||
|
|
||||||
pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
pub trait BaseTransformImpl: BaseTransformImplExt + ElementImpl {
|
||||||
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
||||||
|
@ -301,8 +296,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
fn parent_start(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_start(&self, element: &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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.start
|
.start
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -313,7 +307,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
{
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `start` failed"]
|
["Parent function `start` failed"]
|
||||||
))
|
))
|
||||||
|
@ -326,8 +320,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
fn parent_stop(&self, element: &Self::Type) -> Result<(), gst::ErrorMessage> {
|
fn parent_stop(&self, element: &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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.stop
|
.stop
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -338,7 +331,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
{
|
{
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(gst_error_msg!(
|
Err(gst::gst_error_msg!(
|
||||||
gst::CoreError::StateChange,
|
gst::CoreError::StateChange,
|
||||||
["Parent function `stop` failed"]
|
["Parent function `stop` failed"]
|
||||||
))
|
))
|
||||||
|
@ -357,8 +350,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
) -> Option<gst::Caps> {
|
) -> Option<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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.transform_caps
|
.transform_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -382,8 +374,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
) -> 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
match (*parent_class).fixate_caps {
|
match (*parent_class).fixate_caps {
|
||||||
Some(f) => from_glib_full(f(
|
Some(f) => from_glib_full(f(
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
|
@ -404,12 +395,11 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.set_caps
|
.set_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
gst_result_from_gboolean!(
|
gst::gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
incaps.to_glib_none().0,
|
incaps.to_glib_none().0,
|
||||||
|
@ -431,8 +421,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.accept_caps
|
.accept_caps
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -454,8 +443,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.query
|
.query
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -479,8 +467,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
) -> Option<usize> {
|
) -> Option<usize> {
|
||||||
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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.transform_size
|
.transform_size
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -506,8 +493,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
fn parent_get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> {
|
fn parent_get_unit_size(&self, element: &Self::Type, caps: &gst::Caps) -> Option<usize> {
|
||||||
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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
let f = (*parent_class).get_unit_size.unwrap_or_else(|| {
|
let f = (*parent_class).get_unit_size.unwrap_or_else(|| {
|
||||||
if !element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
if !element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
||||||
unimplemented!(concat!(
|
unimplemented!(concat!(
|
||||||
|
@ -538,8 +524,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
fn parent_sink_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
fn parent_sink_event(&self, element: &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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.sink_event
|
.sink_event
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -555,8 +540,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
fn parent_src_event(&self, element: &Self::Type, event: gst::Event) -> bool {
|
fn parent_src_event(&self, element: &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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.src_event
|
.src_event
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -576,17 +560,16 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
) -> Result<PrepareOutputBufferSuccess, gst::FlowError> {
|
) -> Result<PrepareOutputBufferSuccess, 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.prepare_output_buffer
|
.prepare_output_buffer
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
let mut outbuf: *mut gst_sys::GstBuffer = ptr::null_mut();
|
let mut outbuf: *mut gst::ffi::GstBuffer = ptr::null_mut();
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let res = from_glib(f(
|
let res = from_glib(f(
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
inbuf.as_ptr() as *mut gst_sys::GstBuffer,
|
inbuf.as_ptr() as *mut gst::ffi::GstBuffer,
|
||||||
(&mut outbuf) as *mut *mut gst_sys::GstBuffer as *mut gst_sys::GstBuffer,
|
(&mut outbuf) as *mut *mut gst::ffi::GstBuffer as *mut gst::ffi::GstBuffer,
|
||||||
));
|
));
|
||||||
|
|
||||||
match gst::FlowReturn::into_result(res) {
|
match gst::FlowReturn::into_result(res) {
|
||||||
|
@ -612,8 +595,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.transform
|
.transform
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -644,8 +626,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
||||||
if element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
if element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
||||||
panic!(concat!(
|
panic!(concat!(
|
||||||
|
@ -675,8 +656,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
let f = (*parent_class).transform_ip.unwrap_or_else(|| {
|
||||||
if element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
if element.unsafe_cast_ref::<BaseTransform>().is_in_place() {
|
||||||
panic!(concat!(
|
panic!(concat!(
|
||||||
|
@ -692,7 +672,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let buf: *mut gst_sys::GstBuffer = buf.to_glib_none().0;
|
let buf: *mut gst::ffi::GstBuffer = buf.to_glib_none().0;
|
||||||
gst::FlowReturn::from_glib(f(
|
gst::FlowReturn::from_glib(f(
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
buf as *mut _,
|
buf as *mut _,
|
||||||
|
@ -709,10 +689,9 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
if let Some(ref f) = (*parent_class).copy_metadata {
|
if let Some(ref f) = (*parent_class).copy_metadata {
|
||||||
gst_result_from_gboolean!(
|
gst::gst_result_from_gboolean!(
|
||||||
f(
|
f(
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
inbuf.as_ptr() as *mut _,
|
inbuf.as_ptr() as *mut _,
|
||||||
|
@ -736,8 +715,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.transform_meta
|
.transform_meta
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -755,8 +733,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
fn parent_before_transform(&self, element: &Self::Type, inbuf: &gst::BufferRef) {
|
fn parent_before_transform(&self, element: &Self::Type, inbuf: &gst::BufferRef) {
|
||||||
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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
if let Some(ref f) = (*parent_class).before_transform {
|
if let Some(ref f) = (*parent_class).before_transform {
|
||||||
f(
|
f(
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0,
|
||||||
|
@ -774,8 +751,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.submit_input_buffer
|
.submit_input_buffer
|
||||||
.expect("Missing parent function `submit_input_buffer`");
|
.expect("Missing parent function `submit_input_buffer`");
|
||||||
|
@ -795,8 +771,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
) -> Result<GenerateOutputSuccess, gst::FlowError> {
|
) -> Result<GenerateOutputSuccess, 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::GstBaseTransformClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstBaseTransformClass;
|
|
||||||
let f = (*parent_class)
|
let f = (*parent_class)
|
||||||
.generate_output
|
.generate_output
|
||||||
.expect("Missing parent function `generate_output`");
|
.expect("Missing parent function `generate_output`");
|
||||||
|
@ -808,7 +783,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
))
|
))
|
||||||
.into_result()
|
.into_result()
|
||||||
.map(|res| {
|
.map(|res| {
|
||||||
if res == ::BASE_TRANSFORM_FLOW_DROPPED {
|
if res == crate::BASE_TRANSFORM_FLOW_DROPPED {
|
||||||
GenerateOutputSuccess::Dropped
|
GenerateOutputSuccess::Dropped
|
||||||
} else if res != gst::FlowSuccess::Ok || outbuf.is_null() {
|
} else if res != gst::FlowSuccess::Ok || outbuf.is_null() {
|
||||||
GenerateOutputSuccess::NoOutput
|
GenerateOutputSuccess::NoOutput
|
||||||
|
@ -826,7 +801,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
let element = self.get_instance();
|
let element = self.get_instance();
|
||||||
let ptr: *mut gst_base_sys::GstBaseTransform =
|
let ptr: *mut ffi::GstBaseTransform =
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
|
||||||
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
||||||
let _stream_lock = sinkpad.stream_lock();
|
let _stream_lock = sinkpad.stream_lock();
|
||||||
|
@ -843,7 +818,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
let element = self.get_instance();
|
let element = self.get_instance();
|
||||||
let ptr: *mut gst_base_sys::GstBaseTransform =
|
let ptr: *mut ffi::GstBaseTransform =
|
||||||
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
|
element.unsafe_cast_ref::<BaseTransform>().to_glib_none().0;
|
||||||
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
let sinkpad: Borrowed<gst::Pad> = from_glib_borrow((*ptr).sinkpad);
|
||||||
let _stream_lock = sinkpad.stream_lock();
|
let _stream_lock = sinkpad.stream_lock();
|
||||||
|
@ -898,7 +873,7 @@ pub unsafe trait BaseTransformClassSubclassExt: Sized + 'static {
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
<T as ObjectSubclass>::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
unsafe {
|
unsafe {
|
||||||
let klass = &mut *(self as *mut Self as *mut gst_base_sys::GstBaseTransformClass);
|
let klass = &mut *(self as *mut Self as *mut ffi::GstBaseTransformClass);
|
||||||
|
|
||||||
klass.passthrough_on_same_caps = passthrough_on_same_caps.to_glib();
|
klass.passthrough_on_same_caps = passthrough_on_same_caps.to_glib();
|
||||||
klass.transform_ip_on_passthrough = transform_ip_on_passthrough.to_glib();
|
klass.transform_ip_on_passthrough = transform_ip_on_passthrough.to_glib();
|
||||||
|
@ -942,8 +917,8 @@ pub enum PrepareOutputBufferSuccess {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_start<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_start<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -951,7 +926,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -964,8 +939,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -973,7 +948,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -986,11 +961,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_transform_caps<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_transform_caps<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
direction: gst_sys::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
filter: *mut gst_sys::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst_sys::GstCaps
|
) -> *mut gst::ffi::GstCaps
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -998,7 +973,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), None, {
|
||||||
let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter);
|
let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter);
|
||||||
|
|
||||||
imp.transform_caps(
|
imp.transform_caps(
|
||||||
|
@ -1013,11 +988,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_fixate_caps<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_fixate_caps<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
direction: gst_sys::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
othercaps: *mut gst_sys::GstCaps,
|
othercaps: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst_sys::GstCaps
|
) -> *mut gst::ffi::GstCaps
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1025,7 +1000,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate_caps(
|
imp.fixate_caps(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
|
@ -1037,10 +1012,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_set_caps<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_set_caps<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
incaps: *mut gst_sys::GstCaps,
|
incaps: *mut gst::ffi::GstCaps,
|
||||||
outcaps: *mut gst_sys::GstCaps,
|
outcaps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1048,7 +1023,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.set_caps(
|
match imp.set_caps(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(incaps),
|
&from_glib_borrow(incaps),
|
||||||
|
@ -1065,10 +1040,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
direction: gst_sys::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1076,7 +1051,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.accept_caps(
|
imp.accept_caps(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
|
@ -1087,10 +1062,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_query<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_query<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
direction: gst_sys::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
query: *mut gst_sys::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1098,7 +1073,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
BaseTransformImpl::query(
|
BaseTransformImpl::query(
|
||||||
imp,
|
imp,
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
|
@ -1110,13 +1085,13 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_transform_size<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_transform_size<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
direction: gst_sys::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
size: usize,
|
size: usize,
|
||||||
othercaps: *mut gst_sys::GstCaps,
|
othercaps: *mut gst::ffi::GstCaps,
|
||||||
othersize: *mut usize,
|
othersize: *mut usize,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1124,7 +1099,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.transform_size(
|
match imp.transform_size(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
|
@ -1143,10 +1118,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
caps: *mut gst_sys::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
size: *mut usize,
|
size: *mut usize,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1154,7 +1129,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
match imp.get_unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
match imp.get_unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
*size = s;
|
*size = s;
|
||||||
|
@ -1167,10 +1142,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst_sys::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
outbuf: *mut gst_sys::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1179,9 +1154,9 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let outbuf = outbuf as *mut *mut gst_sys::GstBuffer;
|
let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) {
|
match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) {
|
||||||
Ok(PrepareOutputBufferSuccess::InputBuffer) => {
|
Ok(PrepareOutputBufferSuccess::InputBuffer) => {
|
||||||
*outbuf = inbuf;
|
*outbuf = inbuf;
|
||||||
|
@ -1198,9 +1173,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
event: *mut gst_sys::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1208,16 +1183,16 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
event: *mut gst_sys::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1225,17 +1200,17 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_transform<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_transform<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst_sys::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
outbuf: *mut gst_sys::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1243,7 +1218,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.transform(
|
imp.transform(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(inbuf),
|
&from_glib_borrow(inbuf),
|
||||||
|
@ -1255,9 +1230,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
buf: *mut *mut gst_sys::GstBuffer,
|
buf: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1266,10 +1241,10 @@ where
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let buf = buf as *mut gst_sys::GstBuffer;
|
let buf = buf as *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
if from_glib(gst_base_sys::gst_base_transform_is_passthrough(ptr)) {
|
if from_glib(ffi::gst_base_transform_is_passthrough(ptr)) {
|
||||||
imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf))
|
imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf))
|
||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
|
@ -1281,11 +1256,11 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_transform_meta<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_transform_meta<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
outbuf: *mut gst_sys::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
meta: *mut gst_sys::GstMeta,
|
meta: *mut gst::ffi::GstMeta,
|
||||||
inbuf: *mut gst_sys::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1295,7 +1270,7 @@ where
|
||||||
|
|
||||||
let inbuf = gst::BufferRef::from_ptr(inbuf);
|
let inbuf = gst::BufferRef::from_ptr(inbuf);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), false, {
|
||||||
imp.transform_meta(
|
imp.transform_meta(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
gst::BufferRef::from_mut_ptr(outbuf),
|
gst::BufferRef::from_mut_ptr(outbuf),
|
||||||
|
@ -1307,10 +1282,10 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst_sys::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
outbuf: *mut gst_sys::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> glib_sys::gboolean
|
) -> glib::ffi::gboolean
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1318,17 +1293,17 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
if gst_sys::gst_mini_object_is_writable(outbuf as *mut _) == glib_sys::GFALSE {
|
if gst::ffi::gst_mini_object_is_writable(outbuf as *mut _) == glib::ffi::GFALSE {
|
||||||
gst_warning!(
|
gst::gst_warning!(
|
||||||
gst::CAT_RUST,
|
gst::CAT_RUST,
|
||||||
obj: &*wrap,
|
obj: &*wrap,
|
||||||
"buffer {:?} not writable",
|
"buffer {:?} not writable",
|
||||||
outbuf
|
outbuf
|
||||||
);
|
);
|
||||||
return glib_sys::GFALSE;
|
return glib::ffi::GFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), true, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), true, {
|
||||||
match imp.copy_metadata(
|
match imp.copy_metadata(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
gst::BufferRef::from_ptr(inbuf),
|
gst::BufferRef::from_ptr(inbuf),
|
||||||
|
@ -1345,8 +1320,8 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst_sys::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
) where
|
) where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1354,16 +1329,16 @@ unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), (), {
|
||||||
imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf));
|
imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_submit_input_buffer<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_submit_input_buffer<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
is_discont: glib_sys::gboolean,
|
is_discont: glib::ffi::gboolean,
|
||||||
buf: *mut gst_sys::GstBuffer,
|
buf: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1371,7 +1346,7 @@ where
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.submit_input_buffer(
|
imp.submit_input_buffer(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(is_discont),
|
from_glib(is_discont),
|
||||||
|
@ -1383,9 +1358,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
|
||||||
ptr: *mut gst_base_sys::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
buf: *mut *mut gst_sys::GstBuffer,
|
buf: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -1395,9 +1370,9 @@ where
|
||||||
|
|
||||||
*buf = ptr::null_mut();
|
*buf = ptr::null_mut();
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.generate_output(wrap.unsafe_cast_ref()) {
|
match imp.generate_output(wrap.unsafe_cast_ref()) {
|
||||||
Ok(GenerateOutputSuccess::Dropped) => ::BASE_TRANSFORM_FLOW_DROPPED.into(),
|
Ok(GenerateOutputSuccess::Dropped) => crate::BASE_TRANSFORM_FLOW_DROPPED.into(),
|
||||||
Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok,
|
Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok,
|
||||||
Ok(GenerateOutputSuccess::Buffer(outbuf)) => {
|
Ok(GenerateOutputSuccess::Buffer(outbuf)) => {
|
||||||
*buf = outbuf.into_ptr();
|
*buf = outbuf.into_ptr();
|
||||||
|
|
|
@ -6,20 +6,16 @@
|
||||||
// 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 gst_base_sys;
|
|
||||||
use gst_sys;
|
|
||||||
|
|
||||||
use glib::prelude::*;
|
use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst;
|
|
||||||
use gst::subclass::prelude::*;
|
use gst::subclass::prelude::*;
|
||||||
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::base_src::BaseSrcImpl;
|
use super::base_src::BaseSrcImpl;
|
||||||
use PushSrc;
|
use crate::PushSrc;
|
||||||
|
|
||||||
pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl {
|
pub trait PushSrcImpl: PushSrcImplExt + BaseSrcImpl {
|
||||||
fn fill(
|
fn fill(
|
||||||
|
@ -59,8 +55,7 @@ impl<T: PushSrcImpl> PushSrcImplExt 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::GstPushSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstPushSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.fill
|
.fill
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
|
@ -77,16 +72,15 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
|
||||||
fn parent_alloc(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError> {
|
fn parent_alloc(&self, element: &Self::Type) -> Result<gst::Buffer, 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::GstPushSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstPushSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.alloc
|
.alloc
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
let mut buffer_ptr: *mut gst_sys::GstBuffer = ptr::null_mut();
|
let mut buffer_ptr: *mut gst::ffi::GstBuffer = ptr::null_mut();
|
||||||
|
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
let res = gst::FlowReturn::from_glib(f(
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
||||||
|
@ -101,16 +95,15 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
|
||||||
fn parent_create(&self, element: &Self::Type) -> Result<gst::Buffer, gst::FlowError> {
|
fn parent_create(&self, element: &Self::Type) -> Result<gst::Buffer, 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::GstPushSrcClass;
|
||||||
data.as_ref().get_parent_class() as *mut gst_base_sys::GstPushSrcClass;
|
|
||||||
(*parent_class)
|
(*parent_class)
|
||||||
.create
|
.create
|
||||||
.map(|f| {
|
.map(|f| {
|
||||||
let mut buffer_ptr: *mut gst_sys::GstBuffer = ptr::null_mut();
|
let mut buffer_ptr: *mut gst::ffi::GstBuffer = ptr::null_mut();
|
||||||
|
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst_sys::GstBuffer;
|
let buffer_ref = &mut buffer_ptr as *mut _ as *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
let res = gst::FlowReturn::from_glib(f(
|
let res = gst::FlowReturn::from_glib(f(
|
||||||
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
element.unsafe_cast_ref::<PushSrc>().to_glib_none().0,
|
||||||
|
@ -128,7 +121,7 @@ where
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
<T as ObjectSubclass>::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
fn override_vfuncs(klass: &mut glib::Class<Self>) {
|
fn override_vfuncs(klass: &mut glib::Class<Self>) {
|
||||||
<::BaseSrc as IsSubclassable<T>>::override_vfuncs(klass);
|
<crate::BaseSrc as IsSubclassable<T>>::override_vfuncs(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
klass.fill = Some(push_src_fill::<T>);
|
klass.fill = Some(push_src_fill::<T>);
|
||||||
klass.alloc = Some(push_src_alloc::<T>);
|
klass.alloc = Some(push_src_alloc::<T>);
|
||||||
|
@ -137,9 +130,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn push_src_fill<T: PushSrcImpl>(
|
unsafe extern "C" fn push_src_fill<T: PushSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstPushSrc,
|
ptr: *mut ffi::GstPushSrc,
|
||||||
buffer: *mut gst_sys::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -148,16 +141,16 @@ where
|
||||||
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
||||||
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
let buffer = gst::BufferRef::from_mut_ptr(buffer);
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into()
|
PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>(
|
unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstPushSrc,
|
ptr: *mut ffi::GstPushSrc,
|
||||||
buffer_ptr: *mut gst_sys::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -166,9 +159,9 @@ where
|
||||||
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) {
|
match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
*buffer_ptr = buffer.into_ptr();
|
*buffer_ptr = buffer.into_ptr();
|
||||||
|
@ -181,9 +174,9 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
|
unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
|
||||||
ptr: *mut gst_base_sys::GstPushSrc,
|
ptr: *mut ffi::GstPushSrc,
|
||||||
buffer_ptr: *mut gst_sys::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst_sys::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn
|
||||||
where
|
where
|
||||||
T::Instance: PanicPoison,
|
T::Instance: PanicPoison,
|
||||||
{
|
{
|
||||||
|
@ -192,9 +185,9 @@ where
|
||||||
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
||||||
// FIXME: Wrong signature in -sys bindings
|
// FIXME: Wrong signature in -sys bindings
|
||||||
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
|
||||||
let buffer_ptr = buffer_ptr as *mut *mut gst_sys::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::gst_panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
||||||
match PushSrcImpl::create(imp, wrap.unsafe_cast_ref()) {
|
match PushSrcImpl::create(imp, wrap.unsafe_cast_ref()) {
|
||||||
Ok(buffer) => {
|
Ok(buffer) => {
|
||||||
*buffer_ptr = buffer.into_ptr();
|
*buffer_ptr = buffer.into_ptr();
|
||||||
|
|
|
@ -7,17 +7,16 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use glib::translate::mut_override;
|
use glib::translate::mut_override;
|
||||||
use glib_sys;
|
|
||||||
|
|
||||||
#[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 {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
unsafe {
|
unsafe {
|
||||||
glib_sys::g_mutex_lock(mut_override(mutex));
|
glib::ffi::g_mutex_lock(mut_override(mutex));
|
||||||
}
|
}
|
||||||
MutexGuard(mutex)
|
MutexGuard(mutex)
|
||||||
}
|
}
|
||||||
|
@ -26,7 +25,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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue