Merge pull request #294 from JKamsker/patch-3

Added errordata to analysis
This commit is contained in:
Malte Rosenbjerg 2022-04-05 21:40:52 +02:00 committed by GitHub
commit 28ad380022
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)
throw new FormatNullException();
ffprobeAnalysis.ErrorData = instance.ErrorData;
return new MediaAnalysis(ffprobeAnalysis);
}
private static FFProbeFrames ParseFramesOutput(IProcessResult instance)

View file

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

View file

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