gstreamer_gl/auto/gl_shader.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
4// DO NOT EDIT
5
6use crate::{ffi, GLContext, GLSLStage};
7#[cfg(feature = "v1_16")]
8#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
9use crate::{GLSLProfile, GLSLVersion};
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 ///
19 ///
20 /// ## Properties
21 ///
22 ///
23 /// #### `linked`
24 /// Readable
25 /// <details><summary><h4>Object</h4></summary>
26 ///
27 ///
28 /// #### `name`
29 /// Readable | Writeable | Construct
30 ///
31 ///
32 /// #### `parent`
33 /// The parent of the object. Please note, that when changing the 'parent'
34 /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
35 /// signals due to locking issues. In some cases one can use
36 /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
37 /// achieve a similar effect.
38 ///
39 /// Readable | Writeable
40 /// </details>
41 ///
42 /// # Implements
43 ///
44 /// [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
45 #[doc(alias = "GstGLShader")]
46 pub struct GLShader(Object<ffi::GstGLShader, ffi::GstGLShaderClass>) @extends gst::Object;
47
48 match fn {
49 type_ => || ffi::gst_gl_shader_get_type(),
50 }
51}
52
53impl GLShader {
54 /// Note: must be called in the GL thread
55 /// ## `context`
56 /// a [`GLContext`][crate::GLContext]
57 ///
58 /// # Returns
59 ///
60 /// a new empty `shader`
61 #[doc(alias = "gst_gl_shader_new")]
62 pub fn new(context: &impl IsA<GLContext>) -> GLShader {
63 skip_assert_initialized!();
64 unsafe { from_glib_full(ffi::gst_gl_shader_new(context.as_ref().to_glib_none().0)) }
65 }
66
67 /// Note: must be called in the GL thread
68 /// ## `context`
69 /// a [`GLContext`][crate::GLContext]
70 ///
71 /// # Returns
72 ///
73 /// a default `shader` or [`None`] on failure
74 #[doc(alias = "gst_gl_shader_new_default")]
75 pub fn new_default(context: &impl IsA<GLContext>) -> Result<GLShader, glib::Error> {
76 skip_assert_initialized!();
77 unsafe {
78 let mut error = std::ptr::null_mut();
79 let ret = ffi::gst_gl_shader_new_default(context.as_ref().to_glib_none().0, &mut error);
80 if error.is_null() {
81 Ok(from_glib_full(ret))
82 } else {
83 Err(from_glib_full(error))
84 }
85 }
86 }
87
88 //#[doc(alias = "gst_gl_shader_new_link_with_stages")]
89 //pub fn new_link_with_stages(context: &impl IsA<GLContext>, error: &mut glib::Error, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> GLShader {
90 // unsafe { TODO: call ffi:gst_gl_shader_new_link_with_stages() }
91 //}
92
93 //#[doc(alias = "gst_gl_shader_new_with_stages")]
94 //#[doc(alias = "new_with_stages")]
95 //pub fn with_stages(context: &impl IsA<GLContext>, error: &mut glib::Error, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> GLShader {
96 // unsafe { TODO: call ffi:gst_gl_shader_new_with_stages() }
97 //}
98
99 /// Attaches `stage` to `self`. `stage` must have been successfully compiled
100 /// with [`GLSLStage::compile()`][crate::GLSLStage::compile()].
101 ///
102 /// Note: must be called in the GL thread
103 /// ## `stage`
104 /// a [`GLSLStage`][crate::GLSLStage] to attach
105 ///
106 /// # Returns
107 ///
108 /// whether `stage` could be attached to `self`
109 #[doc(alias = "gst_gl_shader_attach")]
110 pub fn attach(&self, stage: &GLSLStage) -> Result<(), glib::error::BoolError> {
111 unsafe {
112 glib::result_from_gboolean!(
113 ffi::gst_gl_shader_attach(self.to_glib_none().0, stage.to_glib_none().0),
114 "Failed to attach stage to shader"
115 )
116 }
117 }
118
119 /// Attaches `stage` to `self`. `stage` must have been successfully compiled
120 /// with [`GLSLStage::compile()`][crate::GLSLStage::compile()].
121 ///
122 /// Note: must be called in the GL thread
123 /// ## `stage`
124 /// a [`GLSLStage`][crate::GLSLStage] to attach
125 ///
126 /// # Returns
127 ///
128 /// whether `stage` could be attached to `self`
129 #[doc(alias = "gst_gl_shader_attach_unlocked")]
130 pub fn attach_unlocked(&self, stage: &GLSLStage) -> Result<(), glib::error::BoolError> {
131 unsafe {
132 glib::result_from_gboolean!(
133 ffi::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.to_glib_none().0),
134 "Failed to attach stage to shader"
135 )
136 }
137 }
138
139 /// Bind attribute `name` to the specified location `index` using
140 /// `glBindAttributeLocation()`.
141 /// ## `index`
142 /// attribute index to set
143 /// ## `name`
144 /// name of the attribute
145 #[doc(alias = "gst_gl_shader_bind_attribute_location")]
146 pub fn bind_attribute_location(&self, index: u32, name: &str) {
147 unsafe {
148 ffi::gst_gl_shader_bind_attribute_location(
149 self.to_glib_none().0,
150 index,
151 name.to_glib_none().0,
152 );
153 }
154 }
155
156 /// Bind attribute `name` to the specified location `index` using
157 /// `glBindFragDataLocation()`.
158 /// ## `index`
159 /// attribute index to set
160 /// ## `name`
161 /// name of the attribute
162 #[doc(alias = "gst_gl_shader_bind_frag_data_location")]
163 pub fn bind_frag_data_location(&self, index: u32, name: &str) {
164 unsafe {
165 ffi::gst_gl_shader_bind_frag_data_location(
166 self.to_glib_none().0,
167 index,
168 name.to_glib_none().0,
169 );
170 }
171 }
172
173 /// Compiles `stage` and attaches it to `self`.
174 ///
175 /// Note: must be called in the GL thread
176 /// ## `stage`
177 /// a [`GLSLStage`][crate::GLSLStage] to attach
178 ///
179 /// # Returns
180 ///
181 /// whether `stage` could be compiled and attached to `self`
182 #[doc(alias = "gst_gl_shader_compile_attach_stage")]
183 pub fn compile_attach_stage(&self, stage: &GLSLStage) -> Result<(), glib::Error> {
184 unsafe {
185 let mut error = std::ptr::null_mut();
186 let is_ok = ffi::gst_gl_shader_compile_attach_stage(
187 self.to_glib_none().0,
188 stage.to_glib_none().0,
189 &mut error,
190 );
191 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
192 if error.is_null() {
193 Ok(())
194 } else {
195 Err(from_glib_full(error))
196 }
197 }
198 }
199
200 /// Detaches `stage` from `self`. `stage` must have been successfully attached
201 /// to `self` with [`attach()`][Self::attach()] or [`attach_unlocked()`][Self::attach_unlocked()].
202 ///
203 /// Note: must be called in the GL thread
204 /// ## `stage`
205 /// a [`GLSLStage`][crate::GLSLStage] to attach
206 #[doc(alias = "gst_gl_shader_detach")]
207 pub fn detach(&self, stage: &GLSLStage) {
208 unsafe {
209 ffi::gst_gl_shader_detach(self.to_glib_none().0, stage.to_glib_none().0);
210 }
211 }
212
213 /// Detaches `stage` from `self`. `stage` must have been successfully attached
214 /// to `self` with [`attach()`][Self::attach()] or [`attach_unlocked()`][Self::attach_unlocked()].
215 ///
216 /// Note: must be called in the GL thread
217 /// ## `stage`
218 /// a [`GLSLStage`][crate::GLSLStage] to attach
219 #[doc(alias = "gst_gl_shader_detach_unlocked")]
220 pub fn detach_unlocked(&self, stage: &GLSLStage) {
221 unsafe {
222 ffi::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.to_glib_none().0);
223 }
224 }
225
226 /// ## `name`
227 /// name of the attribute
228 ///
229 /// # Returns
230 ///
231 /// the attribute index for `name` in `self` or -1 on failure
232 #[doc(alias = "gst_gl_shader_get_attribute_location")]
233 #[doc(alias = "get_attribute_location")]
234 pub fn attribute_location(&self, name: &str) -> i32 {
235 unsafe {
236 ffi::gst_gl_shader_get_attribute_location(self.to_glib_none().0, name.to_glib_none().0)
237 }
238 }
239
240 ///
241 /// # Returns
242 ///
243 /// the GL program handle for this shader
244 #[doc(alias = "gst_gl_shader_get_program_handle")]
245 #[doc(alias = "get_program_handle")]
246 pub fn program_handle(&self) -> i32 {
247 unsafe { ffi::gst_gl_shader_get_program_handle(self.to_glib_none().0) }
248 }
249
250 /// Note: must be called in the GL thread
251 ///
252 /// # Returns
253 ///
254 /// whether `self` has been successfully linked
255 #[doc(alias = "gst_gl_shader_is_linked")]
256 #[doc(alias = "linked")]
257 pub fn is_linked(&self) -> bool {
258 unsafe { from_glib(ffi::gst_gl_shader_is_linked(self.to_glib_none().0)) }
259 }
260
261 /// Links the current list of [`GLSLStage`][crate::GLSLStage]'s in `self`.
262 ///
263 /// Note: must be called in the GL thread
264 ///
265 /// # Returns
266 ///
267 /// whether `self` could be linked together.
268 #[doc(alias = "gst_gl_shader_link")]
269 pub fn link(&self) -> Result<(), glib::Error> {
270 unsafe {
271 let mut error = std::ptr::null_mut();
272 let is_ok = ffi::gst_gl_shader_link(self.to_glib_none().0, &mut error);
273 debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
274 if error.is_null() {
275 Ok(())
276 } else {
277 Err(from_glib_full(error))
278 }
279 }
280 }
281
282 /// Releases the shader and stages.
283 ///
284 /// Note: must be called in the GL thread
285 #[doc(alias = "gst_gl_shader_release")]
286 pub fn release(&self) {
287 unsafe {
288 ffi::gst_gl_shader_release(self.to_glib_none().0);
289 }
290 }
291
292 /// Releases the shader and stages.
293 ///
294 /// Note: must be called in the GL thread
295 #[doc(alias = "gst_gl_shader_release_unlocked")]
296 pub fn release_unlocked(&self) {
297 unsafe {
298 ffi::gst_gl_shader_release_unlocked(self.to_glib_none().0);
299 }
300 }
301
302 /// Perform `glUniform1f()` for `name` on `self`
303 /// ## `name`
304 /// name of the uniform
305 /// ## `value`
306 /// value to set
307 #[doc(alias = "gst_gl_shader_set_uniform_1f")]
308 pub fn set_uniform_1f(&self, name: &str, value: f32) {
309 unsafe {
310 ffi::gst_gl_shader_set_uniform_1f(self.to_glib_none().0, name.to_glib_none().0, value);
311 }
312 }
313
314 /// Perform `glUniform1fv()` for `name` on `self`
315 /// ## `name`
316 /// name of the uniform
317 /// ## `value`
318 /// values to set
319 #[doc(alias = "gst_gl_shader_set_uniform_1fv")]
320 pub fn set_uniform_1fv(&self, name: &str, value: &[f32]) {
321 let count = value.len() as _;
322 unsafe {
323 ffi::gst_gl_shader_set_uniform_1fv(
324 self.to_glib_none().0,
325 name.to_glib_none().0,
326 count,
327 value.to_glib_none().0,
328 );
329 }
330 }
331
332 /// Perform `glUniform1i()` for `name` on `self`
333 /// ## `name`
334 /// name of the uniform
335 /// ## `value`
336 /// value to set
337 #[doc(alias = "gst_gl_shader_set_uniform_1i")]
338 pub fn set_uniform_1i(&self, name: &str, value: i32) {
339 unsafe {
340 ffi::gst_gl_shader_set_uniform_1i(self.to_glib_none().0, name.to_glib_none().0, value);
341 }
342 }
343
344 /// Perform `glUniform1iv()` for `name` on `self`
345 /// ## `name`
346 /// name of the uniform
347 /// ## `value`
348 /// values to set
349 #[doc(alias = "gst_gl_shader_set_uniform_1iv")]
350 pub fn set_uniform_1iv(&self, name: &str, value: &[i32]) {
351 let count = value.len() as _;
352 unsafe {
353 ffi::gst_gl_shader_set_uniform_1iv(
354 self.to_glib_none().0,
355 name.to_glib_none().0,
356 count,
357 value.to_glib_none().0,
358 );
359 }
360 }
361
362 /// Perform `glUniform2f()` for `name` on `self`
363 /// ## `name`
364 /// name of the uniform
365 /// ## `v0`
366 /// first value to set
367 /// ## `v1`
368 /// second value to set
369 #[doc(alias = "gst_gl_shader_set_uniform_2f")]
370 pub fn set_uniform_2f(&self, name: &str, v0: f32, v1: f32) {
371 unsafe {
372 ffi::gst_gl_shader_set_uniform_2f(self.to_glib_none().0, name.to_glib_none().0, v0, v1);
373 }
374 }
375
376 /// Perform `glUniform2fv()` for `name` on `self`
377 /// ## `name`
378 /// name of the uniform
379 /// ## `value`
380 /// values to set
381 #[doc(alias = "gst_gl_shader_set_uniform_2fv")]
382 pub fn set_uniform_2fv(&self, name: &str, value: &[f32]) {
383 let count = value.len() as _;
384 unsafe {
385 ffi::gst_gl_shader_set_uniform_2fv(
386 self.to_glib_none().0,
387 name.to_glib_none().0,
388 count,
389 value.to_glib_none().0,
390 );
391 }
392 }
393
394 /// Perform `glUniform2i()` for `name` on `self`
395 /// ## `name`
396 /// name of the uniform
397 /// ## `v0`
398 /// first value to set
399 /// ## `v1`
400 /// second value to set
401 #[doc(alias = "gst_gl_shader_set_uniform_2i")]
402 pub fn set_uniform_2i(&self, name: &str, v0: i32, v1: i32) {
403 unsafe {
404 ffi::gst_gl_shader_set_uniform_2i(self.to_glib_none().0, name.to_glib_none().0, v0, v1);
405 }
406 }
407
408 /// Perform `glUniform2iv()` for `name` on `self`
409 /// ## `name`
410 /// name of the uniform
411 /// ## `value`
412 /// values to set
413 #[doc(alias = "gst_gl_shader_set_uniform_2iv")]
414 pub fn set_uniform_2iv(&self, name: &str, value: &[i32]) {
415 let count = value.len() as _;
416 unsafe {
417 ffi::gst_gl_shader_set_uniform_2iv(
418 self.to_glib_none().0,
419 name.to_glib_none().0,
420 count,
421 value.to_glib_none().0,
422 );
423 }
424 }
425
426 /// Perform `glUniform3f()` for `name` on `self`
427 /// ## `name`
428 /// name of the uniform
429 /// ## `v0`
430 /// first value to set
431 /// ## `v1`
432 /// second value to set
433 /// ## `v2`
434 /// third value to set
435 #[doc(alias = "gst_gl_shader_set_uniform_3f")]
436 pub fn set_uniform_3f(&self, name: &str, v0: f32, v1: f32, v2: f32) {
437 unsafe {
438 ffi::gst_gl_shader_set_uniform_3f(
439 self.to_glib_none().0,
440 name.to_glib_none().0,
441 v0,
442 v1,
443 v2,
444 );
445 }
446 }
447
448 /// Perform `glUniform3fv()` for `name` on `self`
449 /// ## `name`
450 /// name of the uniform
451 /// ## `value`
452 /// values to set
453 #[doc(alias = "gst_gl_shader_set_uniform_3fv")]
454 pub fn set_uniform_3fv(&self, name: &str, value: &[f32]) {
455 let count = value.len() as _;
456 unsafe {
457 ffi::gst_gl_shader_set_uniform_3fv(
458 self.to_glib_none().0,
459 name.to_glib_none().0,
460 count,
461 value.to_glib_none().0,
462 );
463 }
464 }
465
466 /// Perform `glUniform3i()` for `name` on `self`
467 /// ## `name`
468 /// name of the uniform
469 /// ## `v0`
470 /// first value to set
471 /// ## `v1`
472 /// second value to set
473 /// ## `v2`
474 /// third value to set
475 #[doc(alias = "gst_gl_shader_set_uniform_3i")]
476 pub fn set_uniform_3i(&self, name: &str, v0: i32, v1: i32, v2: i32) {
477 unsafe {
478 ffi::gst_gl_shader_set_uniform_3i(
479 self.to_glib_none().0,
480 name.to_glib_none().0,
481 v0,
482 v1,
483 v2,
484 );
485 }
486 }
487
488 /// Perform `glUniform3iv()` for `name` on `self`
489 /// ## `name`
490 /// name of the uniform
491 /// ## `value`
492 /// values to set
493 #[doc(alias = "gst_gl_shader_set_uniform_3iv")]
494 pub fn set_uniform_3iv(&self, name: &str, value: &[i32]) {
495 let count = value.len() as _;
496 unsafe {
497 ffi::gst_gl_shader_set_uniform_3iv(
498 self.to_glib_none().0,
499 name.to_glib_none().0,
500 count,
501 value.to_glib_none().0,
502 );
503 }
504 }
505
506 /// Perform `glUniform4f()` for `name` on `self`
507 /// ## `name`
508 /// name of the uniform
509 /// ## `v0`
510 /// first value to set
511 /// ## `v1`
512 /// second value to set
513 /// ## `v2`
514 /// third value to set
515 /// ## `v3`
516 /// fourth value to set
517 #[doc(alias = "gst_gl_shader_set_uniform_4f")]
518 pub fn set_uniform_4f(&self, name: &str, v0: f32, v1: f32, v2: f32, v3: f32) {
519 unsafe {
520 ffi::gst_gl_shader_set_uniform_4f(
521 self.to_glib_none().0,
522 name.to_glib_none().0,
523 v0,
524 v1,
525 v2,
526 v3,
527 );
528 }
529 }
530
531 /// Perform `glUniform4fv()` for `name` on `self`
532 /// ## `name`
533 /// name of the uniform
534 /// ## `value`
535 /// values to set
536 #[doc(alias = "gst_gl_shader_set_uniform_4fv")]
537 pub fn set_uniform_4fv(&self, name: &str, value: &[f32]) {
538 let count = value.len() as _;
539 unsafe {
540 ffi::gst_gl_shader_set_uniform_4fv(
541 self.to_glib_none().0,
542 name.to_glib_none().0,
543 count,
544 value.to_glib_none().0,
545 );
546 }
547 }
548
549 /// Perform `glUniform4i()` for `name` on `self`
550 /// ## `name`
551 /// name of the uniform
552 /// ## `v0`
553 /// first value to set
554 /// ## `v1`
555 /// second value to set
556 /// ## `v2`
557 /// third value to set
558 /// ## `v3`
559 /// fourth value to set
560 #[doc(alias = "gst_gl_shader_set_uniform_4i")]
561 pub fn set_uniform_4i(&self, name: &str, v0: i32, v1: i32, v2: i32, v3: i32) {
562 unsafe {
563 ffi::gst_gl_shader_set_uniform_4i(
564 self.to_glib_none().0,
565 name.to_glib_none().0,
566 v0,
567 v1,
568 v2,
569 v3,
570 );
571 }
572 }
573
574 /// Perform `glUniform4iv()` for `name` on `self`
575 /// ## `name`
576 /// name of the uniform
577 /// ## `value`
578 /// values to set
579 #[doc(alias = "gst_gl_shader_set_uniform_4iv")]
580 pub fn set_uniform_4iv(&self, name: &str, value: &[i32]) {
581 let count = value.len() as _;
582 unsafe {
583 ffi::gst_gl_shader_set_uniform_4iv(
584 self.to_glib_none().0,
585 name.to_glib_none().0,
586 count,
587 value.to_glib_none().0,
588 );
589 }
590 }
591
592 /// Mark's `self` as being used for the next GL draw command.
593 ///
594 /// Note: must be called in the GL thread and `self` must have been linked.
595 #[doc(alias = "gst_gl_shader_use")]
596 #[doc(alias = "use")]
597 pub fn use_(&self) {
598 unsafe {
599 ffi::gst_gl_shader_use(self.to_glib_none().0);
600 }
601 }
602
603 /// ## `context`
604 /// a [`GLContext`][crate::GLContext]
605 /// ## `version`
606 /// a [`GLSLVersion`][crate::GLSLVersion]
607 /// ## `profile`
608 /// a [`GLSLProfile`][crate::GLSLProfile]
609 ///
610 /// # Returns
611 ///
612 /// a passthrough shader string for copying an input external-oes
613 /// texture to the output
614 #[cfg(feature = "v1_16")]
615 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
616 #[doc(alias = "gst_gl_shader_string_fragment_external_oes_get_default")]
617 pub fn string_fragment_external_oes_get_default(
618 context: &impl IsA<GLContext>,
619 version: GLSLVersion,
620 profile: GLSLProfile,
621 ) -> glib::GString {
622 skip_assert_initialized!();
623 unsafe {
624 from_glib_full(ffi::gst_gl_shader_string_fragment_external_oes_get_default(
625 context.as_ref().to_glib_none().0,
626 version.into_glib(),
627 profile.into_glib(),
628 ))
629 }
630 }
631
632 /// ## `context`
633 /// a [`GLContext`][crate::GLContext]
634 /// ## `version`
635 /// a [`GLSLVersion`][crate::GLSLVersion]
636 /// ## `profile`
637 /// a [`GLSLProfile`][crate::GLSLProfile]
638 ///
639 /// # Returns
640 ///
641 /// a passthrough shader string for copying an input texture to
642 /// the output
643 #[cfg(feature = "v1_16")]
644 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
645 #[doc(alias = "gst_gl_shader_string_fragment_get_default")]
646 pub fn string_fragment_get_default(
647 context: &impl IsA<GLContext>,
648 version: GLSLVersion,
649 profile: GLSLProfile,
650 ) -> glib::GString {
651 skip_assert_initialized!();
652 unsafe {
653 from_glib_full(ffi::gst_gl_shader_string_fragment_get_default(
654 context.as_ref().to_glib_none().0,
655 version.into_glib(),
656 profile.into_glib(),
657 ))
658 }
659 }
660
661 /// Generates a shader string that defines the precision of float types in
662 /// GLSL shaders. This is particularly needed for fragment shaders in a
663 /// GLSL ES context where there is no default precision specified.
664 ///
665 /// Practically, this will return the string 'precision mediump float'
666 /// or 'precision highp float' depending on if high precision floats are
667 /// determined to be supported.
668 /// ## `context`
669 /// a [`GLContext`][crate::GLContext]
670 /// ## `version`
671 /// a [`GLSLVersion`][crate::GLSLVersion]
672 /// ## `profile`
673 /// a [`GLSLProfile`][crate::GLSLProfile]
674 ///
675 /// # Returns
676 ///
677 /// a shader string defining the precision of float types based on
678 /// `context`, `version` and `profile`
679 #[cfg(feature = "v1_16")]
680 #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
681 #[doc(alias = "gst_gl_shader_string_get_highest_precision")]
682 pub fn string_get_highest_precision(
683 context: &impl IsA<GLContext>,
684 version: GLSLVersion,
685 profile: GLSLProfile,
686 ) -> glib::GString {
687 skip_assert_initialized!();
688 unsafe {
689 from_glib_none(ffi::gst_gl_shader_string_get_highest_precision(
690 context.as_ref().to_glib_none().0,
691 version.into_glib(),
692 profile.into_glib(),
693 ))
694 }
695 }
696
697 #[doc(alias = "linked")]
698 pub fn connect_linked_notify<F: Fn(&Self) + Send + Sync + 'static>(
699 &self,
700 f: F,
701 ) -> SignalHandlerId {
702 unsafe extern "C" fn notify_linked_trampoline<F: Fn(&GLShader) + Send + Sync + 'static>(
703 this: *mut ffi::GstGLShader,
704 _param_spec: glib::ffi::gpointer,
705 f: glib::ffi::gpointer,
706 ) {
707 let f: &F = &*(f as *const F);
708 f(&from_glib_borrow(this))
709 }
710 unsafe {
711 let f: Box_<F> = Box_::new(f);
712 connect_raw(
713 self.as_ptr() as *mut _,
714 c"notify::linked".as_ptr() as *const _,
715 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
716 notify_linked_trampoline::<F> as *const (),
717 )),
718 Box_::into_raw(f),
719 )
720 }
721 }
722}
723
724unsafe impl Send for GLShader {}
725unsafe impl Sync for GLShader {}