Compare commits
2 commits
5bb5ff98bb
...
f69f7c7eb1
Author | SHA1 | Date | |
---|---|---|---|
|
f69f7c7eb1 | ||
|
cbd7d950da |
9 changed files with 3837 additions and 17 deletions
3637
Cargo.lock
generated
3637
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
24
Cargo.toml
24
Cargo.toml
|
@ -1,3 +1,21 @@
|
||||||
[workspace]
|
[package]
|
||||||
members = ["helloworld"]
|
name = "vcs-camera-satellite"
|
||||||
resolver = "2"
|
version = "0.1.0"
|
||||||
|
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"] }
|
||||||
|
gstreamer-sdp = { version = "0.23.0", features = ["v1_22"] }
|
||||||
|
gstreamer-webrtc = { version = "0.23.0", features = ["v1_22"] }
|
||||||
|
log = "0.4.22"
|
||||||
|
serde = { version = "1.0.204", features = ["derive"] }
|
||||||
|
serde_json = "1.0.122"
|
||||||
|
tokio = "1.39.2"
|
||||||
|
tokio-tungstenite = "0.23.1"
|
||||||
|
tracing = "0.1.40"
|
||||||
|
tracing-subscriber = "0.3.18"
|
||||||
|
|
62
flake.lock
Normal file
62
flake.lock
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722421184,
|
||||||
|
"narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1718428119,
|
||||||
|
"narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-overlay": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722651535,
|
||||||
|
"narHash": "sha256-2uRmNwxe3CO5h7PfvqXrRe8OplXaEdwhqOUtaF13rpU=",
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"rev": "56d83ca6f3c557647476f3720426a7615c22b860",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "oxalica",
|
||||||
|
"repo": "rust-overlay",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
11
flake.nix
11
flake.nix
|
@ -34,8 +34,15 @@ Some utility commands:
|
||||||
};
|
};
|
||||||
rustSettings = with pkgs; {
|
rustSettings = with pkgs; {
|
||||||
src = ./.;
|
src = ./.;
|
||||||
#nativeBuildInputs = [ pkg-config ];
|
nativeBuildInputs = [ pkg-config ];
|
||||||
#buildInputs = [ openssl ];
|
buildInputs = [
|
||||||
|
openssl
|
||||||
|
gst_all_1.gstreamer
|
||||||
|
gst_all_1.gst-plugins-base
|
||||||
|
gst_all_1.gst-plugins-good
|
||||||
|
gst_all_1.gst-plugins-bad # contains gstreamer-webrtc-1.0
|
||||||
|
gst_all_1.gst-plugins-rs
|
||||||
|
];
|
||||||
cargoHash = nixpkgs.lib.fakeHash;
|
cargoHash = nixpkgs.lib.fakeHash;
|
||||||
};
|
};
|
||||||
meta = with nixpkgs.lib; {
|
meta = with nixpkgs.lib; {
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "helloworld"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
|
@ -1,3 +0,0 @@
|
||||||
fn main() {
|
|
||||||
println!("Hello, world!");
|
|
||||||
}
|
|
41
src/main.rs
Normal file
41
src/main.rs
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
mod signaller;
|
||||||
|
|
||||||
|
// 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(())
|
||||||
|
}
|
48
src/signaller/imp.rs
Normal file
48
src/signaller/imp.rs
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
use gstreamer::glib;
|
||||||
|
use gstreamer::subclass::prelude::*;
|
||||||
|
use gstreamer_webrtc::WebRTCSessionDescription;
|
||||||
|
|
||||||
|
use gstrswebrtc::signaller::{Signallable, SignallableImpl};
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct Signaller {}
|
||||||
|
|
||||||
|
impl Signaller {}
|
||||||
|
|
||||||
|
impl SignallableImpl for Signaller {
|
||||||
|
fn start(&self) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn stop(&self) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn send_sdp(&self, _session_id: &str, _sdp: &WebRTCSessionDescription) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn add_ice(
|
||||||
|
&self,
|
||||||
|
_session_id: &str,
|
||||||
|
_candidate: &str,
|
||||||
|
_sdp_m_line_index: u32,
|
||||||
|
_sdp_mid: Option<String>,
|
||||||
|
) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn end_session(&self, _session_id: &str) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
|
impl ObjectSubclass for Signaller {
|
||||||
|
const NAME: &'static str = "MyCustomWebRTCSinkSignaller";
|
||||||
|
type Type = super::MyCustomSignaller;
|
||||||
|
type ParentType = glib::Object;
|
||||||
|
type Interfaces = (Signallable,);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ObjectImpl for Signaller {}
|
20
src/signaller/mod.rs
Normal file
20
src/signaller/mod.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
use gstreamer::glib;
|
||||||
|
use gstrswebrtc::signaller::Signallable;
|
||||||
|
|
||||||
|
mod imp;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
pub struct MyCustomSignaller(ObjectSubclass<imp::Signaller>) @implements Signallable;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl MyCustomSignaller {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
glib::Object::new()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for MyCustomSignaller {
|
||||||
|
fn default() -> Self {
|
||||||
|
MyCustomSignaller::new()
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue