mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-26 03:21:03 +00:00
Store panic information not in a custom instance struct but in the instance data provided by the subclassing infrastructure
This scales better as there will only be only such data instead of two or more when having deeper class hierarchies with multiple Rust elements, and also makes it unnecessary to use a special instance struct so the default works well.
This commit is contained in:
parent
6fa48890bc
commit
ea239c587e
18 changed files with 378 additions and 954 deletions
|
@ -58,7 +58,6 @@ mod fir_filter {
|
||||||
const NAME: &'static str = "RsFirFilter";
|
const NAME: &'static str = "RsFirFilter";
|
||||||
type Type = super::FirFilter;
|
type Type = super::FirFilter;
|
||||||
type ParentType = gst_base::BaseTransform;
|
type ParentType = gst_base::BaseTransform;
|
||||||
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implementation of glib::Object virtual methods
|
// Implementation of glib::Object virtual methods
|
||||||
|
|
|
@ -530,10 +530,7 @@ impl<T: AudioDecoderImpl> AudioDecoderImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: AudioDecoderImpl> IsSubclassable<T> for AudioDecoder
|
unsafe impl<T: AudioDecoderImpl> IsSubclassable<T> for AudioDecoder {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -563,15 +560,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_decoder_open<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_open<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.open(wrap.unsafe_cast_ref()) {
|
match imp.open(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -585,15 +579,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_decoder_close<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_close<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.close(wrap.unsafe_cast_ref()) {
|
match imp.close(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -607,15 +598,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_decoder_start<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_start<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -629,15 +617,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_decoder_stop<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_stop<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -652,15 +637,12 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_set_format<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_set_format<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -677,15 +659,12 @@ unsafe extern "C" fn audio_decoder_parse<T: AudioDecoderImpl>(
|
||||||
adapter: *mut gst_base::ffi::GstAdapter,
|
adapter: *mut gst_base::ffi::GstAdapter,
|
||||||
offset: *mut i32,
|
offset: *mut i32,
|
||||||
len: *mut i32,
|
len: *mut i32,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.parse(wrap.unsafe_cast_ref(), &from_glib_borrow(adapter)) {
|
match imp.parse(wrap.unsafe_cast_ref(), &from_glib_borrow(adapter)) {
|
||||||
Ok((new_offset, new_len)) => {
|
Ok((new_offset, new_len)) => {
|
||||||
assert!(new_offset <= std::i32::MAX as u32);
|
assert!(new_offset <= std::i32::MAX as u32);
|
||||||
|
@ -704,17 +683,14 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_handle_frame<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_handle_frame<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
buffer: *mut *mut gst::ffi::GstBuffer,
|
buffer: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
// FIXME: Misgenerated in gstreamer-audio-sys
|
// FIXME: Misgenerated in gstreamer-audio-sys
|
||||||
let buffer = buffer as *mut gst::ffi::GstBuffer;
|
let buffer = buffer as *mut gst::ffi::GstBuffer;
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.handle_frame(
|
imp.handle_frame(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
|
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
|
||||||
|
@ -727,15 +703,12 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_pre_push<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_pre_push<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
buffer: *mut *mut gst::ffi::GstBuffer,
|
buffer: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
|
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
|
||||||
Ok(Some(new_buffer)) => {
|
Ok(Some(new_buffer)) => {
|
||||||
*buffer = new_buffer.into_ptr();
|
*buffer = new_buffer.into_ptr();
|
||||||
|
@ -755,29 +728,24 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_flush<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_flush<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
hard: glib::ffi::gboolean,
|
hard: glib::ffi::gboolean,
|
||||||
) where
|
) {
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||||
AudioDecoderImpl::flush(imp, wrap.unsafe_cast_ref(), from_glib(hard))
|
AudioDecoderImpl::flush(imp, wrap.unsafe_cast_ref(), from_glib(hard))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audio_decoder_negotiate<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_negotiate<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -792,15 +760,12 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_getcaps<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_getcaps<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
filter: *mut gst::ffi::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||||
AudioDecoderImpl::get_caps(
|
AudioDecoderImpl::get_caps(
|
||||||
imp,
|
imp,
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
|
@ -815,15 +780,12 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_sink_event<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_sink_event<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -832,15 +794,12 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_sink_query<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_sink_query<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -849,15 +808,12 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_src_event<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_src_event<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -866,15 +822,12 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_src_query<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_src_query<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -883,16 +836,13 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_propose_allocation<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_propose_allocation<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -907,16 +857,13 @@ where
|
||||||
unsafe extern "C" fn audio_decoder_decide_allocation<T: AudioDecoderImpl>(
|
unsafe extern "C" fn audio_decoder_decide_allocation<T: AudioDecoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioDecoder,
|
ptr: *mut ffi::GstAudioDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -476,10 +476,7 @@ impl<T: AudioEncoderImpl> AudioEncoderImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: AudioEncoderImpl> IsSubclassable<T> for AudioEncoder
|
unsafe impl<T: AudioEncoderImpl> IsSubclassable<T> for AudioEncoder {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -508,15 +505,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_encoder_open<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_open<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.open(wrap.unsafe_cast_ref()) {
|
match imp.open(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -530,15 +524,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_encoder_close<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_close<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.close(wrap.unsafe_cast_ref()) {
|
match imp.close(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -552,15 +543,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_encoder_start<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_start<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -574,15 +562,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audio_encoder_stop<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_stop<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -597,15 +582,12 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_set_format<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_set_format<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
info: *mut ffi::GstAudioInfo,
|
info: *mut ffi::GstAudioInfo,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_none(info)) {
|
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_none(info)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -620,17 +602,14 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_handle_frame<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_handle_frame<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
buffer: *mut *mut gst::ffi::GstBuffer,
|
buffer: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
// FIXME: Misgenerated in gstreamer-audio-sys
|
// FIXME: Misgenerated in gstreamer-audio-sys
|
||||||
let buffer = buffer as *mut gst::ffi::GstBuffer;
|
let buffer = buffer as *mut gst::ffi::GstBuffer;
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.handle_frame(
|
imp.handle_frame(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
|
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
|
||||||
|
@ -643,15 +622,12 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_pre_push<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_pre_push<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
buffer: *mut *mut gst::ffi::GstBuffer,
|
buffer: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
|
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
|
||||||
Ok(Some(new_buffer)) => {
|
Ok(Some(new_buffer)) => {
|
||||||
*buffer = new_buffer.into_ptr();
|
*buffer = new_buffer.into_ptr();
|
||||||
|
@ -668,30 +644,24 @@ where
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audio_encoder_flush<T: AudioEncoderImpl>(ptr: *mut ffi::GstAudioEncoder)
|
unsafe extern "C" fn audio_encoder_flush<T: AudioEncoderImpl>(ptr: *mut ffi::GstAudioEncoder) {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||||
AudioEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
|
AudioEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audio_encoder_negotiate<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_negotiate<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -706,15 +676,12 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_getcaps<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_getcaps<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
filter: *mut gst::ffi::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||||
AudioEncoderImpl::get_caps(
|
AudioEncoderImpl::get_caps(
|
||||||
imp,
|
imp,
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
|
@ -729,15 +696,12 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_sink_event<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_sink_event<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -746,15 +710,12 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_sink_query<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_sink_query<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -763,15 +724,12 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_src_event<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_src_event<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -780,15 +738,12 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_src_query<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_src_query<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -797,16 +752,13 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_propose_allocation<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_propose_allocation<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -821,16 +773,13 @@ where
|
||||||
unsafe extern "C" fn audio_encoder_decide_allocation<T: AudioEncoderImpl>(
|
unsafe extern "C" fn audio_encoder_decide_allocation<T: AudioEncoderImpl>(
|
||||||
ptr: *mut ffi::GstAudioEncoder,
|
ptr: *mut ffi::GstAudioEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -4,7 +4,6 @@ use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst::subclass::prelude::*;
|
|
||||||
use gst::LoggableError;
|
use gst::LoggableError;
|
||||||
use gst_base::subclass::prelude::*;
|
use gst_base::subclass::prelude::*;
|
||||||
|
|
||||||
|
@ -184,10 +183,7 @@ impl<T: AudioSinkImpl> AudioSinkImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: AudioSinkImpl> IsSubclassable<T> for AudioSink
|
unsafe impl<T: AudioSinkImpl> IsSubclassable<T> for AudioSink {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst_base::BaseSink as IsSubclassable<T>>::class_init(klass);
|
<gst_base::BaseSink as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -207,15 +203,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audiosink_close<T: AudioSinkImpl>(
|
unsafe extern "C" fn audiosink_close<T: AudioSinkImpl>(
|
||||||
ptr: *mut ffi::GstAudioSink,
|
ptr: *mut ffi::GstAudioSink,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.close(wrap.unsafe_cast_ref()) {
|
match imp.close(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -227,30 +220,24 @@ where
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audiosink_delay<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSink) -> u32
|
unsafe extern "C" fn audiosink_delay<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSink) -> u32 {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), 0, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), 0, {
|
||||||
imp.delay(wrap.unsafe_cast_ref())
|
imp.delay(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audiosink_open<T: AudioSinkImpl>(
|
unsafe extern "C" fn audiosink_open<T: AudioSinkImpl>(
|
||||||
ptr: *mut ffi::GstAudioSink,
|
ptr: *mut ffi::GstAudioSink,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.open(wrap.unsafe_cast_ref()) {
|
match imp.open(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -265,17 +252,14 @@ where
|
||||||
unsafe extern "C" fn audiosink_prepare<T: AudioSinkImpl>(
|
unsafe extern "C" fn audiosink_prepare<T: AudioSinkImpl>(
|
||||||
ptr: *mut ffi::GstAudioSink,
|
ptr: *mut ffi::GstAudioSink,
|
||||||
spec: *mut ffi::GstAudioRingBufferSpec,
|
spec: *mut ffi::GstAudioRingBufferSpec,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
let spec = &mut *(spec as *mut AudioRingBufferSpec);
|
let spec = &mut *(spec as *mut AudioRingBufferSpec);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match AudioSinkImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
|
match AudioSinkImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -289,15 +273,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audiosink_unprepare<T: AudioSinkImpl>(
|
unsafe extern "C" fn audiosink_unprepare<T: AudioSinkImpl>(
|
||||||
ptr: *mut ffi::GstAudioSink,
|
ptr: *mut ffi::GstAudioSink,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.unprepare(wrap.unsafe_cast_ref()) {
|
match imp.unprepare(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -313,29 +294,23 @@ unsafe extern "C" fn audiosink_write<T: AudioSinkImpl>(
|
||||||
ptr: *mut ffi::GstAudioSink,
|
ptr: *mut ffi::GstAudioSink,
|
||||||
data: glib::ffi::gpointer,
|
data: glib::ffi::gpointer,
|
||||||
length: u32,
|
length: u32,
|
||||||
) -> i32
|
) -> i32 {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
|
||||||
let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize);
|
let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), -1, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), -1, {
|
||||||
imp.write(wrap.unsafe_cast_ref(), data_slice).unwrap_or(-1)
|
imp.write(wrap.unsafe_cast_ref(), data_slice).unwrap_or(-1)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audiosink_reset<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSink)
|
unsafe extern "C" fn audiosink_reset<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSink) {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||||
imp.reset(wrap.unsafe_cast_ref());
|
imp.reset(wrap.unsafe_cast_ref());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst::subclass::prelude::*;
|
|
||||||
use gst::LoggableError;
|
use gst::LoggableError;
|
||||||
use gst_base::subclass::prelude::*;
|
use gst_base::subclass::prelude::*;
|
||||||
|
|
||||||
|
@ -200,10 +199,7 @@ impl<T: AudioSrcImpl> AudioSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: AudioSrcImpl> IsSubclassable<T> for AudioSrc
|
unsafe impl<T: AudioSrcImpl> IsSubclassable<T> for AudioSrc {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst_base::BaseSrc as IsSubclassable<T>>::class_init(klass);
|
<gst_base::BaseSrc as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -223,15 +219,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audiosrc_close<T: AudioSrcImpl>(
|
unsafe extern "C" fn audiosrc_close<T: AudioSrcImpl>(
|
||||||
ptr: *mut ffi::GstAudioSrc,
|
ptr: *mut ffi::GstAudioSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.close(wrap.unsafe_cast_ref()) {
|
match imp.close(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -243,30 +236,24 @@ where
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audiosrc_delay<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc) -> u32
|
unsafe extern "C" fn audiosrc_delay<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc) -> u32 {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), 0, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), 0, {
|
||||||
imp.delay(wrap.unsafe_cast_ref())
|
imp.delay(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audiosrc_open<T: AudioSrcImpl>(
|
unsafe extern "C" fn audiosrc_open<T: AudioSrcImpl>(
|
||||||
ptr: *mut ffi::GstAudioSrc,
|
ptr: *mut ffi::GstAudioSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.open(wrap.unsafe_cast_ref()) {
|
match imp.open(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -281,17 +268,14 @@ where
|
||||||
unsafe extern "C" fn audiosrc_prepare<T: AudioSrcImpl>(
|
unsafe extern "C" fn audiosrc_prepare<T: AudioSrcImpl>(
|
||||||
ptr: *mut ffi::GstAudioSrc,
|
ptr: *mut ffi::GstAudioSrc,
|
||||||
spec: *mut ffi::GstAudioRingBufferSpec,
|
spec: *mut ffi::GstAudioRingBufferSpec,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
let spec = &mut *(spec as *mut AudioRingBufferSpec);
|
let spec = &mut *(spec as *mut AudioRingBufferSpec);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match AudioSrcImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
|
match AudioSrcImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -305,15 +289,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn audiosrc_unprepare<T: AudioSrcImpl>(
|
unsafe extern "C" fn audiosrc_unprepare<T: AudioSrcImpl>(
|
||||||
ptr: *mut ffi::GstAudioSrc,
|
ptr: *mut ffi::GstAudioSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.unprepare(wrap.unsafe_cast_ref()) {
|
match imp.unprepare(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -330,16 +311,13 @@ unsafe extern "C" fn audiosrc_read<T: AudioSrcImpl>(
|
||||||
data: glib::ffi::gpointer,
|
data: glib::ffi::gpointer,
|
||||||
length: u32,
|
length: u32,
|
||||||
timestamp: *mut gst::ffi::GstClockTime,
|
timestamp: *mut gst::ffi::GstClockTime,
|
||||||
) -> u32
|
) -> u32 {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
|
||||||
let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize);
|
let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), 0, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), 0, {
|
||||||
let (res, timestamp_res) = imp
|
let (res, timestamp_res) = imp
|
||||||
.read(wrap.unsafe_cast_ref(), data_slice)
|
.read(wrap.unsafe_cast_ref(), data_slice)
|
||||||
.unwrap_or((0, gst::CLOCK_TIME_NONE));
|
.unwrap_or((0, gst::CLOCK_TIME_NONE));
|
||||||
|
@ -349,15 +327,12 @@ where
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn audiosrc_reset<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc)
|
unsafe extern "C" fn audiosrc_reset<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc) {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<AudioSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||||
imp.reset(wrap.unsafe_cast_ref());
|
imp.reset(wrap.unsafe_cast_ref());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -703,10 +703,7 @@ impl<T: AggregatorImpl> AggregatorImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: AggregatorImpl> IsSubclassable<T> for Aggregator
|
unsafe impl<T: AggregatorImpl> IsSubclassable<T> for Aggregator {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -743,15 +740,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.flush(wrap.unsafe_cast_ref()).into()
|
imp.flush(wrap.unsafe_cast_ref()).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -761,15 +755,12 @@ unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
aggregator_pad: *mut ffi::GstAggregatorPad,
|
aggregator_pad: *mut ffi::GstAggregatorPad,
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> *mut gst::ffi::GstBuffer
|
) -> *mut gst::ffi::GstBuffer {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||||
imp.clip(
|
imp.clip(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(aggregator_pad),
|
&from_glib_borrow(aggregator_pad),
|
||||||
|
@ -783,15 +774,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
})
|
})
|
||||||
|
@ -803,15 +791,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_finish_buffer_list<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_finish_buffer_list<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
buffer_list: *mut gst::ffi::GstBufferList,
|
buffer_list: *mut gst::ffi::GstBufferList,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
})
|
})
|
||||||
|
@ -822,15 +807,12 @@ unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
aggregator_pad: *mut ffi::GstAggregatorPad,
|
aggregator_pad: *mut ffi::GstAggregatorPad,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(wrap, &imp.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),
|
||||||
|
@ -846,15 +828,12 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
aggregator_pad: *mut ffi::GstAggregatorPad,
|
aggregator_pad: *mut ffi::GstAggregatorPad,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -869,15 +848,12 @@ unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
aggregator_pad: *mut ffi::GstAggregatorPad,
|
aggregator_pad: *mut ffi::GstAggregatorPad,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -893,15 +869,12 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
aggregator_pad: *mut ffi::GstAggregatorPad,
|
aggregator_pad: *mut ffi::GstAggregatorPad,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -914,15 +887,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -931,15 +901,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -949,15 +916,12 @@ unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
mode: gst::ffi::GstPadMode,
|
mode: gst::ffi::GstPadMode,
|
||||||
active: glib::ffi::gboolean,
|
active: glib::ffi::gboolean,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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) => {
|
||||||
|
@ -972,15 +936,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
timeout: glib::ffi::gboolean,
|
timeout: glib::ffi::gboolean,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
|
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
@ -989,15 +950,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1011,15 +969,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1033,15 +988,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
) -> gst::ffi::GstClockTime
|
) -> gst::ffi::GstClockTime {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -1052,15 +1004,12 @@ unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>(
|
||||||
templ: *mut gst::ffi::GstPadTemplate,
|
templ: *mut gst::ffi::GstPadTemplate,
|
||||||
req_name: *const libc::c_char,
|
req_name: *const libc::c_char,
|
||||||
caps: *const gst::ffi::GstCaps,
|
caps: *const gst::ffi::GstCaps,
|
||||||
) -> *mut ffi::GstAggregatorPad
|
) -> *mut ffi::GstAggregatorPad {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::panic_to_error!(&wrap, &imp.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(
|
||||||
|
@ -1079,17 +1028,14 @@ unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
res: *mut *mut gst::ffi::GstCaps,
|
res: *mut *mut gst::ffi::GstCaps,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
*res = ptr::null_mut();
|
*res = ptr::null_mut();
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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();
|
||||||
|
@ -1104,15 +1050,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -1121,15 +1064,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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) => {
|
||||||
|
@ -1145,15 +1085,12 @@ where
|
||||||
#[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 ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.negotiate(wrap.unsafe_cast_ref())
|
imp.negotiate(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -1164,15 +1101,12 @@ where
|
||||||
unsafe extern "C" fn aggregator_peek_next_sample<T: AggregatorImpl>(
|
unsafe extern "C" fn aggregator_peek_next_sample<T: AggregatorImpl>(
|
||||||
ptr: *mut ffi::GstAggregator,
|
ptr: *mut ffi::GstAggregator,
|
||||||
pad: *mut ffi::GstAggregatorPad,
|
pad: *mut ffi::GstAggregatorPad,
|
||||||
) -> *mut gst::ffi::GstSample
|
) -> *mut gst::ffi::GstSample {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Aggregator> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
|
|
@ -203,10 +203,7 @@ impl<T: BaseParseImpl> BaseParseImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: BaseParseImpl> IsSubclassable<T> for BaseParse
|
unsafe impl<T: BaseParseImpl> IsSubclassable<T> for BaseParse {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -224,15 +221,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_parse_start<T: BaseParseImpl>(
|
unsafe extern "C" fn base_parse_start<T: BaseParseImpl>(
|
||||||
ptr: *mut ffi::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -246,15 +240,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>(
|
unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>(
|
||||||
ptr: *mut ffi::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseParse> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -269,16 +260,13 @@ 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 ffi::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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) => {
|
||||||
|
@ -294,16 +282,13 @@ unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>(
|
||||||
ptr: *mut ffi::GstBaseParse,
|
ptr: *mut ffi::GstBaseParse,
|
||||||
frame: *mut ffi::GstBaseParseFrame,
|
frame: *mut ffi::GstBaseParseFrame,
|
||||||
skipsize: *mut i32,
|
skipsize: *mut i32,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), Err(gst::FlowError::Error), {
|
||||||
imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame)
|
imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -323,16 +308,13 @@ unsafe extern "C" fn base_parse_convert<T: BaseParseImpl>(
|
||||||
source_value: i64,
|
source_value: i64,
|
||||||
dest_format: gst::ffi::GstFormat,
|
dest_format: gst::ffi::GstFormat,
|
||||||
dest_value: *mut i64,
|
dest_value: *mut i64,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||||
imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format))
|
imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -400,10 +400,7 @@ impl<T: BaseSinkImpl> BaseSinkImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: BaseSinkImpl> IsSubclassable<T> for BaseSink
|
unsafe impl<T: BaseSinkImpl> IsSubclassable<T> for BaseSink {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -429,15 +426,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_start<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_start<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -451,15 +445,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -474,16 +465,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.render(wrap.unsafe_cast_ref(), &buffer).into()
|
imp.render(wrap.unsafe_cast_ref(), &buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -492,16 +480,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
|
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -510,16 +495,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
list: *mut gst::ffi::GstBufferList,
|
list: *mut gst::ffi::GstBufferList,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -528,16 +510,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
list: *mut gst::ffi::GstBufferList,
|
list: *mut gst::ffi::GstBufferList,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -546,16 +525,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
query_ptr: *mut gst::ffi::GstQuery,
|
query_ptr: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -564,15 +540,12 @@ where
|
||||||
unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
event_ptr: *mut gst::ffi::GstEvent,
|
event_ptr: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -581,16 +554,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
filter: *mut gst::ffi::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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())
|
||||||
|
@ -600,16 +570,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_set_caps<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_set_caps<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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) => {
|
||||||
|
@ -624,16 +591,13 @@ where
|
||||||
unsafe extern "C" fn base_sink_fixate<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_fixate<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
|
@ -641,15 +605,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_unlock<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_unlock<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.unlock(wrap.unsafe_cast_ref()) {
|
match imp.unlock(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -663,15 +624,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>(
|
unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>(
|
||||||
ptr: *mut ffi::GstBaseSink,
|
ptr: *mut ffi::GstBaseSink,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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) => {
|
||||||
|
|
|
@ -580,10 +580,7 @@ impl<T: BaseSrcImpl> BaseSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: BaseSrcImpl> IsSubclassable<T> for BaseSrc
|
unsafe impl<T: BaseSrcImpl> IsSubclassable<T> for BaseSrc {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -613,15 +610,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_start<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_start<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -633,15 +627,14 @@ where
|
||||||
.to_glib()
|
.to_glib()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>(ptr: *mut ffi::GstBaseSrc) -> glib::ffi::gboolean
|
unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>(
|
||||||
where
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
T::Instance: PanicPoison,
|
) -> 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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -655,15 +648,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.is_seekable(wrap.unsafe_cast_ref())
|
imp.is_seekable(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -672,15 +662,12 @@ where
|
||||||
unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
size: *mut u64,
|
size: *mut u64,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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;
|
||||||
|
@ -697,9 +684,7 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
start: *mut gst::ffi::GstClockTime,
|
start: *mut gst::ffi::GstClockTime,
|
||||||
stop: *mut gst::ffi::GstClockTime,
|
stop: *mut gst::ffi::GstClockTime,
|
||||||
) where
|
) {
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
@ -708,7 +693,7 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
|
||||||
*start = gst::ffi::GST_CLOCK_TIME_NONE;
|
*start = gst::ffi::GST_CLOCK_TIME_NONE;
|
||||||
*stop = gst::ffi::GST_CLOCK_TIME_NONE;
|
*stop = gst::ffi::GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::panic_to_error!(&wrap, &imp.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();
|
||||||
|
@ -720,16 +705,13 @@ unsafe extern "C" fn base_src_fill<T: BaseSrcImpl>(
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
|
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
@ -741,10 +723,7 @@ unsafe extern "C" fn base_src_alloc<T: BaseSrcImpl>(
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer_ptr: *mut gst::ffi::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
@ -752,7 +731,7 @@ where
|
||||||
// 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::ffi::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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();
|
||||||
|
@ -769,10 +748,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
|
||||||
offset: u64,
|
offset: u64,
|
||||||
length: u32,
|
length: u32,
|
||||||
buffer_ptr: *mut gst::ffi::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
@ -786,7 +762,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::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.create(
|
match imp.create(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
offset,
|
offset,
|
||||||
|
@ -856,15 +832,12 @@ where
|
||||||
unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
segment: *mut gst::ffi::GstSegment,
|
segment: *mut gst::ffi::GstSegment,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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));
|
||||||
|
@ -877,16 +850,13 @@ where
|
||||||
unsafe extern "C" fn base_src_query<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_query<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
query_ptr: *mut gst::ffi::GstQuery,
|
query_ptr: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -895,15 +865,12 @@ where
|
||||||
unsafe extern "C" fn base_src_event<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_event<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
event_ptr: *mut gst::ffi::GstEvent,
|
event_ptr: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -912,16 +879,13 @@ where
|
||||||
unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
filter: *mut gst::ffi::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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())
|
||||||
|
@ -930,15 +894,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_negotiate<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_negotiate<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -953,16 +914,13 @@ where
|
||||||
unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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) => {
|
||||||
|
@ -977,16 +935,13 @@ where
|
||||||
unsafe extern "C" fn base_src_fixate<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_fixate<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||||
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
imp.fixate(wrap.unsafe_cast_ref(), caps)
|
||||||
})
|
})
|
||||||
.into_ptr()
|
.into_ptr()
|
||||||
|
@ -994,15 +949,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_unlock<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_unlock<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.unlock(wrap.unsafe_cast_ref()) {
|
match imp.unlock(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -1016,15 +968,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>(
|
unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>(
|
||||||
ptr: *mut ffi::GstBaseSrc,
|
ptr: *mut ffi::GstBaseSrc,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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) => {
|
||||||
|
|
|
@ -834,10 +834,7 @@ impl<T: BaseTransformImpl> BaseTransformImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: BaseTransformImpl> IsSubclassable<T> for BaseTransform
|
unsafe impl<T: BaseTransformImpl> IsSubclassable<T> for BaseTransform {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -898,15 +895,12 @@ pub enum PrepareOutputBufferSuccess {
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_start<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_start<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -920,15 +914,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -945,15 +936,12 @@ unsafe extern "C" fn base_transform_transform_caps<T: BaseTransformImpl>(
|
||||||
direction: gst::ffi::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
filter: *mut gst::ffi::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), None, {
|
gst::panic_to_error!(&wrap, &imp.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(
|
||||||
|
@ -972,15 +960,12 @@ unsafe extern "C" fn base_transform_fixate_caps<T: BaseTransformImpl>(
|
||||||
direction: gst::ffi::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
othercaps: *mut gst::ffi::GstCaps,
|
othercaps: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -995,15 +980,12 @@ unsafe extern "C" fn base_transform_set_caps<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
incaps: *mut gst::ffi::GstCaps,
|
incaps: *mut gst::ffi::GstCaps,
|
||||||
outcaps: *mut gst::ffi::GstCaps,
|
outcaps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -1023,15 +1005,12 @@ unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
direction: gst::ffi::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.accept_caps(
|
imp.accept_caps(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
|
@ -1045,15 +1024,12 @@ unsafe extern "C" fn base_transform_query<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
direction: gst::ffi::GstPadDirection,
|
direction: gst::ffi::GstPadDirection,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
BaseTransformImpl::query(
|
BaseTransformImpl::query(
|
||||||
imp,
|
imp,
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
|
@ -1071,15 +1047,12 @@ unsafe extern "C" fn base_transform_transform_size<T: BaseTransformImpl>(
|
||||||
size: usize,
|
size: usize,
|
||||||
othercaps: *mut gst::ffi::GstCaps,
|
othercaps: *mut gst::ffi::GstCaps,
|
||||||
othersize: *mut usize,
|
othersize: *mut usize,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.transform_size(
|
match imp.transform_size(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
from_glib(direction),
|
from_glib(direction),
|
||||||
|
@ -1101,15 +1074,12 @@ unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
caps: *mut gst::ffi::GstCaps,
|
caps: *mut gst::ffi::GstCaps,
|
||||||
size: *mut usize,
|
size: *mut usize,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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;
|
||||||
|
@ -1125,10 +1095,7 @@ unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst::ffi::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
outbuf: *mut gst::ffi::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
@ -1136,7 +1103,7 @@ where
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer;
|
let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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;
|
||||||
|
@ -1155,15 +1122,12 @@ where
|
||||||
unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -1172,15 +1136,12 @@ where
|
||||||
unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -1190,15 +1151,12 @@ unsafe extern "C" fn base_transform_transform<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst::ffi::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
outbuf: *mut gst::ffi::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.transform(
|
imp.transform(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(inbuf),
|
&from_glib_borrow(inbuf),
|
||||||
|
@ -1212,10 +1170,7 @@ where
|
||||||
unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
buf: *mut *mut gst::ffi::GstBuffer,
|
buf: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
@ -1223,7 +1178,7 @@ where
|
||||||
// FIXME: Wrong signature in FFI
|
// FIXME: Wrong signature in FFI
|
||||||
let buf = buf as *mut gst::ffi::GstBuffer;
|
let buf = buf as *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
if from_glib(ffi::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()
|
||||||
|
@ -1240,17 +1195,14 @@ unsafe extern "C" fn base_transform_transform_meta<T: BaseTransformImpl>(
|
||||||
outbuf: *mut gst::ffi::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
meta: *mut gst::ffi::GstMeta,
|
meta: *mut gst::ffi::GstMeta,
|
||||||
inbuf: *mut gst::ffi::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
let inbuf = gst::BufferRef::from_ptr(inbuf);
|
let inbuf = gst::BufferRef::from_ptr(inbuf);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -1265,10 +1217,7 @@ unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst::ffi::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
outbuf: *mut gst::ffi::GstBuffer,
|
outbuf: *mut gst::ffi::GstBuffer,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
@ -1283,7 +1232,7 @@ where
|
||||||
return glib::ffi::GFALSE;
|
return glib::ffi::GFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), true, {
|
gst::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -1302,14 +1251,12 @@ where
|
||||||
unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
inbuf: *mut gst::ffi::GstBuffer,
|
inbuf: *mut gst::ffi::GstBuffer,
|
||||||
) where
|
) {
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), (), {
|
gst::panic_to_error!(&wrap, &imp.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));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1318,15 +1265,12 @@ unsafe extern "C" fn base_transform_submit_input_buffer<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
is_discont: glib::ffi::gboolean,
|
is_discont: glib::ffi::gboolean,
|
||||||
buf: *mut gst::ffi::GstBuffer,
|
buf: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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),
|
||||||
|
@ -1340,17 +1284,14 @@ where
|
||||||
unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
|
unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
|
||||||
ptr: *mut ffi::GstBaseTransform,
|
ptr: *mut ffi::GstBaseTransform,
|
||||||
buf: *mut *mut gst::ffi::GstBuffer,
|
buf: *mut *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<BaseTransform> = from_glib_borrow(ptr);
|
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
*buf = ptr::null_mut();
|
*buf = ptr::null_mut();
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
match imp.generate_output(wrap.unsafe_cast_ref()) {
|
match imp.generate_output(wrap.unsafe_cast_ref()) {
|
||||||
Ok(GenerateOutputSuccess::Dropped) => crate::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,
|
||||||
|
|
|
@ -4,8 +4,6 @@ use glib::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
|
||||||
use gst::subclass::prelude::*;
|
|
||||||
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
use super::base_src::BaseSrcImpl;
|
use super::base_src::BaseSrcImpl;
|
||||||
|
@ -110,10 +108,7 @@ impl<T: PushSrcImpl> PushSrcImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: PushSrcImpl> IsSubclassable<T> for PushSrc
|
unsafe impl<T: PushSrcImpl> IsSubclassable<T> for PushSrc {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<crate::BaseSrc as IsSubclassable<T>>::class_init(klass);
|
<crate::BaseSrc as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -130,16 +125,13 @@ where
|
||||||
unsafe extern "C" fn push_src_fill<T: PushSrcImpl>(
|
unsafe extern "C" fn push_src_fill<T: PushSrcImpl>(
|
||||||
ptr: *mut ffi::GstPushSrc,
|
ptr: *mut ffi::GstPushSrc,
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<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::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -148,10 +140,7 @@ where
|
||||||
unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>(
|
unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>(
|
||||||
ptr: *mut ffi::GstPushSrc,
|
ptr: *mut ffi::GstPushSrc,
|
||||||
buffer_ptr: *mut gst::ffi::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<PushSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
||||||
|
@ -159,7 +148,7 @@ where
|
||||||
// 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::ffi::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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();
|
||||||
|
@ -174,10 +163,7 @@ where
|
||||||
unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
|
unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
|
||||||
ptr: *mut ffi::GstPushSrc,
|
ptr: *mut ffi::GstPushSrc,
|
||||||
buffer_ptr: *mut gst::ffi::GstBuffer,
|
buffer_ptr: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<PushSrc> = from_glib_borrow(ptr);
|
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
|
||||||
|
@ -185,7 +171,7 @@ where
|
||||||
// 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::ffi::GstBuffer;
|
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.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();
|
||||||
|
|
|
@ -532,10 +532,7 @@ impl<T: VideoDecoderImpl> VideoDecoderImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: VideoDecoderImpl> IsSubclassable<T> for VideoDecoder
|
unsafe impl<T: VideoDecoderImpl> IsSubclassable<T> for VideoDecoder {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -566,15 +563,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_open<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_open<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.open(wrap.unsafe_cast_ref()) {
|
match imp.open(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -588,15 +582,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_close<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_close<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.close(wrap.unsafe_cast_ref()) {
|
match imp.close(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -610,15 +601,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_start<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_start<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -632,15 +620,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_stop<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_stop<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -654,15 +639,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_finish<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_finish<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.finish(wrap.unsafe_cast_ref()).into()
|
imp.finish(wrap.unsafe_cast_ref()).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -670,15 +652,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_drain<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_drain<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.drain(wrap.unsafe_cast_ref()).into()
|
imp.drain(wrap.unsafe_cast_ref()).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -687,17 +666,14 @@ where
|
||||||
unsafe extern "C" fn video_decoder_set_format<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_set_format<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
state: *mut ffi::GstVideoCodecState,
|
state: *mut ffi::GstVideoCodecState,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
ffi::gst_video_codec_state_ref(state);
|
ffi::gst_video_codec_state_ref(state);
|
||||||
let wrap_state = VideoCodecState::<Readable>::new(state);
|
let wrap_state = VideoCodecState::<Readable>::new(state);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
|
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -714,10 +690,7 @@ unsafe extern "C" fn video_decoder_parse<T: VideoDecoderImpl>(
|
||||||
frame: *mut ffi::GstVideoCodecFrame,
|
frame: *mut ffi::GstVideoCodecFrame,
|
||||||
adapter: *mut gst_base::ffi::GstAdapter,
|
adapter: *mut gst_base::ffi::GstAdapter,
|
||||||
at_eos: glib::ffi::gboolean,
|
at_eos: glib::ffi::gboolean,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
@ -726,7 +699,7 @@ where
|
||||||
let wrap_adapter: Borrowed<gst_base::Adapter> = from_glib_borrow(adapter);
|
let wrap_adapter: Borrowed<gst_base::Adapter> = from_glib_borrow(adapter);
|
||||||
let at_eos: bool = from_glib(at_eos);
|
let at_eos: bool = from_glib(at_eos);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos)
|
imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos)
|
||||||
.into()
|
.into()
|
||||||
})
|
})
|
||||||
|
@ -736,16 +709,13 @@ where
|
||||||
unsafe extern "C" fn video_decoder_handle_frame<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_handle_frame<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
frame: *mut ffi::GstVideoCodecFrame,
|
frame: *mut ffi::GstVideoCodecFrame,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
|
let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
|
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -753,15 +723,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_flush<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_flush<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref())
|
VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -769,15 +736,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_decoder_negotiate<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_negotiate<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -792,15 +756,12 @@ where
|
||||||
unsafe extern "C" fn video_decoder_getcaps<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_getcaps<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
filter: *mut gst::ffi::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||||
VideoDecoderImpl::get_caps(
|
VideoDecoderImpl::get_caps(
|
||||||
imp,
|
imp,
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
|
@ -815,15 +776,12 @@ where
|
||||||
unsafe extern "C" fn video_decoder_sink_event<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_sink_event<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -832,15 +790,12 @@ where
|
||||||
unsafe extern "C" fn video_decoder_sink_query<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_sink_query<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -849,15 +804,12 @@ where
|
||||||
unsafe extern "C" fn video_decoder_src_event<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_src_event<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -866,15 +818,12 @@ where
|
||||||
unsafe extern "C" fn video_decoder_src_query<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_src_query<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -883,16 +832,13 @@ where
|
||||||
unsafe extern "C" fn video_decoder_propose_allocation<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_propose_allocation<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -907,16 +853,13 @@ where
|
||||||
unsafe extern "C" fn video_decoder_decide_allocation<T: VideoDecoderImpl>(
|
unsafe extern "C" fn video_decoder_decide_allocation<T: VideoDecoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoDecoder,
|
ptr: *mut ffi::GstVideoDecoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoDecoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -466,10 +466,7 @@ impl<T: VideoEncoderImpl> VideoEncoderImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: VideoEncoderImpl> IsSubclassable<T> for VideoEncoder
|
unsafe impl<T: VideoEncoderImpl> IsSubclassable<T> for VideoEncoder {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
<gst::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -498,15 +495,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_encoder_open<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_open<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.open(wrap.unsafe_cast_ref()) {
|
match imp.open(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -520,15 +514,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_encoder_close<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_close<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.close(wrap.unsafe_cast_ref()) {
|
match imp.close(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -542,15 +533,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_encoder_start<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_start<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.start(wrap.unsafe_cast_ref()) {
|
match imp.start(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -564,15 +552,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_encoder_stop<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_stop<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.stop(wrap.unsafe_cast_ref()) {
|
match imp.stop(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -586,15 +571,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_encoder_finish<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_finish<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.finish(wrap.unsafe_cast_ref()).into()
|
imp.finish(wrap.unsafe_cast_ref()).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -603,17 +585,14 @@ where
|
||||||
unsafe extern "C" fn video_encoder_set_format<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_set_format<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
state: *mut ffi::GstVideoCodecState,
|
state: *mut ffi::GstVideoCodecState,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
ffi::gst_video_codec_state_ref(state);
|
ffi::gst_video_codec_state_ref(state);
|
||||||
let wrap_state = VideoCodecState::<Readable>::new(state);
|
let wrap_state = VideoCodecState::<Readable>::new(state);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
|
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -628,16 +607,13 @@ where
|
||||||
unsafe extern "C" fn video_encoder_handle_frame<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_handle_frame<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
frame: *mut ffi::GstVideoCodecFrame,
|
frame: *mut ffi::GstVideoCodecFrame,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
|
let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::FlowReturn::Error, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
|
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -645,15 +621,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_encoder_flush<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_flush<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
|
VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -661,15 +634,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn video_encoder_negotiate<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_negotiate<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
match imp.negotiate(wrap.unsafe_cast_ref()) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -684,15 +654,12 @@ where
|
||||||
unsafe extern "C" fn video_encoder_getcaps<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_getcaps<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
filter: *mut gst::ffi::GstCaps,
|
filter: *mut gst::ffi::GstCaps,
|
||||||
) -> *mut gst::ffi::GstCaps
|
) -> *mut gst::ffi::GstCaps {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), gst::Caps::new_empty(), {
|
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), {
|
||||||
VideoEncoderImpl::get_caps(
|
VideoEncoderImpl::get_caps(
|
||||||
imp,
|
imp,
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
|
@ -707,15 +674,12 @@ where
|
||||||
unsafe extern "C" fn video_encoder_sink_event<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_sink_event<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -724,15 +688,12 @@ where
|
||||||
unsafe extern "C" fn video_encoder_sink_query<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_sink_query<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -741,15 +702,12 @@ where
|
||||||
unsafe extern "C" fn video_encoder_src_event<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_src_event<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
event: *mut gst::ffi::GstEvent,
|
event: *mut gst::ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -758,15 +716,12 @@ where
|
||||||
unsafe extern "C" fn video_encoder_src_query<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_src_query<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.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()
|
||||||
|
@ -775,16 +730,13 @@ where
|
||||||
unsafe extern "C" fn video_encoder_propose_allocation<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_propose_allocation<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -799,16 +751,13 @@ where
|
||||||
unsafe extern "C" fn video_encoder_decide_allocation<T: VideoEncoderImpl>(
|
unsafe extern "C" fn video_encoder_decide_allocation<T: VideoEncoderImpl>(
|
||||||
ptr: *mut ffi::GstVideoEncoder,
|
ptr: *mut ffi::GstVideoEncoder,
|
||||||
query: *mut gst::ffi::GstQuery,
|
query: *mut gst::ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoEncoder> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
|
||||||
let query = gst::QueryRef::from_mut_ptr(query);
|
let query = gst::QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
gst::panic_to_error!(&wrap, &instance.panicked(), false, {
|
gst::panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|
|
@ -50,10 +50,7 @@ impl<T: VideoSinkImpl> VideoSinkImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: VideoSinkImpl> IsSubclassable<T> for VideoSink
|
unsafe impl<T: VideoSinkImpl> IsSubclassable<T> for VideoSink {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<gst_base::BaseSink as IsSubclassable<T>>::class_init(klass);
|
<gst_base::BaseSink as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -68,16 +65,13 @@ where
|
||||||
unsafe extern "C" fn video_sink_show_frame<T: VideoSinkImpl>(
|
unsafe extern "C" fn video_sink_show_frame<T: VideoSinkImpl>(
|
||||||
ptr: *mut ffi::GstVideoSink,
|
ptr: *mut ffi::GstVideoSink,
|
||||||
buffer: *mut gst::ffi::GstBuffer,
|
buffer: *mut gst::ffi::GstBuffer,
|
||||||
) -> gst::ffi::GstFlowReturn
|
) -> gst::ffi::GstFlowReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<VideoSink> = from_glib_borrow(ptr);
|
let wrap: Borrowed<VideoSink> = 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::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, {
|
||||||
imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into()
|
imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
|
|
@ -98,10 +98,7 @@ impl<T: BinImpl> BinImplExt for T {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: BinImpl> IsSubclassable<T> for Bin
|
unsafe impl<T: BinImpl> IsSubclassable<T> for Bin {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<crate::Element as IsSubclassable<T>>::class_init(klass);
|
<crate::Element as IsSubclassable<T>>::class_init(klass);
|
||||||
let klass = klass.as_mut();
|
let klass = klass.as_mut();
|
||||||
|
@ -118,15 +115,12 @@ where
|
||||||
unsafe extern "C" fn bin_add_element<T: BinImpl>(
|
unsafe extern "C" fn bin_add_element<T: BinImpl>(
|
||||||
ptr: *mut ffi::GstBin,
|
ptr: *mut ffi::GstBin,
|
||||||
element: *mut ffi::GstElement,
|
element: *mut ffi::GstElement,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Bin> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Bin> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), false, {
|
panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.add_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
|
match imp.add_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -141,10 +135,7 @@ where
|
||||||
unsafe extern "C" fn bin_remove_element<T: BinImpl>(
|
unsafe extern "C" fn bin_remove_element<T: BinImpl>(
|
||||||
ptr: *mut ffi::GstBin,
|
ptr: *mut ffi::GstBin,
|
||||||
element: *mut ffi::GstElement,
|
element: *mut ffi::GstElement,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Bin> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Bin> = from_glib_borrow(ptr);
|
||||||
|
@ -158,7 +149,7 @@ where
|
||||||
return glib::ffi::GFALSE;
|
return glib::ffi::GFALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), false, {
|
panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
match imp.remove_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
|
match imp.remove_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
|
||||||
Ok(()) => true,
|
Ok(()) => true,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -173,14 +164,12 @@ where
|
||||||
unsafe extern "C" fn bin_handle_message<T: BinImpl>(
|
unsafe extern "C" fn bin_handle_message<T: BinImpl>(
|
||||||
ptr: *mut ffi::GstBin,
|
ptr: *mut ffi::GstBin,
|
||||||
message: *mut ffi::GstMessage,
|
message: *mut ffi::GstMessage,
|
||||||
) where
|
) {
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Bin> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Bin> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), (), {
|
panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||||
imp.handle_message(wrap.unsafe_cast_ref(), from_glib_full(message))
|
imp.handle_message(wrap.unsafe_cast_ref(), from_glib_full(message))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
// Take a look at the license at the top of the repository in the LICENSE file.
|
// Take a look at the license at the top of the repository in the LICENSE file.
|
||||||
|
|
||||||
use super::prelude::*;
|
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
use glib::subclass::prelude::*;
|
use glib::subclass::prelude::*;
|
||||||
use glib::translate::*;
|
use glib::translate::*;
|
||||||
|
@ -14,6 +13,8 @@ use crate::StateChangeError;
|
||||||
use crate::StateChangeReturn;
|
use crate::StateChangeReturn;
|
||||||
use crate::StateChangeSuccess;
|
use crate::StateChangeSuccess;
|
||||||
|
|
||||||
|
use std::sync::atomic;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ElementMetadata {
|
pub struct ElementMetadata {
|
||||||
long_name: String,
|
long_name: String,
|
||||||
|
@ -140,6 +141,8 @@ pub trait ElementImplExt: ObjectSubclass {
|
||||||
|
|
||||||
fn parent_post_message(&self, element: &Self::Type, msg: crate::Message) -> bool;
|
fn parent_post_message(&self, element: &Self::Type, msg: crate::Message) -> bool;
|
||||||
|
|
||||||
|
fn panicked(&self) -> &atomic::AtomicBool;
|
||||||
|
|
||||||
fn catch_panic<R, F: FnOnce(&Self) -> R, G: FnOnce() -> R, P: IsA<Element>>(
|
fn catch_panic<R, F: FnOnce(&Self) -> R, G: FnOnce() -> R, P: IsA<Element>>(
|
||||||
&self,
|
&self,
|
||||||
element: &P,
|
element: &P,
|
||||||
|
@ -154,10 +157,7 @@ pub trait ElementImplExt: ObjectSubclass {
|
||||||
) -> R;
|
) -> R;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: ElementImpl> ElementImplExt for T
|
impl<T: ElementImpl> ElementImplExt for T {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn parent_change_state(
|
fn parent_change_state(
|
||||||
&self,
|
&self,
|
||||||
element: &Self::Type,
|
element: &Self::Type,
|
||||||
|
@ -316,6 +316,11 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn panicked(&self) -> &atomic::AtomicBool {
|
||||||
|
self.get_instance_data::<atomic::AtomicBool>(crate::Element::static_type())
|
||||||
|
.expect("instance not initialized correctly")
|
||||||
|
}
|
||||||
|
|
||||||
fn catch_panic<R, F: FnOnce(&Self) -> R, G: FnOnce() -> R, P: IsA<Element>>(
|
fn catch_panic<R, F: FnOnce(&Self) -> R, G: FnOnce() -> R, P: IsA<Element>>(
|
||||||
&self,
|
&self,
|
||||||
element: &P,
|
element: &P,
|
||||||
|
@ -328,7 +333,7 @@ where
|
||||||
let instance = &*(ptr as *mut T::Instance);
|
let instance = &*(ptr as *mut T::Instance);
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
|
|
||||||
panic_to_error!(element, &instance.panicked(), fallback(), { f(&imp) })
|
panic_to_error!(element, &imp.panicked(), fallback(), { f(&imp) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,17 +349,14 @@ where
|
||||||
let instance = &*(ptr as *mut T::Instance);
|
let instance = &*(ptr as *mut T::Instance);
|
||||||
let imp = instance.get_impl();
|
let imp = instance.get_impl();
|
||||||
|
|
||||||
panic_to_error!(wrap, &instance.panicked(), fallback(), {
|
panic_to_error!(wrap, &imp.panicked(), fallback(), {
|
||||||
f(&imp, wrap.unsafe_cast_ref())
|
f(&imp, wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T: ElementImpl> IsSubclassable<T> for Element
|
unsafe impl<T: ElementImpl> IsSubclassable<T> for Element {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<glib::Object as IsSubclassable<T>>::class_init(klass);
|
<glib::Object as IsSubclassable<T>>::class_init(klass);
|
||||||
|
|
||||||
|
@ -396,16 +398,18 @@ where
|
||||||
|
|
||||||
fn instance_init(instance: &mut glib::subclass::InitializingObject<T>) {
|
fn instance_init(instance: &mut glib::subclass::InitializingObject<T>) {
|
||||||
<glib::Object as IsSubclassable<T>>::instance_init(instance);
|
<glib::Object as IsSubclassable<T>>::instance_init(instance);
|
||||||
|
|
||||||
|
instance.set_instance_data(
|
||||||
|
crate::Element::static_type(),
|
||||||
|
atomic::AtomicBool::new(false),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "C" fn element_change_state<T: ElementImpl>(
|
unsafe extern "C" fn element_change_state<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
transition: ffi::GstStateChange,
|
transition: ffi::GstStateChange,
|
||||||
) -> ffi::GstStateChangeReturn
|
) -> ffi::GstStateChangeReturn {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
@ -420,7 +424,7 @@ where
|
||||||
_ => StateChangeReturn::Failure,
|
_ => StateChangeReturn::Failure,
|
||||||
};
|
};
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), fallback, {
|
panic_to_error!(&wrap, &imp.panicked(), fallback, {
|
||||||
imp.change_state(wrap.unsafe_cast_ref(), transition).into()
|
imp.change_state(wrap.unsafe_cast_ref(), transition).into()
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -431,10 +435,7 @@ unsafe extern "C" fn element_request_new_pad<T: ElementImpl>(
|
||||||
templ: *mut ffi::GstPadTemplate,
|
templ: *mut ffi::GstPadTemplate,
|
||||||
name: *const libc::c_char,
|
name: *const libc::c_char,
|
||||||
caps: *const ffi::GstCaps,
|
caps: *const ffi::GstCaps,
|
||||||
) -> *mut ffi::GstPad
|
) -> *mut ffi::GstPad {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
@ -443,7 +444,7 @@ where
|
||||||
|
|
||||||
// XXX: This is effectively unsafe but the best we can do
|
// XXX: This is effectively unsafe but the best we can do
|
||||||
// See https://bugzilla.gnome.org/show_bug.cgi?id=791193
|
// See https://bugzilla.gnome.org/show_bug.cgi?id=791193
|
||||||
let pad = panic_to_error!(&wrap, &instance.panicked(), None, {
|
let pad = panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||||
imp.request_new_pad(
|
imp.request_new_pad(
|
||||||
wrap.unsafe_cast_ref(),
|
wrap.unsafe_cast_ref(),
|
||||||
&from_glib_borrow(templ),
|
&from_glib_borrow(templ),
|
||||||
|
@ -468,9 +469,7 @@ where
|
||||||
unsafe extern "C" fn element_release_pad<T: ElementImpl>(
|
unsafe extern "C" fn element_release_pad<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
pad: *mut ffi::GstPad,
|
pad: *mut ffi::GstPad,
|
||||||
) where
|
) {
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
@ -483,7 +482,7 @@ unsafe extern "C" fn element_release_pad<T: ElementImpl>(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), (), {
|
panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||||
imp.release_pad(wrap.unsafe_cast_ref(), &from_glib_none(pad))
|
imp.release_pad(wrap.unsafe_cast_ref(), &from_glib_none(pad))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -491,15 +490,12 @@ unsafe extern "C" fn element_release_pad<T: ElementImpl>(
|
||||||
unsafe extern "C" fn element_send_event<T: ElementImpl>(
|
unsafe extern "C" fn element_send_event<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
event: *mut ffi::GstEvent,
|
event: *mut ffi::GstEvent,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), false, {
|
panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event))
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -508,16 +504,13 @@ where
|
||||||
unsafe extern "C" fn element_query<T: ElementImpl>(
|
unsafe extern "C" fn element_query<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
query: *mut ffi::GstQuery,
|
query: *mut ffi::GstQuery,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
let query = QueryRef::from_mut_ptr(query);
|
let query = QueryRef::from_mut_ptr(query);
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), false, {
|
panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.query(wrap.unsafe_cast_ref(), query)
|
imp.query(wrap.unsafe_cast_ref(), query)
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -526,14 +519,12 @@ where
|
||||||
unsafe extern "C" fn element_set_context<T: ElementImpl>(
|
unsafe extern "C" fn element_set_context<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
context: *mut ffi::GstContext,
|
context: *mut ffi::GstContext,
|
||||||
) where
|
) {
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), (), {
|
panic_to_error!(&wrap, &imp.panicked(), (), {
|
||||||
imp.set_context(wrap.unsafe_cast_ref(), &from_glib_borrow(context))
|
imp.set_context(wrap.unsafe_cast_ref(), &from_glib_borrow(context))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -541,17 +532,14 @@ unsafe extern "C" fn element_set_context<T: ElementImpl>(
|
||||||
unsafe extern "C" fn element_set_clock<T: ElementImpl>(
|
unsafe extern "C" fn element_set_clock<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
clock: *mut ffi::GstClock,
|
clock: *mut ffi::GstClock,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
let clock = Option::<crate::Clock>::from_glib_borrow(clock);
|
let clock = Option::<crate::Clock>::from_glib_borrow(clock);
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), false, {
|
panic_to_error!(&wrap, &imp.panicked(), false, {
|
||||||
imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref())
|
imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref())
|
||||||
})
|
})
|
||||||
.to_glib()
|
.to_glib()
|
||||||
|
@ -559,15 +547,12 @@ where
|
||||||
|
|
||||||
unsafe extern "C" fn element_provide_clock<T: ElementImpl>(
|
unsafe extern "C" fn element_provide_clock<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
) -> *mut ffi::GstClock
|
) -> *mut ffi::GstClock {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
|
||||||
panic_to_error!(&wrap, &instance.panicked(), None, {
|
panic_to_error!(&wrap, &imp.panicked(), None, {
|
||||||
imp.provide_clock(wrap.unsafe_cast_ref())
|
imp.provide_clock(wrap.unsafe_cast_ref())
|
||||||
})
|
})
|
||||||
.to_glib_full()
|
.to_glib_full()
|
||||||
|
@ -576,10 +561,7 @@ where
|
||||||
unsafe extern "C" fn element_post_message<T: ElementImpl>(
|
unsafe extern "C" fn element_post_message<T: ElementImpl>(
|
||||||
ptr: *mut ffi::GstElement,
|
ptr: *mut ffi::GstElement,
|
||||||
msg: *mut ffi::GstMessage,
|
msg: *mut ffi::GstMessage,
|
||||||
) -> glib::ffi::gboolean
|
) -> glib::ffi::gboolean {
|
||||||
where
|
|
||||||
T::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
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<Element> = from_glib_borrow(ptr);
|
let wrap: Borrowed<Element> = from_glib_borrow(ptr);
|
||||||
|
@ -660,7 +642,6 @@ mod tests {
|
||||||
const NAME: &'static str = "TestElement";
|
const NAME: &'static str = "TestElement";
|
||||||
type Type = super::TestElement;
|
type Type = super::TestElement;
|
||||||
type ParentType = Element;
|
type ParentType = Element;
|
||||||
type Instance = crate::subclass::ElementInstanceStruct<Self>;
|
|
||||||
|
|
||||||
fn with_class(klass: &Self::Class) -> Self {
|
fn with_class(klass: &Self::Class) -> Self {
|
||||||
let templ = klass.get_pad_template("sink").unwrap();
|
let templ = klass.get_pad_template("sink").unwrap();
|
||||||
|
|
|
@ -55,28 +55,4 @@ pub mod prelude {
|
||||||
pub use super::system_clock::SystemClockImpl;
|
pub use super::system_clock::SystemClockImpl;
|
||||||
pub use super::tag_setter::TagSetterImpl;
|
pub use super::tag_setter::TagSetterImpl;
|
||||||
pub use super::uri_handler::URIHandlerImpl;
|
pub use super::uri_handler::URIHandlerImpl;
|
||||||
pub use super::PanicPoison;
|
|
||||||
}
|
|
||||||
|
|
||||||
use self::prelude::*;
|
|
||||||
use std::sync::atomic::AtomicBool;
|
|
||||||
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct ElementInstanceStruct<T: ObjectSubclass> {
|
|
||||||
parent: <T::ParentType as glib::object::ObjectType>::GlibType,
|
|
||||||
panicked: AtomicBool,
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl<T: ObjectSubclass> InstanceStruct for ElementInstanceStruct<T> {
|
|
||||||
type Type = T;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait PanicPoison {
|
|
||||||
fn panicked(&self) -> &AtomicBool;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T: ObjectSubclass> PanicPoison for ElementInstanceStruct<T> {
|
|
||||||
fn panicked(&self) -> &AtomicBool {
|
|
||||||
&self.panicked
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,7 @@ use crate::Pipeline;
|
||||||
|
|
||||||
pub trait PipelineImpl: BinImpl {}
|
pub trait PipelineImpl: BinImpl {}
|
||||||
|
|
||||||
unsafe impl<T: PipelineImpl> IsSubclassable<T> for Pipeline
|
unsafe impl<T: PipelineImpl> IsSubclassable<T> for Pipeline {
|
||||||
where
|
|
||||||
<T as ObjectSubclass>::Instance: PanicPoison,
|
|
||||||
{
|
|
||||||
fn class_init(klass: &mut glib::Class<Self>) {
|
fn class_init(klass: &mut glib::Class<Self>) {
|
||||||
<crate::Bin as IsSubclassable<T>>::class_init(klass);
|
<crate::Bin as IsSubclassable<T>>::class_init(klass);
|
||||||
let _klass = klass.as_mut();
|
let _klass = klass.as_mut();
|
||||||
|
|
Loading…
Reference in a new issue