2022-01-06 18:38:46 +00:00
|
|
|
use std::ptr;
|
|
|
|
|
2023-01-03 18:58:25 +00:00
|
|
|
use glib::{object::IsA, translate::*};
|
|
|
|
|
|
|
|
use crate::{GLContext, GLDisplay};
|
|
|
|
|
2022-01-06 18:38:46 +00:00
|
|
|
#[doc(alias = "gst_gl_handle_context_query")]
|
|
|
|
pub fn gl_handle_context_query(
|
|
|
|
element: &impl IsA<gst::Element>,
|
2022-01-18 09:57:22 +00:00
|
|
|
query: &mut gst::query::Context,
|
2022-01-06 18:38:46 +00:00
|
|
|
display: Option<&impl IsA<GLDisplay>>,
|
|
|
|
context: Option<&impl IsA<GLContext>>,
|
|
|
|
other_context: Option<&impl IsA<GLContext>>,
|
|
|
|
) -> bool {
|
2022-12-25 10:47:02 +00:00
|
|
|
skip_assert_initialized!();
|
2022-01-06 18:38:46 +00:00
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_gl_handle_context_query(
|
|
|
|
element.as_ref().to_glib_none().0,
|
|
|
|
query.as_mut_ptr(),
|
|
|
|
display.map(|p| p.as_ref()).to_glib_none().0,
|
|
|
|
context.map(|p| p.as_ref()).to_glib_none().0,
|
|
|
|
other_context.map(|p| p.as_ref()).to_glib_none().0,
|
|
|
|
))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[doc(alias = "gst_gl_handle_set_context")]
|
|
|
|
pub fn gl_handle_set_context(
|
|
|
|
element: &impl IsA<gst::Element>,
|
|
|
|
context: &gst::Context,
|
|
|
|
) -> (Option<GLDisplay>, Option<GLContext>) {
|
2022-12-25 10:47:02 +00:00
|
|
|
skip_assert_initialized!();
|
2022-01-06 18:38:46 +00:00
|
|
|
unsafe {
|
|
|
|
let mut display = ptr::null_mut();
|
|
|
|
let mut other_context = ptr::null_mut();
|
|
|
|
let ret = from_glib(ffi::gst_gl_handle_set_context(
|
|
|
|
element.as_ref().to_glib_none().0,
|
|
|
|
context.to_glib_none().0,
|
|
|
|
&mut display,
|
|
|
|
&mut other_context,
|
|
|
|
));
|
|
|
|
if ret {
|
|
|
|
(from_glib_full(display), from_glib_full(other_context))
|
|
|
|
} else {
|
|
|
|
(None, None)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|