mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-07 10:14:14 -04:00
add TryParse to FFProbe Keyframe extraction
This commit is contained in:
parent
679e83082f
commit
8532d88a71
@ -36,6 +36,7 @@
|
|||||||
- [dmitrylyzo](https://github.com/dmitrylyzo)
|
- [dmitrylyzo](https://github.com/dmitrylyzo)
|
||||||
- [DMouse10462](https://github.com/DMouse10462)
|
- [DMouse10462](https://github.com/DMouse10462)
|
||||||
- [DrPandemic](https://github.com/DrPandemic)
|
- [DrPandemic](https://github.com/DrPandemic)
|
||||||
|
- [eglia](https://github.com/eglia)
|
||||||
- [EraYaN](https://github.com/EraYaN)
|
- [EraYaN](https://github.com/EraYaN)
|
||||||
- [escabe](https://github.com/escabe)
|
- [escabe](https://github.com/escabe)
|
||||||
- [excelite](https://github.com/excelite)
|
- [excelite](https://github.com/excelite)
|
||||||
|
@ -65,9 +65,11 @@ public static class FfProbeKeyframeExtractor
|
|||||||
if (rest.EndsWith(",K_"))
|
if (rest.EndsWith(",K_"))
|
||||||
{
|
{
|
||||||
// Trim the flags from the packet line. Example line: packet,7169.079000,K_
|
// Trim the flags from the packet line. Example line: packet,7169.079000,K_
|
||||||
var keyframe = double.Parse(rest[..^3], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture);
|
if (double.TryParse(rest[..^3], NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture, out var keyframe))
|
||||||
// Have to manually convert to ticks to avoid rounding errors as TimeSpan is only precise down to 1 ms when converting double.
|
{
|
||||||
keyframes.Add(Convert.ToInt64(keyframe * TimeSpan.TicksPerSecond));
|
// Have to manually convert to ticks to avoid rounding errors as TimeSpan is only precise down to 1 ms when converting double.
|
||||||
|
keyframes.Add(Convert.ToInt64(keyframe * TimeSpan.TicksPerSecond));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (lineType.Equals("stream", StringComparison.OrdinalIgnoreCase))
|
else if (lineType.Equals("stream", StringComparison.OrdinalIgnoreCase))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user