mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2024-11-25 19:11:06 +00:00
examples: Add Windows support to glupload
WGL does not have the concept of a `Display` connection, presumably because there's always only one compositor active. All interop and sharing is happening from the `Context` afterwards. After all `glutin` doesn't have a pointer inside `RawDisplay::Wgl`, and upstream `gstreamer` code creates a dummy display on Win32. WINRT is not taken into account & tested yet. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1468>
This commit is contained in:
parent
f3d7e18bcd
commit
cfb0fe6a17
4 changed files with 22 additions and 6 deletions
11
Cargo.lock
generated
11
Cargo.lock
generated
|
@ -776,12 +776,14 @@ dependencies = [
|
||||||
"dispatch",
|
"dispatch",
|
||||||
"glutin_egl_sys",
|
"glutin_egl_sys",
|
||||||
"glutin_glx_sys",
|
"glutin_glx_sys",
|
||||||
|
"glutin_wgl_sys",
|
||||||
"icrate",
|
"icrate",
|
||||||
"libloading",
|
"libloading",
|
||||||
"objc2",
|
"objc2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"raw-window-handle",
|
"raw-window-handle",
|
||||||
"wayland-sys",
|
"wayland-sys",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
"x11-dl",
|
"x11-dl",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -817,6 +819,15 @@ dependencies = [
|
||||||
"x11-dl",
|
"x11-dl",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glutin_wgl_sys"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead"
|
||||||
|
dependencies = [
|
||||||
|
"gl_generator",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gobject-sys"
|
name = "gobject-sys"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
|
|
|
@ -54,7 +54,7 @@ foreach($features in $features_matrix) {
|
||||||
if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) {
|
if ($env:LocalFeatures -and ($env:LocalFeatures -ne '--no-default-features')) {
|
||||||
if ($crate -eq 'examples') {
|
if ($crate -eq 'examples') {
|
||||||
# FIXME: We can do --all-features for examples once we have gtk3 installed in the image
|
# FIXME: We can do --all-features for examples once we have gtk3 installed in the image
|
||||||
$env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18,windows"
|
$env:LocalFeatures = "--features=rtsp-server,rtsp-server-record,pango-cairo,overlay-composition,gst-play,gst-player,ges,image,cairo-rs,gst-video/v1_18,windows,gl"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($crate -eq 'tutorials') {
|
if ($crate -eq 'tutorials') {
|
||||||
|
|
|
@ -30,8 +30,9 @@ byte-slice-cast = "1"
|
||||||
cairo-rs = { workspace = true, features=["use_glib"], optional = true }
|
cairo-rs = { workspace = true, features=["use_glib"], optional = true }
|
||||||
derive_more = "0.99.5"
|
derive_more = "0.99.5"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
glutin = { version = "0.31", optional = true, default-features = false }
|
# Since there's nothing Windows-specific to enable on gstreamer-rs, unconditionally enable glutin's WGL backend
|
||||||
glutin-winit = { version = "0.4", optional = true, default-features = false }
|
glutin = { version = "0.31", optional = true, default-features = false, features = ["wgl"] }
|
||||||
|
glutin-winit = { version = "0.4", optional = true, default-features = false, features = ["wgl"] }
|
||||||
image = { version = "0.24", optional = true, default-features = false, features = ["png", "jpeg"] }
|
image = { version = "0.24", optional = true, default-features = false, features = ["png", "jpeg"] }
|
||||||
memfd = { version = "0.6", optional = true }
|
memfd = { version = "0.6", optional = true }
|
||||||
memmap2 = { version = "0.9", optional = true }
|
memmap2 = { version = "0.9", optional = true }
|
||||||
|
|
|
@ -434,8 +434,8 @@ impl App {
|
||||||
|
|
||||||
println!("Using raw GL context {:?}", raw_gl_context);
|
println!("Using raw GL context {:?}", raw_gl_context);
|
||||||
|
|
||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(any(target_os = "linux", windows)))]
|
||||||
compile_error!("This example only has Linux support");
|
compile_error!("This example only has Linux and Windows support");
|
||||||
|
|
||||||
let api = App::map_gl_api(gl_config.api());
|
let api = App::map_gl_api(gl_config.api());
|
||||||
|
|
||||||
|
@ -449,7 +449,6 @@ impl App {
|
||||||
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(egl_display as usize) }
|
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(egl_display as usize) }
|
||||||
.context("Failed to create GLDisplayEGL from raw `EGLDisplay`")?
|
.context("Failed to create GLDisplayEGL from raw `EGLDisplay`")?
|
||||||
.upcast::<gst_gl::GLDisplay>();
|
.upcast::<gst_gl::GLDisplay>();
|
||||||
|
|
||||||
(egl_context as usize, gl_display, gst_gl::GLPlatform::EGL)
|
(egl_context as usize, gl_display, gst_gl::GLPlatform::EGL)
|
||||||
}
|
}
|
||||||
#[cfg(feature = "gst-gl-x11")]
|
#[cfg(feature = "gst-gl-x11")]
|
||||||
|
@ -463,6 +462,11 @@ impl App {
|
||||||
.upcast::<gst_gl::GLDisplay>();
|
.upcast::<gst_gl::GLDisplay>();
|
||||||
(glx_context as usize, gl_display, gst_gl::GLPlatform::GLX)
|
(glx_context as usize, gl_display, gst_gl::GLPlatform::GLX)
|
||||||
}
|
}
|
||||||
|
#[cfg(windows)]
|
||||||
|
(glutin::display::RawDisplay::Wgl, glutin::context::RawContext::Wgl(wgl_context)) => {
|
||||||
|
let gl_display = gst_gl::GLDisplay::new();
|
||||||
|
(wgl_context as usize, gl_display, gst_gl::GLPlatform::WGL)
|
||||||
|
}
|
||||||
#[allow(unreachable_patterns)]
|
#[allow(unreachable_patterns)]
|
||||||
handler => anyhow::bail!("Unsupported platform: {handler:?}."),
|
handler => anyhow::bail!("Unsupported platform: {handler:?}."),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue