mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-02-02 04:12:25 +00:00
examples/glupload: Allow EGL and Wayland features to coexist
If EGL and Wayland were both set the Wayland bit of code would never be build-tested nor used. Now if both are enabled try to acquire a GLDisplay through both handles before bailing. The methods can still be tested in isolation by not enabling one or the other feature.
This commit is contained in:
parent
28cfa91b40
commit
8ab8f00005
2 changed files with 22 additions and 19 deletions
|
@ -26,7 +26,6 @@ gtk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||||
gdk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
gdk = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||||
gio = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
gio = { git = "https://github.com/gtk-rs/gtk-rs", optional = true }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
cfg-if = "1.0"
|
|
||||||
derive_more = "0.99.5"
|
derive_more = "0.99.5"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
byte-slice-cast = "1"
|
byte-slice-cast = "1"
|
||||||
|
|
|
@ -356,27 +356,31 @@ impl App {
|
||||||
{
|
{
|
||||||
#[cfg(any(feature = "gst-gl-egl", feature = "gst-gl-wayland"))]
|
#[cfg(any(feature = "gst-gl-egl", feature = "gst-gl-wayland"))]
|
||||||
RawHandle::Egl(egl_context) => {
|
RawHandle::Egl(egl_context) => {
|
||||||
cfg_if::cfg_if! {
|
let mut gl_display = None;
|
||||||
if #[cfg(feature = "gst-gl-egl")] {
|
|
||||||
let gl_display = if let Some(display) =
|
#[cfg(feature = "gst-gl-egl")]
|
||||||
unsafe { windowed_context.get_egl_display() }
|
if let Some(display) = unsafe { windowed_context.get_egl_display() } {
|
||||||
{
|
gl_display = Some(
|
||||||
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) }.unwrap()
|
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) }
|
||||||
} else {
|
.unwrap()
|
||||||
panic!("EGL context without EGL display");
|
.upcast::<gst_gl::GLDisplay>(),
|
||||||
|
)
|
||||||
};
|
};
|
||||||
} else if #[cfg(feature = "gst-gl-wayland")] {
|
|
||||||
let gl_display = if let Some(display) = inner_window.get_wayland_display() {
|
#[cfg(feature = "gst-gl-wayland")]
|
||||||
unsafe { gst_gl_wayland::GLDisplayWayland::with_display(display as usize) }.unwrap()
|
if let Some(display) = inner_window.get_wayland_display() {
|
||||||
} else {
|
gl_display = Some(
|
||||||
panic!("Wayland window without Wayland display");
|
unsafe {
|
||||||
|
gst_gl_wayland::GLDisplayWayland::with_display(display as usize)
|
||||||
|
}
|
||||||
|
.unwrap()
|
||||||
|
.upcast::<gst_gl::GLDisplay>(),
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
(
|
(
|
||||||
egl_context as usize,
|
egl_context as usize,
|
||||||
gl_display.upcast::<gst_gl::GLDisplay>(),
|
gl_display.expect("Could not retrieve GLDisplay through EGL context and/or Wayland display"),
|
||||||
gst_gl::GLPlatform::EGL,
|
gst_gl::GLPlatform::EGL,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue