added compiling version of example
This commit is contained in:
parent
cbd7d950da
commit
f69f7c7eb1
3 changed files with 40 additions and 3 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -3248,6 +3248,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||||
name = "vcs-camera-satellite"
|
name = "vcs-camera-satellite"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
"config",
|
"config",
|
||||||
"gst-plugin-webrtc",
|
"gst-plugin-webrtc",
|
||||||
"gstreamer",
|
"gstreamer",
|
||||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
anyhow = "1.0.86"
|
||||||
config = "0.14.0"
|
config = "0.14.0"
|
||||||
gst-plugin-webrtc = "0.13.0"
|
gst-plugin-webrtc = "0.13.0"
|
||||||
gstreamer = { version = "0.23.0", features = ["v1_22"] }
|
gstreamer = { version = "0.23.0", features = ["v1_22"] }
|
||||||
|
|
41
src/main.rs
41
src/main.rs
|
@ -1,6 +1,41 @@
|
||||||
|
|
||||||
mod signaller;
|
mod signaller;
|
||||||
|
|
||||||
fn main() {
|
// from outside the plugin repository, one would need to add plugin package as follows:
|
||||||
println!("Hello, world!");
|
// [dependencies]
|
||||||
|
// gstrswebrtc = { package = "gst-plugin-webrtc", git = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/" }
|
||||||
|
use gstrswebrtc;
|
||||||
|
|
||||||
|
use anyhow::Error;
|
||||||
|
use gstreamer::prelude::*;
|
||||||
|
use gstrswebrtc::signaller as signaller_interface;
|
||||||
|
use gstrswebrtc::webrtcsink;
|
||||||
|
|
||||||
|
fn main() -> Result<(), Error> {
|
||||||
|
gstreamer::init()?;
|
||||||
|
|
||||||
|
let custom_signaller = signaller::MyCustomSignaller::new();
|
||||||
|
let webrtcsink = webrtcsink::BaseWebRTCSink::with_signaller(
|
||||||
|
signaller_interface::Signallable::from(custom_signaller),
|
||||||
|
);
|
||||||
|
|
||||||
|
let pipeline = gstreamer::Pipeline::new();
|
||||||
|
|
||||||
|
let video_src = gstreamer::ElementFactory::make("videotestsrc").build().unwrap();
|
||||||
|
|
||||||
|
pipeline
|
||||||
|
.add_many([&video_src, webrtcsink.upcast_ref()])
|
||||||
|
.unwrap();
|
||||||
|
video_src
|
||||||
|
.link(webrtcsink.upcast_ref::<gstreamer::Element>())
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let bus = pipeline.bus().unwrap();
|
||||||
|
|
||||||
|
pipeline.set_state(gstreamer::State::Playing).unwrap();
|
||||||
|
|
||||||
|
let _msg = bus.timed_pop_filtered(gstreamer::ClockTime::NONE, &[gstreamer::MessageType::Eos]);
|
||||||
|
|
||||||
|
pipeline.set_state(gstreamer::State::Null).unwrap();
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue