diff options
Diffstat (limited to 'win/CS')
11 files changed, 38 insertions, 48 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs index 6ed3bf2e1..cdd436b03 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/EncodeTask.cs @@ -460,6 +460,7 @@ namespace HandBrake.ApplicationServices.Model /// Gets or sets Duration.
/// </summary>
public int? PreviewDuration { get; set; }
+
#endregion
#region Helpers
@@ -484,6 +485,21 @@ namespace HandBrake.ApplicationServices.Model return false;
}
}
+
+ /// <summary>
+ /// Gets or sets a value indicating whether IsPreviewEncode.
+ /// </summary>
+ public bool IsPreviewEncode { get; set; }
+
+ /// <summary>
+ /// Gets or sets PreviewEncodeDuration.
+ /// </summary>
+ public int PreviewEncodeDuration { get; set; }
+
+ /// <summary>
+ /// Gets or sets PreviewEncodeStartAt.
+ /// </summary>
+ public string PreviewEncodeStartAt { get; set; }
#endregion
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs index a62115109..0e06ca5c6 100644 --- a/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Model/QueueTask.cs @@ -25,32 +25,6 @@ namespace HandBrake.ApplicationServices.Model #endregion
- #region Constructors and Destructors
-
- /// <summary>
- /// Initializes a new instance of the <see cref="QueueTask"/> class.
- /// </summary>
- public QueueTask()
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="QueueTask"/> class.
- /// </summary>
- /// <param name="query">
- /// The query.
- /// </param>
- public QueueTask(string query)
- {
- this.Query = query;
- if (this.Task == null)
- {
- this.Task = new EncodeTask();
- }
- }
-
- #endregion
-
#region Properties
/// <summary>
@@ -59,11 +33,6 @@ namespace HandBrake.ApplicationServices.Model public bool CustomQuery { get; set; }
/// <summary>
- /// Gets or sets the query string.
- /// </summary>
- public string Query { get; set; }
-
- /// <summary>
/// Gets or sets Status.
/// </summary>
public QueueItemStatus Status
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs index 537a97d71..e04c4e830 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs @@ -257,8 +257,9 @@ namespace HandBrake.ApplicationServices.Services.Base try
{
+ string query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(encodeQueueTask.Task));
this.logBuffer = new StringBuilder();
- this.logBuffer.AppendLine(String.Format("CLI Query: {0}", encodeQueueTask.Query));
+ this.logBuffer.AppendLine(String.Format("CLI Query: {0}", query));
this.logBuffer.AppendLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
this.logBuffer.AppendLine();
@@ -275,7 +276,7 @@ namespace HandBrake.ApplicationServices.Services.Base this.fileWriter = new StreamWriter(logFile) { AutoFlush = true };
this.fileWriter.WriteLine(GeneralUtilities.CreateCliLogHeader());
- this.fileWriter.WriteLine(String.Format("CLI Query: {0}", encodeQueueTask.Query));
+ this.fileWriter.WriteLine(String.Format("CLI Query: {0}", query));
this.fileWriter.WriteLine(String.Format("User Query: {0}", encodeQueueTask.CustomQuery));
this.fileWriter.WriteLine();
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs index 8c04d5a3b..7553456d5 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode.cs @@ -21,6 +21,7 @@ namespace HandBrake.ApplicationServices.Services using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services.Base;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.ApplicationServices.Utilities;
/// <summary>
/// Class which handles the CLI
@@ -120,7 +121,16 @@ namespace HandBrake.ApplicationServices.Services this.VerifyEncodeDestinationPath(currentTask);
string handbrakeCLIPath = Path.Combine(Application.StartupPath, "HandBrakeCLI.exe");
- ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, currentTask.Query)
+
+ // TODO tidy this code up, it's kinda messy.
+ string query = this.currentTask.Task.IsPreviewEncode
+ ? QueryGeneratorUtility.GeneratePreviewQuery(
+ new EncodeTask(this.currentTask.Task),
+ this.currentTask.Task.PreviewEncodeDuration,
+ this.currentTask.Task.PreviewEncodeStartAt)
+ : QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.currentTask.Task));
+
+ ProcessStartInfo cliStart = new ProcessStartInfo(handbrakeCLIPath, query)
{
RedirectStandardOutput = true,
RedirectStandardError = enableLogging ? true : false,
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs index 0d3a40e7f..8464ffed2 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/QueueManager.cs @@ -23,6 +23,7 @@ namespace HandBrake.ApplicationServices.Services using HandBrake.ApplicationServices.Exceptions;
using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Interfaces;
+ using HandBrake.ApplicationServices.Utilities;
using EventArgs = System.EventArgs;
@@ -392,7 +393,7 @@ namespace HandBrake.ApplicationServices.Services string queries = string.Empty;
foreach (QueueTask queueItem in this.queue)
{
- string qItem = queueItem.Query;
+ string qItem = QueryGeneratorUtility.GenerateQuery(new EncodeTask(queueItem.Task));
string fullQuery = '"' + Application.StartupPath + "\\HandBrakeCLI.exe" + '"' + qItem;
if (queries == string.Empty)
diff --git a/win/CS/HandBrakeWPF/Installer/Installer.nsi b/win/CS/HandBrakeWPF/Installer/Installer.nsi index 9cee83635..c19c0e2ab 100644 --- a/win/CS/HandBrakeWPF/Installer/Installer.nsi +++ b/win/CS/HandBrakeWPF/Installer/Installer.nsi @@ -132,7 +132,6 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
- File "*.html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/Installer/Installer64.nsi b/win/CS/HandBrakeWPF/Installer/Installer64.nsi index 0413f60de..9e6ff4872 100644 --- a/win/CS/HandBrakeWPF/Installer/Installer64.nsi +++ b/win/CS/HandBrakeWPF/Installer/Installer64.nsi @@ -133,7 +133,6 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
- File "*.html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl b/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl index 19429202d..07b9d6240 100644 --- a/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl +++ b/win/CS/HandBrakeWPF/Installer/MakeNightly.nsi.tmpl @@ -132,7 +132,6 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
- File "*.html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl b/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl index 8dc420e38..15c35d248 100644 --- a/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl +++ b/win/CS/HandBrakeWPF/Installer/MakeNightly64.nsi.tmpl @@ -132,7 +132,6 @@ Section "Handbrake" SEC01 File "*.config"
File "*.xml"
File "*.pdb"
- File "*.html"
; Copy the standard doc set into the doc folder
SetOutPath "$INSTDIR\doc"
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index 2e9ec5e64..156fc1dfa 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -899,11 +899,7 @@ namespace HandBrakeWPF.ViewModels return;
}
- QueueTask task = new QueueTask
- {
- Task = new EncodeTask(this.CurrentTask),
- Query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.CurrentTask))
- };
+ QueueTask task = new QueueTask { Task = new EncodeTask(this.CurrentTask) };
this.queueProcessor.QueueManager.Add(task);
if (!this.IsEncoding)
@@ -1049,10 +1045,9 @@ namespace HandBrakeWPF.ViewModels }
// Create the Queue Task and Start Processing
- QueueTask task = new QueueTask(null)
+ QueueTask task = new QueueTask
{
Task = new EncodeTask(this.CurrentTask),
- Query = QueryGeneratorUtility.GenerateQuery(new EncodeTask(this.CurrentTask)),
CustomQuery = false
};
this.queueProcessor.QueueManager.Add(task);
diff --git a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs index e2efe673f..81aeb5e40 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PreviewViewModel.cs @@ -23,7 +23,6 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Model.Encoding;
using HandBrake.ApplicationServices.Services.Interfaces;
- using HandBrake.ApplicationServices.Utilities;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.ViewModels.Interfaces;
@@ -277,10 +276,13 @@ namespace HandBrakeWPF.ViewModels this.CurrentlyPlaying = encodeTask.Destination.Replace(".m", "_sample.m");
+ // Setup the encode task as a preview encode
+ encodeTask.IsPreviewEncode = true;
+ encodeTask.PreviewEncodeStartAt = this.StartAt.ToString(CultureInfo.InvariantCulture);
+ encodeTask.PreviewEncodeDuration = this.Duration;
QueueTask task = new QueueTask
{
Task = encodeTask,
- Query = QueryGeneratorUtility.GeneratePreviewQuery(encodeTask, this.Duration, this.StartAt.ToString(CultureInfo.InvariantCulture)),
};
ThreadPool.QueueUserWorkItem(this.CreatePreview, task);
|