Make properties on MediaStream classes for deserialization #296

Former-commit-id: fc86a64b9e
This commit is contained in:
Malte Rosenbjerg 2022-03-24 20:37:27 +01:00
parent c84c68407d
commit 549856f619
4 changed files with 23 additions and 23 deletions

View file

@ -2,9 +2,9 @@
{
public class AudioStream : MediaStream
{
public int Channels { get; internal set; }
public string ChannelLayout { get; internal set; } = null!;
public int SampleRateHz { get; internal set; }
public string Profile { get; internal set; } = null!;
public int Channels { get; set; }
public string ChannelLayout { get; set; } = null!;
public int SampleRateHz { get; set; }
public string Profile { get; set; } = null!;
}
}

View file

@ -163,7 +163,7 @@ private static FFProbeFrames ParseFramesOutput(IProcessResult instance)
NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | System.Text.Json.Serialization.JsonNumberHandling.WriteAsString
}) ;
return ffprobeAnalysis;
return ffprobeAnalysis!;
}
private static FFProbePackets ParsePacketsOutput(IProcessResult instance)
@ -175,7 +175,7 @@ private static FFProbePackets ParsePacketsOutput(IProcessResult instance)
NumberHandling = System.Text.Json.Serialization.JsonNumberHandling.AllowReadingFromString | System.Text.Json.Serialization.JsonNumberHandling.WriteAsString
}) ;
return ffprobeAnalysis;
return ffprobeAnalysis!;
}
private static void ThrowIfInputFileDoesNotExist(string filePath)

View file

@ -5,18 +5,18 @@
namespace FFMpegCore
{
public class MediaStream
public abstract class MediaStream
{
public int Index { get; internal set; }
public string CodecName { get; internal set; } = null!;
public string CodecLongName { get; internal set; } = null!;
public int Index { get; set; }
public string CodecName { get; set; } = null!;
public string CodecLongName { get; set; } = null!;
public string CodecTagString { get; set; } = null!;
public string CodecTag { get; set; } = null!;
public long BitRate { get; internal set; }
public TimeSpan Duration { get; internal set; }
public string? Language { get; internal set; }
public Dictionary<string, bool>? Disposition { get; internal set; }
public Dictionary<string, string>? Tags { get; internal set; }
public long BitRate { get; set; }
public TimeSpan Duration { get; set; }
public string? Language { get; set; }
public Dictionary<string, bool>? Disposition { get; set; }
public Dictionary<string, string>? Tags { get; set; }
public Codec GetCodecInfo() => FFMpeg.GetCodec(CodecName);
}

View file

@ -4,14 +4,14 @@ namespace FFMpegCore
{
public class VideoStream : MediaStream
{
public double AvgFrameRate { get; internal set; }
public int BitsPerRawSample { get; internal set; }
public (int Width, int Height) DisplayAspectRatio { get; internal set; }
public string Profile { get; internal set; } = null!;
public int Width { get; internal set; }
public int Height { get; internal set; }
public double FrameRate { get; internal set; }
public string PixelFormat { get; internal set; } = null!;
public double AvgFrameRate { get; set; }
public int BitsPerRawSample { get; set; }
public (int Width, int Height) DisplayAspectRatio { get; set; }
public string Profile { get; set; } = null!;
public int Width { get; set; }
public int Height { get; set; }
public double FrameRate { get; set; }
public string PixelFormat { get; set; } = null!;
public int Rotation { get; set; }
public double AverageFrameRate { get; set; }