mirror of
https://github.com/valmojr/armatak.git
synced 2026-06-14 05:13:28 +00:00
separed video stream oss in scopes
This commit is contained in:
@@ -25,12 +25,14 @@ pub fn start_stream(
|
|||||||
) -> &'static str {
|
) -> &'static str {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
{
|
{
|
||||||
return ctx.callback_null(
|
ctx.callback_null(
|
||||||
"armatak_video_error",
|
"armatak_video_error",
|
||||||
"Screen capture is only supported on Windows",
|
"Screen capture is only supported on Windows",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
{
|
||||||
let (tx, rx): (Sender<()>, Receiver<()>) = mpsc::channel();
|
let (tx, rx): (Sender<()>, Receiver<()>) = mpsc::channel();
|
||||||
let rtsp_url = format!(
|
let rtsp_url = format!(
|
||||||
"rtsp://{}:{}@{}:{}/{}",
|
"rtsp://{}:{}@{}:{}/{}",
|
||||||
@@ -53,24 +55,12 @@ pub fn start_stream(
|
|||||||
&rtsp_url_clone,
|
&rtsp_url_clone,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
let mut child = cmd.creation_flags(CREATE_NO_WINDOW).spawn().unwrap();
|
||||||
let mut child = match cmd.creation_flags(CREATE_NO_WINDOW).spawn() {
|
|
||||||
Ok(child) => child,
|
|
||||||
Err(e) => {
|
|
||||||
let _ = ctx.callback_data(
|
|
||||||
"armatak_video_error",
|
|
||||||
"Failed to Start FFmpeg",
|
|
||||||
e.to_string(),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if rx.recv().is_err() {
|
if rx.recv().is_err() {
|
||||||
let _ = ctx.callback_null("armatak_video_error", "Error receiving stop signal");
|
let _ = ctx.callback_null("armatak_video_error", "Error receiving stop signal");
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
if let Err(e) = child.kill() {
|
if let Err(e) = child.kill() {
|
||||||
let _ = ctx.callback_data(
|
let _ = ctx.callback_data(
|
||||||
"armatak_video_error",
|
"armatak_video_error",
|
||||||
@@ -86,6 +76,7 @@ pub fn start_stream(
|
|||||||
eprintln!("Failed to acquire lock: {}", e);
|
eprintln!("Failed to acquire lock: {}", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
"starting video stream"
|
"starting video stream"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user