mirror of https://github.com/jellyfin/jellyfin.git
Set EnableRaisingEvents correctly for SubtitleEncoder
This commit is contained in:
parent
189b99df16
commit
0b80902cc8
|
@ -106,25 +106,22 @@ namespace Emby.Server.Implementations.Diagnostics
|
||||||
return _process.WaitForExit(timeMs);
|
return _process.WaitForExit(timeMs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Task<bool> WaitForExitAsync(int timeMs)
|
public Task<bool> WaitForExitAsync(int timeMs)
|
||||||
{
|
{
|
||||||
//if (_process.WaitForExit(100))
|
//Note: For this function to work correctly, the option EnableRisingEvents needs to be set to true.
|
||||||
//{
|
|
||||||
// return Task.FromResult(true);
|
|
||||||
//}
|
|
||||||
|
|
||||||
//timeMs -= 100;
|
|
||||||
timeMs = Math.Max(0, timeMs);
|
|
||||||
|
|
||||||
var tcs = new TaskCompletionSource<bool>();
|
|
||||||
|
|
||||||
var cancellationToken = new CancellationTokenSource(timeMs).Token;
|
|
||||||
|
|
||||||
if (HasExited)
|
if (HasExited)
|
||||||
{
|
{
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timeMs = Math.Max(0, timeMs);
|
||||||
|
|
||||||
|
var tcs = new TaskCompletionSource<bool>();
|
||||||
|
|
||||||
|
var cancellationToken = new CancellationTokenSource(timeMs).Token;
|
||||||
|
|
||||||
_process.Exited += (sender, args) => tcs.TrySetResult(true);
|
_process.Exited += (sender, args) => tcs.TrySetResult(true);
|
||||||
|
|
||||||
cancellationToken.Register(() => tcs.TrySetResult(HasExited));
|
cancellationToken.Register(() => tcs.TrySetResult(HasExited));
|
||||||
|
|
|
@ -437,7 +437,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
FileName = _mediaEncoder.EncoderPath,
|
FileName = _mediaEncoder.EncoderPath,
|
||||||
Arguments = string.Format("{0} -i \"{1}\" -c:s srt \"{2}\"", encodingParam, inputPath, outputPath),
|
Arguments = string.Format("{0} -i \"{1}\" -c:s srt \"{2}\"", encodingParam, inputPath, outputPath),
|
||||||
|
EnableRaisingEvents = true,
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
ErrorDialog = false
|
ErrorDialog = false
|
||||||
});
|
});
|
||||||
|
@ -574,7 +574,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||||
{
|
{
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
|
EnableRaisingEvents = true,
|
||||||
FileName = _mediaEncoder.EncoderPath,
|
FileName = _mediaEncoder.EncoderPath,
|
||||||
Arguments = processArgs,
|
Arguments = processArgs,
|
||||||
IsHidden = true,
|
IsHidden = true,
|
||||||
|
|
Loading…
Reference in New Issue