diff --git a/ffplayout-engine/src/input/playlist.rs b/ffplayout-engine/src/input/playlist.rs index 7aea0e7f..94e9a89a 100644 --- a/ffplayout-engine/src/input/playlist.rs +++ b/ffplayout-engine/src/input/playlist.rs @@ -13,7 +13,7 @@ use simplelog::*; use ffplayout_lib::utils::{ check_sync, gen_dummy, get_delta, get_sec, is_close, is_remote, json_serializer::read_json, loop_image, loop_input, modified_time, seek_and_length, valid_source, Media, MediaProbe, - PlayoutConfig, PlayoutStatus, DUMMY_LEN, IMAGE_CODEC_NAME, + PlayoutConfig, PlayoutStatus, DUMMY_LEN, IMAGE_FORMAT, }; /// Struct for current playlist. @@ -448,8 +448,7 @@ fn timed_source( } else if total_delta <= 0.0 { info!("Begin is over play time, skip: {}", node.source); } else if total_delta < node.duration - node.seek || last { - new_node = handle_list_end(node, total_delta); - new_node.add_filter(config, &playout_stat.chain); + new_node = handle_list_end(config, node, total_delta, &playout_stat.chain); } new_node @@ -467,11 +466,10 @@ fn gen_source( node.add_probe(); if node - .probe - .clone() - .and_then(|p| p.video_streams) - .and_then(|v| v[0].codec_name.clone()) - .filter(|c| IMAGE_CODEC_NAME.contains(&c.as_str())) + .source + .rsplit_once('.') + .map(|(_, e)| e.to_lowercase()) + .filter(|c| IMAGE_FORMAT.contains(&c.as_str())) .is_some() { let cmd = loop_image(&node.source, duration); @@ -493,11 +491,12 @@ fn gen_source( error!("Source not found: {}", node.source); } - if probe - .clone() - .video_streams - .and_then(|v| v[0].codec_name.clone()) - .filter(|c| IMAGE_CODEC_NAME.contains(&c.as_str())) + if config + .storage + .filler_clip + .rsplit_once('.') + .map(|(_, e)| e.to_lowercase()) + .filter(|c| IMAGE_FORMAT.contains(&c.as_str())) .is_some() { let cmd = loop_image(&config.storage.filler_clip, duration); @@ -550,21 +549,24 @@ fn handle_list_init( /// when we come to last clip in playlist, /// or when we reached total playtime, /// we end up here -fn handle_list_end(mut node: Media, total_delta: f64) -> Media { +fn handle_list_end( + config: &PlayoutConfig, + mut node: Media, + total_delta: f64, + filter_chain: &Arc>>, +) -> Media { debug!("Playlist end"); - node.add_probe(); let mut out = if node.seek > 0.0 { node.seek + total_delta } else { + warn!("Clip length is not in time, new duration is: {total_delta:.2}"); total_delta }; - // prevent looping + // out can't be longer then duration if out > node.duration { out = node.duration - } else { - warn!("Clip length is not in time, new duration is: {total_delta:.2}") } if node.duration > total_delta && total_delta > 1.0 && node.duration - node.seek >= total_delta @@ -592,23 +594,5 @@ fn handle_list_end(mut node: Media, total_delta: f64) -> Media { node.process = Some(true); - if node - .probe - .clone() - .and_then(|p| p.video_streams) - .and_then(|v| v[0].codec_name.clone()) - .filter(|c| IMAGE_CODEC_NAME.contains(&c.as_str())) - .is_some() - { - node.cmd = Some(loop_image(&node.source, total_delta)); - } else { - node.cmd = Some(seek_and_length( - node.source.clone(), - node.seek, - node.out, - node.duration, - )); - } - - node + gen_source(config, node, filter_chain) } diff --git a/ffplayout-frontend b/ffplayout-frontend index d0a2fa69..c02141af 160000 --- a/ffplayout-frontend +++ b/ffplayout-frontend @@ -1 +1 @@ -Subproject commit d0a2fa6921172d667ce718e9362d4076fc16c23c +Subproject commit c02141af54762961cf559248a3c9d42e9d317e0b diff --git a/lib/src/utils/config.rs b/lib/src/utils/config.rs index f6518873..9a7f417a 100644 --- a/lib/src/utils/config.rs +++ b/lib/src/utils/config.rs @@ -12,9 +12,9 @@ use crate::utils::{free_tcp_socket, time_to_sec}; use crate::vec_strings; pub const DUMMY_LEN: f64 = 60.0; -pub const IMAGE_CODEC_NAME: [&str; 23] = [ - "bmp", "dds", "dpx", "exr", "gif", "hdr", "j2k", "jpeg2000", "jpegls", "jpegxl", "mjpeg", - "pcx", "pfm", "pgm", "phm", "png", "psd", "ppm", "sgi", "svg", "targa", "tiff", "webp", +pub const IMAGE_FORMAT: [&str; 21] = [ + "bmp", "dds", "dpx", "exr", "gif", "hdr", "j2k", "jpg", "jpeg", "pcx", "pfm", "pgm", "phm", + "png", "psd", "ppm", "sgi", "svg", "tga", "tif", "webp", ]; /// Global Config diff --git a/lib/src/utils/mod.rs b/lib/src/utils/mod.rs index fbc7dc4e..4277645c 100644 --- a/lib/src/utils/mod.rs +++ b/lib/src/utils/mod.rs @@ -27,7 +27,7 @@ pub mod json_serializer; mod json_validate; mod logging; -pub use config::{self as playout_config, PlayoutConfig, DUMMY_LEN, IMAGE_CODEC_NAME}; +pub use config::{self as playout_config, PlayoutConfig, DUMMY_LEN, IMAGE_FORMAT}; pub use controller::{PlayerControl, PlayoutStatus, ProcessControl, ProcessUnit::*}; pub use generator::generate_playlist; pub use json_serializer::{read_json, JsonPlaylist};