diff options
author | sr55 <[email protected]> | 2021-02-04 20:24:27 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2021-02-04 20:24:27 +0000 |
commit | f52375b929185731ee0033cb605e2281c9966d02 (patch) | |
tree | b9f654fd9bb4b2e980db15ce37721bc650fa6b29 /win | |
parent | 8ac490e3e147c84a01d7679c22ba817eba84880f (diff) |
WinGui: More Interop Cleanup. Anamorphic Factory is not used. Similar functionaility is in HandBrakePictureHelper.cs
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs | 94 | ||||
-rw-r--r-- | win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs | 4 | ||||
-rw-r--r-- | win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs | 22 | ||||
-rw-r--r-- | win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs | 1 | ||||
-rw-r--r-- | win/CS/HandBrake.Interop/Interop/Interfaces/Model/PreviewSettings.cs (renamed from win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs) | 5 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Services/Scan/LibScan.cs | 1 |
6 files changed, 9 insertions, 118 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs b/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs deleted file mode 100644 index 24be1337b..000000000 --- a/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs +++ /dev/null @@ -1,94 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// <copyright file="AnamorphicFactory.cs" company="HandBrake Project (https://handbrake.fr)"> -// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. -// </copyright> -// <summary> -// The Anamorphic factory. -// </summary> -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Interop.Factories -{ - using System.Collections.Generic; - - using HandBrake.Interop.Interop.Json.Anamorphic; - using HandBrake.Interop.Interop.Json.Shared; - using HandBrake.Interop.Interop.Model; - using HandBrake.Interop.Interop.Model.Encoding; - using HandBrake.Interop.Interop.Model.Preview; - - /// <summary> - /// The anamorphic factory. - /// </summary> - public class AnamorphicFactory - { - /// <summary> - /// The keep setting. - /// </summary> - public enum KeepSetting - { - HB_KEEP_WIDTH = 0x01, - HB_KEEP_HEIGHT = 0x02, - HB_KEEP_DISPLAY_ASPECT = 0x04 - } - - /// <summary> - /// Finds output geometry for the given preview settings and title. - /// </summary> - /// <param name="settings"> - /// The preview settings. - /// </param> - /// <param name="title"> - /// Information on the title to consider. - /// </param> - /// <returns> - /// Geometry Information - /// </returns> - public static Geometry CreateGeometry(PreviewSettings settings, SourceVideoInfo title) - { - int settingMode = settings.KeepDisplayAspect ? 0x04 : 0; - - // Sanitize the Geometry First. - AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry - { - SourceGeometry = new Geometry - { - Width = title.Resolution.Width, - Height = title.Resolution.Height, - PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height } - }, - DestSettings = new DestSettings - { - AnamorphicMode = (int)settings.Anamorphic, - Geometry = - { - Width = settings.Width, - Height = settings.Height, - PAR = new PAR - { - Num = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : settings.PixelAspectX, - Den = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : settings.PixelAspectY, - } - }, - Keep = settingMode, - Crop = new List<int> { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right }, - Modulus = settings.Modulus ?? 16, - MaxWidth = settings.MaxWidth, - MaxHeight = settings.MaxHeight, - ItuPAR = false - } - }; - - if (settings.Anamorphic == Anamorphic.Custom) - { - anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = settings.PixelAspectX, Den = settings.PixelAspectY }; - } - else - { - anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height }; - } - - return HandBrakeUtils.GetAnamorphicSize(anamorphicGeometry); - } - } -} diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs index f08ae1407..fd117162d 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs @@ -20,10 +20,10 @@ namespace HandBrake.Interop.Interop using System.Xml; using HandBrake.Interop.Interop.EventArgs; - using HandBrake.Interop.Interop.Factories; using HandBrake.Interop.Interop.HbLib; using HandBrake.Interop.Interop.Helpers; using HandBrake.Interop.Interop.Interfaces; + using HandBrake.Interop.Interop.Interfaces.Model; using HandBrake.Interop.Interop.Json.Encode; using HandBrake.Interop.Interop.Json.Scan; using HandBrake.Interop.Interop.Json.State; @@ -204,7 +204,7 @@ namespace HandBrake.Interop.Interop { crop = new[] { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right }, itu_par = 0, - keep = (int)AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH + (settings.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width? + keep = (int)HandBrakePictureHelpers.KeepSetting.HB_KEEP_WIDTH + (settings.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width? maxWidth = settings.MaxWidth, maxHeight = settings.MaxHeight, mode = (int)(hb_anamorphic_mode_t)settings.Anamorphic, diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs index 838ceaa33..96e9720ba 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs @@ -15,31 +15,14 @@ namespace HandBrake.Interop.Interop public class HandBrakePictureHelpers { - /// <summary> - /// The keep setting. - /// </summary> public enum KeepSetting { + // From common.h HB_KEEP_WIDTH = 0x01, HB_KEEP_HEIGHT = 0x02, HB_KEEP_DISPLAY_ASPECT = 0x04 } - /// <summary> - /// The hb_set_anamorphic_size 2. - /// </summary> - /// <param name="job"> - /// The job. - /// </param> - /// <param name="title"> - /// The title. - /// </param> - /// <param name="setting"> - /// The setting. - /// </param> - /// <returns> - /// The <see cref="AnamorphicResult"/>. - /// </returns> public static AnamorphicResult hb_set_anamorphic_size2(PictureSettingsJob job, PictureSettingsTitle title, KeepSetting setting) { int settingMode = (int)setting + (job.KeepDisplayAspect ? 0x04 : 0); @@ -86,8 +69,7 @@ namespace HandBrake.Interop.Interop int outputParHeight = result.par.den; return new AnamorphicResult { OutputWidth = outputWidth, OutputHeight = outputHeight, OutputParWidth = outputParWidth, OutputParHeight = outputParHeight }; } - - + internal static hb_geometry_s GetAnamorphicSizes(hb_geometry_s sourceGeometry, hb_geometry_settings_s uiGeometry) { hb_geometry_s geometry = new hb_geometry_s(); diff --git a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs index 284cde4d6..ea162ce5b 100644 --- a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs @@ -12,6 +12,7 @@ namespace HandBrake.Interop.Interop.Interfaces using System; using HandBrake.Interop.Interop.EventArgs; + using HandBrake.Interop.Interop.Interfaces.Model; using HandBrake.Interop.Interop.Json.Scan; using HandBrake.Interop.Interop.Model.Preview; diff --git a/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs b/win/CS/HandBrake.Interop/Interop/Interfaces/Model/PreviewSettings.cs index d09d05eda..5304610ff 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs +++ b/win/CS/HandBrake.Interop/Interop/Interfaces/Model/PreviewSettings.cs @@ -7,9 +7,10 @@ // </summary> // -------------------------------------------------------------------------------------------------------------------- -namespace HandBrake.Interop.Interop.Model.Preview +namespace HandBrake.Interop.Interop.Interfaces.Model { - using Encoding; + using HandBrake.Interop.Interop.Model; + using HandBrake.Interop.Interop.Model.Encoding; /// <summary> /// The preview settings. diff --git a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs index 8ea3e097a..ca8a124bc 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/LibScan.cs @@ -16,6 +16,7 @@ namespace HandBrakeWPF.Services.Scan using HandBrake.Interop.Interop; using HandBrake.Interop.Interop.Interfaces; + using HandBrake.Interop.Interop.Interfaces.Model; using HandBrake.Interop.Interop.Json.Scan; using HandBrake.Interop.Interop.Model; using HandBrake.Interop.Interop.Model.Encoding; |