summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-11-19 21:55:44 +0000
committersr55 <[email protected]>2013-11-19 21:55:44 +0000
commitf83ab26ab8e1d2ce277f0c12f23b5753bf63d763 (patch)
treef59a860b5a06effcdccc57dfa83629d171536864 /win/CS/HandBrake.ApplicationServices/Services
parentca8fe7c1fe8abf869d4c53e31124c5f0b1aa8dfa (diff)
WinGui: Started work on API improvements in the Application services dll. Removing the concept of user settings and replacing it with a Configuration object.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5896 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs4
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Encode.cs15
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs6
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs9
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/LibScan.cs15
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs2
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/ServerService.cs7
9 files changed, 31 insertions, 37 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index 58f67401e..f1a94a05b 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -323,13 +323,12 @@ namespace HandBrake.ApplicationServices.Services.Base
string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),
+ encodeQueueTask.Configuration.IsDvdNavDisabled,
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),
userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl);
this.logBuffer = new StringBuilder();
this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));
- this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
this.logBuffer.AppendLine();
// Clear the current Encode Logs)
@@ -346,7 +345,6 @@ namespace HandBrake.ApplicationServices.Services.Base
this.fileWriter = new StreamWriter(logFile) { AutoFlush = true };
this.fileWriter.WriteLine(header);
this.fileWriter.WriteLine(string.Format("CLI Query: {0}", query));
- this.fileWriter.WriteLine(string.Format("User Query: {0}", encodeQueueTask.CustomQuery));
this.fileWriter.WriteLine();
}
catch (Exception)
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
index 5ad95d08e..08394b88c 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs
@@ -96,10 +96,7 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="encodeQueueTask">
/// The encodeQueueTask.
/// </param>
- /// <param name="enableLogging">
- /// Enable Logging. When Disabled we onlt parse Standard Ouput for progress info. Standard Error log data is ignored.
- /// </param>
- public void Start(QueueTask encodeQueueTask, bool enableLogging)
+ public void Start(QueueTask encodeQueueTask)
{
try
{
@@ -111,7 +108,7 @@ namespace HandBrake.ApplicationServices.Services
this.IsEncoding = true;
this.currentTask = encodeQueueTask;
- if (enableLogging)
+ if (encodeQueueTask.Configuration.IsLoggingEnabled)
{
try
{
@@ -137,12 +134,12 @@ namespace HandBrake.ApplicationServices.Services
this.currentTask.Task.PreviewEncodeStartAt,
userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),
+ encodeQueueTask.Configuration.IsDvdNavDisabled,
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding))
: QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),
+ encodeQueueTask.Configuration.IsDvdNavDisabled,
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),
userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl);
@@ -150,7 +147,7 @@ namespace HandBrake.ApplicationServices.Services
ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query)
{
RedirectStandardOutput = true,
- RedirectStandardError = enableLogging,
+ RedirectStandardError = encodeQueueTask.Configuration.IsLoggingEnabled,
UseShellExecute = false,
CreateNoWindow = true
};
@@ -161,7 +158,7 @@ namespace HandBrake.ApplicationServices.Services
this.startTime = DateTime.Now;
- if (enableLogging)
+ if (encodeQueueTask.Configuration.IsLoggingEnabled)
{
this.HbProcess.ErrorDataReceived += this.HbProcErrorDataReceived;
this.HbProcess.BeginErrorReadLine();
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
index 8d70247f7..17cf2e7f8 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IEncode.cs
@@ -82,10 +82,7 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="job">
/// The job.
/// </param>
- /// <param name="enableLogging">
- /// The enable Logging.
- /// </param>
- void Start(QueueTask job, bool enableLogging);
+ void Start(QueueTask job);
/// <summary>
/// The pause.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
index 785728582..d1049ba49 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IScan.cs
@@ -12,6 +12,7 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
using System;
using HandBrake.ApplicationServices.EventArgs;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Parsing;
/// <summary>
@@ -87,7 +88,10 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="postAction">
/// The post Action.
/// </param>
- void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction);
+ /// <param name="configuration">
+ /// The configuraiton.
+ /// </param>
+ void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction, HBConfiguration configuration);
/// <summary>
/// Kill the scan
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs
index 9aa1f1cb7..9351ab03d 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Interfaces/IServerService.cs
@@ -54,11 +54,8 @@ namespace HandBrake.ApplicationServices.Services.Interfaces
/// <param name="job">
/// The job.
/// </param>
- /// <param name="enableLogging">
- /// The enable logging.
- /// </param>
[OperationContract]
- void StartEncode(QueueTask job, bool enableLogging);
+ void StartEncode(QueueTask job);
/// <summary>
/// The process encode logs.
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
index f6da448ac..744bbc890 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibEncode.cs
@@ -95,14 +95,11 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="job">
/// The job.
/// </param>
- /// <param name="enableLogging">
- /// The enable Logging.
- /// </param>
- public void Start(QueueTask job, bool enableLogging)
+ public void Start(QueueTask job)
{
// Setup
this.startTime = DateTime.Now;
- this.loggingEnabled = enableLogging;
+ this.loggingEnabled = job.Configuration.IsLoggingEnabled;
this.currentTask = job;
// Create a new HandBrake instance
@@ -123,7 +120,7 @@ namespace HandBrake.ApplicationServices.Services
this.IsEncoding = true;
// Enable logging if required.
- if (enableLogging)
+ if (job.Configuration.IsLoggingEnabled)
{
try
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
index 7064cc643..6a372f228 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs
@@ -15,6 +15,7 @@ namespace HandBrake.ApplicationServices.Services
using System.Text;
using HandBrake.ApplicationServices.EventArgs;
+ using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Interfaces;
@@ -175,7 +176,10 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="postAction">
/// The post Action.
/// </param>
- public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction)
+ /// <param name="configuraiton">
+ /// The configuraiton.
+ /// </param>
+ public void Scan(string sourcePath, int title, int previewCount, Action<bool> postAction, HBConfiguration configuraiton)
{
// Try to cleanup any previous scan instances.
if (instance != null)
@@ -223,7 +227,7 @@ namespace HandBrake.ApplicationServices.Services
instance.ScanCompleted += this.InstanceScanCompleted;
// Start the scan on a back
- this.ScanSource(sourcePath, title, previewCount);
+ this.ScanSource(sourcePath, title, previewCount, configuraiton);
}
/// <summary>
@@ -263,7 +267,10 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="previewCount">
/// The preview Count.
/// </param>
- private void ScanSource(object sourcePath, int title, int previewCount)
+ /// <param name="configuraiton">
+ /// The configuraiton.
+ /// </param>
+ private void ScanSource(object sourcePath, int title, int previewCount, HBConfiguration configuraiton)
{
try
{
@@ -281,7 +288,7 @@ namespace HandBrake.ApplicationServices.Services
TimeSpan.FromSeconds(
this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration));
- HandBrakeUtils.SetDvdNav(!this.userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav));
+ HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled);
this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0);
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
index d80a485ec..eb173c5b3 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
@@ -581,7 +581,7 @@ namespace HandBrake.ApplicationServices.Services
if (job != null)
{
this.InvokeJobProcessingStarted(new QueueProgressEventArgs(job));
- this.EncodeService.Start(job, true);
+ this.EncodeService.Start(job);
}
else
{
diff --git a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs b/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
index ab0acd596..0fd2ef4b1 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/ServerService.cs
@@ -115,16 +115,13 @@ namespace HandBrake.ApplicationServices.Services
/// <param name="job">
/// The job.
/// </param>
- /// <param name="enableLogging">
- /// The enable logging.
- /// </param>
- public void StartEncode(QueueTask job, bool enableLogging)
+ public void StartEncode(QueueTask job)
{
Console.WriteLine("Starting Source Encode for: " + job.Task.Source);
encodeService.EncodeCompleted += this.EncodeServiceEncodeCompleted;
encodeService.EncodeStarted += this.encodeService_EncodeStarted;
encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;
- encodeService.Start(job, enableLogging);
+ encodeService.Start(job);
}
/// <summary>