1#[cfg(not(feature = "v1_26"))]
4use {crate::value::GstValueExt, std::str::FromStr};
5
6use glib::{prelude::*, subclass::prelude::*, translate::*};
7
8use super::prelude::*;
9use crate::{
10 ffi, Bin, Buffer, BufferList, Element, Event, FlowError, FlowSuccess, Message, MiniObject,
11 Object, Pad, PadLinkError, PadLinkSuccess, QueryRef, StateChange, StateChangeError,
12 StateChangeSuccess, Tracer,
13};
14
15#[allow(unused_variables)]
16pub trait TracerImpl: GstObjectImpl + ObjectSubclass<Type: IsA<Tracer>> {
17 const USE_STRUCTURE_PARAMS: bool = false;
21
22 fn bin_add_post(&self, ts: u64, bin: &Bin, element: &Element, success: bool) {}
23 fn bin_add_pre(&self, ts: u64, bin: &Bin, element: &Element) {}
24 fn bin_remove_post(&self, ts: u64, bin: &Bin, success: bool) {}
25 fn bin_remove_pre(&self, ts: u64, bin: &Bin, element: &Element) {}
26 fn element_new(&self, ts: u64, element: &Element) {}
27 fn element_add_pad(&self, ts: u64, element: &Element, pad: &Pad) {}
28 fn element_remove_pad(&self, ts: u64, element: &Element, pad: &Pad) {}
29 fn element_change_state_post(
30 &self,
31 ts: u64,
32 element: &Element,
33 change: StateChange,
34 result: Result<StateChangeSuccess, StateChangeError>,
35 ) {
36 }
37 fn element_change_state_pre(&self, ts: u64, element: &Element, change: StateChange) {}
38 fn element_post_message_post(&self, ts: u64, element: &Element, success: bool) {}
39 fn element_post_message_pre(&self, ts: u64, element: &Element, message: &Message) {}
40 fn element_query_post(&self, ts: u64, element: &Element, query: &QueryRef, success: bool) {}
41 fn element_query_pre(&self, ts: u64, element: &Element, query: &QueryRef) {}
42 fn mini_object_created(&self, ts: u64, object: std::ptr::NonNull<ffi::GstMiniObject>) {}
45 fn mini_object_destroyed(&self, ts: u64, object: std::ptr::NonNull<ffi::GstMiniObject>) {}
48 fn mini_object_reffed(&self, ts: u64, object: &MiniObject, new_refcount: i32) {}
49 fn mini_object_unreffed(&self, ts: u64, object: &MiniObject, new_refcount: i32) {}
50 fn object_created(&self, ts: u64, object: &Object) {}
51 fn object_destroyed(&self, ts: u64, object: std::ptr::NonNull<ffi::GstObject>) {}
54 fn object_reffed(&self, ts: u64, object: &Object, new_refcount: i32) {}
55 fn object_unreffed(&self, ts: u64, object: &Object, new_refcount: i32) {}
56 fn pad_link_post(
57 &self,
58 ts: u64,
59 src: &Pad,
60 sink: &Pad,
61 result: Result<PadLinkSuccess, PadLinkError>,
62 ) {
63 }
64 fn pad_link_pre(&self, ts: u64, src: &Pad, sink: &Pad) {}
65 fn pad_pull_range_post(&self, ts: u64, pad: &Pad, result: Result<&Buffer, FlowError>) {}
66 fn pad_pull_range_pre(&self, ts: u64, pad: &Pad, offset: u64, size: u32) {}
67 fn pad_push_event_post(&self, ts: u64, pad: &Pad, success: bool) {}
68 fn pad_push_event_pre(&self, ts: u64, pad: &Pad, event: &Event) {}
69 #[cfg(feature = "v1_22")]
70 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
71 fn pad_chain_list_post(&self, ts: u64, pad: &Pad, result: Result<FlowSuccess, FlowError>) {}
72 #[cfg(feature = "v1_22")]
73 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
74 fn pad_chain_list_pre(&self, ts: u64, pad: &Pad, buffer_list: &BufferList) {}
75 #[cfg(feature = "v1_22")]
76 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
77 fn pad_chain_post(&self, ts: u64, pad: &Pad, result: Result<FlowSuccess, FlowError>) {}
78 #[cfg(feature = "v1_22")]
79 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
80 fn pad_chain_pre(&self, ts: u64, pad: &Pad, buffer: &Buffer) {}
81 fn pad_push_list_post(&self, ts: u64, pad: &Pad, result: Result<FlowSuccess, FlowError>) {}
82 fn pad_push_list_pre(&self, ts: u64, pad: &Pad, buffer_list: &BufferList) {}
83 fn pad_push_post(&self, ts: u64, pad: &Pad, result: Result<FlowSuccess, FlowError>) {}
84 fn pad_push_pre(&self, ts: u64, pad: &Pad, buffer: &Buffer) {}
85 fn pad_query_post(&self, ts: u64, pad: &Pad, query: &QueryRef, success: bool) {}
86 fn pad_query_pre(&self, ts: u64, pad: &Pad, query: &QueryRef) {}
87 fn pad_unlink_post(&self, ts: u64, src: &Pad, sink: &Pad, success: bool) {}
88 fn pad_unlink_pre(&self, ts: u64, src: &Pad, sink: &Pad) {}
89 #[cfg(feature = "v1_20")]
90 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
91 fn plugin_feature_loaded(&self, ts: u64, feature: &crate::PluginFeature) {}
92 #[cfg(feature = "v1_26")]
93 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
94 fn memory_init(&self, ts: u64, mem: &crate::MemoryRefTrace) {}
95 #[cfg(feature = "v1_26")]
96 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
97 fn memory_free_pre(&self, ts: u64, mem: &crate::MemoryRef) {}
98 #[cfg(feature = "v1_26")]
99 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
100 fn memory_free_post(&self, ts: u64, mem: std::ptr::NonNull<ffi::GstMemory>) {}
101
102 #[cfg(feature = "v1_28")]
103 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
104 fn pool_buffer_queued(&self, ts: u64, pool: &crate::BufferPool, buffer: &Buffer) {}
105 #[cfg(feature = "v1_28")]
106 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
107 fn pool_buffer_dequeued(&self, ts: u64, pool: &crate::BufferPool, buffer: &Buffer) {}
108}
109
110#[cfg(not(feature = "v1_26"))]
111fn format_available_properties(class: &glib::object::ObjectClass) -> String {
112 class
113 .list_properties()
114 .iter()
115 .filter(|p| {
116 p.flags().contains(glib::ParamFlags::WRITABLE)
117 && p.name() != "parent"
118 && p.name() != "params"
119 })
120 .map(|p| format!(" {}: {}", p.name(), p.blurb().map_or("", |b| b)))
121 .collect::<Vec<_>>()
122 .join("\n")
123}
124
125#[cfg(not(feature = "v1_26"))]
126fn emit_property_warning(obj: &glib::Object, msg: &str) {
127 let props = format_available_properties(obj.class());
128 glib::g_warning!("gsttracer", "{}\nAvailable properties:\n{}", msg, props);
129}
130
131unsafe impl<T: TracerImpl> IsSubclassable<T> for Tracer {
132 fn class_init(class: &mut glib::Class<Self>) {
133 Self::parent_class_init::<T>(class);
134
135 #[cfg(feature = "v1_26")]
136 {
137 let class = class.as_mut();
138 unsafe {
139 ffi::gst_tracer_class_set_use_structure_params(
140 class,
141 T::USE_STRUCTURE_PARAMS.into_glib(),
142 );
143 }
144 }
145 #[cfg(not(feature = "v1_26"))]
146 unsafe {
147 if T::USE_STRUCTURE_PARAMS {
148 use std::sync::OnceLock;
149 static TRACER_CONSTRUCTED_FUNC: OnceLock<
150 unsafe extern "C" fn(*mut glib::gobject_ffi::GObject),
151 > = OnceLock::new();
152
153 let class =
154 &mut *(class.as_mut() as *mut _ as *mut glib::gobject_ffi::GObjectClass);
155 TRACER_CONSTRUCTED_FUNC.get_or_init(|| class.constructed.unwrap());
156 unsafe extern "C" fn constructed(objptr: *mut glib::gobject_ffi::GObject) {
157 let obj = glib::Object::from_glib_borrow(objptr);
158 let params = obj.property::<Option<String>>("params");
159
160 let Some(params) = params else {
161 TRACER_CONSTRUCTED_FUNC.get().unwrap()(objptr);
162
163 return;
164 };
165
166 if params.is_empty() {
167 TRACER_CONSTRUCTED_FUNC.get().unwrap()(objptr);
168
169 return;
170 }
171
172 let s = match crate::Structure::from_str(&format!("tracer-settings,{}", params))
173 {
174 Ok(s) => s,
175 Err(err) => {
176 emit_property_warning(
177 &obj,
178 &format!(
179 "Can't setup tracer {err:?}: invalid parameters '{params}'"
180 ),
181 );
182 return;
183 }
184 };
185
186 let class = obj.class();
187
188 for (field, field_value) in s.iter() {
189 let pspec = match class.find_property(field.as_str()) {
190 Some(p) => p,
191 None => {
192 emit_property_warning(
193 &obj,
194 &format!(
195 "Can't setup tracer: property '{}' not found",
196 field.as_str()
197 ),
198 );
199 return;
200 }
201 };
202
203 let value = if field_value.type_() == pspec.value_type() {
204 field_value.to_value()
205 } else if field_value.type_() == glib::types::Type::STRING {
206 let str_val = field_value.get::<String>().unwrap();
207 #[cfg(feature = "v1_20")]
208 {
209 match glib::Value::deserialize_with_pspec(&str_val, &pspec) {
210 Ok(v) => v,
211 Err(_) => {
212 emit_property_warning(&obj, &format!("Can't instantiate tracer: invalid property '{}' value: '{}'", field.as_str(), str_val));
213 return;
214 }
215 }
216 }
217 #[cfg(not(feature = "v1_20"))]
218 {
219 match glib::Value::deserialize(&str_val, pspec.value_type()) {
220 Ok(v) => v,
221 Err(_) => {
222 emit_property_warning(&obj, &format!("Can't instantiate tracer: invalid property '{}' value: '{}'", field.as_str(), str_val));
223 return;
224 }
225 }
226 }
227 } else {
228 emit_property_warning(&obj, &format!(
229 "Can't setup tracer: property '{}' type mismatch, expected {}, got {}",
230 field.as_str(),
231 pspec.value_type().name(),
232 field_value.type_().name()
233 ));
234 return;
235 };
236
237 crate::debug!(crate::CAT_RUST, "Setting property {field:?}");
238 obj.set_property(field.as_str(), &value);
239 }
240
241 TRACER_CONSTRUCTED_FUNC.get().unwrap()(objptr);
242 }
243
244 class.constructed = Some(constructed);
245 }
246 }
247 }
248}
249
250pub trait TracerImplExt: TracerImpl {
251 fn register_hook(&self, hook: TracerHook);
256}
257
258macro_rules! define_tracer_hooks {
259 ($($(#[$attr:meta])* $name: ident($quark: literal) = |$this: ident, $ts: ident, $($cb_arg: ident: $cb_arg_ty: ty),*| $impl: block;)*) => {
260 pub enum TracerHook {
261 $($(#[$attr])* $name),*
262 }
263 impl<T: TracerImpl> TracerImplExt for T {
264 fn register_hook(&self, hook: TracerHook) {
265 use TracerHook::*;
266 let (hook_type, callback) = match hook {
267 $($(#[$attr])* $name => {
268 #[allow(non_snake_case)]
269 unsafe extern "C" fn callback<T: TracerImpl>(
270 $this: *mut ffi::GstTracer,
271 $ts: u64,
272 $($cb_arg: $cb_arg_ty),*
273 ) {
274 let $this = Tracer::from_glib_borrow($this);
275 let $this = T::from_obj($this.unsafe_cast_ref());
276 $impl
277 }
278 (
279 concat!($quark, "\0"),
280 callback::<T> as unsafe extern "C" fn(_, _, $($cb_arg_ty),*) as *const ()
281 )
282 },)*
283 };
284 unsafe {
285 let instance = self.obj();
286 ffi::gst_tracing_register_hook(
287 instance.to_glib_none().0 as *mut ffi::GstTracer,
288 hook_type.as_ptr() as *const _,
289 Some(std::mem::transmute::<*const (), extern "C" fn()>(callback)),
290 );
291 }
292 }
293 }
294 };
295}
296
297define_tracer_hooks! {
298 BinAddPost("bin-add-post") = |this, ts, b: *mut ffi::GstBin, e: *mut ffi::GstElement, r: glib::ffi::gboolean| {
299 let b = Bin::from_glib_borrow(b);
300 let e = Element::from_glib_borrow(e);
301 this.bin_add_post(ts, &b, &e, bool::from_glib(r))
302 };
303 BinAddPre("bin-add-pre") = |this, ts, b: *mut ffi::GstBin, e: *mut ffi::GstElement| {
304 let b = Bin::from_glib_borrow(b);
305 let e = Element::from_glib_borrow(e);
306 this.bin_add_pre(ts, &b, &e)
307 };
308 BinRemovePost("bin-remove-post") = |this, ts, b: *mut ffi::GstBin, r: glib::ffi::gboolean| {
309 let b = Bin::from_glib_borrow(b);
310 this.bin_remove_post(ts, &b, bool::from_glib(r))
311 };
312 BinRemovePre("bin-remove-pre") = |this, ts, b: *mut ffi::GstBin, e: *mut ffi::GstElement| {
313 let b = Bin::from_glib_borrow(b);
314 let e = Element::from_glib_borrow(e);
315 this.bin_remove_pre(ts, &b, &e)
316 };
317 ElementNew("element-new") = |this, ts, e: *mut ffi::GstElement| {
318 let e = Element::from_glib_borrow(e);
319 this.element_new(ts, &e)
320 };
321 ElementAddPad("element-add-pad") = |this, ts, e: *mut ffi::GstElement, p: *mut ffi::GstPad| {
322 let e = Element::from_glib_borrow(e);
323 let p = Pad::from_glib_borrow(p);
324 this.element_add_pad(ts, &e, &p)
325 };
326 ElementRemovePad("element-remove-pad") = |this, ts, e: *mut ffi::GstElement, p: *mut ffi::GstPad| {
327 let e = Element::from_glib_borrow(e);
328 let p = Pad::from_glib_borrow(p);
329 this.element_remove_pad(ts, &e, &p)
330 };
331 ElementChangeStatePost("element-change-state-post") = |this, ts, e: *mut ffi::GstElement, c: ffi::GstStateChange, r: ffi::GstStateChangeReturn| {
332 let e = Element::from_glib_borrow(e);
333 this.element_change_state_post(ts, &e, StateChange::from_glib(c), try_from_glib(r))
334 };
335 ElementChangeStatePre("element-change-state-pre") = |this, ts, e: *mut ffi::GstElement, c: ffi::GstStateChange| {
336 let e = Element::from_glib_borrow(e);
337 this.element_change_state_pre(ts, &e, StateChange::from_glib(c))
338 };
339 ElementPostMessagePost("element-post-message-post") = |this, ts, e: *mut ffi::GstElement, r: glib::ffi::gboolean| {
340 let e = Element::from_glib_borrow(e);
341 this.element_post_message_post(ts, &e, bool::from_glib(r))
342 };
343 ElementPostMessagePre("element-post-message-pre") = |this, ts, e: *mut ffi::GstElement, m: *mut ffi::GstMessage| {
344 let e = Element::from_glib_borrow(e);
345 let m = Message::from_glib_borrow(m);
346 this.element_post_message_pre(ts, &e, &m)
347 };
348 ElementQueryPost("element-query-post") = |this, ts, e: *mut ffi::GstElement, q: *mut ffi::GstQuery, r: glib::ffi::gboolean| {
349 let e = Element::from_glib_borrow(e);
350 let q = QueryRef::from_ptr(q);
351 this.element_query_post(ts, &e, q, bool::from_glib(r))
352 };
353 ElementQueryPre("element-query-pre") = |this, ts, e: *mut ffi::GstElement, q: *mut ffi::GstQuery| {
354 let e = Element::from_glib_borrow(e);
355 let q = QueryRef::from_ptr(q);
356 this.element_query_pre(ts, &e, q)
357 };
358 MiniObjectCreated("mini-object-created") = |this, ts, o: *mut ffi::GstMiniObject| {
360 this.mini_object_created(ts, std::ptr::NonNull::new_unchecked(o))
361 };
362 MiniObjectDestroyed("mini-object-destroyed") = |this, ts, o: *mut ffi::GstMiniObject| {
364 this.mini_object_destroyed(ts, std::ptr::NonNull::new_unchecked(o))
365 };
366 MiniObjectReffed("mini-object-reffed") = |this, ts, o: *mut ffi::GstMiniObject, rc: libc::c_int| {
367 let o = MiniObject::from_glib_borrow(o);
368 this.mini_object_reffed(ts, &o, rc)
369 };
370 MiniObjectUnreffed("mini-object-unreffed") = |this, ts, o: *mut ffi::GstMiniObject, rc: libc::c_int| {
371 let o = MiniObject::from_glib_borrow(o);
372 this.mini_object_unreffed(ts, &o, rc)
373 };
374 ObjectCreated("object-created") = |this, ts, o: *mut ffi::GstObject| {
375 let o = Object::from_glib_borrow(o);
376 this.object_created(ts, &o)
377 };
378 ObjectDestroyed("object-destroyed") = |this, ts, o: *mut ffi::GstObject| {
380 this.object_destroyed(ts, std::ptr::NonNull::new_unchecked(o))
381 };
382 ObjectReffed("object-reffed") = |this, ts, o: *mut ffi::GstObject, rc: libc::c_int| {
383 let o = Object::from_glib_borrow(o);
384 this.object_reffed(ts, &o, rc)
385 };
386 ObjectUnreffed("object-unreffed") = |this, ts, o: *mut ffi::GstObject, rc: libc::c_int| {
387 let o = Object::from_glib_borrow(o);
388 this.object_unreffed(ts, &o, rc)
389 };
390 PadLinkPost("pad-link-post") = |this, ts, src: *mut ffi::GstPad, sink: *mut ffi::GstPad, r: ffi::GstPadLinkReturn| {
391 let src = Pad::from_glib_borrow(src);
392 let sink = Pad::from_glib_borrow(sink);
393 this.pad_link_post(ts, &src, &sink, try_from_glib(r))
394 };
395 PadLinkPre("pad-link-pre") = |this, ts, src: *mut ffi::GstPad, sink: *mut ffi::GstPad| {
396 let src = Pad::from_glib_borrow(src);
397 let sink = Pad::from_glib_borrow(sink);
398 this.pad_link_pre(ts, &src, &sink)
399 };
400 PadPullRangePost("pad-pull-range-post") = |this, ts, p: *mut ffi::GstPad, b: *mut ffi::GstBuffer, r: ffi::GstFlowReturn| {
401 let p = Pad::from_glib_borrow(p);
402 let res: Result::<FlowSuccess, FlowError> = try_from_glib(r);
403 match res {
404 Ok(_) => {
405 this.pad_pull_range_post(ts, &p, Ok(&from_glib_borrow(b)))
406 }
407 Err(err) => {
408 this.pad_pull_range_post(ts, &p, Err(err))
409 }
410 }
411 };
412 PadPullRangePre("pad-pull-range-pre") = |this, ts, p: *mut ffi::GstPad, o: u64, s: libc::c_uint| {
413 let p = Pad::from_glib_borrow(p);
414 this.pad_pull_range_pre(ts, &p, o, s)
415 };
416 PadPushEventPost("pad-push-event-post") = |this, ts, p: *mut ffi::GstPad, r: glib::ffi::gboolean| {
417 let p = Pad::from_glib_borrow(p);
418 this.pad_push_event_post(ts, &p, bool::from_glib(r))
419 };
420 PadPushEventPre("pad-push-event-pre") = |this, ts, p: *mut ffi::GstPad, e: *mut ffi::GstEvent| {
421 let p = Pad::from_glib_borrow(p);
422 let e = Event::from_glib_borrow(e);
423 this.pad_push_event_pre(ts, &p, &e)
424 };
425 PadPushListPost("pad-push-list-post") = |this, ts, p: *mut ffi::GstPad, r: ffi::GstFlowReturn| {
426 let p = Pad::from_glib_borrow(p);
427 this.pad_push_list_post(ts, &p, try_from_glib(r))
428 };
429 PadPushListPre("pad-push-list-pre") = |this, ts, p: *mut ffi::GstPad, bl: *mut ffi::GstBufferList| {
430 let p = Pad::from_glib_borrow(p);
431 let bl = BufferList::from_glib_borrow(bl);
432 this.pad_push_list_pre(ts, &p, &bl)
433 };
434 PadPushPost("pad-push-post") = |this, ts, p: *mut ffi::GstPad, r: ffi::GstFlowReturn| {
435 let p = Pad::from_glib_borrow(p);
436 this.pad_push_post(ts, &p, try_from_glib(r))
437 };
438 PadPushPre("pad-push-pre") = |this, ts, p: *mut ffi::GstPad, b: *mut ffi::GstBuffer| {
439 let p = Pad::from_glib_borrow(p);
440 let b = Buffer::from_glib_borrow(b);
441 this.pad_push_pre(ts, &p, &b)
442 };
443 #[cfg(feature = "v1_22")]
444 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
445 PadChainListPost("pad-chain-list-post") = |this, ts, p: *mut ffi::GstPad, r: ffi::GstFlowReturn| {
446 let p = Pad::from_glib_borrow(p);
447 this.pad_chain_list_post(ts, &p, try_from_glib(r))
448 };
449 #[cfg(feature = "v1_22")]
450 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
451 PadChainListPre("pad-chain-list-pre") = |this, ts, p: *mut ffi::GstPad, bl: *mut ffi::GstBufferList| {
452 let p = Pad::from_glib_borrow(p);
453 let bl = BufferList::from_glib_borrow(bl);
454 this.pad_chain_list_pre(ts, &p, &bl)
455 };
456 #[cfg(feature = "v1_22")]
457 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
458 PadChainPost("pad-chain-post") = |this, ts, p: *mut ffi::GstPad, r: ffi::GstFlowReturn| {
459 let p = Pad::from_glib_borrow(p);
460 this.pad_chain_post(ts, &p, try_from_glib(r))
461 };
462 #[cfg(feature = "v1_22")]
463 #[cfg_attr(docsrs, doc(cfg(feature = "v1_22")))]
464 PadChainPre("pad-chain-pre") = |this, ts, p: *mut ffi::GstPad, b: *mut ffi::GstBuffer| {
465 let p = Pad::from_glib_borrow(p);
466 let b = Buffer::from_glib_borrow(b);
467 this.pad_chain_pre(ts, &p, &b)
468 };
469 PadQueryPost("pad-query-post") = |this, ts, p: *mut ffi::GstPad, q: *mut ffi::GstQuery, r: glib::ffi::gboolean| {
470 let p = Pad::from_glib_borrow(p);
471 let q = QueryRef::from_ptr(q);
472 this.pad_query_post(ts, &p, q, bool::from_glib(r))
473 };
474 PadQueryPre("pad-query-pre") = |this, ts, p: *mut ffi::GstPad, q: *mut ffi::GstQuery| {
475 let p = Pad::from_glib_borrow(p);
476 let q = QueryRef::from_ptr(q);
477 this.pad_query_pre(ts, &p, q)
478 };
479 PadUnlinkPost("pad-unlink-post") = |this, ts, src: *mut ffi::GstPad, sink: *mut ffi::GstPad, r: glib::ffi::gboolean| {
480 let src = Pad::from_glib_borrow(src);
481 let sink = Pad::from_glib_borrow(sink);
482 this.pad_unlink_post(ts, &src, &sink, bool::from_glib(r))
483 };
484 PadUnlinkPre("pad-unlink-pre") = |this, ts, src: *mut ffi::GstPad, sink: *mut ffi::GstPad| {
485 let src = Pad::from_glib_borrow(src);
486 let sink = Pad::from_glib_borrow(sink);
487 this.pad_unlink_pre(ts, &src, &sink)
488 };
489 #[cfg(feature = "v1_20")]
490 #[cfg_attr(docsrs, doc(cfg(feature = "v1_20")))]
491 PluginFeatureLoaded("plugin-feature-loaded") = |this, ts, feature: *mut ffi::GstPluginFeature| {
492 let feature = crate::PluginFeature::from_glib_borrow(feature);
493 this.plugin_feature_loaded(ts, &feature)
494 };
495
496 #[cfg(feature = "v1_26")]
497 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
498 MemoryInit("memory-init") = |this, ts, memory: *mut ffi::GstMemory| {
499 let memory = crate::MemoryRefTrace::from_ptr(memory);
500 this.memory_init(ts, memory)
501 };
502 #[cfg(feature = "v1_26")]
503 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
504 MemoryFreePre("memory-free-pre") = |this, ts, memory: *mut ffi::GstMemory| {
505 let memory = crate::MemoryRef::from_ptr(memory);
506 this.memory_free_pre(ts, memory)
507 };
508 #[cfg(feature = "v1_26")]
509 #[cfg_attr(docsrs, doc(cfg(feature = "v1_26")))]
510 MemoryFreePost("memory-free-post") = |this, ts, memory: *mut ffi::GstMemory| {
511 this.memory_free_post(ts, std::ptr::NonNull::new_unchecked(memory))
512 };
513 #[cfg(feature = "v1_28")]
514 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
515 PoolBufferQueued("pool-buffer-queued") = |this, ts, pool: *mut ffi::GstBufferPool, buffer: *mut ffi::GstBuffer| {
516 let pool = crate::BufferPool::from_glib_borrow(pool);
517 let b = Buffer::from_glib_borrow(buffer);
518
519 this.pool_buffer_queued(ts, &pool, &b)
520 };
521 #[cfg(feature = "v1_28")]
522 #[cfg_attr(docsrs, doc(cfg(feature = "v1_28")))]
523 PoolBufferDequeued("pool-buffer-dequeued") = |this, ts, pool: *mut ffi::GstBufferPool, buffer: *mut ffi::GstBuffer| {
524 let pool = crate::BufferPool::from_glib_borrow(pool);
525 let b = Buffer::from_glib_borrow(buffer);
526
527 this.pool_buffer_dequeued(ts, &pool, &b)
528 };
529}