summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2016-03-10 20:44:49 +0000
committerJohn Stebbins <[email protected]>2016-03-11 14:14:30 -0700
commitbe495c77c554e0ec10dfd81e53fe8b4c170ba6b7 (patch)
tree173a136282127e57afd52290c73f340a0e94900e /win/CS/HandBrakeWPF
parent5d9e1585a9be17528546f82cde903829082e7a2b (diff)
WinGui: Initial commit supporting separated interlace detection. Not tested yet.
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs13
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs13
-rw-r--r--win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs10
-rw-r--r--win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs28
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs53
-rw-r--r--win/CS/HandBrakeWPF/Views/FiltersView.xaml64
-rw-r--r--win/CS/HandBrakeWPF/Views/Styles/Styles.xaml4
7 files changed, 165 insertions, 20 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
index b154c4dce..a25cd1100 100644
--- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
@@ -15,7 +15,6 @@ namespace HandBrakeWPF.Converters
using System;
using HandBrake.ApplicationServices.Model;
- using HandBrake.ApplicationServices.Utilities;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Services.Queue.Model;
@@ -95,6 +94,10 @@ namespace HandBrakeWPF.Converters
{
return EnumHelper<DeinterlaceFilter>.GetEnumDisplayValues(typeof(DeinterlaceFilter));
}
+ if (value is IEnumerable<CombDetect>)
+ {
+ return EnumHelper<CombDetect>.GetEnumDisplayValues(typeof(CombDetect));
+ }
// Single Items
if (targetType == typeof(VideoEncoder) || value.GetType() == typeof(VideoEncoder))
@@ -145,6 +148,10 @@ namespace HandBrakeWPF.Converters
{
return EnumHelper<DeinterlaceFilter>.GetDisplay((DeinterlaceFilter)value);
}
+ if (targetType == typeof(CombDetect) || value.GetType() == typeof(CombDetect))
+ {
+ return EnumHelper<CombDetect>.GetDisplay((CombDetect)value);
+ }
return null;
}
@@ -215,6 +222,10 @@ namespace HandBrakeWPF.Converters
return EnumHelper<DeinterlaceFilter>.GetValue(value.ToString());
}
+ if (targetType == typeof(CombDetect) || value.GetType() == typeof(CombDetect))
+ {
+ return EnumHelper<CombDetect>.GetValue(value.ToString());
+ }
return null;
}
}
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs
index 6304c4af3..5167e7218 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs
@@ -435,6 +435,19 @@ namespace HandBrakeWPF.Services.Encode.Factories
filter.FilterList.Add(filterItem);
}
+ if (job.DeinterlaceFilter == DeinterlaceFilter.Decomb || job.DeinterlaceFilter == DeinterlaceFilter.Yadif)
+ {
+ if (job.CombDetect != CombDetect.Off)
+ {
+ IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_COMB_DETECT, EnumHelper<CombDetect>.GetShortName(job.CombDetect), null, job.CustomCombDetect);
+ string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr);
+ JToken settings = JObject.Parse(unparsedJson);
+
+ Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_COMB_DETECT, Settings = settings };
+ filter.FilterList.Add(filterItem);
+ }
+ }
+
// Denoise
if (job.Denoise != Denoise.Off)
{
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs
index 0ae588bc7..71af5cc0d 100644
--- a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs
+++ b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs
@@ -298,11 +298,21 @@ namespace HandBrakeWPF.Services.Encode.Model
public Decomb Decomb { get; set; }
/// <summary>
+ /// Gets or sets the comb detect.
+ /// </summary>
+ public CombDetect CombDetect { get; set; }
+
+ /// <summary>
/// Gets or sets CustomDecomb.
/// </summary>
public string CustomDecomb { get; set; }
/// <summary>
+ /// Gets or sets the custom comb detect.
+ /// </summary>
+ public string CustomCombDetect { get; set; }
+
+ /// <summary>
/// Gets or sets Detelecine.
/// </summary>
public Detelecine Detelecine { get; set; }
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
index a92a67adb..046e51d5b 100644
--- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
+++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
@@ -173,9 +173,35 @@ namespace HandBrakeWPF.Services.Presets.Factories
}
}
+ if (preset.Task.DeinterlaceFilter == DeinterlaceFilter.Yadif || preset.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb)
+ {
+ switch (importedPreset.PictureCombDetectPreset)
+ {
+ case "off":
+ preset.Task.CombDetect = CombDetect.Off;
+ break;
+ case "custom":
+ preset.Task.CombDetect = CombDetect.Custom;
+ break;
+ case "default":
+ preset.Task.CombDetect = CombDetect.Default;
+ break;
+ case "permissive":
+ preset.Task.CombDetect = CombDetect.LessSensitive;
+ break;
+ case "fast":
+ preset.Task.CombDetect = CombDetect.Fast;
+ break;
+ default:
+ preset.Task.CombDetect = CombDetect.Off;
+ break;
+ }
+ }
+
preset.Task.CustomDeinterlace = importedPreset.PictureDetelecineCustom;
preset.Task.CustomDenoise = importedPreset.PictureDenoiseCustom;
preset.Task.CustomDetelecine = importedPreset.PictureDetelecineCustom;
+ preset.Task.CustomCombDetect = importedPreset.PictureCombDetectCustom;
switch (importedPreset.PictureDetelecine)
{
@@ -579,6 +605,8 @@ namespace HandBrakeWPF.Services.Presets.Factories
preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune);
preset.PictureDetelecine = EnumHelper<Detelecine>.GetShortName(export.Task.Detelecine);
preset.PictureDetelecineCustom = export.Task.CustomDetelecine;
+ preset.PictureCombDetectPreset = EnumHelper<CombDetect>.GetShortName(export.Task.CombDetect);
+ preset.PictureCombDetectCustom = export.Task.CustomCombDetect;
// Video
preset.VideoEncoder = EnumHelper<VideoEncoder>.GetShortName(export.Task.VideoEncoder);
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
index 4dd88f6be..7cb50ac37 100644
--- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
@@ -216,6 +216,17 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Comb Detection Presets
+ /// </summary>
+ public IEnumerable<CombDetect> CombDetectPresets
+ {
+ get
+ {
+ return EnumHelper<CombDetect>.GetEnumList();
+ }
+ }
+
+ /// <summary>
/// Gets or sets a value indicating whether Grayscale.
/// </summary>
public bool Grayscale
@@ -256,6 +267,48 @@ namespace HandBrakeWPF.ViewModels
}
}
+ public CombDetect SelectedCombDetectPreset
+ {
+ get
+ {
+ return this.CurrentTask.CombDetect;
+ }
+
+ set
+ {
+ this.CurrentTask.CombDetect = value;
+ this.NotifyOfPropertyChange(() => this.SelectedCombDetectPreset);
+
+ // Show / Hide the Custom Control
+ this.NotifyOfPropertyChange(() => this.ShowCombDetectCustom);
+ }
+ }
+
+ /// <summary>
+ /// Show the CombDetect Custom Box.
+ /// </summary>
+ public bool ShowCombDetectCustom
+ {
+ get
+ {
+ return this.SelectedCombDetectPreset == CombDetect.Custom;
+ }
+ }
+
+ public string CustomCombDetect
+ {
+ get
+ {
+ return this.CurrentTask.CustomCombDetect;
+ }
+
+ set
+ {
+ this.CurrentTask.CustomCombDetect = value;
+ this.NotifyOfPropertyChange(() => this.CustomCombDetect);
+ }
+ }
+
/// <summary>
/// Gets or sets SelectedDecomb.
/// </summary>
diff --git a/win/CS/HandBrakeWPF/Views/FiltersView.xaml b/win/CS/HandBrakeWPF/Views/FiltersView.xaml
index 494adae51..d40567fcc 100644
--- a/win/CS/HandBrakeWPF/Views/FiltersView.xaml
+++ b/win/CS/HandBrakeWPF/Views/FiltersView.xaml
@@ -10,7 +10,6 @@
<UserControl.Resources>
<Converters:BooleanToVisibilityConverter x:Key="boolToVisConverter" />
<Converters:EnumComboConverter x:Key="boolComboConverter" />
- <Converters:InverseBooleanConverter x:Key="inverseBooleanConverter" />
<filters:DenoisePresetConverter x:Key="DenoisePresetConverter" />
</UserControl.Resources>
@@ -56,31 +55,58 @@
Visibility="{Binding ShowDetelecineCustom, Converter={StaticResource boolToVisConverter}}"/>
<!-- Deinterlace -->
- <TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Deinterlace}" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10" />
- <StackPanel Grid.Row="1" Grid.Column="1" >
+ <TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Deinterlace}" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Margin="0,0,0,10" />
+ <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Margin="0,0,0,10">
<ComboBox Width="120" ItemsSource="{Binding DeinterlaceFilterOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left"
- SelectedItem="{Binding SelectedDeinterlaceFilter, Converter={StaticResource boolComboConverter}}" Margin="0,0,0,10" />
+ SelectedItem="{Binding SelectedDeinterlaceFilter, Converter={StaticResource boolComboConverter}}" />
</StackPanel>
- <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="2">
- <TextBlock Text="Preset:" VerticalAlignment="Center" Margin="0,0,5,10" Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}" />
- <ComboBox Width="120" ItemsSource="{Binding DecombOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
- SelectedItem="{Binding SelectedDecomb, Converter={StaticResource boolComboConverter}}"
- Visibility="{Binding IsDecombMode, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
+ <Grid Grid.Row="1" Grid.Column="2" Margin="0,0,0,10">
+ <Grid.RowDefinitions>
+ <RowDefinition />
+ <RowDefinition />
+ </Grid.RowDefinitions>
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition />
+ <ColumnDefinition Width="15"/>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition />
+ </Grid.ColumnDefinitions>
+
+
+ <TextBlock Text="Preset:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="0" Grid.Row="0" Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}" />
+ <StackPanel Grid.Row="0" Grid.Column="1" Orientation="Horizontal">
+ <ComboBox Width="120" ItemsSource="{Binding DecombOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
+ SelectedItem="{Binding SelectedDecomb, Converter={StaticResource boolComboConverter}}"
+ Visibility="{Binding IsDecombMode, Converter={StaticResource boolToVisConverter}}" />
+
+ <ComboBox Width="120" ItemsSource="{Binding DeInterlaceOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
+ SelectedItem="{Binding SelectedDeInterlace, Converter={StaticResource boolComboConverter}}"
+ Visibility="{Binding IsDeinterlaceMode, Converter={StaticResource boolToVisConverter}}" />
+ </StackPanel>
- <ComboBox Width="120" ItemsSource="{Binding DeInterlaceOptions, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
- SelectedItem="{Binding SelectedDeInterlace, Converter={StaticResource boolComboConverter}}"
- Visibility="{Binding IsDeinterlaceMode, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
+ <TextBlock Text="Custom:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="0" Grid.Row="1" Visibility="{Binding ShowDeinterlaceDecombCustom, Converter={StaticResource boolToVisConverter}}" />
+ <StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
+ <TextBox Width="120" Text="{Binding CustomDecomb, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
+ Visibility="{Binding ShowDecombCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,5,0,0" MinHeight="22" />
- <TextBlock Text="Custom:" VerticalAlignment="Center" Margin="5,0,5,10" Visibility="{Binding ShowDeinterlaceDecombCustom, Converter={StaticResource boolToVisConverter}}" />
- <TextBox Width="120" Text="{Binding CustomDecomb, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
- Visibility="{Binding ShowDecombCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
+ <TextBox Width="120" Text="{Binding CustomDeinterlace, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
+ Visibility="{Binding ShowDeinterlaceCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,5,0,0" MinHeight="22" />
+ </StackPanel>
- <TextBox Width="120" Text="{Binding CustomDeinterlace, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
- Visibility="{Binding ShowDeinterlaceCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,0,0,10" />
- </StackPanel>
+ <TextBlock Text="Interlace Detection:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="3" Grid.Row="0" Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}" />
+ <TextBlock Text="Custom:" VerticalAlignment="Center" Margin="0,0,5,0" Grid.Column="3" Grid.Row="1" Visibility="{Binding ShowCombDetectCustom, Converter={StaticResource boolToVisConverter}}" />
+
+ <ComboBox Width="120" Grid.Row="0" Grid.Column="4" ItemsSource="{Binding CombDetectPresets, Converter={StaticResource boolComboConverter}}" HorizontalAlignment="Left" VerticalAlignment="Center"
+ SelectedItem="{Binding SelectedCombDetectPreset, Converter={StaticResource boolComboConverter}}"
+ Visibility="{Binding IsDeinterlaceDecomb, Converter={StaticResource boolToVisConverter}}"/>
+ <TextBox Width="120" Grid.Row="1" Grid.Column="4" Text="{Binding CustomCombDetect, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" HorizontalAlignment="Left"
+ Visibility="{Binding ShowCombDetectCustom, Converter={StaticResource boolToVisConverter}}" Margin="0,5,0,0" MinHeight="22" />
+ </Grid>
@@ -112,7 +138,7 @@
<StackPanel Orientation="Horizontal" Visibility="{Binding ShowDenoiseCustom, Converter={StaticResource boolToVisConverter}}">
<TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Custom}" Margin="5,0,5,0" />
- <TextBox Width="120" Margin="0" Text="{Binding CustomDenoise, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" />
+ <TextBox Width="120" Margin="0" Text="{Binding CustomDenoise, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" MinHeight="22" />
</StackPanel>
</StackPanel>
diff --git a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml
index 247819000..3b4b0eeb9 100644
--- a/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml
+++ b/win/CS/HandBrakeWPF/Views/Styles/Styles.xaml
@@ -13,6 +13,10 @@
<Style TargetType="{x:Type TextBlock}">
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
+
+ <Style TargetType="{x:Type TextBox}">
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
+ </Style>
<Style TargetType="{x:Type Button}">
<Setter Property="MinHeight" Value="22"/>