add task runner to hls output

This commit is contained in:
amazing 2023-10-27 10:51:05 +02:00
parent 11d7d930a5
commit 652522da32
3 changed files with 23 additions and 8 deletions

8
Cargo.lock generated
View File

@ -1112,7 +1112,7 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]] [[package]]
name = "ffplayout" name = "ffplayout"
version = "0.20.0-beta2" version = "0.20.0-beta3"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",
@ -1134,7 +1134,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-api" name = "ffplayout-api"
version = "0.20.0-beta2" version = "0.20.0-beta3"
dependencies = [ dependencies = [
"actix-files", "actix-files",
"actix-multipart", "actix-multipart",
@ -1167,7 +1167,7 @@ dependencies = [
[[package]] [[package]]
name = "ffplayout-lib" name = "ffplayout-lib"
version = "0.20.0-beta2" version = "0.20.0-beta3"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",
@ -3126,7 +3126,7 @@ dependencies = [
[[package]] [[package]]
name = "tests" name = "tests"
version = "0.20.0-beta2" version = "0.20.0-beta3"
dependencies = [ dependencies = [
"chrono", "chrono",
"crossbeam-channel", "crossbeam-channel",

View File

@ -4,7 +4,7 @@ default-members = ["ffplayout-api", "ffplayout-engine", "tests"]
resolver = "2" resolver = "2"
[workspace.package] [workspace.package]
version = "0.20.0-beta2" version = "0.20.0-beta3"
license = "GPL-3.0" license = "GPL-3.0"
repository = "https://github.com/ffplayout/ffplayout" repository = "https://github.com/ffplayout/ffplayout"
authors = ["Jonathan Baecker <jonbae77@gmail.com>"] authors = ["Jonathan Baecker <jonbae77@gmail.com>"]

View File

@ -28,7 +28,7 @@ use std::{
use simplelog::*; use simplelog::*;
use crate::input::source_generator; use crate::input::source_generator;
use crate::utils::{log_line, prepare_output_cmd, valid_stream}; use crate::utils::{log_line, prepare_output_cmd, task_runner, valid_stream};
use ffplayout_lib::{ use ffplayout_lib::{
utils::{ utils::{
controller::ProcessUnit::*, get_delta, sec_to_time, stderr_reader, test_tcp_port, Media, controller::ProcessUnit::*, get_delta, sec_to_time, stderr_reader, test_tcp_port, Media,
@ -161,8 +161,8 @@ pub fn write_hls(
for node in get_source { for node in get_source {
*player_control.current_media.lock().unwrap() = Some(node.clone()); *player_control.current_media.lock().unwrap() = Some(node.clone());
let mut cmd = match node.cmd { let mut cmd = match &node.cmd {
Some(cmd) => cmd, Some(cmd) => cmd.clone(),
None => break, None => break,
}; };
@ -176,6 +176,21 @@ pub fn write_hls(
node.source node.source
); );
if config.task.enable {
let task_config = config.clone();
let task_node = node.clone();
let server_running = proc_control.server_is_running.load(Ordering::SeqCst);
if config.task.path.is_file() {
thread::spawn(move || task_runner::run(task_config, task_node, server_running));
} else {
error!(
"<bright-blue>{:?}</> executable not exists!",
config.task.path
);
}
}
let mut enc_prefix = vec_strings!["-hide_banner", "-nostats", "-v", &ff_log_format]; let mut enc_prefix = vec_strings!["-hide_banner", "-nostats", "-v", &ff_log_format];
let mut read_rate = 1.0; let mut read_rate = 1.0;