Files
ersatztv/ErsatzTV.Application/Streaming/PtsAndDuration.cs
T
Jason DoveandGitHub 245c4ec359 code analysis and cleanup (#1411)
* cleanup scanner project

* cleanup infrastructure projects

* cleanup ffmpeg project

* cleanup core project

* cleanup app project

* cleanup main project

* update dependencies

* code cleanup
2023-09-03 06:23:42 -05:00

20 lines
546 B
C#

using System.Globalization;
namespace ErsatzTV.Application.Streaming;
public record PtsAndDuration(long Pts, long Duration)
{
public static PtsAndDuration From(string ffprobeLine)
{
string[] split = ffprobeLine.Split("|");
var left = long.Parse(split[0], CultureInfo.InvariantCulture);
if (!long.TryParse(split[1], out long right))
{
// some durations are N/A, so we have to guess at something
right = 10_000;
}
return new PtsAndDuration(left, right);
}
}