// --------------------------------------------------------------------------------------------------------------------
//
// 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 HandBrakeWPF.Instance
{
using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.Interfaces;
using HandBrake.Interop.Model;
///
/// The HandBrake Instance manager.
/// Only supports scanning right now.
///
public static class HandBrakeInstanceManager
{
private static IEncodeInstance encodeInstance;
///
/// Initializes static members of the class.
///
static HandBrakeInstanceManager()
{
}
///
/// The init.
///
public static void Init()
{
// Nothing to do. Triggers static constructor.
}
///
/// The get encode instance.
///
///
/// The verbosity.
///
///
/// The configuratio.
///
///
/// The .
///
public static IEncodeInstance GetEncodeInstance(int verbosity, HBConfiguration configuration)
{
if (encodeInstance != null)
{
encodeInstance.Dispose();
encodeInstance = null;
}
IEncodeInstance newInstance;
if (configuration.RemoteServiceEnabled)
{
newInstance = new RemoteInstance(configuration.RemoteServicePort);
}
else
{
newInstance = new HandBrakeInstance();
}
newInstance.Initialize(verbosity);
encodeInstance = newInstance;
HandBrakeUtils.SetDvdNav(!configuration.IsDvdNavDisabled);
return encodeInstance;
}
}
}