mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
571 B
20 lines
571 B
using System.Globalization; |
|
|
|
namespace ErsatzTV.Application.Streaming; |
|
|
|
public record PtsTime(TimeSpan Value) |
|
{ |
|
public static readonly PtsTime Zero = new(TimeSpan.Zero); |
|
|
|
public static PtsTime From(string ffprobeLine) |
|
{ |
|
string[] split = ffprobeLine.Split("|"); |
|
var ptsTime = double.Parse(split[0], CultureInfo.InvariantCulture); |
|
if (double.TryParse(split[1], CultureInfo.InvariantCulture, out double duration)) |
|
{ |
|
ptsTime += duration; |
|
} |
|
|
|
return new PtsTime(TimeSpan.FromSeconds(ptsTime)); |
|
} |
|
}
|
|
|