summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs')
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs29
1 files changed, 21 insertions, 8 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs
index 653cbcd64..2b5418212 100644
--- a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs
@@ -41,8 +41,10 @@ namespace HandBrake.Interop.Interop
/// True if the global initialize function has been called.
/// </summary>
private static bool globalInitialized;
-
- private static bool initSuccess = false;
+
+ /// <summary>
+ /// True if we initialized without hardware support.
+ /// </summary>
private static bool initNoHardware = false;
/// <summary>
@@ -64,7 +66,8 @@ namespace HandBrake.Interop.Interop
public static void EnsureGlobalInit(bool initNoHardwareMode)
{
if (!globalInitialized)
- {
+ {
+ bool initSuccess;
try
{
if (initNoHardwareMode)
@@ -89,11 +92,13 @@ namespace HandBrake.Interop.Interop
// Try without Hardware support. Bad drivers can sometimes cause issues.
if (!initSuccess)
- {
+ {
if (HBFunctions.hb_global_init_no_hardware() == -1)
{
throw new InvalidOperationException("HB global init failed.");
- }
+ }
+
+ initNoHardware = true;
}
globalInitialized = true;
@@ -345,12 +350,20 @@ namespace HandBrake.Interop.Interop
{
ErrorLogged?.Invoke(null, new MessageLoggedEventArgs(message));
}
-
+
+ /// <summary>
+ /// Returns true if we have successfully run global initialization.
+ /// </summary>
+ /// <returns>True if we have successfully run global initialization.</returns>
public static bool IsInitialised()
{
- return initSuccess;
+ return globalInitialized;
}
-
+
+ /// <summary>
+ /// Returns true if we initialized without hardware support.
+ /// </summary>
+ /// <returns>True if we initialized without hardware support.</returns>
public static bool IsInitNoHardware()
{
return initNoHardware;