mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-01-03 05:48:43 +00:00
Bind various new API
This commit is contained in:
parent
4b8f85c4c6
commit
a1c4a58180
22 changed files with 625 additions and 217 deletions
|
@ -26,6 +26,7 @@ manual = [
|
||||||
"Gst.Element",
|
"Gst.Element",
|
||||||
"Gst.URIHandler",
|
"Gst.URIHandler",
|
||||||
"Gst.Format",
|
"Gst.Format",
|
||||||
|
"Gst.MiniObject",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
|
@ -52,6 +53,11 @@ final_type = true
|
||||||
# Action signal
|
# Action signal
|
||||||
ignore = true
|
ignore = true
|
||||||
|
|
||||||
|
[[object.signal]]
|
||||||
|
name = "pull-object"
|
||||||
|
# Action signal
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object.signal]]
|
[[object.signal]]
|
||||||
name = "try-pull-sample"
|
name = "try-pull-sample"
|
||||||
# Action signal
|
# Action signal
|
||||||
|
@ -62,6 +68,11 @@ final_type = true
|
||||||
# Action signal
|
# Action signal
|
||||||
ignore = true
|
ignore = true
|
||||||
|
|
||||||
|
[[object.signal]]
|
||||||
|
name = "try-pull-object"
|
||||||
|
# Action signal
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object.property]]
|
[[object.property]]
|
||||||
name = "emit-signals"
|
name = "emit-signals"
|
||||||
# Use callbacks instead
|
# Use callbacks instead
|
||||||
|
@ -92,6 +103,11 @@ final_type = true
|
||||||
# Use callbacks instead
|
# Use callbacks instead
|
||||||
ignore = true
|
ignore = true
|
||||||
|
|
||||||
|
[[object.signal]]
|
||||||
|
name = "new-serialized-event"
|
||||||
|
# Use callbacks instead
|
||||||
|
ignore = true
|
||||||
|
|
||||||
[[object.function]]
|
[[object.function]]
|
||||||
name = "set_caps"
|
name = "set_caps"
|
||||||
[[object.function.parameter]]
|
[[object.function.parameter]]
|
||||||
|
@ -108,6 +124,11 @@ final_type = true
|
||||||
[object.function.return]
|
[object.function.return]
|
||||||
nullable_return_is_error = "Failed to pull sample"
|
nullable_return_is_error = "Failed to pull sample"
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "pull_object"
|
||||||
|
[object.function.return]
|
||||||
|
nullable_return_is_error = "Failed to pull object"
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "GstApp.AppSrc"
|
name = "GstApp.AppSrc"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -33,6 +33,7 @@ pub struct AppSinkCallbacks {
|
||||||
Box<dyn FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static>,
|
Box<dyn FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static>,
|
||||||
>,
|
>,
|
||||||
>,
|
>,
|
||||||
|
new_event: Option<RefCell<Box<dyn FnMut(&AppSink) -> bool + Send + 'static>>>,
|
||||||
panicked: AtomicBool,
|
panicked: AtomicBool,
|
||||||
callbacks: ffi::GstAppSinkCallbacks,
|
callbacks: ffi::GstAppSinkCallbacks,
|
||||||
}
|
}
|
||||||
|
@ -47,6 +48,7 @@ impl AppSinkCallbacks {
|
||||||
eos: None,
|
eos: None,
|
||||||
new_preroll: None,
|
new_preroll: None,
|
||||||
new_sample: None,
|
new_sample: None,
|
||||||
|
new_event: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +66,7 @@ pub struct AppSinkCallbacksBuilder {
|
||||||
Box<dyn FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static>,
|
Box<dyn FnMut(&AppSink) -> Result<gst::FlowSuccess, gst::FlowError> + Send + 'static>,
|
||||||
>,
|
>,
|
||||||
>,
|
>,
|
||||||
|
new_event: Option<RefCell<Box<dyn FnMut(&AppSink) -> bool + Send + 'static>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppSinkCallbacksBuilder {
|
impl AppSinkCallbacksBuilder {
|
||||||
|
@ -98,15 +101,26 @@ impl AppSinkCallbacksBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
pub fn new_event<F: FnMut(&AppSink) -> bool + Send + 'static>(self, new_event: F) -> Self {
|
||||||
|
Self {
|
||||||
|
new_event: Some(RefCell::new(Box::new(new_event))),
|
||||||
|
..self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build(self) -> AppSinkCallbacks {
|
pub fn build(self) -> AppSinkCallbacks {
|
||||||
let have_eos = self.eos.is_some();
|
let have_eos = self.eos.is_some();
|
||||||
let have_new_preroll = self.new_preroll.is_some();
|
let have_new_preroll = self.new_preroll.is_some();
|
||||||
let have_new_sample = self.new_sample.is_some();
|
let have_new_sample = self.new_sample.is_some();
|
||||||
|
let have_new_event = self.new_event.is_some();
|
||||||
|
|
||||||
AppSinkCallbacks {
|
AppSinkCallbacks {
|
||||||
eos: self.eos,
|
eos: self.eos,
|
||||||
new_preroll: self.new_preroll,
|
new_preroll: self.new_preroll,
|
||||||
new_sample: self.new_sample,
|
new_sample: self.new_sample,
|
||||||
|
new_event: self.new_event,
|
||||||
panicked: AtomicBool::new(false),
|
panicked: AtomicBool::new(false),
|
||||||
callbacks: ffi::GstAppSinkCallbacks {
|
callbacks: ffi::GstAppSinkCallbacks {
|
||||||
eos: if have_eos { Some(trampoline_eos) } else { None },
|
eos: if have_eos { Some(trampoline_eos) } else { None },
|
||||||
|
@ -120,12 +134,12 @@ impl AppSinkCallbacksBuilder {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
_gst_reserved: [
|
new_event: if have_new_event {
|
||||||
ptr::null_mut(),
|
Some(trampoline_new_event)
|
||||||
ptr::null_mut(),
|
} else {
|
||||||
ptr::null_mut(),
|
None
|
||||||
ptr::null_mut(),
|
},
|
||||||
],
|
_gst_reserved: [ptr::null_mut(), ptr::null_mut(), ptr::null_mut()],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,6 +246,39 @@ unsafe extern "C" fn trampoline_new_sample(
|
||||||
ret.into_glib()
|
ret.into_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsafe extern "C" fn trampoline_new_event(
|
||||||
|
appsink: *mut ffi::GstAppSink,
|
||||||
|
callbacks: gpointer,
|
||||||
|
) -> glib::ffi::gboolean {
|
||||||
|
let callbacks = &*(callbacks as *const AppSinkCallbacks);
|
||||||
|
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||||
|
|
||||||
|
if callbacks.panicked.load(Ordering::Relaxed) {
|
||||||
|
let element: Borrowed<AppSink> = from_glib_borrow(appsink);
|
||||||
|
gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
|
||||||
|
return false.into_glib();
|
||||||
|
}
|
||||||
|
|
||||||
|
let ret = if let Some(ref new_event) = callbacks.new_event {
|
||||||
|
let result = panic::catch_unwind(panic::AssertUnwindSafe(|| {
|
||||||
|
(&mut *new_event.borrow_mut())(&element)
|
||||||
|
}));
|
||||||
|
match result {
|
||||||
|
Ok(result) => result,
|
||||||
|
Err(err) => {
|
||||||
|
callbacks.panicked.store(true, Ordering::Relaxed);
|
||||||
|
post_panic_error_message(&element, &err);
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
|
ret.into_glib()
|
||||||
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
|
unsafe extern "C" fn destroy_callbacks(ptr: gpointer) {
|
||||||
Box::<AppSinkCallbacks>::from_raw(ptr as *mut _);
|
Box::<AppSinkCallbacks>::from_raw(ptr as *mut _);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
use glib::object::ObjectExt;
|
|
||||||
use glib::object::ObjectType as ObjectType_;
|
use glib::object::ObjectType as ObjectType_;
|
||||||
use glib::signal::connect_raw;
|
use glib::signal::connect_raw;
|
||||||
use glib::signal::SignalHandlerId;
|
use glib::signal::SignalHandlerId;
|
||||||
|
@ -66,12 +63,15 @@ impl AppSink {
|
||||||
unsafe { from_glib(ffi::gst_app_sink_is_eos(self.to_glib_none().0)) }
|
unsafe { from_glib(ffi::gst_app_sink_is_eos(self.to_glib_none().0)) }
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
//#[doc(alias = "gst_app_sink_pull_object")]
|
#[doc(alias = "gst_app_sink_pull_object")]
|
||||||
//pub fn pull_object(&self) -> /*Ignored*/Option<gst::MiniObject> {
|
pub fn pull_object(&self) -> Result<gst::MiniObject, glib::BoolError> {
|
||||||
// unsafe { TODO: call ffi:gst_app_sink_pull_object() }
|
unsafe {
|
||||||
//}
|
Option::<_>::from_glib_full(ffi::gst_app_sink_pull_object(self.to_glib_none().0))
|
||||||
|
.ok_or_else(|| glib::bool_error!("Failed to pull object"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_app_sink_pull_preroll")]
|
#[doc(alias = "gst_app_sink_pull_preroll")]
|
||||||
pub fn pull_preroll(&self) -> Result<gst::Sample, glib::BoolError> {
|
pub fn pull_preroll(&self) -> Result<gst::Sample, glib::BoolError> {
|
||||||
|
@ -134,12 +134,20 @@ impl AppSink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
//#[doc(alias = "gst_app_sink_try_pull_object")]
|
#[doc(alias = "gst_app_sink_try_pull_object")]
|
||||||
//pub fn try_pull_object(&self, timeout: impl Into<Option<gst::ClockTime>>) -> /*Ignored*/Option<gst::MiniObject> {
|
pub fn try_pull_object(
|
||||||
// unsafe { TODO: call ffi:gst_app_sink_try_pull_object() }
|
&self,
|
||||||
//}
|
timeout: impl Into<Option<gst::ClockTime>>,
|
||||||
|
) -> Option<gst::MiniObject> {
|
||||||
|
unsafe {
|
||||||
|
from_glib_full(ffi::gst_app_sink_try_pull_object(
|
||||||
|
self.to_glib_none().0,
|
||||||
|
timeout.into().into_glib(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
#[cfg(any(feature = "v1_10", feature = "dox"))]
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_10")))]
|
||||||
|
@ -197,42 +205,6 @@ impl AppSink {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "new-serialized-event")]
|
|
||||||
pub fn connect_new_serialized_event<F: Fn(&Self) -> bool + Send + Sync + 'static>(
|
|
||||||
&self,
|
|
||||||
f: F,
|
|
||||||
) -> SignalHandlerId {
|
|
||||||
unsafe extern "C" fn new_serialized_event_trampoline<
|
|
||||||
F: Fn(&AppSink) -> bool + Send + Sync + 'static,
|
|
||||||
>(
|
|
||||||
this: *mut ffi::GstAppSink,
|
|
||||||
f: glib::ffi::gpointer,
|
|
||||||
) -> glib::ffi::gboolean {
|
|
||||||
let f: &F = &*(f as *const F);
|
|
||||||
f(&from_glib_borrow(this)).into_glib()
|
|
||||||
}
|
|
||||||
unsafe {
|
|
||||||
let f: Box_<F> = Box_::new(f);
|
|
||||||
connect_raw(
|
|
||||||
self.as_ptr() as *mut _,
|
|
||||||
b"new-serialized-event\0".as_ptr() as *const _,
|
|
||||||
Some(transmute::<_, unsafe extern "C" fn()>(
|
|
||||||
new_serialized_event_trampoline::<F> as *const (),
|
|
||||||
)),
|
|
||||||
Box_::into_raw(f),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
//#[doc(alias = "try-pull-object")]
|
|
||||||
//pub fn connect_try_pull_object<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
|
|
||||||
// Ignored return value Gst.MiniObject
|
|
||||||
//}
|
|
||||||
|
|
||||||
#[doc(alias = "buffer-list")]
|
#[doc(alias = "buffer-list")]
|
||||||
pub fn connect_buffer_list_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
pub fn connect_buffer_list_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
&self,
|
&self,
|
||||||
|
|
|
@ -17,6 +17,7 @@ external_libraries = [
|
||||||
|
|
||||||
generate = [
|
generate = [
|
||||||
"GstPbutils.DiscovererResult",
|
"GstPbutils.DiscovererResult",
|
||||||
|
"GstPbutils.PbUtilsCapsDescriptionFlags",
|
||||||
]
|
]
|
||||||
|
|
||||||
manual = [
|
manual = [
|
||||||
|
|
|
@ -71,3 +71,87 @@ impl ToValue for DiscovererSerializeFlags {
|
||||||
Self::static_type()
|
Self::static_type()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
bitflags! {
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "GstPbUtilsCapsDescriptionFlags")]
|
||||||
|
pub struct PbUtilsCapsDescriptionFlags: u32 {
|
||||||
|
#[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_CONTAINER")]
|
||||||
|
const CONTAINER = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_CONTAINER as u32;
|
||||||
|
#[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_AUDIO")]
|
||||||
|
const AUDIO = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_AUDIO as u32;
|
||||||
|
#[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_VIDEO")]
|
||||||
|
const VIDEO = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_VIDEO as u32;
|
||||||
|
#[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_IMAGE")]
|
||||||
|
const IMAGE = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_IMAGE as u32;
|
||||||
|
#[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_SUBTITLE")]
|
||||||
|
const SUBTITLE = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_SUBTITLE as u32;
|
||||||
|
#[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_TAG")]
|
||||||
|
const TAG = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_TAG as u32;
|
||||||
|
#[doc(alias = "GST_PBUTILS_CAPS_DESCRIPTION_FLAG_GENERIC")]
|
||||||
|
const GENERIC = ffi::GST_PBUTILS_CAPS_DESCRIPTION_FLAG_GENERIC as u32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl IntoGlib for PbUtilsCapsDescriptionFlags {
|
||||||
|
type GlibType = ffi::GstPbUtilsCapsDescriptionFlags;
|
||||||
|
|
||||||
|
fn into_glib(self) -> ffi::GstPbUtilsCapsDescriptionFlags {
|
||||||
|
self.bits()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(hidden)]
|
||||||
|
impl FromGlib<ffi::GstPbUtilsCapsDescriptionFlags> for PbUtilsCapsDescriptionFlags {
|
||||||
|
unsafe fn from_glib(value: ffi::GstPbUtilsCapsDescriptionFlags) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
Self::from_bits_truncate(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
impl StaticType for PbUtilsCapsDescriptionFlags {
|
||||||
|
fn static_type() -> Type {
|
||||||
|
unsafe { from_glib(ffi::gst_pb_utils_caps_description_flags_get_type()) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
impl glib::value::ValueType for PbUtilsCapsDescriptionFlags {
|
||||||
|
type Type = Self;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
unsafe impl<'a> FromValue<'a> for PbUtilsCapsDescriptionFlags {
|
||||||
|
type Checker = glib::value::GenericValueTypeChecker<Self>;
|
||||||
|
|
||||||
|
unsafe fn from_value(value: &'a glib::Value) -> Self {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
from_glib(glib::gobject_ffi::g_value_get_flags(value.to_glib_none().0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
impl ToValue for PbUtilsCapsDescriptionFlags {
|
||||||
|
fn to_value(&self) -> glib::Value {
|
||||||
|
let mut value = glib::Value::for_value_type::<Self>();
|
||||||
|
unsafe {
|
||||||
|
glib::gobject_ffi::g_value_set_flags(value.to_glib_none_mut().0, self.into_glib());
|
||||||
|
}
|
||||||
|
value
|
||||||
|
}
|
||||||
|
|
||||||
|
fn value_type(&self) -> glib::Type {
|
||||||
|
Self::static_type()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
// DO NOT EDIT
|
// DO NOT EDIT
|
||||||
|
|
||||||
use crate::EncodingTarget;
|
use crate::EncodingTarget;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
use crate::PbUtilsCapsDescriptionFlags;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
|
@ -23,12 +26,17 @@ pub fn encoding_list_available_categories() -> Vec<glib::GString> {
|
||||||
unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_available_categories()) }
|
unsafe { FromGlibPtrContainer::from_glib_full(ffi::gst_encoding_list_available_categories()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
//#[doc(alias = "gst_pb_utils_get_caps_description_flags")]
|
#[doc(alias = "gst_pb_utils_get_caps_description_flags")]
|
||||||
//pub fn pb_utils_get_caps_description_flags(caps: &gst::Caps) -> /*Ignored*/PbUtilsCapsDescriptionFlags {
|
pub fn pb_utils_get_caps_description_flags(caps: &gst::Caps) -> PbUtilsCapsDescriptionFlags {
|
||||||
// unsafe { TODO: call ffi:gst_pb_utils_get_caps_description_flags() }
|
assert_initialized_main_thread!();
|
||||||
//}
|
unsafe {
|
||||||
|
from_glib(ffi::gst_pb_utils_get_caps_description_flags(
|
||||||
|
caps.to_glib_none().0,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(alias = "gst_pb_utils_get_element_description")]
|
#[doc(alias = "gst_pb_utils_get_element_description")]
|
||||||
pub fn pb_utils_get_element_description(
|
pub fn pb_utils_get_element_description(
|
||||||
|
|
|
@ -44,6 +44,9 @@ pub use self::enums::DiscovererResult;
|
||||||
|
|
||||||
mod flags;
|
mod flags;
|
||||||
pub use self::flags::DiscovererSerializeFlags;
|
pub use self::flags::DiscovererSerializeFlags;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
pub use self::flags::PbUtilsCapsDescriptionFlags;
|
||||||
|
|
||||||
pub mod functions;
|
pub mod functions;
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,15 @@ impl<'a> RTPBuffer<'a, Writable> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_rtp_buffer_remove_extension_data")]
|
||||||
|
pub fn remove_extension_data(&mut self) {
|
||||||
|
unsafe {
|
||||||
|
ffi::gst_rtp_buffer_remove_extension_data(&mut self.rtp_buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, T> RTPBuffer<'a, T> {
|
impl<'a, T> RTPBuffer<'a, T> {
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub trait RTPHeaderExtensionExtManual: 'static {
|
||||||
write_flags: RTPHeaderExtensionFlags,
|
write_flags: RTPHeaderExtensionFlags,
|
||||||
output: &mut gst::BufferRef,
|
output: &mut gst::BufferRef,
|
||||||
data: &mut [u8],
|
data: &mut [u8],
|
||||||
) -> usize;
|
) -> Result<usize, glib::BoolError>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
|
impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
|
||||||
|
@ -47,17 +47,23 @@ impl<O: IsA<RTPHeaderExtension>> RTPHeaderExtensionExtManual for O {
|
||||||
write_flags: RTPHeaderExtensionFlags,
|
write_flags: RTPHeaderExtensionFlags,
|
||||||
output: &mut gst::BufferRef,
|
output: &mut gst::BufferRef,
|
||||||
data: &mut [u8],
|
data: &mut [u8],
|
||||||
) -> usize {
|
) -> Result<usize, glib::BoolError> {
|
||||||
let size = data.len() as usize;
|
let size = data.len() as usize;
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_rtp_header_extension_write(
|
let res = ffi::gst_rtp_header_extension_write(
|
||||||
self.as_ref().to_glib_none().0,
|
self.as_ref().to_glib_none().0,
|
||||||
input_meta.to_glib_none().0,
|
input_meta.to_glib_none().0,
|
||||||
write_flags.into_glib(),
|
write_flags.into_glib(),
|
||||||
output.as_mut_ptr(),
|
output.as_mut_ptr(),
|
||||||
data.to_glib_none().0,
|
data.to_glib_none().0,
|
||||||
size,
|
size,
|
||||||
)
|
);
|
||||||
|
|
||||||
|
if res < 0 {
|
||||||
|
Err(glib::bool_error!("Failed to write header extension"))
|
||||||
|
} else {
|
||||||
|
Ok(res as usize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,6 +156,26 @@ manual_traits = ["VideoDecoderExtManual"]
|
||||||
name = "drop_frame"
|
name = "drop_frame"
|
||||||
manual = true
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "finish_subframe"
|
||||||
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "drop_subframe"
|
||||||
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "have_last_subframe"
|
||||||
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "get_processed_subframe_index"
|
||||||
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "get_input_subframe_index"
|
||||||
|
manual = true
|
||||||
|
|
||||||
[[object.function]]
|
[[object.function]]
|
||||||
name = "set_latency"
|
name = "set_latency"
|
||||||
manual = true
|
manual = true
|
||||||
|
|
|
@ -52,16 +52,6 @@ pub trait VideoDecoderExt: 'static {
|
||||||
#[doc(alias = "gst_video_decoder_allocate_output_buffer")]
|
#[doc(alias = "gst_video_decoder_allocate_output_buffer")]
|
||||||
fn allocate_output_buffer(&self) -> Result<gst::Buffer, glib::BoolError>;
|
fn allocate_output_buffer(&self) -> Result<gst::Buffer, glib::BoolError>;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "gst_video_decoder_drop_subframe")]
|
|
||||||
fn drop_subframe(&self, frame: &VideoCodecFrame) -> gst::FlowReturn;
|
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "gst_video_decoder_finish_subframe")]
|
|
||||||
fn finish_subframe(&self, frame: &VideoCodecFrame) -> gst::FlowReturn;
|
|
||||||
|
|
||||||
#[doc(alias = "gst_video_decoder_get_buffer_pool")]
|
#[doc(alias = "gst_video_decoder_get_buffer_pool")]
|
||||||
#[doc(alias = "get_buffer_pool")]
|
#[doc(alias = "get_buffer_pool")]
|
||||||
fn buffer_pool(&self) -> Option<gst::BufferPool>;
|
fn buffer_pool(&self) -> Option<gst::BufferPool>;
|
||||||
|
@ -70,12 +60,6 @@ pub trait VideoDecoderExt: 'static {
|
||||||
#[doc(alias = "get_estimate_rate")]
|
#[doc(alias = "get_estimate_rate")]
|
||||||
fn estimate_rate(&self) -> i32;
|
fn estimate_rate(&self) -> i32;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "gst_video_decoder_get_input_subframe_index")]
|
|
||||||
#[doc(alias = "get_input_subframe_index")]
|
|
||||||
fn input_subframe_index(&self, frame: &VideoCodecFrame) -> u32;
|
|
||||||
|
|
||||||
#[doc(alias = "gst_video_decoder_get_max_decode_time")]
|
#[doc(alias = "gst_video_decoder_get_max_decode_time")]
|
||||||
#[doc(alias = "get_max_decode_time")]
|
#[doc(alias = "get_max_decode_time")]
|
||||||
fn max_decode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff;
|
fn max_decode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff;
|
||||||
|
@ -102,12 +86,6 @@ pub trait VideoDecoderExt: 'static {
|
||||||
#[doc(alias = "get_pending_frame_size")]
|
#[doc(alias = "get_pending_frame_size")]
|
||||||
fn pending_frame_size(&self) -> usize;
|
fn pending_frame_size(&self) -> usize;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "gst_video_decoder_get_processed_subframe_index")]
|
|
||||||
#[doc(alias = "get_processed_subframe_index")]
|
|
||||||
fn processed_subframe_index(&self, frame: &VideoCodecFrame) -> u32;
|
|
||||||
|
|
||||||
#[doc(alias = "gst_video_decoder_get_qos_proportion")]
|
#[doc(alias = "gst_video_decoder_get_qos_proportion")]
|
||||||
#[doc(alias = "get_qos_proportion")]
|
#[doc(alias = "get_qos_proportion")]
|
||||||
fn qos_proportion(&self) -> f64;
|
fn qos_proportion(&self) -> f64;
|
||||||
|
@ -121,11 +99,6 @@ pub trait VideoDecoderExt: 'static {
|
||||||
#[doc(alias = "gst_video_decoder_have_frame")]
|
#[doc(alias = "gst_video_decoder_have_frame")]
|
||||||
fn have_frame(&self) -> gst::FlowReturn;
|
fn have_frame(&self) -> gst::FlowReturn;
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "gst_video_decoder_have_last_subframe")]
|
|
||||||
fn have_last_subframe(&self, frame: &VideoCodecFrame) -> gst::FlowReturn;
|
|
||||||
|
|
||||||
#[doc(alias = "gst_video_decoder_merge_tags")]
|
#[doc(alias = "gst_video_decoder_merge_tags")]
|
||||||
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode);
|
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode);
|
||||||
|
|
||||||
|
@ -236,28 +209,6 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExt for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
fn drop_subframe(&self, frame: &VideoCodecFrame) -> gst::FlowReturn {
|
|
||||||
unsafe {
|
|
||||||
from_glib(ffi::gst_video_decoder_drop_subframe(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
frame.to_glib_full(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
fn finish_subframe(&self, frame: &VideoCodecFrame) -> gst::FlowReturn {
|
|
||||||
unsafe {
|
|
||||||
from_glib(ffi::gst_video_decoder_finish_subframe(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
frame.to_glib_full(),
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn buffer_pool(&self) -> Option<gst::BufferPool> {
|
fn buffer_pool(&self) -> Option<gst::BufferPool> {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_glib_full(ffi::gst_video_decoder_get_buffer_pool(
|
from_glib_full(ffi::gst_video_decoder_get_buffer_pool(
|
||||||
|
@ -270,17 +221,6 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExt for O {
|
||||||
unsafe { ffi::gst_video_decoder_get_estimate_rate(self.as_ref().to_glib_none().0) }
|
unsafe { ffi::gst_video_decoder_get_estimate_rate(self.as_ref().to_glib_none().0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
fn input_subframe_index(&self, frame: &VideoCodecFrame) -> u32 {
|
|
||||||
unsafe {
|
|
||||||
ffi::gst_video_decoder_get_input_subframe_index(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
frame.to_glib_none().0,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn max_decode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff {
|
fn max_decode_time(&self, frame: &VideoCodecFrame) -> gst::ClockTimeDiff {
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_video_decoder_get_max_decode_time(
|
ffi::gst_video_decoder_get_max_decode_time(
|
||||||
|
@ -324,17 +264,6 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExt for O {
|
||||||
unsafe { ffi::gst_video_decoder_get_pending_frame_size(self.as_ref().to_glib_none().0) }
|
unsafe { ffi::gst_video_decoder_get_pending_frame_size(self.as_ref().to_glib_none().0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
fn processed_subframe_index(&self, frame: &VideoCodecFrame) -> u32 {
|
|
||||||
unsafe {
|
|
||||||
ffi::gst_video_decoder_get_processed_subframe_index(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
frame.to_glib_none().0,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn qos_proportion(&self) -> f64 {
|
fn qos_proportion(&self) -> f64 {
|
||||||
unsafe { ffi::gst_video_decoder_get_qos_proportion(self.as_ref().to_glib_none().0) }
|
unsafe { ffi::gst_video_decoder_get_qos_proportion(self.as_ref().to_glib_none().0) }
|
||||||
}
|
}
|
||||||
|
@ -357,17 +286,6 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExt for O {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
fn have_last_subframe(&self, frame: &VideoCodecFrame) -> gst::FlowReturn {
|
|
||||||
unsafe {
|
|
||||||
from_glib(ffi::gst_video_decoder_have_last_subframe(
|
|
||||||
self.as_ref().to_glib_none().0,
|
|
||||||
frame.to_glib_none().0,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) {
|
fn merge_tags(&self, tags: Option<&gst::TagList>, mode: gst::TagMergeMode) {
|
||||||
unsafe {
|
unsafe {
|
||||||
ffi::gst_video_decoder_merge_tags(
|
ffi::gst_video_decoder_merge_tags(
|
||||||
|
|
|
@ -22,7 +22,7 @@ impl<'a> ::glib::translate::ToGlibPtr<'a, *mut ffi::GstVideoCodecFrame> for Vide
|
||||||
}
|
}
|
||||||
|
|
||||||
fn to_glib_full(&self) -> *mut ffi::GstVideoCodecFrame {
|
fn to_glib_full(&self) -> *mut ffi::GstVideoCodecFrame {
|
||||||
unimplemented!()
|
unsafe { ffi::gst_video_codec_frame_ref(self.frame) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,6 +192,20 @@ impl<'a> VideoCodecFrame<'a> {
|
||||||
unsafe { from_glib((*self.to_glib_none().0).deadline) }
|
unsafe { from_glib((*self.to_glib_none().0).deadline) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_get_processed_subframe_index")]
|
||||||
|
pub fn subframes_processed(&self) -> u32 {
|
||||||
|
unsafe { (*self.to_glib_none().0).abidata.ABI.subframes_processed }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_get_input_subframe_index")]
|
||||||
|
pub fn num_subframes(&self) -> u32 {
|
||||||
|
unsafe { (*self.to_glib_none().0).abidata.ABI.num_subframes }
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub unsafe fn into_ptr(self) -> *mut ffi::GstVideoCodecFrame {
|
pub unsafe fn into_ptr(self) -> *mut ffi::GstVideoCodecFrame {
|
||||||
let stream_lock = self.element.stream_lock();
|
let stream_lock = self.element.stream_lock();
|
||||||
|
|
|
@ -50,6 +50,22 @@ pub trait VideoDecoderExtManual: 'static {
|
||||||
fn release_frame(&self, frame: VideoCodecFrame);
|
fn release_frame(&self, frame: VideoCodecFrame);
|
||||||
fn drop_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
fn drop_frame(&self, frame: VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_finish_subframe")]
|
||||||
|
fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_drop_subframe")]
|
||||||
|
fn drop_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_have_last_subframe")]
|
||||||
|
fn have_last_subframe(
|
||||||
|
&self,
|
||||||
|
frame: &VideoCodecFrame,
|
||||||
|
) -> Result<gst::FlowSuccess, gst::FlowError>;
|
||||||
|
|
||||||
#[doc(alias = "get_latency")]
|
#[doc(alias = "get_latency")]
|
||||||
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>);
|
fn latency(&self) -> (gst::ClockTime, Option<gst::ClockTime>);
|
||||||
fn set_latency(
|
fn set_latency(
|
||||||
|
@ -352,6 +368,45 @@ impl<O: IsA<VideoDecoder>> VideoDecoderExtManual for O {
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_finish_subframe")]
|
||||||
|
fn finish_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
unsafe {
|
||||||
|
try_from_glib(ffi::gst_video_decoder_finish_subframe(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
frame.to_glib_full(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_drop_subframe")]
|
||||||
|
fn drop_subframe(&self, frame: &VideoCodecFrame) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
unsafe {
|
||||||
|
try_from_glib(ffi::gst_video_decoder_drop_subframe(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
frame.to_glib_full(),
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_video_decoder_have_last_subframe")]
|
||||||
|
fn have_last_subframe(
|
||||||
|
&self,
|
||||||
|
frame: &VideoCodecFrame,
|
||||||
|
) -> Result<gst::FlowSuccess, gst::FlowError> {
|
||||||
|
unsafe {
|
||||||
|
try_from_glib(ffi::gst_video_decoder_have_last_subframe(
|
||||||
|
self.as_ref().to_glib_none().0,
|
||||||
|
frame.to_glib_none().0,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HasStreamLock for VideoDecoder {
|
impl HasStreamLock for VideoDecoder {
|
||||||
|
|
|
@ -99,3 +99,8 @@ status = "generate"
|
||||||
name = "to_string"
|
name = "to_string"
|
||||||
[object.function.return]
|
[object.function.return]
|
||||||
nullable = false
|
nullable = false
|
||||||
|
|
||||||
|
[[object]]
|
||||||
|
name = "GstWebRTC.WebRTCSCTPTransport"
|
||||||
|
status = "generate"
|
||||||
|
version = "1.20"
|
||||||
|
|
|
@ -25,6 +25,13 @@ pub use self::web_rtcrtp_sender::WebRTCRTPSender;
|
||||||
mod web_rtcrtp_transceiver;
|
mod web_rtcrtp_transceiver;
|
||||||
pub use self::web_rtcrtp_transceiver::WebRTCRTPTransceiver;
|
pub use self::web_rtcrtp_transceiver::WebRTCRTPTransceiver;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
mod web_rtcsctp_transport;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
pub use self::web_rtcsctp_transport::WebRTCSCTPTransport;
|
||||||
|
|
||||||
mod web_rtc_session_description;
|
mod web_rtc_session_description;
|
||||||
pub use self::web_rtc_session_description::WebRTCSessionDescription;
|
pub use self::web_rtc_session_description::WebRTCSessionDescription;
|
||||||
|
|
||||||
|
|
200
gstreamer-webrtc/src/auto/web_rtcsctp_transport.rs
Normal file
200
gstreamer-webrtc/src/auto/web_rtcsctp_transport.rs
Normal file
|
@ -0,0 +1,200 @@
|
||||||
|
// This file was generated by gir (https://github.com/gtk-rs/gir)
|
||||||
|
// from gir-files (https://github.com/gtk-rs/gir-files)
|
||||||
|
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
|
||||||
|
// DO NOT EDIT
|
||||||
|
|
||||||
|
use crate::WebRTCDTLSTransport;
|
||||||
|
use crate::WebRTCSCTPTransportState;
|
||||||
|
use glib::object::ObjectType as ObjectType_;
|
||||||
|
use glib::signal::connect_raw;
|
||||||
|
use glib::signal::SignalHandlerId;
|
||||||
|
use glib::translate::*;
|
||||||
|
use glib::StaticType;
|
||||||
|
use std::boxed::Box as Box_;
|
||||||
|
use std::mem::transmute;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
#[doc(alias = "GstWebRTCSCTPTransport")]
|
||||||
|
pub struct WebRTCSCTPTransport(Object<ffi::GstWebRTCSCTPTransport, ffi::GstWebRTCSCTPTransportClass>);
|
||||||
|
|
||||||
|
match fn {
|
||||||
|
type_ => || ffi::gst_webrtc_sctp_transport_get_type(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WebRTCSCTPTransport {
|
||||||
|
#[doc(alias = "max-channels")]
|
||||||
|
pub fn max_channels(&self) -> u32 {
|
||||||
|
unsafe {
|
||||||
|
let mut value = glib::Value::from_type(<u32 as StaticType>::static_type());
|
||||||
|
glib::gobject_ffi::g_object_get_property(
|
||||||
|
self.as_ptr() as *mut glib::gobject_ffi::GObject,
|
||||||
|
b"max-channels\0".as_ptr() as *const _,
|
||||||
|
value.to_glib_none_mut().0,
|
||||||
|
);
|
||||||
|
value
|
||||||
|
.get()
|
||||||
|
.expect("Return Value for property `max-channels` getter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "max-message-size")]
|
||||||
|
pub fn max_message_size(&self) -> u64 {
|
||||||
|
unsafe {
|
||||||
|
let mut value = glib::Value::from_type(<u64 as StaticType>::static_type());
|
||||||
|
glib::gobject_ffi::g_object_get_property(
|
||||||
|
self.as_ptr() as *mut glib::gobject_ffi::GObject,
|
||||||
|
b"max-message-size\0".as_ptr() as *const _,
|
||||||
|
value.to_glib_none_mut().0,
|
||||||
|
);
|
||||||
|
value
|
||||||
|
.get()
|
||||||
|
.expect("Return Value for property `max-message-size` getter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn state(&self) -> WebRTCSCTPTransportState {
|
||||||
|
unsafe {
|
||||||
|
let mut value =
|
||||||
|
glib::Value::from_type(<WebRTCSCTPTransportState as StaticType>::static_type());
|
||||||
|
glib::gobject_ffi::g_object_get_property(
|
||||||
|
self.as_ptr() as *mut glib::gobject_ffi::GObject,
|
||||||
|
b"state\0".as_ptr() as *const _,
|
||||||
|
value.to_glib_none_mut().0,
|
||||||
|
);
|
||||||
|
value
|
||||||
|
.get()
|
||||||
|
.expect("Return Value for property `state` getter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn transport(&self) -> Option<WebRTCDTLSTransport> {
|
||||||
|
unsafe {
|
||||||
|
let mut value =
|
||||||
|
glib::Value::from_type(<WebRTCDTLSTransport as StaticType>::static_type());
|
||||||
|
glib::gobject_ffi::g_object_get_property(
|
||||||
|
self.as_ptr() as *mut glib::gobject_ffi::GObject,
|
||||||
|
b"transport\0".as_ptr() as *const _,
|
||||||
|
value.to_glib_none_mut().0,
|
||||||
|
);
|
||||||
|
value
|
||||||
|
.get()
|
||||||
|
.expect("Return Value for property `transport` getter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "max-channels")]
|
||||||
|
pub fn connect_max_channels_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_max_channels_trampoline<
|
||||||
|
F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstWebRTCSCTPTransport,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(&from_glib_borrow(this))
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::max-channels\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_max_channels_trampoline::<F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "max-message-size")]
|
||||||
|
pub fn connect_max_message_size_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_max_message_size_trampoline<
|
||||||
|
F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstWebRTCSCTPTransport,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(&from_glib_borrow(this))
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::max-message-size\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_max_message_size_trampoline::<F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "state")]
|
||||||
|
pub fn connect_state_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_state_trampoline<
|
||||||
|
F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstWebRTCSCTPTransport,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(&from_glib_borrow(this))
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::state\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_state_trampoline::<F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[doc(alias = "transport")]
|
||||||
|
pub fn connect_transport_notify<F: Fn(&Self) + Send + Sync + 'static>(
|
||||||
|
&self,
|
||||||
|
f: F,
|
||||||
|
) -> SignalHandlerId {
|
||||||
|
unsafe extern "C" fn notify_transport_trampoline<
|
||||||
|
F: Fn(&WebRTCSCTPTransport) + Send + Sync + 'static,
|
||||||
|
>(
|
||||||
|
this: *mut ffi::GstWebRTCSCTPTransport,
|
||||||
|
_param_spec: glib::ffi::gpointer,
|
||||||
|
f: glib::ffi::gpointer,
|
||||||
|
) {
|
||||||
|
let f: &F = &*(f as *const F);
|
||||||
|
f(&from_glib_borrow(this))
|
||||||
|
}
|
||||||
|
unsafe {
|
||||||
|
let f: Box_<F> = Box_::new(f);
|
||||||
|
connect_raw(
|
||||||
|
self.as_ptr() as *mut _,
|
||||||
|
b"notify::transport\0".as_ptr() as *const _,
|
||||||
|
Some(transmute::<_, unsafe extern "C" fn()>(
|
||||||
|
notify_transport_trampoline::<F> as *const (),
|
||||||
|
)),
|
||||||
|
Box_::into_raw(f),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for WebRTCSCTPTransport {}
|
||||||
|
unsafe impl Sync for WebRTCSCTPTransport {}
|
|
@ -17,3 +17,10 @@ external_libraries = [
|
||||||
|
|
||||||
[external_libraries]
|
[external_libraries]
|
||||||
gstreamer_sdp="GstSdp"
|
gstreamer_sdp="GstSdp"
|
||||||
|
|
||||||
|
[[object]]
|
||||||
|
name = "GstWebRTC.WebRTCSCTPTransport"
|
||||||
|
status = "generate"
|
||||||
|
[[object.function]]
|
||||||
|
name = "get_type"
|
||||||
|
version = "1.20"
|
||||||
|
|
|
@ -443,6 +443,8 @@ extern "C" {
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
// GstWebRTCSCTPTransport
|
// GstWebRTCSCTPTransport
|
||||||
//=========================================================================
|
//=========================================================================
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
pub fn gst_webrtc_sctp_transport_get_type() -> GType;
|
pub fn gst_webrtc_sctp_transport_get_type() -> GType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1052,6 +1052,36 @@ final_type = true
|
||||||
[object.function.return]
|
[object.function.return]
|
||||||
nullable_return_is_error = "Failed to create element from factory name"
|
nullable_return_is_error = "Failed to create element from factory name"
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "create_full"
|
||||||
|
# varargs
|
||||||
|
ignore = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "create_valist"
|
||||||
|
# varargs
|
||||||
|
ignore = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "create_with_properties"
|
||||||
|
# separate name/value arrays need to be merged
|
||||||
|
manual = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "make_full"
|
||||||
|
# varargs
|
||||||
|
ignore = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "make_valist"
|
||||||
|
# varargs
|
||||||
|
ignore = true
|
||||||
|
|
||||||
|
[[object.function]]
|
||||||
|
name = "make_with_properties"
|
||||||
|
# separate name/value arrays need to be merged
|
||||||
|
manual = true
|
||||||
|
|
||||||
[[object]]
|
[[object]]
|
||||||
name = "Gst.TypeFindFactory"
|
name = "Gst.TypeFindFactory"
|
||||||
status = "generate"
|
status = "generate"
|
||||||
|
|
|
@ -75,39 +75,6 @@ impl ElementFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
//#[doc(alias = "gst_element_factory_create_full")]
|
|
||||||
//pub fn create_full(&self, first: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<Element> {
|
|
||||||
// unsafe { TODO: call ffi:gst_element_factory_create_full() }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
//#[doc(alias = "gst_element_factory_create_valist")]
|
|
||||||
//pub fn create_valist(&self, first: Option<&str>, properties: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<Element> {
|
|
||||||
// unsafe { TODO: call ffi:gst_element_factory_create_valist() }
|
|
||||||
//}
|
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "gst_element_factory_create_with_properties")]
|
|
||||||
pub fn create_with_properties(
|
|
||||||
&self,
|
|
||||||
n: u32,
|
|
||||||
names: Option<&str>,
|
|
||||||
values: Option<&glib::Value>,
|
|
||||||
) -> Option<Element> {
|
|
||||||
unsafe {
|
|
||||||
from_glib_none(ffi::gst_element_factory_create_with_properties(
|
|
||||||
self.to_glib_none().0,
|
|
||||||
n,
|
|
||||||
names.to_glib_none().0,
|
|
||||||
values.to_glib_none().0,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc(alias = "gst_element_factory_get_element_type")]
|
#[doc(alias = "gst_element_factory_get_element_type")]
|
||||||
#[doc(alias = "get_element_type")]
|
#[doc(alias = "get_element_type")]
|
||||||
pub fn element_type(&self) -> glib::types::Type {
|
pub fn element_type(&self) -> glib::types::Type {
|
||||||
|
@ -237,40 +204,6 @@ impl ElementFactory {
|
||||||
.ok_or_else(|| glib::bool_error!("Failed to create element from factory name"))
|
.ok_or_else(|| glib::bool_error!("Failed to create element from factory name"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
//#[doc(alias = "gst_element_factory_make_full")]
|
|
||||||
//pub fn make_full(factoryname: &str, first: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<Element> {
|
|
||||||
// unsafe { TODO: call ffi:gst_element_factory_make_full() }
|
|
||||||
//}
|
|
||||||
|
|
||||||
//#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
//#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
//#[doc(alias = "gst_element_factory_make_valist")]
|
|
||||||
//pub fn make_valist(factoryname: &str, first: Option<&str>, properties: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<Element> {
|
|
||||||
// unsafe { TODO: call ffi:gst_element_factory_make_valist() }
|
|
||||||
//}
|
|
||||||
|
|
||||||
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
|
||||||
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
|
||||||
#[doc(alias = "gst_element_factory_make_with_properties")]
|
|
||||||
pub fn make_with_properties(
|
|
||||||
factoryname: &str,
|
|
||||||
n: u32,
|
|
||||||
names: Option<&str>,
|
|
||||||
values: Option<&glib::Value>,
|
|
||||||
) -> Option<Element> {
|
|
||||||
assert_initialized_main_thread!();
|
|
||||||
unsafe {
|
|
||||||
from_glib_none(ffi::gst_element_factory_make_with_properties(
|
|
||||||
factoryname.to_glib_none().0,
|
|
||||||
n,
|
|
||||||
names.to_glib_none().0,
|
|
||||||
values.to_glib_none().0,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for ElementFactory {}
|
unsafe impl Send for ElementFactory {}
|
||||||
|
|
65
gstreamer/src/element_factory.rs
Normal file
65
gstreamer/src/element_factory.rs
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
use crate::Element;
|
||||||
|
use crate::ElementFactory;
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
use glib::prelude::*;
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
use glib::translate::*;
|
||||||
|
|
||||||
|
impl ElementFactory {
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_element_factory_create_with_properties")]
|
||||||
|
pub fn create_with_properties(
|
||||||
|
&self,
|
||||||
|
properties: &[(&str, &dyn ToValue)],
|
||||||
|
) -> Result<Element, glib::BoolError> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
let n = properties.len() as u32;
|
||||||
|
let names = properties.iter().map(|(name, _)| *name).collect::<Vec<_>>();
|
||||||
|
let values = properties
|
||||||
|
.iter()
|
||||||
|
.map(|(_, value)| value.to_value())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
Option::<_>::from_glib_none(ffi::gst_element_factory_create_with_properties(
|
||||||
|
self.to_glib_none().0,
|
||||||
|
n,
|
||||||
|
names.to_glib_none().0,
|
||||||
|
values.as_ptr() as *const glib::gobject_ffi::GValue,
|
||||||
|
))
|
||||||
|
.ok_or_else(|| glib::bool_error!("Failed to create element from factory"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(feature = "v1_20", feature = "dox"))]
|
||||||
|
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_20")))]
|
||||||
|
#[doc(alias = "gst_element_factory_make_with_properties")]
|
||||||
|
pub fn make_with_properties(
|
||||||
|
factoryname: &str,
|
||||||
|
properties: &[(&str, &dyn ToValue)],
|
||||||
|
) -> Result<Element, glib::BoolError> {
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
let n = properties.len() as u32;
|
||||||
|
let names = properties.iter().map(|(name, _)| *name).collect::<Vec<_>>();
|
||||||
|
let values = properties
|
||||||
|
.iter()
|
||||||
|
.map(|(_, value)| value.to_value())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
assert_initialized_main_thread!();
|
||||||
|
unsafe {
|
||||||
|
Option::<_>::from_glib_none(ffi::gst_element_factory_make_with_properties(
|
||||||
|
factoryname.to_glib_none().0,
|
||||||
|
n,
|
||||||
|
names.to_glib_none().0,
|
||||||
|
values.as_ptr() as *const glib::gobject_ffi::GValue,
|
||||||
|
))
|
||||||
|
.ok_or_else(|| glib::bool_error!("Failed to create element from factory name"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -129,6 +129,7 @@ pub use promise::{Promise, PromiseError};
|
||||||
|
|
||||||
pub mod bus;
|
pub mod bus;
|
||||||
mod element;
|
mod element;
|
||||||
|
mod element_factory;
|
||||||
|
|
||||||
mod bin;
|
mod bin;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue