summaryrefslogtreecommitdiffstats
path: root/win
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
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')
-rw-r--r--win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs5
-rw-r--r--win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj1
-rw-r--r--win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs7
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs27
-rw-r--r--win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs29
-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
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs54
-rw-r--r--win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs58
-rw-r--r--win/CS/HandBrakeWPF/HandBrakeWPF.csproj1
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs7
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs5
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs15
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs9
23 files changed, 190 insertions, 104 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
index f5ca3bef5..a03bf58d9 100644
--- a/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
+++ b/win/CS/HandBrake.ApplicationServices/ASUserSettingConstants.cs
@@ -45,11 +45,6 @@ namespace HandBrake.ApplicationServices
public const string HandBrakeBuild = "HandBrakeBuild";
/// <summary>
- /// Disable Libdvdnav
- /// </summary>
- public const string DisableLibDvdNav = "DisableLibDvdNav";
-
- /// <summary>
/// Min Title Scan Duration
/// </summary>
public const string MinScanDuration = "MinTitleScanDuration";
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
index 473ae6893..e9386ac37 100644
--- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
+++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj
@@ -97,6 +97,7 @@
<Compile Include="Isolation\BackgroundServiceConnector.cs" />
<Compile Include="Isolation\IsolatedEncodeService.cs" />
<Compile Include="LibHb\AudioVideoHelpers.cs" />
+ <Compile Include="Model\HBConfiguration.cs" />
<Compile Include="Model\VideoScaler.cs" />
<Compile Include="Services\Interfaces\IEncodeServiceWrapper.cs" />
<Compile Include="Services\Interfaces\IHbServiceCallback.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
index 2f29d7054..bc31544a4 100644
--- a/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
+++ b/win/CS/HandBrake.ApplicationServices/Isolation/IsolatedEncodeService.cs
@@ -173,13 +173,10 @@ namespace HandBrake.ApplicationServices.Isolation
/// <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)
{
ThreadPool.QueueUserWorkItem(
- delegate { this.Service.StartEncode(job, enableLogging); });
+ delegate { this.Service.StartEncode(job); });
}
/// <summary>
diff --git a/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs b/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs
new file mode 100644
index 000000000..35d07dcfc
--- /dev/null
+++ b/win/CS/HandBrake.ApplicationServices/Model/HBConfiguration.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBConfiguration.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// HandBrakes Configuration options
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Model
+{
+ /// <summary>
+ /// HandBrakes configuration options
+ /// </summary>
+ public class HBConfiguration
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether is logging enabled.
+ /// </summary>
+ public bool IsLoggingEnabled { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether is dvd nav disabled.
+ /// </summary>
+ public bool IsDvdNavDisabled { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs
index 84e9eee9f..68f32011a 100644
--- a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs
+++ b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs
@@ -38,14 +38,25 @@ namespace HandBrake.ApplicationServices.Model
}
/// <summary>
- /// Gets or sets ScannedSource.
+ /// Initializes a new instance of the <see cref="QueueTask"/> class.
/// </summary>
- public Source ScannedSource { get; set; }
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
+ public QueueTask(EncodeTask task, HBConfiguration configuration)
+ {
+ this.Task = task;
+ this.Configuration = configuration;
+ this.Status = QueueItemStatus.Waiting;
+ }
/// <summary>
- /// Gets or sets a value indicating whether if this is a user or GUI generated query
+ /// Gets or sets ScannedSource.
/// </summary>
- public bool CustomQuery { get; set; }
+ public Source ScannedSource { get; set; }
/// <summary>
/// Gets or sets Status.
@@ -65,10 +76,15 @@ namespace HandBrake.ApplicationServices.Model
}
/// <summary>
- /// Gets or sets the Encode Task.
+ /// Gets the task.
/// </summary>
public EncodeTask Task { get; set; }
+ /// <summary>
+ /// Gets the configuration.
+ /// </summary>
+ public HBConfiguration Configuration { get; set; }
+
#endregion
/// <summary>
@@ -82,7 +98,7 @@ namespace HandBrake.ApplicationServices.Model
/// </returns>
protected bool Equals(QueueTask other)
{
- return Equals(this.ScannedSource, other.ScannedSource) && this.CustomQuery.Equals(other.CustomQuery) && Equals(this.Task, other.Task) && this.status == other.status;
+ return Equals(this.ScannedSource, other.ScannedSource) && Equals(this.Task, other.Task) && this.status == other.status;
}
/// <summary>
@@ -125,7 +141,6 @@ namespace HandBrake.ApplicationServices.Model
unchecked
{
int hashCode = (this.ScannedSource != null ? this.ScannedSource.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ this.CustomQuery.GetHashCode();
hashCode = (hashCode * 397) ^ (this.Task != null ? this.Task.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (int)this.status;
return hashCode;
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>
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
index 5dee88426..30c1e9eb7 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/QueryGeneratorUtility.cs
@@ -957,24 +957,24 @@ namespace HandBrake.ApplicationServices.Utilities
{
query += string.Format(" -x {0}", task.ExtraAdvancedArguments);
}
- }
- }
-
- // QSV Only
- if (task.VideoEncoder == VideoEncoder.QuickSync)
- {
- query += string.Format(" --qsv-preset={0}", task.QsvPreset.ToString().ToLower());
- }
-
- // options that apply to all encoders
- if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))
- {
- query += string.Format(" -x {0}", task.AdvancedEncoderOptions);
- }
-
- // Options that apply to both x264 and QuickSync
- if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)
- {
+ }
+ }
+
+ // QSV Only
+ if (task.VideoEncoder == VideoEncoder.QuickSync)
+ {
+ query += string.Format(" --qsv-preset={0}", task.QsvPreset.ToString().ToLower());
+ }
+
+ // options that apply to all encoders
+ if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))
+ {
+ query += string.Format(" -x {0}", task.AdvancedEncoderOptions);
+ }
+
+ // Options that apply to both x264 and QuickSync
+ if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)
+ {
// when using x264 with the advanced panel, the H.264 profile/level widgets are disabled
if (!(task.VideoEncoder == VideoEncoder.X264 && task.ShowAdvancedTab))
{
@@ -985,15 +985,15 @@ namespace HandBrake.ApplicationServices.Utilities
if (task.H264Profile != x264Profile.None)
{
query += string.Format(
- " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));
- }
- }
- }
-
- return query;
- }
-
- /// <summary>
+ " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));
+ }
+ }
+ }
+
+ return query;
+ }
+
+ /// <summary>
/// Generate the Command Line Arguments for any additional advanced options.
/// </summary>
/// <param name="verbosity">
diff --git a/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
new file mode 100644
index 000000000..8c353bbdb
--- /dev/null
+++ b/win/CS/HandBrakeWPF/Factories/HBConfigurationFactory.cs
@@ -0,0 +1,58 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBConfigurationFactory.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// HBConfiguration Factory
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Factories
+{
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Services.Interfaces;
+
+ /// <summary>
+ /// HBConfiguration Factory
+ /// </summary>
+ public class HBConfigurationFactory
+ {
+ /// <summary>
+ /// The user setting service.
+ /// </summary>
+ private static readonly IUserSettingService UserSettingService = IoC.Get<IUserSettingService>();
+
+ /// <summary>
+ /// The create.
+ /// </summary>
+ /// <param name="isLoggingEnabled">
+ /// The is logging enabled.
+ /// </param>
+ /// <returns>
+ /// The <see cref="HBConfiguration"/>.
+ /// </returns>
+ public static HBConfiguration Create(bool isLoggingEnabled)
+ {
+ HBConfiguration config = new HBConfiguration
+ {
+ IsDvdNavDisabled = UserSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav),
+ IsLoggingEnabled = isLoggingEnabled
+ };
+
+ return config;
+ }
+
+ /// <summary>
+ /// The create.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="HBConfiguration"/>.
+ /// </returns>
+ public static HBConfiguration Create()
+ {
+ return Create(true);
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
index 44296ceee..d6eb10641 100644
--- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
+++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj
@@ -140,6 +140,7 @@
<Compile Include="Constants.cs" />
<Compile Include="Controls\SplitButton\SplitMenuButton.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
+ <Compile Include="Factories\HBConfigurationFactory.cs" />
<Compile Include="ViewModels\CountdownAlertViewModel.cs" />
<Compile Include="ViewModels\Interfaces\ICountdownAlertViewModel.cs" />
<Compile Include="Views\CountdownAlertView.xaml.cs">
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
index 1fe1a448e..c7247a7c7 100644
--- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
+++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
@@ -187,12 +187,9 @@ namespace HandBrakeWPF.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)
{
- this.encodeService.Start(job, enableLogging);
+ this.encodeService.Start(job);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index 14b712ddf..ac876e6bf 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -246,6 +246,11 @@ namespace HandBrakeWPF
/// </summary>
public const string AddForeignAudioScanTrack = "AddForeignAudioScanTrack";
+ /// <summary>
+ /// The disable lib dvd nav.
+ /// </summary>
+ public const string DisableLibDvdNav = "DisableLibDvdNav";
+
#endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
index c99fb1c51..15c5df127 100644
--- a/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/InstantViewModel.cs
@@ -29,6 +29,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Factories;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Interfaces;
@@ -777,7 +778,8 @@ namespace HandBrakeWPF.ViewModels
filename,
title,
this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
- null);
+ null,
+ HBConfigurationFactory.Create());
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
index e4e938be7..68e4077d7 100644
--- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs
@@ -31,6 +31,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Factories;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Model;
using HandBrakeWPF.Properties;
@@ -1087,7 +1088,7 @@ namespace HandBrakeWPF.ViewModels
return;
}
- QueueTask task = new QueueTask { Task = new EncodeTask(this.CurrentTask) };
+ QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());
if (!this.queueProcessor.CheckForDestinationPathDuplicates(task.Task.Destination))
{
this.queueProcessor.Add(task);
@@ -1284,11 +1285,7 @@ namespace HandBrakeWPF.ViewModels
}
// Create the Queue Task and Start Processing
- QueueTask task = new QueueTask
- {
- Task = new EncodeTask(this.CurrentTask),
- CustomQuery = false
- };
+ QueueTask task = new QueueTask(new EncodeTask(this.CurrentTask), HBConfigurationFactory.Create());
this.queueProcessor.Add(task);
this.queueProcessor.Start();
this.IsEncoding = true;
@@ -1304,7 +1301,7 @@ namespace HandBrakeWPF.ViewModels
{
// Rescan the source to make sure it's still valid
this.queueEditTask = task;
- this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction);
+ this.scanService.Scan(task.Source, task.Title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), QueueEditAction, HBConfigurationFactory.Create());
}
/// <summary>
@@ -1341,7 +1338,7 @@ namespace HandBrakeWPF.ViewModels
QueryGeneratorUtility.GenerateQuery(this.CurrentTask,
userSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount),
userSettingService.GetUserSetting<int>(ASUserSettingConstants.Verbosity),
- userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav),
+ HBConfigurationFactory.Create().IsDvdNavDisabled,
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableQuickSyncDecoding),
userSettingService.GetUserSetting<bool>(ASUserSettingConstants.EnableDxva),
userSettingService.GetUserSetting<VideoScaler>(ASUserSettingConstants.ScalingMode) == VideoScaler.BicubicCl),
@@ -1630,7 +1627,7 @@ namespace HandBrakeWPF.ViewModels
{
if (!string.IsNullOrEmpty(filename))
{
- this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null);
+ this.scanService.Scan(filename, title, this.UserSettingService.GetUserSetting<int>(ASUserSettingConstants.PreviewScanCount), null, HBConfigurationFactory.Create());
}
}
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 19d42918a..fd7f0920c 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1982,7 +1982,7 @@ namespace HandBrakeWPF.ViewModels
this.MinLength = this.userSettingService.GetUserSetting<int>(ASUserSettingConstants.MinScanDuration);
// Use dvdnav
- this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(ASUserSettingConstants.DisableLibDvdNav);
+ this.DisableLibdvdNav = userSettingService.GetUserSetting<bool>(UserSettingConstants.DisableLibDvdNav);
int port;
int.TryParse(userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort), out port);
@@ -2064,7 +2064,7 @@ namespace HandBrakeWPF.ViewModels
this.userSettingService.SetUserSetting(ASUserSettingConstants.MinScanDuration, value);
}
- userSettingService.SetUserSetting(ASUserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);
+ userSettingService.SetUserSetting(UserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);
userSettingService.SetUserSetting(UserSettingConstants.EnableProcessIsolation, this.EnableProcessIsolation);
userSettingService.SetUserSetting(UserSettingConstants.ServerPort, this.ServerPort.ToString(CultureInfo.InvariantCulture));
userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, this.EnableLibHb);
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
index 39bc48090..9aba8e442 100644
--- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs
@@ -22,6 +22,7 @@ namespace HandBrakeWPF.ViewModels
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrakeWPF.Factories;
using HandBrakeWPF.Services;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -300,11 +301,7 @@ namespace HandBrakeWPF.ViewModels
encodeTask.IsPreviewEncode = true;
encodeTask.PreviewEncodeStartAt = this.StartAt.ToString(CultureInfo.InvariantCulture);
encodeTask.PreviewEncodeDuration = this.Duration;
- QueueTask task = new QueueTask
- {
- Task = encodeTask,
- };
-
+ QueueTask task = new QueueTask(encodeTask, HBConfigurationFactory.Create(false));
ThreadPool.QueueUserWorkItem(this.CreatePreview, task);
}
@@ -389,7 +386,7 @@ namespace HandBrakeWPF.ViewModels
this.encodeService.EncodeCompleted += this.encodeService_EncodeCompleted;
this.encodeService.EncodeStatusChanged += this.encodeService_EncodeStatusChanged;
- this.encodeService.Start((QueueTask)state, false);
+ this.encodeService.Start((QueueTask)state);
this.userSettingService.SetUserSetting(UserSettingConstants.LastPreviewDuration, this.Duration);
}
#endregion