Merge pull request #141 from rosenbjerg/master

Also include output data on non-zero ffmpeg exitcode
This commit is contained in:
Malte Rosenbjerg 2020-12-09 11:03:56 +01:00 committed by GitHub
commit 2815ca06f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View file

@ -13,7 +13,6 @@ public enum FFMpegExceptionType
public class FFMpegException : Exception
{
public FFMpegException(FFMpegExceptionType type, string? message = null, Exception? innerException = null, string ffmpegErrorOutput = "", string ffmpegOutput = "")
: base(message, innerException)
{

View file

@ -77,13 +77,13 @@ void OnCancelEvent(object sender, EventArgs args)
CancelEvent -= OnCancelEvent;
}
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
return HandleCompletion(throwOnError, errorCode, instance.ErrorData, instance.OutputData);
}
private bool HandleCompletion(bool throwOnError, int errorCode, IReadOnlyList<string> errorData)
private bool HandleCompletion(bool throwOnError, int errorCode, IReadOnlyList<string> errorData, IReadOnlyList<string> outputData)
{
if (throwOnError && errorCode != 0)
throw new FFMpegException(FFMpegExceptionType.Conversion, string.Join("\n", errorData));
throw new FFMpegException(FFMpegExceptionType.Conversion, "FFMpeg exited with non-zero exitcode.", null, string.Join("\n", errorData), string.Join("\n", outputData));
_onPercentageProgress?.Invoke(100.0);
if (_totalTimespan.HasValue) _onTimeProgress?.Invoke(_totalTimespan.Value);
@ -123,7 +123,7 @@ await Task.WhenAll(instance.FinishedRunning().ContinueWith(t =>
CancelEvent -= OnCancelEvent;
}
return HandleCompletion(throwOnError, errorCode, instance.ErrorData);
return HandleCompletion(throwOnError, errorCode, instance.ErrorData, instance.OutputData);
}
private Instance PrepareInstance(out CancellationTokenSource cancellationTokenSource)

View file

@ -9,9 +9,9 @@
<Version>3.0.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
<PackageReleaseNotes>- Include ffmpeg output data in exception</PackageReleaseNotes>
<PackageReleaseNotes>- Also include ffmpeg output data on non-zero exit code</PackageReleaseNotes>
<LangVersion>8</LangVersion>
<PackageVersion>3.2.3</PackageVersion>
<PackageVersion>3.2.4</PackageVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>Malte Rosenbjerg, Vlad Jerca</Authors>
<PackageTags>ffmpeg ffprobe convert video audio mediafile resize analyze muxing</PackageTags>