summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs')
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs17
1 files changed, 14 insertions, 3 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
index 98eb6071b..72352478c 100644
--- a/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
@@ -15,9 +15,12 @@ namespace HandBrake.Interop.Interop
using System.Runtime.InteropServices;
using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces;
using HandBrake.Interop.Interop.Helpers;
using HandBrake.Interop.Interop.Json.Presets;
using HandBrake.Interop.Interop.Model;
+ using HandBrake.Interop.Interop.Providers;
+ using HandBrake.Interop.Interop.Providers.Interfaces;
using Newtonsoft.Json;
@@ -26,6 +29,14 @@ namespace HandBrake.Interop.Interop
/// </summary>
public class HandBrakePresetService
{
+ private static IHbFunctions hbFunctions;
+
+ static HandBrakePresetService()
+ {
+ IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider();
+ hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper();
+ }
+
/// <summary>
/// The get built in presets.
/// Requires an hb_init to have been invoked.
@@ -35,7 +46,7 @@ namespace HandBrake.Interop.Interop
/// </returns>
public static IList<PresetCategory> GetBuiltInPresets()
{
- IntPtr presets = HBFunctions.hb_presets_builtin_get_json();
+ IntPtr presets = hbFunctions.hb_presets_builtin_get_json();
string presetJson = Marshal.PtrToStringAnsi(presets);
IList<PresetCategory> presetList = JsonConvert.DeserializeObject<IList<PresetCategory>>(presetJson);
@@ -53,7 +64,7 @@ namespace HandBrake.Interop.Interop
/// </returns>
public static PresetTransportContainer GetPresetsFromFile(string filename)
{
- IntPtr presetStringPointer = HBFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename));
+ IntPtr presetStringPointer = hbFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename));
string presetJson = Marshal.PtrToStringAnsi(presetStringPointer);
if (!string.IsNullOrEmpty(presetJson))
@@ -96,7 +107,7 @@ namespace HandBrake.Interop.Interop
IntPtr minor = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));
IntPtr micro = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int)));
- HBFunctions.hb_presets_current_version(major, minor, micro);
+ hbFunctions.hb_presets_current_version(major, minor, micro);
int majorVersion = Marshal.ReadInt32(major);
int minorVersion = Marshal.ReadInt32(minor);