mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2024-11-10 00:24:14 +01:00
parent
737eea3a98
commit
3837edee8c
5 changed files with 13 additions and 4 deletions
|
@ -84,7 +84,7 @@ public void MediaAnalysis_ParseDuration(string duration, int expectedDays, int e
|
|||
{
|
||||
var ffprobeStream = new FFProbeStream { Duration = duration };
|
||||
|
||||
var parsedDuration = MediaAnalysisUtils.ParseDuration(ffprobeStream);
|
||||
var parsedDuration = MediaAnalysisUtils.ParseDuration(ffprobeStream.Duration);
|
||||
|
||||
Assert.AreEqual(expectedDays, parsedDuration.Days);
|
||||
Assert.AreEqual(expectedHours, parsedDuration.Hours);
|
||||
|
|
|
@ -59,6 +59,9 @@ public class FFProbeStream : ITagsContainer, IDispositionContainer
|
|||
[JsonPropertyName("sample_aspect_ratio")]
|
||||
public string SampleAspectRatio { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("start_time")]
|
||||
public string StartTime { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("duration")]
|
||||
public string Duration { get; set; } = null!;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ private MediaFormat ParseFormat(Format analysisFormat)
|
|||
return new MediaFormat
|
||||
{
|
||||
Duration = MediaAnalysisUtils.ParseDuration(analysisFormat.Duration),
|
||||
StartTime = MediaAnalysisUtils.ParseDuration(analysisFormat.StartTime),
|
||||
FormatName = analysisFormat.FormatName,
|
||||
FormatLongName = analysisFormat.FormatLongName,
|
||||
StreamCount = analysisFormat.NbStreams,
|
||||
|
@ -66,7 +67,8 @@ private VideoStream ParseVideoStream(FFProbeStream stream)
|
|||
CodecTagString = stream.CodecTagString,
|
||||
DisplayAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.DisplayAspectRatio, ':'),
|
||||
SampleAspectRatio = MediaAnalysisUtils.ParseRatioInt(stream.SampleAspectRatio, ':'),
|
||||
Duration = MediaAnalysisUtils.ParseDuration(stream),
|
||||
Duration = MediaAnalysisUtils.ParseDuration(stream.Duration),
|
||||
StartTime = MediaAnalysisUtils.ParseDuration(stream.StartTime),
|
||||
FrameRate = MediaAnalysisUtils.DivideRatio(MediaAnalysisUtils.ParseRatioDouble(stream.FrameRate, '/')),
|
||||
Height = stream.Height ?? 0,
|
||||
Width = stream.Width ?? 0,
|
||||
|
@ -92,7 +94,8 @@ private AudioStream ParseAudioStream(FFProbeStream stream)
|
|||
CodecTagString = stream.CodecTagString,
|
||||
Channels = stream.Channels ?? default,
|
||||
ChannelLayout = stream.ChannelLayout,
|
||||
Duration = MediaAnalysisUtils.ParseDuration(stream),
|
||||
Duration = MediaAnalysisUtils.ParseDuration(stream.Duration),
|
||||
StartTime = MediaAnalysisUtils.ParseDuration(stream.StartTime),
|
||||
SampleRateHz = !string.IsNullOrEmpty(stream.SampleRate) ? MediaAnalysisUtils.ParseIntInvariant(stream.SampleRate) : default,
|
||||
Profile = stream.Profile,
|
||||
Language = stream.GetLanguage(),
|
||||
|
@ -110,7 +113,8 @@ private SubtitleStream ParseSubtitleStream(FFProbeStream stream)
|
|||
BitRate = !string.IsNullOrEmpty(stream.BitRate) ? MediaAnalysisUtils.ParseLongInvariant(stream.BitRate) : default,
|
||||
CodecName = stream.CodecName,
|
||||
CodecLongName = stream.CodecLongName,
|
||||
Duration = MediaAnalysisUtils.ParseDuration(stream),
|
||||
Duration = MediaAnalysisUtils.ParseDuration(stream.Duration),
|
||||
StartTime = MediaAnalysisUtils.ParseDuration(stream.StartTime),
|
||||
Language = stream.GetLanguage(),
|
||||
Disposition = MediaAnalysisUtils.FormatDisposition(stream.Disposition),
|
||||
Tags = stream.Tags.ToCaseInsensitive(),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
public class MediaFormat
|
||||
{
|
||||
public TimeSpan Duration { get; set; }
|
||||
public TimeSpan StartTime { get; set; }
|
||||
public string FormatName { get; set; } = null!;
|
||||
public string FormatLongName { get; set; } = null!;
|
||||
public int StreamCount { get; set; }
|
||||
|
|
|
@ -10,6 +10,7 @@ public abstract class MediaStream
|
|||
public string CodecTagString { get; set; } = null!;
|
||||
public string CodecTag { get; set; } = null!;
|
||||
public long BitRate { get; set; }
|
||||
public TimeSpan StartTime { get; set; }
|
||||
public TimeSpan Duration { get; set; }
|
||||
public string? Language { get; set; }
|
||||
public Dictionary<string, bool>? Disposition { get; set; }
|
||||
|
|
Loading…
Reference in a new issue