diff --git a/examples/Cargo.toml b/examples/Cargo.toml index d3e0fd518..426c4d7ac 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -158,7 +158,7 @@ name = "ges" required-features = ["ges"] [[bin]] -name = "glupload" +name = "glwindow" required-features = ["gl"] [[bin]] diff --git a/examples/src/bin/glwindow.rs b/examples/src/bin/glwindow.rs new file mode 100644 index 000000000..a9467a50f --- /dev/null +++ b/examples/src/bin/glwindow.rs @@ -0,0 +1,16 @@ +#[path = "../glupload.rs"] +mod glupload; +use glupload::*; + +#[path = "../examples-common.rs"] +pub mod examples_common; + +fn example_main() { + App::new() + .and_then(main_loop) + .unwrap_or_else(|e| eprintln!("Error! {}", e)) +} + +fn main() { + examples_common::run(example_main); +} diff --git a/examples/src/bin/glupload.rs b/examples/src/glupload.rs similarity index 98% rename from examples/src/bin/glupload.rs rename to examples/src/glupload.rs index f91b1a0d2..5158d0db1 100644 --- a/examples/src/bin/glupload.rs +++ b/examples/src/glupload.rs @@ -17,9 +17,6 @@ use std::sync; use anyhow::Error; use derive_more::{Display, Error}; -#[path = "../examples-common.rs"] -mod examples_common; - #[derive(Debug, Display, Error)] #[display(fmt = "Missing element {}", _0)] struct MissingElement(#[error(not(source))] &'static str); @@ -319,7 +316,7 @@ enum Message { BusEvent, } -struct App { +pub(crate) struct App { pipeline: gst::Pipeline, appsink: gst_app::AppSink, glupload: gst::Element, @@ -330,7 +327,7 @@ struct App { } impl App { - fn new() -> Result { + pub(crate) fn new() -> Result { gst::init()?; let (pipeline, appsink, glupload) = App::create_pipeline()?; @@ -605,7 +602,7 @@ impl App { } } -fn main_loop(app: App) -> Result<(), Error> { +pub(crate) fn main_loop(app: App) -> Result<(), Error> { app.setup(&app.event_loop)?; println!( @@ -700,13 +697,3 @@ fn main_loop(app: App) -> Result<(), Error> { } }) } - -fn example_main() { - App::new() - .and_then(main_loop) - .unwrap_or_else(|e| eprintln!("Error! {}", e)) -} - -fn main() { - examples_common::run(example_main); -}