Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
786218a114 |
No files matched your search
@@ -1,13 +0,0 @@
|
|||||||
# These are supported funding model platforms
|
|
||||||
|
|
||||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
|
||||||
patreon: # Replace with a single Patreon username
|
|
||||||
open_collective: # Replace with a single Open Collective username
|
|
||||||
ko_fi: qesoul
|
|
||||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
|
||||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
|
||||||
liberapay: # Replace with a single Liberapay username
|
|
||||||
issuehunt: # Replace with a single IssueHunt username
|
|
||||||
otechie: # Replace with a single Otechie username
|
|
||||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
|
||||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# Neolink
|
# Neolink
|
||||||
|
|
||||||
 [](https://deps.rs/repo/github/QuantumEntangledAndy/neolink) <a href='https://ko-fi.com/G2G5HOYIZ' target='_blank'><img height='12' style='border:0px;height:30px;' src='https://storage.ko-fi.com/cdn/kofi2.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
|

|
||||||
|
|
||||||
Neolink is a small program that acts as a proxy between Reolink IP cameras and
|
Neolink is a small program that acts as a proxy between Reolink IP cameras and
|
||||||
normal RTSP clients.
|
normal RTSP clients.
|
||||||
|
|||||||
@@ -120,6 +120,9 @@ pub(crate) struct CameraConfig {
|
|||||||
alias = "stretching"
|
alias = "stretching"
|
||||||
)]
|
)]
|
||||||
pub(crate) use_smoothing: bool,
|
pub(crate) use_smoothing: bool,
|
||||||
|
|
||||||
|
#[serde(default = "default_true", alias = "splash")]
|
||||||
|
pub(crate) use_splash: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Validate, Clone)]
|
#[derive(Debug, Deserialize, Validate, Clone)]
|
||||||
|
|||||||
+12
-6
@@ -41,16 +41,17 @@ glib::wrapper! {
|
|||||||
|
|
||||||
impl Default for NeoMediaFactory {
|
impl Default for NeoMediaFactory {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new(100, true)
|
Self::new(100, true, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NeoMediaFactory {
|
impl NeoMediaFactory {
|
||||||
pub(crate) fn new(buffer_size: usize, use_smoothing: bool) -> Self {
|
pub(crate) fn new(buffer_size: usize, use_smoothing: bool, use_splash: bool) -> Self {
|
||||||
let factory = Object::new::<NeoMediaFactory>();
|
let factory = Object::new::<NeoMediaFactory>();
|
||||||
factory.set_shared(false);
|
factory.set_shared(false);
|
||||||
factory.imp().shared.set_buffer_size(buffer_size);
|
factory.imp().shared.set_buffer_size(buffer_size);
|
||||||
factory.imp().shared.set_use_smoothing(use_smoothing);
|
factory.imp().shared.set_use_smoothing(use_smoothing);
|
||||||
|
factory.imp().shared.set_use_splash(use_splash);
|
||||||
factory.set_launch("videotestsrc pattern=\"snow\" ! video/x-raw,width=896,height=512,framerate=25/1 ! textoverlay name=\"inittextoverlay\" text=\"Stream not Ready\" valignment=top halignment=left font-desc=\"Sans, 32\" ! jpegenc ! rtpjpegpay name=pay0");
|
factory.set_launch("videotestsrc pattern=\"snow\" ! video/x-raw,width=896,height=512,framerate=25/1 ! textoverlay name=\"inittextoverlay\" text=\"Stream not Ready\" valignment=top halignment=left font-desc=\"Sans, 32\" ! jpegenc ! rtpjpegpay name=pay0");
|
||||||
factory.set_suspend_mode(RTSPSuspendMode::None);
|
factory.set_suspend_mode(RTSPSuspendMode::None);
|
||||||
factory.set_transport_mode(RTSPTransportMode::PLAY);
|
factory.set_transport_mode(RTSPTransportMode::PLAY);
|
||||||
@@ -183,7 +184,7 @@ impl ObjectImpl for NeoMediaFactoryImpl {}
|
|||||||
impl RTSPMediaFactoryImpl for NeoMediaFactoryImpl {
|
impl RTSPMediaFactoryImpl for NeoMediaFactoryImpl {
|
||||||
fn create_element(&self, url: &RTSPUrl) -> Option<Element> {
|
fn create_element(&self, url: &RTSPUrl) -> Option<Element> {
|
||||||
self.parent_create_element(url)
|
self.parent_create_element(url)
|
||||||
.map(|orig| self.build_pipeline(orig).expect("Could not build pipeline"))
|
.and_then(|orig| self.build_pipeline(orig).expect("Could not build pipeline"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +260,7 @@ impl NeoMediaFactoryImpl {
|
|||||||
self.shared.number_of_clients.load(Ordering::Relaxed)
|
self.shared.number_of_clients.load(Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn build_pipeline(&self, media: Element) -> AnyResult<Element> {
|
fn build_pipeline(&self, media: Element) -> AnyResult<Option<Element>> {
|
||||||
// debug!("Building PIPELINE");
|
// debug!("Building PIPELINE");
|
||||||
let bin = media
|
let bin = media
|
||||||
.dynamic_cast::<Bin>()
|
.dynamic_cast::<Bin>()
|
||||||
@@ -282,6 +283,9 @@ impl NeoMediaFactoryImpl {
|
|||||||
self.shared.buffer_ready.load(Ordering::Relaxed),
|
self.shared.buffer_ready.load(Ordering::Relaxed),
|
||||||
) {
|
) {
|
||||||
(VidFormats::Unknown, true) | (_, false) => {
|
(VidFormats::Unknown, true) | (_, false) => {
|
||||||
|
if !self.shared.get_use_splash() {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
debug!("Building Unknown Pipeline");
|
debug!("Building Unknown Pipeline");
|
||||||
let source = make_element("videotestsrc", "testvidsrc")?;
|
let source = make_element("videotestsrc", "testvidsrc")?;
|
||||||
source.set_property_from_str("pattern", "snow");
|
source.set_property_from_str("pattern", "snow");
|
||||||
@@ -588,8 +592,10 @@ impl NeoMediaFactoryImpl {
|
|||||||
|
|
||||||
self.clientsender.blocking_send(client_data)?;
|
self.clientsender.blocking_send(client_data)?;
|
||||||
// debug!("Pipeline built");
|
// debug!("Pipeline built");
|
||||||
bin.dynamic_cast::<Element>()
|
let element = bin
|
||||||
.map_err(|_| anyhow!("Cannot cast back"))
|
.dynamic_cast::<Element>()
|
||||||
|
.map_err(|_| anyhow!("Cannot cast back"))?;
|
||||||
|
Ok(Some(element))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn join(&self) -> AnyResult<()> {
|
async fn join(&self) -> AnyResult<()> {
|
||||||
|
|||||||
@@ -363,7 +363,11 @@ impl NeoRtspServerImpl {
|
|||||||
match self.medias.write().await.entry(key.clone()) {
|
match self.medias.write().await.entry(key.clone()) {
|
||||||
Entry::Occupied(_occ) => {}
|
Entry::Occupied(_occ) => {}
|
||||||
Entry::Vacant(vac) => {
|
Entry::Vacant(vac) => {
|
||||||
let media = NeoMediaFactory::new(config.buffer_size, config.use_smoothing);
|
let media = NeoMediaFactory::new(
|
||||||
|
config.buffer_size,
|
||||||
|
config.use_smoothing,
|
||||||
|
config.use_splash,
|
||||||
|
);
|
||||||
let thread_media = media.clone();
|
let thread_media = media.clone();
|
||||||
self.threads
|
self.threads
|
||||||
.write()
|
.write()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ pub(super) struct NeoMediaShared {
|
|||||||
pub(super) buffer_ready: AtomicBool,
|
pub(super) buffer_ready: AtomicBool,
|
||||||
pub(super) buffer_size: AtomicUsize,
|
pub(super) buffer_size: AtomicUsize,
|
||||||
pub(super) use_smoothing: AtomicBool,
|
pub(super) use_smoothing: AtomicBool,
|
||||||
|
pub(super) splash: AtomicBool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for NeoMediaShared {
|
impl Default for NeoMediaShared {
|
||||||
@@ -36,6 +37,7 @@ impl Default for NeoMediaShared {
|
|||||||
buffer_ready: AtomicBool::new(false),
|
buffer_ready: AtomicBool::new(false),
|
||||||
buffer_size: AtomicUsize::new(100),
|
buffer_size: AtomicUsize::new(100),
|
||||||
use_smoothing: AtomicBool::new(false),
|
use_smoothing: AtomicBool::new(false),
|
||||||
|
splash: AtomicBool::new(true),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,4 +58,12 @@ impl NeoMediaShared {
|
|||||||
pub(super) fn set_use_smoothing(&self, new_value: bool) {
|
pub(super) fn set_use_smoothing(&self, new_value: bool) {
|
||||||
self.use_smoothing.store(new_value, Ordering::Relaxed)
|
self.use_smoothing.store(new_value, Ordering::Relaxed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(super) fn get_use_splash(&self) -> bool {
|
||||||
|
self.splash.load(Ordering::Relaxed)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(super) fn set_use_splash(&self, new_value: bool) {
|
||||||
|
self.splash.store(new_value, Ordering::Relaxed)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user