Update FFmpegWrapper.cs
This commit is contained in:
parent
b101d8f8a4
commit
d351a6225e
@ -417,14 +417,9 @@ public static class FFmpegWrapper
|
|||||||
RedirectStandardError = stderr
|
RedirectStandardError = stderr
|
||||||
};
|
};
|
||||||
|
|
||||||
var ffmpeg = new Process
|
using (var ffmpeg = new Process { StartInfo = info })
|
||||||
{
|
{
|
||||||
StartInfo = info
|
Logger?.LogDebug("Starting ffmpeg with the following arguments: {Arguments}", ffmpeg.StartInfo.Arguments);
|
||||||
};
|
|
||||||
|
|
||||||
Logger?.LogDebug(
|
|
||||||
"Starting ffmpeg with the following arguments: {Arguments}",
|
|
||||||
ffmpeg.StartInfo.Arguments);
|
|
||||||
|
|
||||||
ffmpeg.Start();
|
ffmpeg.Start();
|
||||||
|
|
||||||
@ -434,29 +429,24 @@ public static class FFmpegWrapper
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger?.LogDebug(
|
Logger?.LogDebug("ffmpeg priority could not be modified. {Message}", e.Message);
|
||||||
"ffmpeg priority could not be modified. {Message}",
|
|
||||||
e.Message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
{
|
{
|
||||||
var buf = new byte[4096];
|
var buf = new byte[4096];
|
||||||
var bytesRead = 0;
|
int bytesRead;
|
||||||
|
|
||||||
do
|
using (var streamReader = stderr ? ffmpeg.StandardError : ffmpeg.StandardOutput)
|
||||||
|
{
|
||||||
|
while ((bytesRead = streamReader.BaseStream.Read(buf, 0, buf.Length)) > 0)
|
||||||
{
|
{
|
||||||
var streamReader = stderr ? ffmpeg.StandardError : ffmpeg.StandardOutput;
|
|
||||||
bytesRead = streamReader.BaseStream.Read(buf, 0, buf.Length);
|
|
||||||
ms.Write(buf, 0, bytesRead);
|
ms.Write(buf, 0, bytesRead);
|
||||||
}
|
}
|
||||||
while (bytesRead > 0);
|
|
||||||
|
|
||||||
if (ffmpeg.WaitForExit(timeout))
|
|
||||||
{
|
|
||||||
ffmpeg.Dispose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ffmpeg.WaitForExit(timeout);
|
||||||
|
|
||||||
var output = ms.ToArray();
|
var output = ms.ToArray();
|
||||||
|
|
||||||
// If caching is enabled, cache the output of this command.
|
// If caching is enabled, cache the output of this command.
|
||||||
@ -468,6 +458,7 @@ public static class FFmpegWrapper
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fingerprint a queued episode.
|
/// Fingerprint a queued episode.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user