diff options
Diffstat (limited to 'win/CS/HandBrakeWPF')
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs | 14 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs | 49 |
2 files changed, 55 insertions, 8 deletions
diff --git a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs index dedfadf9f..91323761f 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ChaptersViewModel.cs @@ -400,7 +400,19 @@ namespace HandBrakeWPF.ViewModels // differences (e.g. longer title sequences and different distributor credits)
if (hasTimestamps)
{
- var diffs = importedChapters.Zip(this.Chapters, (import, source) => source.Duration - import.Value.Item2);
+ List<TimeSpan> diffs = new List<TimeSpan>();
+ foreach (KeyValuePair<int, Tuple<string, TimeSpan>> import in importedChapters)
+ {
+ ChapterMarker sourceMarker = this.Chapters[import.Key - 1];
+ TimeSpan source = sourceMarker.Duration;
+
+ TimeSpan diff = source - import.Value.Item2;
+ diffs.Add(diff);
+
+ }
+
+
+ // var diffs = importedChapters.Zip(this.Chapters, (import, source) => source.Duration - import.Value.Item2);
if (diffs.Count(diff => Math.Abs(diff.TotalSeconds) > 15) > 2)
{
if (this.errorService.ShowMessageBox(
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 5170e45c7..d79398348 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -1435,14 +1435,9 @@ namespace HandBrakeWPF.ViewModels }
this.VideoPresetMaxValue = encoder.Presets.Count - 1;
- int middlePreset = (int)Math.Round((decimal)(this.VideoPresetMaxValue / 2), 0);
+
- if (selectedEncoder == VideoEncoder.NvencH264 || selectedEncoder == VideoEncoder.NvencH265)
- {
- middlePreset = this.VideoPresets.IndexOf(this.VideoPresets.FirstOrDefault(s => s.ShortName == "slow"));
- }
-
- this.VideoPresetValue = middlePreset;
+ this.VideoPresetValue = GetDefaultEncoderPreset(selectedEncoder);
}
else
{
@@ -1532,5 +1527,45 @@ namespace HandBrakeWPF.ViewModels this.SetRF(displayRF);
}
+
+ private int GetDefaultEncoderPreset(VideoEncoder selectedEncoder)
+ {
+ int defaultPreset = (int)Math.Round((decimal)(this.VideoPresetMaxValue / 2), 0);
+
+ // Override for NVEnc
+ if (selectedEncoder == VideoEncoder.NvencH264 || selectedEncoder == VideoEncoder.NvencH265)
+ {
+ // TODO -> is the RTX good enough to default to a more balanced preset?
+ defaultPreset = this.VideoPresets.IndexOf(this.VideoPresets.FirstOrDefault(s => s.ShortName == "slow"));
+ }
+
+ // Override for QuickSync
+ if (selectedEncoder == VideoEncoder.QuickSyncH265 || selectedEncoder == VideoEncoder.QuickSyncH26510b)
+ {
+ if (HandBrake.Interop.Utilities.SystemInfo.QsvHardwareGeneration > 6)
+ {
+ defaultPreset = this.VideoPresets.IndexOf(this.VideoPresets.FirstOrDefault(s => s.ShortName == "speed")); // TGL
+ }
+ else
+ {
+ defaultPreset = this.VideoPresets.IndexOf(this.VideoPresets.FirstOrDefault(s => s.ShortName == "balanced")); // ICL and Earlier.
+ }
+ }
+
+ if (selectedEncoder == VideoEncoder.QuickSync)
+ {
+ // h264 encoder hasn't changed much in recent years, so stick to balanced.
+ defaultPreset = this.VideoPresets.IndexOf(this.VideoPresets.FirstOrDefault(s => s.ShortName == "balanced"));
+ }
+
+ // Override for VCE
+ if (selectedEncoder == VideoEncoder.VceH264 || selectedEncoder == VideoEncoder.VceH265)
+ {
+ // TODO Would be good to have VCE version detection.
+ defaultPreset = this.VideoPresets.IndexOf(this.VideoPresets.FirstOrDefault(s => s.ShortName == "balanced"));
+ }
+
+ return defaultPreset;
+ }
}
}
\ No newline at end of file |