Initial commit
This commit is contained in:
commit
b9e1e34ca0
6 changed files with 126 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
/target
|
||||||
|
Cargo.lock
|
23
Cargo.toml
Normal file
23
Cargo.toml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
[package]
|
||||||
|
name = "gst-rtmpsrv"
|
||||||
|
description = "GStreamer Plugin that creates a server that is capable of receiving a RTMP stream"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Rafael Caricio <rafael@caricio.com>"]
|
||||||
|
repository = "https://github.com/rafaelcaricio/gst-rtmpsrv"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
name = "rtmpsrv"
|
||||||
|
crate-type = ["cdylib", "rlib", "staticlib"]
|
||||||
|
path = "src/lib.rs"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
glib = { git = "https://github.com/gtk-rs/gtk-rs" }
|
||||||
|
gst = { package = "gstreamer", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||||
|
gst-base = { package = "gstreamer-base", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||||
|
gst-video = { package = "gstreamer-video", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||||
|
gst-audio = { package = "gstreamer-audio", git = "https://gitlab.freedesktop.org/gstreamer/gstreamer-rs", features = ["v1_12"] }
|
||||||
|
once_cell = "1.0"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
gst-plugin-version-helper = { git = "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs" }
|
3
README.md
Normal file
3
README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# GStreamer RTMP Server Plugin
|
||||||
|
|
||||||
|
GStreamer Plugin that creates a server that is capable of receiving a RTMP stream.
|
3
build.rs
Normal file
3
build.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
fn main() {
|
||||||
|
gst_plugin_version_helper::get_info();
|
||||||
|
}
|
62
src/imp.rs
Normal file
62
src/imp.rs
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
use glib::subclass;
|
||||||
|
use glib::subclass::prelude::*;
|
||||||
|
use gst::prelude::*;
|
||||||
|
use gst::subclass::prelude::*;
|
||||||
|
use gst::{gst_debug, gst_error, gst_info, gst_log};
|
||||||
|
use gst_base::prelude::*;
|
||||||
|
use gst_base::subclass::prelude::*;
|
||||||
|
|
||||||
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
|
||||||
|
gst::DebugCategory::new(
|
||||||
|
"rtmpsrvsrc",
|
||||||
|
gst::DebugColorFlags::empty(),
|
||||||
|
Some("RTMP Server Source"),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
pub struct RtmpSvrSrc {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ObjectSubclass for RtmpSvrSrc {
|
||||||
|
const NAME: &'static str = "RtmpSvrSrc";
|
||||||
|
type Type = super::RtmpSrvSrc;
|
||||||
|
type ParentType = gst_base::PushSrc;
|
||||||
|
type Instance = gst::subclass::ElementInstanceStruct<Self>;
|
||||||
|
type Class = subclass::simple::ClassStruct<Self>;
|
||||||
|
|
||||||
|
glib::object_subclass!();
|
||||||
|
|
||||||
|
fn class_init(klass: &mut Self::Class) {
|
||||||
|
klass.set_metadata(
|
||||||
|
"RTMP Server Source",
|
||||||
|
"Source/Video",
|
||||||
|
"Creates a server that is capable of receiving a RTMP stream",
|
||||||
|
"Rafael Caricio <rafael@caricio.com>",
|
||||||
|
);
|
||||||
|
|
||||||
|
let caps = gst::Caps::new_simple(
|
||||||
|
"video/x-raw",
|
||||||
|
&[],
|
||||||
|
);
|
||||||
|
|
||||||
|
let src_pad_template = gst::PadTemplate::new(
|
||||||
|
"src",
|
||||||
|
gst::PadDirection::Src,
|
||||||
|
gst::PadPresence::Always,
|
||||||
|
&caps,
|
||||||
|
).unwrap();
|
||||||
|
klass.add_pad_template(src_pad_template);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new() -> Self {
|
||||||
|
Self {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ObjectImpl for RtmpSvrSrc {}
|
||||||
|
impl ElementImpl for RtmpSvrSrc {}
|
||||||
|
impl BaseSrcImpl for RtmpSvrSrc {}
|
||||||
|
impl PushSrcImpl for RtmpSvrSrc {}
|
33
src/lib.rs
Normal file
33
src/lib.rs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
use glib::prelude::*;
|
||||||
|
|
||||||
|
mod imp;
|
||||||
|
|
||||||
|
glib::wrapper! {
|
||||||
|
pub struct RtmpSrvSrc(ObjectSubclass<imp::RtmpSvrSrc>) @extends gst_base::BaseSrc, gst::Element, gst::Object;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsafe impl Send for RtmpSrvSrc {}
|
||||||
|
unsafe impl Sync for RtmpSrvSrc {}
|
||||||
|
|
||||||
|
pub fn plugin_init(plugin: &gst::Plugin) -> Result<(), glib::BoolError> {
|
||||||
|
gst::Element::register(
|
||||||
|
Some(plugin),
|
||||||
|
"rtmpsvrsrc",
|
||||||
|
gst::Rank::None,
|
||||||
|
RtmpSrvSrc::static_type(),
|
||||||
|
)?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
gst::plugin_define!(
|
||||||
|
rtmpsrvsrc,
|
||||||
|
env!("CARGO_PKG_DESCRIPTION"),
|
||||||
|
plugin_init,
|
||||||
|
concat!(env!("CARGO_PKG_VERSION"), "-", env!("COMMIT_ID")),
|
||||||
|
"MIT/X11",
|
||||||
|
env!("CARGO_PKG_NAME"),
|
||||||
|
env!("CARGO_PKG_NAME"),
|
||||||
|
env!("CARGO_PKG_REPOSITORY"),
|
||||||
|
env!("BUILD_REL_DATE")
|
||||||
|
);
|
Loading…
Reference in a new issue