summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-08-24 17:17:06 +0000
committersr55 <[email protected]>2013-08-24 17:17:06 +0000
commitbb5043c58b3a74fe87db12f1aaa7cbc6e2504824 (patch)
tree78a535b868dd7d8280a31752e32522fef3e53c7f /win/CS/HandBrake.ApplicationServices
parentf8e7adc789a0a426907bad279c0c6741da32aba5 (diff)
Interop: Few minor updates for QuickSync.
WinGui: Create a new instances of HandBrakeInstance for every new encode. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5746 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs46
1 files changed, 18 insertions, 28 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index d6f312e24..83e4fe5ca 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -36,7 +36,7 @@ namespace HandBrake.ApplicationServices.Services
/*
* TODO
* 1. Expose the Previews code.
- * 2. Expose the Logging.
+ * 2. Cleanup old instances.
*
*/
@@ -48,11 +48,6 @@ namespace HandBrake.ApplicationServices.Services
static readonly object LogLock = new object();
/// <summary>
- /// LibHB Instance
- /// </summary>
- private readonly IHandBrakeInstance instance;
-
- /// <summary>
/// The user setting service.
/// </summary>
private readonly IUserSettingService userSettingService;
@@ -87,28 +82,25 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
private StreamWriter scanLog;
+ /// <summary>
+ /// LibHB Instance
+ /// </summary>
+ private IHandBrakeInstance instance;
+
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="LibScan"/> class.
/// </summary>
- /// <param name="handBrakeInstance">
- /// The hand Brake Instance.
- /// </param>
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public LibScan(IHandBrakeInstance handBrakeInstance, IUserSettingService userSettingService)
+ public LibScan(IUserSettingService userSettingService)
{
logging = new StringBuilder();
header = GeneralUtilities.CreateCliLogHeader();
-
- instance = handBrakeInstance;
this.userSettingService = userSettingService;
- instance.Initialize(1);
- instance.ScanProgress += this.InstanceScanProgress;
- instance.ScanCompleted += this.InstanceScanCompleted;
HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;
HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged;
@@ -182,7 +174,6 @@ namespace HandBrake.ApplicationServices.Services
// Clear down the logging
this.logging.Clear();
-
try
{
// Make we don't pick up a stale last_scan_log_xyz.txt (and that we have rights to the file)
@@ -201,10 +192,17 @@ namespace HandBrake.ApplicationServices.Services
Directory.CreateDirectory(Path.GetDirectoryName(dvdInfoPath));
}
+ // Create a new scan log.
scanLog = new StreamWriter(dvdInfoPath);
- Thread t = new Thread(unused => this.ScanSource(sourcePath, title, previewCount));
- t.Start();
+ // Create a new HandBrake Instance.
+ instance = new HandBrakeInstance();
+ instance.Initialize(1);
+ instance.ScanProgress += this.InstanceScanProgress;
+ instance.ScanCompleted += this.InstanceScanCompleted;
+
+ // Start the scan on a back
+ this.ScanSource(sourcePath, title, previewCount);
}
/// <summary>
@@ -212,6 +210,8 @@ namespace HandBrake.ApplicationServices.Services
/// </summary>
public void Stop()
{
+ instance.StopScan();
+
try
{
if (this.scanLog != null)
@@ -224,16 +224,6 @@ namespace HandBrake.ApplicationServices.Services
{
// Do Nothing.
}
-
- instance.StopScan();
- }
-
- /// <summary>
- /// Shutdown the service.
- /// </summary>
- public void Shutdown()
- {
- // Nothing to do for this implementation.
}
#endregion