]> granicus.if.org Git - handbrake/commitdiff
WinGui:
authorsr55 <sr55.hb@outlook.com>
Tue, 27 Jan 2015 21:23:57 +0000 (21:23 +0000)
committersr55 <sr55.hb@outlook.com>
Tue, 27 Jan 2015 21:23:57 +0000 (21:23 +0000)
- 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

win/CS/HandBrake.ApplicationServices/Services/Encode/EncodeBase.cs
win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs
win/CS/HandBrake.ApplicationServices/Services/QueueProcessor.cs
win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs [new file with mode: 0644]
win/CS/HandBrakeWPF/HandBrakeWPF.csproj
win/CS/HandBrakeWPF/Views/QueueView.xaml

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