mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
removed native code from media encoder
This commit is contained in:
parent
b4984a78fd
commit
1da4e55d51
@ -11,7 +11,6 @@ using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -74,10 +73,6 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||
Version = version;
|
||||
FFProbePath = ffProbePath;
|
||||
FFMpegPath = ffMpegPath;
|
||||
|
||||
// Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes
|
||||
SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT |
|
||||
ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -994,44 +989,6 @@ namespace MediaBrowser.Server.Implementations.MediaEncoder
|
||||
{
|
||||
_videoImageResourcePool.Dispose();
|
||||
}
|
||||
|
||||
SetErrorMode(ErrorModes.SYSTEM_DEFAULT);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the error mode.
|
||||
/// </summary>
|
||||
/// <param name="uMode">The u mode.</param>
|
||||
/// <returns>ErrorModes.</returns>
|
||||
[DllImport("kernel32.dll")]
|
||||
static extern ErrorModes SetErrorMode(ErrorModes uMode);
|
||||
|
||||
/// <summary>
|
||||
/// Enum ErrorModes
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ErrorModes : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// The SYSTE m_ DEFAULT
|
||||
/// </summary>
|
||||
SYSTEM_DEFAULT = 0x0,
|
||||
/// <summary>
|
||||
/// The SE m_ FAILCRITICALERRORS
|
||||
/// </summary>
|
||||
SEM_FAILCRITICALERRORS = 0x0001,
|
||||
/// <summary>
|
||||
/// The SE m_ NOALIGNMENTFAULTEXCEPT
|
||||
/// </summary>
|
||||
SEM_NOALIGNMENTFAULTEXCEPT = 0x0004,
|
||||
/// <summary>
|
||||
/// The SE m_ NOGPFAULTERRORBOX
|
||||
/// </summary>
|
||||
SEM_NOGPFAULTERRORBOX = 0x0002,
|
||||
/// <summary>
|
||||
/// The SE m_ NOOPENFILEERRORBOX
|
||||
/// </summary>
|
||||
SEM_NOOPENFILEERRORBOX = 0x8000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
using MediaBrowser.Common.Constants;
|
||||
using System.Runtime.InteropServices;
|
||||
using MediaBrowser.Common.Constants;
|
||||
using MediaBrowser.Common.Implementations.Logging;
|
||||
using MediaBrowser.Common.Implementations.Updates;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Implementations;
|
||||
using MediaBrowser.ServerApplication.Native;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
@ -183,6 +185,7 @@ namespace MediaBrowser.ServerApplication
|
||||
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager, bool runService)
|
||||
{
|
||||
SystemEvents.SessionEnding += SystemEvents_SessionEnding;
|
||||
SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
|
||||
|
||||
_appHost = new ApplicationHost(appPaths, logManager);
|
||||
|
||||
@ -192,10 +195,24 @@ namespace MediaBrowser.ServerApplication
|
||||
{
|
||||
_app.AppStarted += (sender, args) => StartService(logManager);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not crazy about this but it's the only way to suppress ffmpeg crash dialog boxes
|
||||
SetErrorMode(ErrorModes.SEM_FAILCRITICALERRORS | ErrorModes.SEM_NOALIGNMENTFAULTEXCEPT |
|
||||
ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
|
||||
}
|
||||
|
||||
_app.Run();
|
||||
}
|
||||
|
||||
static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
|
||||
{
|
||||
if (e.Reason == SessionSwitchReason.SessionLogon)
|
||||
{
|
||||
BrowserLauncher.OpenDashboard(_appHost.UserManager, _appHost.ServerConfigurationManager, _appHost, _logger);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the service.
|
||||
/// </summary>
|
||||
@ -224,6 +241,11 @@ namespace MediaBrowser.ServerApplication
|
||||
|
||||
_appHost.Dispose();
|
||||
|
||||
if (!_isRunningAsService)
|
||||
{
|
||||
SetErrorMode(ErrorModes.SYSTEM_DEFAULT);
|
||||
}
|
||||
|
||||
if (_isRestarting)
|
||||
{
|
||||
using (var process = Process.Start("cmd", "/c net start " + BackgroundService.Name))
|
||||
@ -465,5 +487,41 @@ namespace MediaBrowser.ServerApplication
|
||||
service.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the error mode.
|
||||
/// </summary>
|
||||
/// <param name="uMode">The u mode.</param>
|
||||
/// <returns>ErrorModes.</returns>
|
||||
[DllImport("kernel32.dll")]
|
||||
static extern ErrorModes SetErrorMode(ErrorModes uMode);
|
||||
|
||||
/// <summary>
|
||||
/// Enum ErrorModes
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum ErrorModes : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// The SYSTE m_ DEFAULT
|
||||
/// </summary>
|
||||
SYSTEM_DEFAULT = 0x0,
|
||||
/// <summary>
|
||||
/// The SE m_ FAILCRITICALERRORS
|
||||
/// </summary>
|
||||
SEM_FAILCRITICALERRORS = 0x0001,
|
||||
/// <summary>
|
||||
/// The SE m_ NOALIGNMENTFAULTEXCEPT
|
||||
/// </summary>
|
||||
SEM_NOALIGNMENTFAULTEXCEPT = 0x0004,
|
||||
/// <summary>
|
||||
/// The SE m_ NOGPFAULTERRORBOX
|
||||
/// </summary>
|
||||
SEM_NOGPFAULTERRORBOX = 0x0002,
|
||||
/// <summary>
|
||||
/// The SE m_ NOOPENFILEERRORBOX
|
||||
/// </summary>
|
||||
SEM_NOOPENFILEERRORBOX = 0x8000
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user