glupload: panic if target OS is not Linux

For now this is the only OS supported by this test.
This commit is contained in:
Víctor Manuel Jáquez Leal 2019-02-27 19:58:47 +01:00
parent 07ddf2f370
commit c378167573

View file

@ -29,8 +29,6 @@ use failure::Error;
extern crate failure_derive; extern crate failure_derive;
extern crate glutin; extern crate glutin;
use glutin::os::unix::RawHandle;
use glutin::os::ContextTraitExt;
use glutin::ContextTrait; use glutin::ContextTrait;
#[path = "../examples-common.rs"] #[path = "../examples-common.rs"]
@ -350,6 +348,11 @@ impl App {
let combined_context_ = combined_context.clone(); let combined_context_ = combined_context.clone();
let context = combined_context_.context(); let context = combined_context_.context();
if cfg!(target_os = "linux") {
use glutin::os::unix::RawHandle;
use glutin::os::ContextTraitExt;
let egl_context = match unsafe { context.raw_handle() } { let egl_context = match unsafe { context.raw_handle() } {
RawHandle::Egl(egl_context) => egl_context as usize, RawHandle::Egl(egl_context) => egl_context as usize,
_ => panic!("Invalid platform"), _ => panic!("Invalid platform"),
@ -401,6 +404,9 @@ impl App {
gst::BusSyncReply::Pass gst::BusSyncReply::Pass
}); });
} else {
panic!("This example only has Linux support");
}
Ok(App { Ok(App {
pipeline, pipeline,