// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The hand brake instance manager. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.Interop { using System; using HandBrake.Interop.Interfaces; /// /// The HandBrake Instance manager. /// Only supports scanning right now. /// public static class HandBrakeInstanceManager { private static HandBrakeInstance scanInstance; private static HandBrakeInstance encodeInstance; /// /// Gets the scanInstance. /// /// /// The verbosity. /// /// /// The . /// public static IHandBrakeInstance GetScanInstance(int verbosity) { if (scanInstance != null) { scanInstance.Dispose(); scanInstance = null; } HandBrakeInstance newInstance = new HandBrakeInstance(); newInstance.Initialize(verbosity); scanInstance = newInstance; return scanInstance; } /// /// The get encode instance. /// /// /// The verbosity. /// /// /// The . /// public static IHandBrakeInstance GetEncodeInstance(int verbosity) { if (encodeInstance != null) { encodeInstance.Dispose(); encodeInstance = null; } HandBrakeInstance newInstance = new HandBrakeInstance(); newInstance.Initialize(verbosity); encodeInstance = newInstance; return encodeInstance; } /// /// Gets the last scan scan instance. /// public static IHandBrakeInstance LastScanScanInstance { get { return scanInstance; } } /// /// Gets the handle. /// internal static IntPtr LastScanHandle { get { return scanInstance.Handle; } } /// /// Gets the last encode scan instance. /// public static IHandBrakeInstance LastEncodeScanInstance { get { return encodeInstance; } } /// /// Gets the encode handle. /// internal static IntPtr LastEncodeHandle { get { return encodeInstance.Handle; } } } }