summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrakeWPF
diff options
context:
space:
mode:
authorsr55 <[email protected]>2013-08-23 13:20:38 +0000
committersr55 <[email protected]>2013-08-23 13:20:38 +0000
commitc7dc884bbee9c87fb4e7eb974d5ee029f4c234e4 (patch)
tree9775daec15adcc3c39b957e9dd37e858b5a2cbf1 /win/CS/HandBrakeWPF
parent1270ebc49fc8dc11ea509815094faacfa8338834 (diff)
WinGui: Manually merged the QuickSync UI changes from the qsv branch to trunk
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5741 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r--win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs8
-rw-r--r--win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs8
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs1
-rw-r--r--win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs201
-rw-r--r--win/CS/HandBrakeWPF/Views/VideoView.xaml75
-rw-r--r--win/CS/HandBrakeWPF/Views/VideoView.xaml.cs86
6 files changed, 341 insertions, 38 deletions
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
index 6f89bb52f..d65b7f9f1 100644
--- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs
@@ -65,6 +65,10 @@ namespace HandBrakeWPF.Converters
{
return EnumHelper<Mixdown>.GetEnumDisplayValues(typeof(Mixdown));
}
+ if (targetType == typeof(QsvPreset) || value.GetType() == typeof(QsvPreset))
+ {
+ return EnumHelper<QsvPreset>.GetDisplay((QsvPreset)value);
+ }
if (value is IEnumerable<PresetPictureSettingsMode>)
{
@@ -182,6 +186,10 @@ namespace HandBrakeWPF.Converters
{
return EnumHelper<Mixdown>.GetValue(value.ToString());
}
+ if (targetType == typeof(QsvPreset) || value.GetType() == typeof(QsvPreset))
+ {
+ return EnumHelper<QsvPreset>.GetValue(value.ToString());
+ }
if (targetType == typeof(PresetPictureSettingsMode) || value.GetType() == typeof(PresetPictureSettingsMode))
{
diff --git a/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs b/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs
index f44e18a3e..8cd29431f 100644
--- a/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs
+++ b/win/CS/HandBrakeWPF/Converters/InverseBooleanConverter.cs
@@ -19,10 +19,6 @@ namespace HandBrakeWPF.Converters
[ValueConversion(typeof(bool), typeof(bool))]
public class InverseBooleanConverter : IValueConverter
{
- #region Implemented Interfaces
-
- #region IValueConverter
-
/// <summary>
/// The convert.
/// </summary>
@@ -73,9 +69,5 @@ namespace HandBrakeWPF.Converters
{
throw new NotSupportedException();
}
-
- #endregion
-
- #endregion
}
} \ No newline at end of file
diff --git a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs
index f1da43828..d7ae4e498 100644
--- a/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/EncoderOptionsViewModel.cs
@@ -33,6 +33,7 @@ namespace HandBrakeWPF.ViewModels
public EncoderOptionsViewModel()
{
this.Task = new EncodeTask();
+ cachedOptions.Add(VideoEncoder.QuickSync, "async-depth=4");
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
index f37f9c7ea..bc07f57f5 100644
--- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
+++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs
@@ -63,6 +63,16 @@ namespace HandBrakeWPF.ViewModels
private bool displayX264Options;
/// <summary>
+ /// The display qsv options.
+ /// </summary>
+ private bool displayQSVOptions;
+
+ /// <summary>
+ /// Backing field used to display / hide the h264 options
+ /// </summary>
+ private bool displayEncoderOptions;
+
+ /// <summary>
/// The quality max.
/// </summary>
private int qualityMax;
@@ -88,6 +98,11 @@ namespace HandBrakeWPF.ViewModels
private int x264PresetValue;
/// <summary>
+ /// The qsv preset value.
+ /// </summary>
+ private int qsvPresetValue;
+
+ /// <summary>
/// The extra arguments.
/// </summary>
private string extraArguments;
@@ -102,6 +117,11 @@ namespace HandBrakeWPF.ViewModels
/// </summary>
private bool useAdvancedTab;
+ /// <summary>
+ /// The display framerate controls.
+ /// </summary>
+ private bool displayNonQSVControls;
+
#endregion
#region Constructors and Destructors
@@ -126,6 +146,7 @@ namespace HandBrakeWPF.ViewModels
this.VideoEncoders = EnumHelper<VideoEncoder>.GetEnumList();
X264Presets = new BindingList<x264Preset>(EnumHelper<x264Preset>.GetEnumList().ToList());
+ QsvPresets = new BindingList<QsvPreset>(EnumHelper<QsvPreset>.GetEnumList().ToList());
H264Profiles = EnumHelper<x264Profile>.GetEnumList();
X264Tunes = EnumHelper<x264Tune>.GetEnumList().Where(t => t != x264Tune.Fastdecode);
this.H264Levels = Levels;
@@ -149,13 +170,17 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- bool showAdvTabSetting =
- this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAdvancedTab);
+ bool showAdvTabSetting = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ShowAdvancedTab);
if (!showAdvTabSetting)
{
this.UseAdvancedTab = false;
}
+ if (this.SelectedVideoEncoder == VideoEncoder.QuickSync)
+ {
+ return false;
+ }
+
return showAdvTabSetting;
}
}
@@ -303,7 +328,7 @@ namespace HandBrakeWPF.ViewModels
{
get
{
- return 0.0.Equals(this.DisplayRF);
+ return 0.0.Equals(this.DisplayRF) && this.SelectedVideoEncoder == VideoEncoder.X264;
}
}
@@ -366,6 +391,7 @@ namespace HandBrakeWPF.ViewModels
case VideoEncoder.FFMpeg2:
this.Task.Quality = (32 - value);
break;
+ case VideoEncoder.QuickSync:
case VideoEncoder.X264:
double rfValue = 51.0 - value * cqStep;
rfValue = Math.Round(rfValue, 2);
@@ -394,6 +420,40 @@ namespace HandBrakeWPF.ViewModels
}
/// <summary>
+ /// Gets or sets a value indicating whether two pass.
+ /// </summary>
+ public bool TwoPass
+ {
+ get
+ {
+ return this.Task.TwoPass;
+ }
+
+ set
+ {
+ this.Task.TwoPass = value;
+ this.NotifyOfPropertyChange(() => this.TwoPass);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether turbo first pass.
+ /// </summary>
+ public bool TurboFirstPass
+ {
+ get
+ {
+ return this.Task.TurboFirstPass;
+ }
+
+ set
+ {
+ this.Task.TurboFirstPass = value;
+ this.NotifyOfPropertyChange(() => this.TurboFirstPass);
+ }
+ }
+
+ /// <summary>
/// Gets the rfqp.
/// </summary>
public string Rfqp
@@ -480,9 +540,23 @@ namespace HandBrakeWPF.ViewModels
// Hide the x264 controls when not needed.
this.DisplayX264Options = value == VideoEncoder.X264;
+ this.DisplayQSVOptions = value == VideoEncoder.QuickSync;
+ this.DisplayH264Options = value == VideoEncoder.X264 || value == VideoEncoder.QuickSync;
+ this.UseAdvancedTab = value != VideoEncoder.QuickSync && this.UseAdvancedTab;
+ this.DisplayNonQSVControls = value != VideoEncoder.QuickSync;
this.NotifyOfPropertyChange(() => this.Rfqp);
+ this.NotifyOfPropertyChange(() => this.ShowAdvancedTab);
+
this.NotifyOfPropertyChange(() => this.HighQualityLabel);
+ if (value == VideoEncoder.QuickSync)
+ {
+ this.IsConstantFramerate = true;
+ this.TwoPass = false;
+ this.TurboFirstPass = false;
+ this.Task.Framerate = null;
+ this.NotifyOfPropertyChange(() => SelectedFramerate);
+ }
}
}
@@ -526,6 +600,23 @@ namespace HandBrakeWPF.ViewModels
}
}
}
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to display H264
+ /// </summary>
+ public bool DisplayH264Options
+ {
+ get
+ {
+ return this.displayEncoderOptions;
+ }
+ set
+ {
+ this.displayEncoderOptions = value;
+ this.NotifyOfPropertyChange(() => this.DisplayH264Options);
+ }
+ }
+
/// <summary>
/// Gets or sets a value indicating whether display x 264 options.
@@ -544,6 +635,40 @@ namespace HandBrakeWPF.ViewModels
}
}
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to display qsv options.
+ /// </summary>
+ public bool DisplayQSVOptions
+ {
+ get
+ {
+ return this.displayQSVOptions;
+ }
+ set
+ {
+ this.displayQSVOptions = value;
+ this.NotifyOfPropertyChange(() => this.DisplayQSVOptions);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether display framerate controls.
+ /// </summary>
+ public bool DisplayNonQSVControls
+ {
+ get
+ {
+ return this.displayNonQSVControls;
+ }
+
+ set
+ {
+ this.displayNonQSVControls = value;
+ this.NotifyOfPropertyChange(() => this.DisplayNonQSVControls);
+ }
+ }
+
/// <summary>
/// Gets or sets the x 264 preset value.
/// </summary>
@@ -585,6 +710,45 @@ namespace HandBrakeWPF.ViewModels
}
}
}
+
+ /// <summary>
+ /// Gets or sets X264Preset.
+ /// </summary>
+ public QsvPreset QsvPreset
+ {
+ get
+ {
+ return this.Task.QsvPreset;
+ }
+ set
+ {
+ if (!object.Equals(this.QsvPreset, value))
+ {
+ this.Task.QsvPreset = value;
+ this.NotifyOfPropertyChange(() => this.QsvPreset);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the x 264 preset value.
+ /// </summary>
+ public int QsvPresetValue
+ {
+ get
+ {
+ return this.qsvPresetValue;
+ }
+ set
+ {
+ if (!object.Equals(this.QsvPresetValue, value))
+ {
+ this.qsvPresetValue = value;
+ this.QsvPreset = this.QsvPresets[value];
+ this.NotifyOfPropertyChange(() => this.QsvPresetValue);
+ }
+ }
+ }
/// <summary>
/// Gets or sets H264Profile.
@@ -677,6 +841,12 @@ namespace HandBrakeWPF.ViewModels
public BindingList<x264Preset> X264Presets { get; set; }
/// <summary>
+ /// Gets or sets QsvPreset.
+ /// </summary>
+ public BindingList<QsvPreset> QsvPresets { get; set; }
+
+
+ /// <summary>
/// Gets or sets X264Profiles.
/// </summary>
public IEnumerable<x264Profile> H264Profiles { get; set; }
@@ -702,6 +872,17 @@ namespace HandBrakeWPF.ViewModels
}
}
+ /// <summary>
+ /// Gets the qsv slider max.
+ /// </summary>
+ public int QsvSliderMax
+ {
+ get
+ {
+ return SystemInfo.IsHswOrNewer ? 2 : 1;
+ }
+ }
+
#endregion
#region Public Methods
@@ -774,6 +955,7 @@ namespace HandBrakeWPF.ViewModels
this.RF = 32 - cq;
}
break;
+ case VideoEncoder.QuickSync:
case VideoEncoder.X264:
double multiplier = 1.0 / cqStep;
@@ -812,6 +994,10 @@ namespace HandBrakeWPF.ViewModels
this.FastDecode = preset.Task.VideoEncoder == VideoEncoder.X264 && preset.Task.FastDecode;
this.ExtraArguments = preset.Task.ExtraAdvancedArguments;
+ this.QsvPresetValue = preset.Task.VideoEncoder == VideoEncoder.QuickSync
+ ? (int)preset.Task.QsvPreset
+ : SystemInfo.IsHswOrNewer ? (int)QsvPreset.Quality : (int)QsvPreset.Balanced;
+
this.UseAdvancedTab = !string.IsNullOrEmpty(preset.Task.AdvancedEncoderOptions) && this.ShowAdvancedTab;
}
}
@@ -843,6 +1029,7 @@ namespace HandBrakeWPF.ViewModels
this.NotifyOfPropertyChange(() => this.H264Profile);
this.NotifyOfPropertyChange(() => this.FastDecode);
this.NotifyOfPropertyChange(() => this.ExtraArguments);
+ this.NotifyOfPropertyChange(() => this.QsvPreset);
}
/// <summary>
@@ -853,7 +1040,14 @@ namespace HandBrakeWPF.ViewModels
/// </param>
public void SetEncoder(VideoEncoder encoder)
{
+ this.DisplayH264Options = encoder == VideoEncoder.X264 || encoder == VideoEncoder.QuickSync;
this.DisplayX264Options = encoder == VideoEncoder.X264;
+ this.DisplayQSVOptions = encoder == VideoEncoder.QuickSync;
+
+ if (encoder == VideoEncoder.QuickSync)
+ {
+ this.UseAdvancedTab = false;
+ }
}
/// <summary>
@@ -909,6 +1103,7 @@ namespace HandBrakeWPF.ViewModels
this.QualityMax = 31;
break;
case VideoEncoder.X264:
+ case VideoEncoder.QuickSync:
this.QualityMin = 0;
this.QualityMax = (int)(51 / userSettingService.GetUserSetting<double>(UserSettingConstants.X264Step));
break;
diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml b/win/CS/HandBrakeWPF/Views/VideoView.xaml
index c4bd565c7..fffbfd0b2 100644
--- a/win/CS/HandBrakeWPF/Views/VideoView.xaml
+++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml
@@ -6,7 +6,8 @@
xmlns:Converters="clr-namespace:HandBrakeWPF.Converters"
xmlns:Video="clr-namespace:HandBrakeWPF.Converters.Video"
xmlns:Properties="clr-namespace:HandBrakeWPF.Properties"
- xmlns:Micro="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro" mc:Ignorable="d" >
+ xmlns:cal="http://www.caliburnproject.org"
+ mc:Ignorable="d" >
<UserControl.Resources>
<Converters:BooleanConverter x:Key="boolConverter" />
@@ -74,12 +75,18 @@
<StackPanel Orientation="Horizontal">
<TextBlock Text="Framerate (FPS):" VerticalAlignment="Top" Margin="0,5,0,0" Width="100"/>
<StackPanel Orientation="Vertical">
- <ComboBox Width="120" ItemsSource="{Binding Framerates}" SelectedItem="{Binding SelectedFramerate}" />
- <RadioButton Content="Constant Framerate" IsChecked="{Binding IsConstantFramerate}" Margin="0,10,0,0" />
- <RadioButton Content="Variable Framerate" IsChecked="{Binding IsVariableFramerate}" Margin="0,5,0,0"
+ <ComboBox Width="120" ItemsSource="{Binding Framerates}" SelectedItem="{Binding SelectedFramerate}"
+ Visibility="{Binding DisplayNonQSVControls, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ <TextBlock Text="Same as source" VerticalAlignment="Center" Margin="0,5,0,0"
+ Visibility="{Binding DisplayNonQSVControls, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}"/>
+
+ <StackPanel Orientation="Vertical" Visibility="{Binding DisplayNonQSVControls, Converter={StaticResource boolToVisConverter}}">
+ <RadioButton Content="Constant Framerate" IsChecked="{Binding IsConstantFramerate}" Margin="0,10,0,0" />
+ <RadioButton Content="Variable Framerate" IsChecked="{Binding IsVariableFramerate}" Margin="0,5,0,0"
Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=true}" />
- <RadioButton Content="Peak Framerate" IsChecked="{Binding IsPeakFramerate}" Margin="0,5,0,0"
+ <RadioButton Content="Peak Framerate" IsChecked="{Binding IsPeakFramerate}" Margin="0,5,0,0"
Visibility="{Binding ShowPeakFramerate, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
+ </StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
@@ -89,7 +96,7 @@
<TextBlock Text="Quality" FontWeight="Bold" Margin="0,0,0,10"/>
<StackPanel Orientation="Horizontal" Margin="0,0,0,10" >
- <RadioButton Content="Constant Quality:" IsChecked="{Binding IsConstantQuantity}" Margin="0,0,10,0"/>
+ <RadioButton Content="Constant Quality:" IsChecked="{Binding IsConstantQuantity}" Margin="0,0,10,0" Checked="qsv_preset_radiobutton"/>
<TextBlock Text="{Binding DisplayRF}" MinWidth="30" />
<TextBlock Text="{Binding Rfqp}" FontWeight="Bold" Margin="5,0,0,0" />
@@ -112,22 +119,21 @@
</Grid>
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
- <RadioButton Content="Avg Bitrate (kbps):" IsChecked="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,10,0"/>
- <TextBox Width="75" Text="{Binding Task.VideoBitrate, UpdateSourceTrigger=PropertyChanged}"
- IsEnabled="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}" />
+ <RadioButton Content="Avg Bitrate (kbps):" IsChecked="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}" Margin="0,0,10,0" Checked="qsv_preset_radiobutton"/>
+ <TextBox Width="75" Text="{Binding Task.VideoBitrate, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}" />
</StackPanel>
- <StackPanel Orientation="Horizontal" Margin="30,0,0,0">
+ <StackPanel Orientation="Horizontal" Margin="30,0,0,0" Visibility="{Binding DisplayNonQSVControls, Converter={StaticResource boolToVisConverter}}">
<CheckBox Content="2-Pass Encoding" IsEnabled="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}"
- IsChecked="{Binding Task.TwoPass}" Margin="0,0,10,0" />
+ IsChecked="{Binding TwoPass}" Margin="0,0,10,0" />
<CheckBox Content="Turbo first pass" IsEnabled="{Binding IsConstantQuantity, Converter={StaticResource boolConverter}, ConverterParameter=true}"
- IsChecked="{Binding Task.TurboFirstPass}" />
+ IsChecked="{Binding TurboFirstPass}" />
</StackPanel>
</StackPanel>
<!-- H264 settings -->
- <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0,20,0,0" Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}">
+ <Grid Grid.Row="1" Grid.ColumnSpan="2" Margin="0,20,0,0" Visibility="{Binding DisplayH264Options, Converter={StaticResource boolToVisConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@@ -139,8 +145,7 @@
<CheckBox Content="Use Advanced Tab instead" Grid.Row="1" IsChecked="{Binding UseAdvancedTab}"
Visibility="{Binding ShowAdvancedTab, Converter={StaticResource boolToVisConverter}, ConverterParameter=false}" />
- <Grid Grid.Row="2" Margin="0,5,0,0" IsEnabled="{Binding UseAdvancedTab, Converter={StaticResource inverseConverter}}"
- Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}">
+ <Grid Grid.Row="2" Margin="0,5,0,0" IsEnabled="{Binding UseAdvancedTab, Converter={StaticResource inverseConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
@@ -160,22 +165,36 @@
<!-- Row 1 -->
- <TextBlock Text="x264 Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" />
- <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal">
+ <TextBlock Text="x264 Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />
+ <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" >
<Slider Minimum="0" Maximum="9" Width="150" Value="{Binding X264PresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}"
IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" ToolTip="{x:Static Properties:Resources.Video_x264Preset}"
Style="{StaticResource LongToolTipHolder}" />
<TextBlock Text="{Binding X264Preset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />
</StackPanel>
- <TextBlock Text="x264 Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0" />
+ <TextBlock Text="x264 Tune:" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" Margin="0,10,0,0"
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />
<ComboBox Width="100" Grid.Row="2" Grid.Column="1" Margin="5,10,5,0" Height="22"
- ItemsSource="{Binding X264Tunes, Converter={StaticResource enumComboConverter}}"
- SelectedItem="{Binding X264Tune, Converter={StaticResource enumComboConverter}}"
- ToolTip="{x:Static Properties:Resources.Video_x264Tune}"
- Style="{StaticResource LongToolTipHolder}" />
+ ItemsSource="{Binding X264Tunes, Converter={StaticResource enumComboConverter}}"
+ SelectedItem="{Binding X264Tune, Converter={StaticResource enumComboConverter}}"
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}"
+ ToolTip="{x:Static Properties:Resources.Video_x264Tune}"
+ Style="{StaticResource LongToolTipHolder}" />
<CheckBox IsChecked="{Binding FastDecode}" Content="Fast Decode" Grid.Row="2" Grid.Column="2" Margin="10,10,10,0" VerticalAlignment="Center"
- ToolTip="{x:Static Properties:Resources.Video_x264FastDecode}"/>
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}"
+ ToolTip="{x:Static Properties:Resources.Video_x264FastDecode}"/>
+
+ <TextBlock Text="QSV Preset:" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
+ Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" />
+ <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal"
+ Visibility="{Binding DisplayQSVOptions, Converter={StaticResource boolToVisConverter}}" >
+ <Slider Minimum="0" Maximum="{Binding QsvSliderMax}" Width="150" Value="{Binding QsvPresetValue, Mode=Default, UpdateSourceTrigger=PropertyChanged}"
+ IsSnapToTickEnabled="True" TickFrequency="1" TickPlacement="BottomRight" ValueChanged="qsv_preset_ValueChanged"/>
+ <TextBlock Text="{Binding QsvPreset, Converter={StaticResource enumComboConverter}}" Margin="5,0,0,0" />
+ </StackPanel>
<!-- Row 2-->
@@ -194,13 +213,15 @@
ToolTip="{x:Static Properties:Resources.Video_x264Level}"/>
<!-- Row 3 -->
- <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" />
+ <TextBlock Text="Extra Options:" Grid.Row="4" Grid.Column="0" Margin="0,10,0,0" VerticalAlignment="Center" HorizontalAlignment="Left"
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" />
<TextBox Text="{Binding ExtraArguments, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
- Height="30" MaxLines="2" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,10,0,0" VerticalAlignment="Center"
- ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}">
+ Height="30" MaxLines="2" Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="3" Margin="5,10,0,0" VerticalAlignment="Center"
+ ToolTip="{Binding FullOptionsTooltip}" Style="{StaticResource LongToolTipHolder}"
+ Visibility="{Binding DisplayX264Options, Converter={StaticResource boolToVisConverter}}" >
<TextBox.ContextMenu>
<ContextMenu>
- <MenuItem Header="Copy Full Query" Micro:Message.Attach="[Event Click] = [Action CopyQuery]" />
+ <MenuItem Header="Copy Full Query" cal:Message.Attach="[Event Click] = [Action CopyQuery]" />
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
diff --git a/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs b/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs
index 8a0842a96..a285e490b 100644
--- a/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs
+++ b/win/CS/HandBrakeWPF/Views/VideoView.xaml.cs
@@ -9,8 +9,19 @@
namespace HandBrakeWPF.Views
{
+ using System.Collections.Generic;
+ using System.Windows;
using System.Windows.Controls;
+ using Caliburn.Micro;
+
+ using HandBrake.ApplicationServices.Model;
+ using HandBrake.ApplicationServices.Utilities;
+ using HandBrake.Interop.Model.Encoding;
+
+ using HandBrakeWPF.ViewModels;
+ using HandBrakeWPF.ViewModels.Interfaces;
+
/// <summary>
/// Interaction logic for VideoView.xaml
/// </summary>
@@ -23,5 +34,80 @@ namespace HandBrakeWPF.Views
{
InitializeComponent();
}
+
+
+ private void qsv_preset_radiobutton(object sender, System.Windows.RoutedEventArgs e)
+ {
+ qsv_preset_ValueChanged(sender, null);
+ }
+
+ private void qsv_preset_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
+ {
+ VideoViewModel mvm = ((VideoViewModel)this.DataContext);
+ EncodeTask task = mvm.Task;
+
+ string addon = "";
+
+ if (SystemInfo.IsHswOrNewer)
+ {
+ if (task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality)
+ {
+ if (task.QsvPreset == QsvPreset.Balanced ||
+ task.QsvPreset == QsvPreset.Speed)
+ addon = "num-ref-frame=1";
+ }
+ if (task.VideoEncodeRateType == VideoEncodeRateType.AverageBitrate)
+ {
+ if (task.QsvPreset == QsvPreset.Quality)
+ addon = "lookahead=1:gop-ref-dist=3";
+ else
+ if (task.QsvPreset == QsvPreset.Balanced)
+ {
+ addon = "num-ref-frame=1:gop-ref-dist=1";
+ }
+ else
+ if (task.QsvPreset == QsvPreset.Speed)
+ addon = "gop-ref-dist=1";
+ }
+ }
+
+
+ string full_string = addon + ":";
+
+ IDictionary<string, string> newOptions = new Dictionary<string, string>();
+ string[] existingSegments = full_string.Split(':');
+ foreach (string existingSegment in existingSegments)
+ {
+ string optionName = existingSegment;
+ string optionValue = string.Empty;
+ int equalsIndex = existingSegment.IndexOf('=');
+ if (equalsIndex >= 0)
+ {
+ optionName = existingSegment.Substring(
+ 0, existingSegment.IndexOf("=", System.StringComparison.Ordinal));
+ optionValue = existingSegment.Substring(equalsIndex);
+ }
+
+ if (optionName != string.Empty)
+ {
+ if (newOptions.ContainsKey(optionName))
+ newOptions.Remove(optionName);
+ newOptions.Add(optionName, optionValue);
+ }
+ }
+
+ full_string = "";
+ foreach (KeyValuePair<string, string> entry in newOptions)
+ {
+ full_string += entry.Key;
+ if (entry.Value != string.Empty)
+ full_string += entry.Value;
+ full_string += ":";
+ }
+ full_string = full_string.TrimEnd(':');
+
+ task.AdvancedEncoderOptions = full_string;
+ task.NotifyOfPropertyChange(() => task.AdvancedEncoderOptions);
+ }
}
}