diff options
Diffstat (limited to 'win/C#/Functions')
-rw-r--r-- | win/C#/Functions/PresetLoader.cs | 60 | ||||
-rw-r--r-- | win/C#/Functions/QueryParser.cs | 4 |
2 files changed, 34 insertions, 30 deletions
diff --git a/win/C#/Functions/PresetLoader.cs b/win/C#/Functions/PresetLoader.cs index b484b6958..5f0459040 100644 --- a/win/C#/Functions/PresetLoader.cs +++ b/win/C#/Functions/PresetLoader.cs @@ -155,40 +155,42 @@ namespace Handbrake.Functions // Quality
- mainWindow.radio_cq.Checked = true;
- if (presetQuery.VideoEncoder == "H.264 (x264)")
+ if (presetQuery.VideoQuality != -1)
{
- double cqStep = Properties.Settings.Default.x264cqstep;
- int value;
- double x264step = cqStep;
- double presetValue = presetQuery.VideoQuality;
-
- double x = 51 / x264step;
-
- double calculated = presetValue / x264step;
- calculated = x - calculated;
-
- int.TryParse(calculated.ToString(), out value);
-
- // This will sometimes occur when the preset was generated
- // with a different granularity, so, round and try again.
- if (value == 0)
+ mainWindow.radio_cq.Checked = true;
+ if (presetQuery.VideoEncoder == "H.264 (x264)")
{
- double val = Math.Round(calculated, 0);
- int.TryParse(val.ToString(), out value);
+ double cqStep = Properties.Settings.Default.x264cqstep;
+ int value;
+ double x264step = cqStep;
+ double presetValue = presetQuery.VideoQuality;
+
+ double x = 51/x264step;
+
+ double calculated = presetValue/x264step;
+ calculated = x - calculated;
+
+ int.TryParse(calculated.ToString(), out value);
+
+ // This will sometimes occur when the preset was generated
+ // with a different granularity, so, round and try again.
+ if (value == 0)
+ {
+ double val = Math.Round(calculated, 0);
+ int.TryParse(val.ToString(), out value);
+ }
+ if (value <= mainWindow.slider_videoQuality.Maximum)
+ mainWindow.slider_videoQuality.Value = value;
+ }
+ else
+ {
+ int presetVal;
+ int.TryParse(presetQuery.VideoQuality.ToString(), out presetVal);
+ if (presetVal > mainWindow.slider_videoQuality.Minimum)
+ mainWindow.slider_videoQuality.Value = presetVal;
}
- if (value <= mainWindow.slider_videoQuality.Maximum)
- mainWindow.slider_videoQuality.Value = value;
- }
- else
- {
- int presetVal;
- int.TryParse(presetQuery.VideoQuality.ToString(), out presetVal);
- if (presetVal > mainWindow.slider_videoQuality.Minimum)
- mainWindow.slider_videoQuality.Value = presetVal;
}
-
mainWindow.check_2PassEncode.CheckState = presetQuery.TwoPass ? CheckState.Checked : CheckState.Unchecked;
mainWindow.drp_videoFramerate.Text = presetQuery.VideoFramerate;
diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 7230ad993..78a73b52b 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -329,7 +329,9 @@ namespace Handbrake.Functions {
float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture);
thisQuery.VideoQuality = qConvert;
- }
+ }
+ else
+ thisQuery.VideoQuality = -1;
#endregion
#region Audio Tab
|