]> granicus.if.org Git - handbrake/commitdiff
WinGui: Make LibHB a first class citizen for encoding. (Now on by default). Update...
authorsr55 <sr55.hb@outlook.com>
Sun, 11 Jan 2015 18:12:28 +0000 (18:12 +0000)
committersr55 <sr55.hb@outlook.com>
Sun, 11 Jan 2015 18:12:28 +0000 (18:12 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6732 b64f7644-9d1e-0410-96f1-a4d463321fa5

win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs
win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs
win/CS/HandBrakeWPF/App.xaml.cs
win/CS/HandBrakeWPF/AppArguments.cs
win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
win/CS/HandBrakeWPF/UserSettingConstants.cs
win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
win/CS/HandBrakeWPF/Views/OptionsView.xaml
win/CS/HandBrakeWPF/defaultsettings.xml

index d7b018145a410e097fcd71cfa560136a010c8862..91eaa28f32c35135738ecfaf820bc03121427c30 100644 (file)
@@ -230,7 +230,8 @@ namespace HandBrake.ApplicationServices.Utilities
                                 Default = track.Default,\r
                                 FileName = track.SrtFileName,\r
                                 LanguageCode = track.SrtLang,\r
-                                Offset = track.SrtOffset\r
+                                Offset = track.SrtOffset,\r
+                                BurnedIn = track.Burned\r
                             });\r
                 }\r
                 else\r
index a92253d7b519bd5706f778d7b2e96c3987e0d9c4..461397eb21f1c1214503af484688f9ddcf93662b 100644 (file)
@@ -9,6 +9,8 @@
 \r
 namespace HandBrake.Interop.Json.Encode\r
 {\r
+    using System;\r
+\r
     /// <summary>\r
     /// The video.\r
     /// </summary>\r
@@ -30,9 +32,9 @@ namespace HandBrake.Interop.Json.Encode
         public int Bitrate { get; set; }\r
 \r
         /// <summary>\r
-        /// Gets or sets the number of passes\r
+        /// Gets or sets a value indicating whether two pass.\r
         /// </summary>\r
-        public int pass { get; set; }\r
+        public bool TwoPass { get; set; }\r
 \r
         /// <summary>\r
         /// Gets or sets Turbo First Pass. For x264/5\r
index 88bae4116f090f50f6013a9f09da44584997f60e..ebfee5c213401097271a5f1b51658c782a14aa50 100644 (file)
@@ -170,24 +170,29 @@ namespace HandBrake.Interop.Json.Factories
 \r
             foreach (SourceSubtitle item in job.Subtitles.SourceSubtitles)\r
             {\r
-                SubtitleList track = new SubtitleList\r
-                    {\r
-                        Burn = item.BurnedIn, \r
-                        Default = item.Default, \r
-                        Force = item.Forced, \r
-                        ID = item.TrackNumber, \r
-                        Track = item.TrackNumber\r
-                    };\r
-\r
-                subtitle.SubtitleList.Add(track);\r
+                // Handle Foreign Audio Search\r
+                if (item.TrackNumber == 0)\r
+                {\r
+                    subtitle.Search.Enable = true;\r
+                    subtitle.Search.Burn = item.BurnedIn;\r
+                    subtitle.Search.Default = item.Default;\r
+                    subtitle.Search.Forced = item.Forced;\r
+                }\r
+                else\r
+                {\r
+                    SubtitleList track = new SubtitleList { Burn = item.BurnedIn, Default = item.Default, Force = item.Forced, ID = item.TrackNumber, Track = item.TrackNumber };\r
+                    subtitle.SubtitleList.Add(track);\r
+                }\r
             }\r
 \r
             foreach (SrtSubtitle item in job.Subtitles.SrtSubtitles)\r
             {\r
                 SubtitleList track = new SubtitleList\r
                     {\r
+                        Track = -1, // Indicates SRT\r
                         Default = item.Default, \r
                         Offset = item.Offset, \r
+                        Burn = item.BurnedIn,\r
                         SRT =\r
                             new SRT\r
                                 {\r
@@ -223,6 +228,8 @@ namespace HandBrake.Interop.Json.Factories
                 video.Codec = videoEncoder.Id;\r
             }\r
 \r
+            video.TwoPass = job.EncodingProfile.TwoPass;\r
+            video.Turbo = job.EncodingProfile.TurboFirstPass;\r
             video.Level = job.EncodingProfile.VideoLevel;\r
             video.Options = job.EncodingProfile.VideoOptions;\r
             video.Preset = job.EncodingProfile.VideoPreset;\r
index a744d859cabba856dcebed9254b7a16ca1f95ea8..ce13693ab72491aba31562fd2dbed65eddd86cf1 100644 (file)
@@ -68,7 +68,7 @@ namespace HandBrakeWPF
 \r
             if (e.Args.Any(f => f.Equals("--enable-libhb")))\r
             {\r
-                AppArguments.EnableLibHB = true;\r
+                AppArguments.UseLibHb = true;\r
             }\r
 \r
             base.OnStartup(e);\r
index 107eb7e5c5f9a6d6fc9be59c75c37db2897c9a40..ecd47fb351e11d2db82890ec872c47ad389e335a 100644 (file)
@@ -22,6 +22,6 @@ namespace HandBrakeWPF
         /// <summary>\r
         /// Gets or sets a value indicating whether enable lib hb.\r
         /// </summary>\r
-        public static bool EnableLibHB { get; set; }\r
+        public static bool UseLibHb { get; set; }\r
     }\r
 }\r
index 7c679d03396df1925690ae80841465ab29e79fbc..b63cd3d68cb7ff3cf5dbf8a30de26039b30c06ea 100644 (file)
@@ -49,7 +49,7 @@ namespace HandBrakeWPF.Services
         /// </param>\r
         public EncodeServiceWrapper(IUserSettingService userSettingService)\r
         {\r
-            var useLibHb = AppArguments.EnableLibHB ? AppArguments.EnableLibHB : userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);\r
+            var useLibHb = AppArguments.UseLibHb ? AppArguments.UseLibHb : userSettingService.GetUserSetting<bool>(UserSettingConstants.UseLibHb);\r
             var useProcessIsolation =\r
                 userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);\r
             var port = userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort);\r
@@ -70,7 +70,6 @@ namespace HandBrakeWPF.Services
                 catch (Exception exc)\r
                 {\r
                     // Try to recover from errors.\r
-                    userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, false);\r
                     throw new GeneralApplicationException(\r
                         "Unable to initialise LibHB or Background worker service",\r
                         "Falling back to using HandBrakeCLI.exe. Setting has been reset",\r
index 18a410bb3204a3c7aa77e4fd35a1069a05fee377..e2e258c004ff9e7c487b0016662d7341ab0bf503 100644 (file)
@@ -109,7 +109,7 @@ namespace HandBrakeWPF
         /// <summary>\r
         /// Enable the use of LibHb instead of HandBrakeCLI\r
         /// </summary>\r
-        public const string EnableLibHb = "EnableLibHb";\r
+        public const string UseLibHb = "UseLibHb";\r
 \r
         /// <summary>\r
         /// Growl Encodes\r
index 38c1dcd551d99dedbe6d6d6824a59373a219c288..51e30fdb18b313bb92d928793912636d9b041bb8 100644 (file)
@@ -1567,7 +1567,7 @@ namespace HandBrakeWPF.ViewModels
             int.TryParse(userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort), out port);\r
             this.ServerPort = port;\r
             this.EnableProcessIsolation = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);\r
-            this.EnableLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);\r
+            this.EnableLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.UseLibHb);\r
         }\r
 \r
         /// <summary>\r
@@ -1630,7 +1630,7 @@ namespace HandBrakeWPF.ViewModels
             userSettingService.SetUserSetting(UserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);\r
             userSettingService.SetUserSetting(UserSettingConstants.EnableProcessIsolation, this.EnableProcessIsolation);\r
             userSettingService.SetUserSetting(UserSettingConstants.ServerPort, this.ServerPort.ToString(CultureInfo.InvariantCulture));\r
-            userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, this.EnableLibHb);\r
+            userSettingService.SetUserSetting(UserSettingConstants.UseLibHb, this.EnableLibHb);\r
         }\r
 \r
         /// <summary>\r
index 900a7af7db472541e354cb14900f94a4a818d4d3..f2fe2fa025ab51cf181b0bf3c964a897aef828b2 100644 (file)
 \r
                     <StackPanel Orientation="Vertical" Margin="0,10,0,20" Visibility="Visible">\r
 \r
-                        <TextBlock Text="Alpha Features" FontSize="14" Margin="0,0,0,10"/>\r
+                        <TextBlock Text="Encode Engine" FontSize="14" Margin="0,0,0,10"/>\r
 \r
                         <StackPanel Orientation="Vertical"  Margin="20,0,0,0">\r
                                    \r
-                            <CheckBox Content="Use LibHB for Encoding (uses hb.dll instead of HandBrakeCLI.exe)" Margin="0,5,0,0" IsChecked="{Binding EnableLibHb}"  />\r
+                            <CheckBox Content="Use LibHB instead of HandBrakeCLI.exe for encoding." Margin="0,5,0,5" IsChecked="{Binding EnableLibHb}"  />\r
+                            <TextBlock Text="LibHB" FontWeight="Bold" />\r
+                            <TextBlock Text="Accessing LibHB directly, allows the app to pause and restart encodes. Process isolation is not currently supported, so a crash will prevent the rest of the queue from completing."\r
+                                       TextWrapping="Wrap" Margin="10,0,10,5"/>\r
+                            <TextBlock Text="HandBrakeCLI.exe" FontWeight="Bold" />\r
+                            <TextBlock Text="Using HandBrakeCLI.exe provides process isolation so a crash during an encode won't prevent the rest of the queue from completing. You won't however be able to pause encodes."\r
+                                       TextWrapping="Wrap" Margin="10,0,10,5"/>\r
+                            \r
+                            \r
                             <CheckBox Content="Enable Process Isolation (Run Encodes via an intermediate service)" Margin="20,10,0,0" IsChecked="{Binding EnableProcessIsolation}" Visibility="Collapsed" />\r
                             <StackPanel Orientation="Horizontal" Margin="0,10,0,0" Visibility="Collapsed">\r
                                 <TextBlock Text="Server Port:" VerticalAlignment="Center" />\r
index 5525a2e057bf37d8408d8e7c9d05ef84c022e339..afffb4c8a6713defe568031738faae8876a16f9e 100644 (file)
   </item>\r
   <item>\r
     <key>\r
-      <string>EnableLibHb</string>\r
+      <string>UseLibHb</string>\r
     </key>\r
     <value>\r
-      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>\r
+      <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">true</anyType>\r
     </value>\r
   </item>\r
   <item>\r