From: sr55 Date: Tue, 27 Jan 2015 21:23:57 +0000 (+0000) Subject: WinGui: X-Git-Tag: 1.0.0~1488 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=12def0ed27098092a7a998eaa29886770071a2b4;p=handbrake WinGui: - Fixes to Disk logging. - Improvements to Queue Item tooltip. - Queue will no longer pause if an encode fails. It will move onto the next item and try that. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6822 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- 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 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. +// +// +// The video options queue tooltip converter. +// +// -------------------------------------------------------------------------------------------------------------------- + +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; + + /// + /// The x 264 queue tooltip converter. + /// + public class VideoOptionsTooltipConverter : IValueConverter + { + /// + /// Converts a value. + /// + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// + /// The value produced by the binding source. + /// + /// + /// The type of the binding target property. + /// + /// + /// The converter parameter to use. + /// + /// + /// The culture to use in the converter. + /// + 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.GetDisplay(task.VideoEncoder), quality, twoPass); + } + + return "Unknown"; + } + + /// + /// Converts a value. + /// + /// + /// A converted value. If the method returns null, the valid null value is used. + /// + /// + /// The value that is produced by the binding target. + /// + /// + /// The type to convert to. + /// + /// + /// The converter parameter to use. + /// + /// + /// The culture to use in the converter. + /// + 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 @@ + 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 @@ + +