summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsr55 <[email protected]>2015-01-11 18:12:28 +0000
committersr55 <[email protected]>2015-01-11 18:12:28 +0000
commit04392778932f7e6f424039f30d775ac4e1fd7b2b (patch)
treefa07d529e0a7fbb720173f40ae925e492ab117cb
parent095576f3fbb5c96c9ef58fe45af9390bf718e1dd (diff)
WinGui: Make LibHB a first class citizen for encoding. (Now on by default). Update for JSON API changes. Bug fixes in subtitles and twopass encoding.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6732 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs3
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs6
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs27
-rw-r--r--win/CS/HandBrakeWPF/App.xaml.cs2
-rw-r--r--win/CS/HandBrakeWPF/AppArguments.cs2
-rw-r--r--win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs3
-rw-r--r--win/CS/HandBrakeWPF/UserSettingConstants.cs2
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs4
-rw-r--r--win/CS/HandBrakeWPF/Views/OptionsView.xaml12
-rw-r--r--win/CS/HandBrakeWPF/defaultsettings.xml4
10 files changed, 41 insertions, 24 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
index d7b018145..91eaa28f3 100644
--- a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
+++ b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs
@@ -230,7 +230,8 @@ namespace HandBrake.ApplicationServices.Utilities
Default = track.Default,
FileName = track.SrtFileName,
LanguageCode = track.SrtLang,
- Offset = track.SrtOffset
+ Offset = track.SrtOffset,
+ BurnedIn = track.Burned
});
}
else
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs
index a92253d7b..461397eb2 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs
@@ -9,6 +9,8 @@
namespace HandBrake.Interop.Json.Encode
{
+ using System;
+
/// <summary>
/// The video.
/// </summary>
@@ -30,9 +32,9 @@ namespace HandBrake.Interop.Json.Encode
public int Bitrate { get; set; }
/// <summary>
- /// Gets or sets the number of passes
+ /// Gets or sets a value indicating whether two pass.
/// </summary>
- public int pass { get; set; }
+ public bool TwoPass { get; set; }
/// <summary>
/// Gets or sets Turbo First Pass. For x264/5
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs
index 88bae4116..ebfee5c21 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs
@@ -170,24 +170,29 @@ namespace HandBrake.Interop.Json.Factories
foreach (SourceSubtitle item in job.Subtitles.SourceSubtitles)
{
- SubtitleList track = new SubtitleList
- {
- Burn = item.BurnedIn,
- Default = item.Default,
- Force = item.Forced,
- ID = item.TrackNumber,
- Track = item.TrackNumber
- };
-
- subtitle.SubtitleList.Add(track);
+ // Handle Foreign Audio Search
+ if (item.TrackNumber == 0)
+ {
+ subtitle.Search.Enable = true;
+ subtitle.Search.Burn = item.BurnedIn;
+ subtitle.Search.Default = item.Default;
+ subtitle.Search.Forced = item.Forced;
+ }
+ else
+ {
+ SubtitleList track = new SubtitleList { Burn = item.BurnedIn, Default = item.Default, Force = item.Forced, ID = item.TrackNumber, Track = item.TrackNumber };
+ subtitle.SubtitleList.Add(track);
+ }
}
foreach (SrtSubtitle item in job.Subtitles.SrtSubtitles)
{
SubtitleList track = new SubtitleList
{
+ Track = -1, // Indicates SRT
Default = item.Default,
Offset = item.Offset,
+ Burn = item.BurnedIn,
SRT =
new SRT
{
@@ -223,6 +228,8 @@ namespace HandBrake.Interop.Json.Factories
video.Codec = videoEncoder.Id;
}
+ video.TwoPass = job.EncodingProfile.TwoPass;
+ video.Turbo = job.EncodingProfile.TurboFirstPass;
video.Level = job.EncodingProfile.VideoLevel;
video.Options = job.EncodingProfile.VideoOptions;
video.Preset = job.EncodingProfile.VideoPreset;
diff --git a/win/CS/HandBrakeWPF/App.xaml.cs b/win/CS/HandBrakeWPF/App.xaml.cs
index a744d859c..ce13693ab 100644
--- a/win/CS/HandBrakeWPF/App.xaml.cs
+++ b/win/CS/HandBrakeWPF/App.xaml.cs
@@ -68,7 +68,7 @@ namespace HandBrakeWPF
if (e.Args.Any(f => f.Equals("--enable-libhb")))
{
- AppArguments.EnableLibHB = true;
+ AppArguments.UseLibHb = true;
}
base.OnStartup(e);
diff --git a/win/CS/HandBrakeWPF/AppArguments.cs b/win/CS/HandBrakeWPF/AppArguments.cs
index 107eb7e5c..ecd47fb35 100644
--- a/win/CS/HandBrakeWPF/AppArguments.cs
+++ b/win/CS/HandBrakeWPF/AppArguments.cs
@@ -22,6 +22,6 @@ namespace HandBrakeWPF
/// <summary>
/// Gets or sets a value indicating whether enable lib hb.
/// </summary>
- public static bool EnableLibHB { get; set; }
+ public static bool UseLibHb { get; set; }
}
}
diff --git a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
index 7c679d033..b63cd3d68 100644
--- a/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
+++ b/win/CS/HandBrakeWPF/Services/EncodeServiceWrapper.cs
@@ -49,7 +49,7 @@ namespace HandBrakeWPF.Services
/// </param>
public EncodeServiceWrapper(IUserSettingService userSettingService)
{
- var useLibHb = AppArguments.EnableLibHB ? AppArguments.EnableLibHB : userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);
+ var useLibHb = AppArguments.UseLibHb ? AppArguments.UseLibHb : userSettingService.GetUserSetting<bool>(UserSettingConstants.UseLibHb);
var useProcessIsolation =
userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);
var port = userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort);
@@ -70,7 +70,6 @@ namespace HandBrakeWPF.Services
catch (Exception exc)
{
// Try to recover from errors.
- userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, false);
throw new GeneralApplicationException(
"Unable to initialise LibHB or Background worker service",
"Falling back to using HandBrakeCLI.exe. Setting has been reset",
diff --git a/win/CS/HandBrakeWPF/UserSettingConstants.cs b/win/CS/HandBrakeWPF/UserSettingConstants.cs
index 18a410bb3..e2e258c00 100644
--- a/win/CS/HandBrakeWPF/UserSettingConstants.cs
+++ b/win/CS/HandBrakeWPF/UserSettingConstants.cs
@@ -109,7 +109,7 @@ namespace HandBrakeWPF
/// <summary>
/// Enable the use of LibHb instead of HandBrakeCLI
/// </summary>
- public const string EnableLibHb = "EnableLibHb";
+ public const string UseLibHb = "UseLibHb";
/// <summary>
/// Growl Encodes
diff --git a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
index 38c1dcd55..51e30fdb1 100644
--- a/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/OptionsViewModel.cs
@@ -1567,7 +1567,7 @@ namespace HandBrakeWPF.ViewModels
int.TryParse(userSettingService.GetUserSetting<string>(UserSettingConstants.ServerPort), out port);
this.ServerPort = port;
this.EnableProcessIsolation = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableProcessIsolation);
- this.EnableLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.EnableLibHb);
+ this.EnableLibHb = userSettingService.GetUserSetting<bool>(UserSettingConstants.UseLibHb);
}
/// <summary>
@@ -1630,7 +1630,7 @@ namespace HandBrakeWPF.ViewModels
userSettingService.SetUserSetting(UserSettingConstants.DisableLibDvdNav, this.DisableLibdvdNav);
userSettingService.SetUserSetting(UserSettingConstants.EnableProcessIsolation, this.EnableProcessIsolation);
userSettingService.SetUserSetting(UserSettingConstants.ServerPort, this.ServerPort.ToString(CultureInfo.InvariantCulture));
- userSettingService.SetUserSetting(UserSettingConstants.EnableLibHb, this.EnableLibHb);
+ userSettingService.SetUserSetting(UserSettingConstants.UseLibHb, this.EnableLibHb);
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/OptionsView.xaml b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
index 900a7af7d..f2fe2fa02 100644
--- a/win/CS/HandBrakeWPF/Views/OptionsView.xaml
+++ b/win/CS/HandBrakeWPF/Views/OptionsView.xaml
@@ -328,11 +328,19 @@
<StackPanel Orientation="Vertical" Margin="0,10,0,20" Visibility="Visible">
- <TextBlock Text="Alpha Features" FontSize="14" Margin="0,0,0,10"/>
+ <TextBlock Text="Encode Engine" FontSize="14" Margin="0,0,0,10"/>
<StackPanel Orientation="Vertical" Margin="20,0,0,0">
- <CheckBox Content="Use LibHB for Encoding (uses hb.dll instead of HandBrakeCLI.exe)" Margin="0,5,0,0" IsChecked="{Binding EnableLibHb}" />
+ <CheckBox Content="Use LibHB instead of HandBrakeCLI.exe for encoding." Margin="0,5,0,5" IsChecked="{Binding EnableLibHb}" />
+ <TextBlock Text="LibHB" FontWeight="Bold" />
+ <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."
+ TextWrapping="Wrap" Margin="10,0,10,5"/>
+ <TextBlock Text="HandBrakeCLI.exe" FontWeight="Bold" />
+ <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."
+ TextWrapping="Wrap" Margin="10,0,10,5"/>
+
+
<CheckBox Content="Enable Process Isolation (Run Encodes via an intermediate service)" Margin="20,10,0,0" IsChecked="{Binding EnableProcessIsolation}" Visibility="Collapsed" />
<StackPanel Orientation="Horizontal" Margin="0,10,0,0" Visibility="Collapsed">
<TextBlock Text="Server Port:" VerticalAlignment="Center" />
diff --git a/win/CS/HandBrakeWPF/defaultsettings.xml b/win/CS/HandBrakeWPF/defaultsettings.xml
index 5525a2e05..afffb4c8a 100644
--- a/win/CS/HandBrakeWPF/defaultsettings.xml
+++ b/win/CS/HandBrakeWPF/defaultsettings.xml
@@ -386,10 +386,10 @@
</item>
<item>
<key>
- <string>EnableLibHb</string>
+ <string>UseLibHb</string>
</key>
<value>
- <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">false</anyType>
+ <anyType xmlns:q1="http://www.w3.org/2001/XMLSchema" d4p1:type="q1:boolean" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">true</anyType>
</value>
</item>
<item>