Merge pull request #294 from JKamsker/patch-3

Added errordata to analysis

Former-commit-id: 28ad380022
This commit is contained in:
Malte Rosenbjerg 2022-04-05 21:40:52 +02:00 committed by GitHub
commit 9dde83c89d
4 changed files with 8 additions and 1 deletions

View file

@ -152,6 +152,7 @@ private static IMediaAnalysis ParseOutput(IProcessResult instance)
if (ffprobeAnalysis?.Format == null) if (ffprobeAnalysis?.Format == null)
throw new FormatNullException(); throw new FormatNullException();
ffprobeAnalysis.ErrorData = instance.ErrorData;
return new MediaAnalysis(ffprobeAnalysis); return new MediaAnalysis(ffprobeAnalysis);
} }
private static FFProbeFrames ParseFramesOutput(IProcessResult instance) private static FFProbeFrames ParseFramesOutput(IProcessResult instance)

View file

@ -10,6 +10,9 @@ public class FFProbeAnalysis
[JsonPropertyName("format")] [JsonPropertyName("format")]
public Format Format { get; set; } = null!; public Format Format { get; set; } = null!;
[JsonIgnore]
public IReadOnlyList<string> ErrorData { get; set; }
} }
public class FFProbeStream : ITagsContainer, IDispositionContainer public class FFProbeStream : ITagsContainer, IDispositionContainer

View file

@ -13,5 +13,6 @@ public interface IMediaAnalysis
List<VideoStream> VideoStreams { get; } List<VideoStream> VideoStreams { get; }
List<AudioStream> AudioStreams { get; } List<AudioStream> AudioStreams { get; }
List<SubtitleStream> SubtitleStreams { get; } List<SubtitleStream> SubtitleStreams { get; }
IReadOnlyList<string> ErrorData { get; }
} }
} }

View file

@ -13,6 +13,7 @@ internal MediaAnalysis(FFProbeAnalysis analysis)
VideoStreams = analysis.Streams.Where(stream => stream.CodecType == "video").Select(ParseVideoStream).ToList(); VideoStreams = analysis.Streams.Where(stream => stream.CodecType == "video").Select(ParseVideoStream).ToList();
AudioStreams = analysis.Streams.Where(stream => stream.CodecType == "audio").Select(ParseAudioStream).ToList(); AudioStreams = analysis.Streams.Where(stream => stream.CodecType == "audio").Select(ParseAudioStream).ToList();
SubtitleStreams = analysis.Streams.Where(stream => stream.CodecType == "subtitle").Select(ParseSubtitleStream).ToList(); SubtitleStreams = analysis.Streams.Where(stream => stream.CodecType == "subtitle").Select(ParseSubtitleStream).ToList();
ErrorData = analysis.ErrorData ?? new List<string>().AsReadOnly();
} }
private MediaFormat ParseFormat(Format analysisFormat) private MediaFormat ParseFormat(Format analysisFormat)
@ -45,6 +46,7 @@ private MediaFormat ParseFormat(Format analysisFormat)
public List<VideoStream> VideoStreams { get; } public List<VideoStream> VideoStreams { get; }
public List<AudioStream> AudioStreams { get; } public List<AudioStream> AudioStreams { get; }
public List<SubtitleStream> SubtitleStreams { get; } public List<SubtitleStream> SubtitleStreams { get; }
public IReadOnlyList<string> ErrorData { get; }
private VideoStream ParseVideoStream(FFProbeStream stream) private VideoStream ParseVideoStream(FFProbeStream stream)
{ {