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"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"config",
|
||||
"gst-plugin-webrtc",
|
||||
"gstreamer",
|
||||
|
|
|
@ -6,6 +6,7 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1.0.86"
|
||||
config = "0.14.0"
|
||||
gst-plugin-webrtc = "0.13.0"
|
||||
gstreamer = { version = "0.23.0", features = ["v1_22"] }
|
||||
|
|
41
src/main.rs
41
src/main.rs
|
@ -1,6 +1,41 @@
|
|||
|
||||
mod signaller;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
// from outside the plugin repository, one would need to add plugin package as follows:
|
||||
// [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