forked from mirrors/gstreamer-rs
example/glupload: Update to separated GL windowing crates
This commit is contained in:
parent
55badab13d
commit
75bcc8402d
2 changed files with 27 additions and 24 deletions
|
@ -9,6 +9,9 @@ edition = "2018"
|
||||||
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
||||||
gst = { package = "gstreamer", path = "../gstreamer" }
|
gst = { package = "gstreamer", path = "../gstreamer" }
|
||||||
gst-gl = { package = "gstreamer-gl", path = "../gstreamer-gl", optional = true }
|
gst-gl = { package = "gstreamer-gl", path = "../gstreamer-gl", optional = true }
|
||||||
|
gst-gl-egl = { package = "gstreamer-gl-egl", path = "../gstreamer-gl/egl", optional = true }
|
||||||
|
gst-gl-wayland = { package = "gstreamer-gl-wayland", path = "../gstreamer-gl/wayland", optional = true }
|
||||||
|
gst-gl-x11 = { package = "gstreamer-gl-x11", path = "../gstreamer-gl/x11", optional = true }
|
||||||
gst-app = { package = "gstreamer-app", path = "../gstreamer-app" }
|
gst-app = { package = "gstreamer-app", path = "../gstreamer-app" }
|
||||||
gst-audio = { package = "gstreamer-audio", path = "../gstreamer-audio" }
|
gst-audio = { package = "gstreamer-audio", path = "../gstreamer-audio" }
|
||||||
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
|
gst-base = { package = "gstreamer-base", path = "../gstreamer-base" }
|
||||||
|
@ -23,6 +26,7 @@ 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"
|
||||||
|
@ -50,9 +54,6 @@ v1_14 = ["gst/v1_14"]
|
||||||
pango-cairo = ["pango", "pangocairo", "cairo-rs"]
|
pango-cairo = ["pango", "pangocairo", "cairo-rs"]
|
||||||
overlay-composition = ["pango", "pangocairo", "cairo-rs"]
|
overlay-composition = ["pango", "pangocairo", "cairo-rs"]
|
||||||
gl = ["gst-gl", "gl_generator", "glutin"]
|
gl = ["gst-gl", "gl_generator", "glutin"]
|
||||||
gl-egl = ["gst-gl/egl"]
|
|
||||||
gl-x11 = ["gst-gl/x11"]
|
|
||||||
gl-wayland = ["gst-gl/wayland"]
|
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "appsink"
|
name = "appsink"
|
||||||
|
@ -161,7 +162,7 @@ required-features = ["ges"]
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "glupload"
|
name = "glupload"
|
||||||
required-features = ["gl"]
|
required-features = ["gl"]
|
||||||
features = ["gl-egl", "gl-x11", "gl-wayland"]
|
features = ["gst-gl-egl", "gst-gl-wayland", "gst-gl-x11"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "subclass"
|
name = "subclass"
|
||||||
|
|
|
@ -340,13 +340,13 @@ impl App {
|
||||||
|
|
||||||
let windowed_context = unsafe { windowed_context.make_current().map_err(|(_, err)| err)? };
|
let windowed_context = unsafe { windowed_context.make_current().map_err(|(_, err)| err)? };
|
||||||
|
|
||||||
#[cfg(any(feature = "gl-x11", feature = "gl-wayland"))]
|
#[cfg(any(feature = "gst-gl-x11", feature = "gst-gl-wayland"))]
|
||||||
let inner_window = windowed_context.window();
|
let inner_window = windowed_context.window();
|
||||||
|
|
||||||
let shared_context: gst_gl::GLContext;
|
let shared_context: gst_gl::GLContext;
|
||||||
if cfg!(target_os = "linux") {
|
if cfg!(target_os = "linux") {
|
||||||
use glutin::os::unix::RawHandle;
|
use glutin::os::unix::RawHandle;
|
||||||
#[cfg(any(feature = "gl-x11", feature = "gl-wayland"))]
|
#[cfg(any(feature = "gst-gl-x11", feature = "gst-gl-wayland"))]
|
||||||
use glutin::os::unix::WindowExt;
|
use glutin::os::unix::WindowExt;
|
||||||
use glutin::os::ContextTraitExt;
|
use glutin::os::ContextTraitExt;
|
||||||
|
|
||||||
|
@ -354,23 +354,25 @@ impl App {
|
||||||
|
|
||||||
let (gl_context, gl_display, platform) = match unsafe { windowed_context.raw_handle() }
|
let (gl_context, gl_display, platform) = match unsafe { windowed_context.raw_handle() }
|
||||||
{
|
{
|
||||||
#[cfg(any(feature = "gl-egl", feature = "gl-wayland"))]
|
#[cfg(any(feature = "gst-gl-egl", feature = "gst-gl-wayland"))]
|
||||||
RawHandle::Egl(egl_context) => {
|
RawHandle::Egl(egl_context) => {
|
||||||
#[cfg(feature = "gl-egl")]
|
cfg_if::cfg_if! {
|
||||||
let gl_display = if let Some(display) =
|
if #[cfg(feature = "gst-gl-egl")] {
|
||||||
unsafe { windowed_context.get_egl_display() }
|
let gl_display = if let Some(display) =
|
||||||
{
|
unsafe { windowed_context.get_egl_display() }
|
||||||
unsafe { gst_gl::GLDisplayEGL::with_egl_display(display as usize) }.unwrap()
|
{
|
||||||
} else {
|
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) }.unwrap()
|
||||||
panic!("EGL context without EGL display");
|
} else {
|
||||||
};
|
panic!("EGL context without EGL display");
|
||||||
|
};
|
||||||
#[cfg(not(feature = "gl-egl"))]
|
} else if #[cfg(feature = "gst-gl-wayland")] {
|
||||||
let gl_display = if let Some(display) = inner_window.get_wayland_display() {
|
let gl_display = if let Some(display) = inner_window.get_wayland_display() {
|
||||||
unsafe { gst_gl::GLDisplayWayland::with_display(display as usize) }.unwrap()
|
unsafe { gst_gl_wayland::GLDisplayWayland::with_display(display as usize) }.unwrap()
|
||||||
} else {
|
} else {
|
||||||
panic!("Wayland window without Wayland display");
|
panic!("Wayland window without Wayland display");
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
egl_context as usize,
|
egl_context as usize,
|
||||||
|
@ -378,10 +380,10 @@ impl App {
|
||||||
gst_gl::GLPlatform::EGL,
|
gst_gl::GLPlatform::EGL,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
#[cfg(feature = "gl-x11")]
|
#[cfg(feature = "gst-gl-x11")]
|
||||||
RawHandle::Glx(glx_context) => {
|
RawHandle::Glx(glx_context) => {
|
||||||
let gl_display = if let Some(display) = inner_window.get_xlib_display() {
|
let gl_display = if let Some(display) = inner_window.get_xlib_display() {
|
||||||
unsafe { gst_gl::GLDisplayX11::with_display(display as usize) }.unwrap()
|
unsafe { gst_gl_x11::GLDisplayX11::with_display(display as usize) }.unwrap()
|
||||||
} else {
|
} else {
|
||||||
panic!("X11 window without X Display");
|
panic!("X11 window without X Display");
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue