#![allow(unsafe_code)]
#![allow(unsafe_op_in_unsafe_fn)]
#![allow(clippy::ptr_as_ptr)]
#![allow(clippy::cast_possible_wrap)]
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::cast_lossless)]
#![allow(clippy::too_many_lines)]
#![allow(clippy::borrow_as_ptr)]
#![allow(clippy::ref_as_ptr)]
#![allow(clippy::struct_field_names)]
mod context;
mod streams;
mod write;
use crate::error::StreamError;
fn ffmpeg_err(code: i32) -> StreamError {
StreamError::Ffmpeg {
code,
message: ff_sys::av_error_string(code),
}
}
fn ffmpeg_err_msg(msg: &str) -> StreamError {
StreamError::Ffmpeg {
code: 0,
message: msg.to_owned(),
}
}
pub(crate) fn write_dash(
input_path: &str,
output_dir: &str,
segment_duration_secs: f64,
) -> Result<(), StreamError> {
std::fs::create_dir_all(output_dir)?;
unsafe { write::write_dash_unsafe(input_path, output_dir, segment_duration_secs) }
}
pub(crate) fn write_dash_abr(
input_path: &str,
output_dir: &str,
segment_duration_secs: f64,
renditions: &[(i64, i32, i32)], ) -> Result<(), StreamError> {
std::fs::create_dir_all(output_dir)?;
unsafe {
write::write_dash_abr_unsafe(input_path, output_dir, segment_duration_secs, renditions)
}
}