srt::parse, ssa::parse and vtt::parse do not take file paths as input anymore. For this I've created srt::parse_from_file, ssa::parse_from_file and vtt::parse_from_file. When taking arbitrary user input, or untrusted input in general, and this input is malformed in a way that it resembles a filepath it could lead to unwanted file reads and/or crashes, thus the separation
Changed SRTFile::to_file, SSAFile::to_file and VTTFile::to_file to take a Path reference instead of a &str as parameter
Made all fields in Time private and added Time::fps, Time::frames functions instead
Renamed Time::update_from_ms to Time::set_ms and changed the "parsing" to number calculations only
Added Time::to_vtt_string
Changed parameter for Time::to_ass_string and to_srt_string to take self as reference
Removed Time::update_from_fps_frames, Time::derive_frames (this is now called directly when using Time::frames), Time::add_ms and Time::sub_ms
Removed time::frames_to_ms, time::ms_to_frames and time::ms_to_timestring
Add and Sub traits for Time got implemented for every integer type and &mut integer type reference. When subtracting a value greater than the internal stored time, an overflow error will occur
AddAssign and SubAssign traits for Time got implemented for every integer type. When subtracting a value greater than the internal stored time, an overflow error will occur
This PR changes some types and functions:
srt::parse
,ssa::parse
andvtt::parse
do not take file paths as input anymore. For this I've createdsrt::parse_from_file
,ssa::parse_from_file
andvtt::parse_from_file
. When taking arbitrary user input, or untrusted input in general, and this input is malformed in a way that it resembles a filepath it could lead to unwanted file reads and/or crashes, thus the separationSRTFile::to_file
,SSAFile::to_file
andVTTFile::to_file
to take aPath
reference instead of a&str
as parameterTime
private and addedTime::fps
,Time::frames
functions insteadTime::update_from_ms
toTime::set_ms
and changed the "parsing" to number calculations onlyTime::to_vtt_string
Time::to_ass_string
andto_srt_string
to takeself
as referenceTime::update_from_fps_frames
,Time::derive_frames
(this is now called directly when usingTime::frames
),Time::add_ms
andTime::sub_ms
time::frames_to_ms
,time::ms_to_frames
andtime::ms_to_timestring
Add
andSub
traits forTime
got implemented for every integer type and&mut
integer type reference. When subtracting a value greater than the internal stored time, an overflow error will occurAddAssign
andSubAssign
traits forTime
got implemented for every integer type. When subtracting a value greater than the internal stored time, an overflow error will occur