diff options
6 files changed, 107 insertions, 16 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs index 3c78835ae..8737ba64f 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs @@ -10,6 +10,8 @@ namespace HandBrake.ApplicationServices.Services.Encode
{
using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text;
@@ -344,7 +346,7 @@ namespace HandBrake.ApplicationServices.Services.Encode this.fileWriter.WriteLine(this.header);
if (!isLibhb)
{
- this.fileWriter.WriteLine(string.Format("CLI Query: {0}", query));
+ this.fileWriter.WriteLine("CLI Query: {0}", query);
}
this.fileWriter.WriteLine();
}
@@ -353,8 +355,12 @@ namespace HandBrake.ApplicationServices.Services.Encode {
if (this.fileWriter != null)
{
- this.fileWriter.Close();
- this.fileWriter.Dispose();
+ lock (FileWriterLock)
+ {
+ this.fileWriter.Flush();
+ this.fileWriter.Close();
+ this.fileWriter.Dispose();
+ }
}
throw;
@@ -417,6 +423,7 @@ namespace HandBrake.ApplicationServices.Services.Encode {
if (this.fileWriter != null)
{
+ this.fileWriter.Flush();
this.fileWriter.Close();
this.fileWriter.Dispose();
}
@@ -424,9 +431,9 @@ namespace HandBrake.ApplicationServices.Services.Encode this.fileWriter = null;
}
}
- catch (Exception)
+ catch (Exception exc)
{
- // This exception doesn't warrent user interaction, but it should be logged (TODO)
+ Debug.WriteLine(exc); // This exception doesn't warrent user interaction, but it should be logged
}
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs index 6bc9ed884..208f8d307 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs @@ -343,15 +343,21 @@ namespace HandBrake.ApplicationServices.Services.Encode this.IsEncoding = false;
ServiceLogMessage("Encode Completed ...");
- this.InvokeEncodeCompleted(
- e.Error
- ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Task.Destination)
- : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Task.Destination));
-
+ // Stop Logging.
HandBrakeUtils.MessageLogged -= this.HandBrakeInstanceMessageLogged;
HandBrakeUtils.ErrorLogged -= this.HandBrakeInstanceErrorLogged;
+
+ // Handling Log Data
+ this.ProcessLogs(this.currentTask.Task.Destination, this.currentTask.Configuration);
+ // Cleanup
this.ShutdownFileWriter();
+
+ // Raise the Encode Completed EVent.
+ this.InvokeEncodeCompleted(
+ e.Error
+ ? new EventArgs.EncodeCompletedEventArgs(false, null, string.Empty, this.currentTask.Task.Destination)
+ : new EventArgs.EncodeCompletedEventArgs(true, null, string.Empty, this.currentTask.Task.Destination));
}
#endregion
}
diff --git a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs index ab1b4c2cb..991b2132e 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs @@ -488,12 +488,8 @@ namespace HandBrake.ApplicationServices.Services if (!e.Successful)
{
this.LastProcessedJob.Status = QueueItemStatus.Error;
- this.Pause();
}
- // Handling Log Data
- this.EncodeService.ProcessLogs(this.LastProcessedJob.Task.Destination, this.LastProcessedJob.Configuration);
-
// Move onto the next job.
if (this.IsProcessing)
{
diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs new file mode 100644 index 000000000..a4ec4e9e5 --- /dev/null +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs @@ -0,0 +1,80 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoOptionsTooltipConverter.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>
+// The video options queue tooltip converter.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Converters.Video
+{
+ using System;
+ using System.Globalization;
+ using System.Windows.Data;
+
+ using HandBrake.ApplicationServices.Services.Encode.Model;
+ using HandBrake.ApplicationServices.Utilities;
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The x 264 queue tooltip converter.
+ /// </summary>
+ public class VideoOptionsTooltipConverter : IValueConverter
+ {
+ /// <summary>
+ /// Converts a value.
+ /// </summary>
+ /// <returns>
+ /// A converted value. If the method returns null, the valid null value is used.
+ /// </returns>
+ /// <param name="value">
+ /// The value produced by the binding source.
+ /// </param>
+ /// <param name="targetType">
+ /// The type of the binding target property.
+ /// </param>
+ /// <param name="parameter">
+ /// The converter parameter to use.
+ /// </param>
+ /// <param name="culture">
+ /// The culture to use in the converter.
+ /// </param>
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ EncodeTask task = value as EncodeTask;
+ if (task != null)
+ {
+ string rfqp = task.VideoEncoder == VideoEncoder.X264 || task.VideoEncoder == VideoEncoder.X265 ? "RF" : "QP";
+ string quality = task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality ? task.Quality + rfqp : task.VideoBitrate + " kbps";
+ string twoPass = task.TwoPass ? task.TurboFirstPass ? " (2-Pass with Turbo)" : " (2-Pass)" : string.Empty;
+ return string.Format("{0} - {1}{2}", EnumHelper<VideoEncoder>.GetDisplay(task.VideoEncoder), quality, twoPass);
+ }
+
+ return "Unknown";
+ }
+
+ /// <summary>
+ /// Converts a value.
+ /// </summary>
+ /// <returns>
+ /// A converted value. If the method returns null, the valid null value is used.
+ /// </returns>
+ /// <param name="value">
+ /// The value that is produced by the binding target.
+ /// </param>
+ /// <param name="targetType">
+ /// The type to convert to.
+ /// </param>
+ /// <param name="parameter">
+ /// The converter parameter to use.
+ /// </param>
+ /// <param name="culture">
+ /// The culture to use in the converter.
+ /// </param>
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 981226e01..3b84e37a6 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -160,6 +160,7 @@ <Compile Include="Converters\Audio\AudioBehaviourConverter.cs" />
<Compile Include="Converters\Filters\DenoisePresetConverter.cs" />
<Compile Include="Converters\Subtitles\SubtitleBehaviourConverter.cs" />
+ <Compile Include="Converters\Video\VideoOptionsTooltipConverter.cs" />
<Compile Include="Converters\Video\ScalingConverter.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Model\Audio\AudioBehaviourModes.cs" />
diff --git a/win/CS/HandBrakeWPF/Views/QueueView.xaml b/win/CS/HandBrakeWPF/Views/QueueView.xaml index 00f77f985..8b86bd34f 100644 --- a/win/CS/HandBrakeWPF/Views/QueueView.xaml +++ b/win/CS/HandBrakeWPF/Views/QueueView.xaml @@ -29,6 +29,8 @@ <Audio:AudioQueueDisplayConverter x:Key="audioTrackDisplayConverter" />
<Subtitles:SubtitlesQueueDisplayConverter x:Key="subtitleTrackDisplayConverter" />
<video:EncoderOptionsTooltipConverter x:Key="encoderOptionsTooltipConverter" />
+ <video:VideoOptionsTooltipConverter x:Key="videoOptionsTooltipConverter" />
+
<Style x:Key="LongToolTipHolder" TargetType="FrameworkElement">
@@ -248,8 +250,7 @@ <TextBlock Text="{Binding Task.PictureSettingsDesc}" TextWrapping="Wrap" Grid.Row="2" Grid.Column="1" />
<TextBlock FontWeight="Bold" Text="Video:" Grid.Row="3" Grid.Column="0" />
- <TextBlock Text="{Binding Task.VideoEncoder, Converter={StaticResource enumComboConverter}}"
- Grid.Row="3" Grid.Column="1" />
+ <TextBlock Text="{Binding Task, Converter={StaticResource videoOptionsTooltipConverter}}" Grid.Row="3" Grid.Column="1" TextWrapping="Wrap" />
<TextBlock FontWeight="Bold" Text="Audio: " Grid.Row="4" Grid.Column="0"/>
<TextBlock Text="{Binding Task.AudioTracks, Converter={StaticResource audioTrackDisplayConverter}}"
|