diff options
author | sr55 <[email protected]> | 2020-10-04 15:41:07 +0100 |
---|---|---|
committer | sr55 <[email protected]> | 2020-10-04 15:41:15 +0100 |
commit | de8f3c5586121dcdf2b3b415464d686b9e58e3d2 (patch) | |
tree | 24d5ad72d02c602f43280295f6d5d5b0e2b56678 /win/CS | |
parent | 561977956f39858d81e4786565466e63f8ddd430 (diff) |
HandBrake.Interop: Library cleanup.
- Remove HbFunctions provider class and interface. It's not needed. Interop library will direct call libhb though HBFunctions.cs
- Remove HbFunctionsDirect. Any consumer of the HandBrake API should be using managed calls rather than having to deal with pointers.
- Fix many stylecop warnings and update rulesets around this.
Diffstat (limited to 'win/CS')
120 files changed, 601 insertions, 1382 deletions
diff --git a/win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs b/win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs index 849aff069..31cae3283 100644 --- a/win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs +++ b/win/CS/HandBrake.Interop/Attributes/DisplayNameLocalized.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="DisplayNameLocalized.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="DisplayNameLocalized.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> diff --git a/win/CS/HandBrake.Interop/Attributes/ShortName.cs b/win/CS/HandBrake.Interop/Attributes/ShortName.cs index 1f5ef6700..2e9f97570 100644 --- a/win/CS/HandBrake.Interop/Attributes/ShortName.cs +++ b/win/CS/HandBrake.Interop/Attributes/ShortName.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="ShortName.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="ShortName.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> diff --git a/win/CS/HandBrake.Interop/HandBrake.Interop.csproj b/win/CS/HandBrake.Interop/HandBrake.Interop.csproj index 4034d02c7..b7cd952c9 100644 --- a/win/CS/HandBrake.Interop/HandBrake.Interop.csproj +++ b/win/CS/HandBrake.Interop/HandBrake.Interop.csproj @@ -19,6 +19,12 @@ </PropertyGroup> <ItemGroup> + <Compile Remove="Interop\HbLib\Wrappers\**" /> + <EmbeddedResource Remove="Interop\HbLib\Wrappers\**" /> + <None Remove="Interop\HbLib\Wrappers\**" /> + </ItemGroup> + + <ItemGroup> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> </ItemGroup> diff --git a/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs b/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs index 303995194..bad483d78 100644 --- a/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs +++ b/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="EncodeProgressEventArgs.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="EncodeProgressEventArgs.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> diff --git a/win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs b/win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs index 2359fff5d..22f74b0b3 100644 --- a/win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs +++ b/win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="MessageLoggedEventArgs.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="MessageLoggedEventArgs.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> diff --git a/win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs b/win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs index 8e87552a2..274210a9b 100644 --- a/win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs +++ b/win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="ScanProgressEventArgs.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="ScanProgressEventArgs.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> diff --git a/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs b/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs index a1d0207f3..24be1337b 100644 --- a/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs +++ b/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="AnamorphicFactory.cs" company="HandBrake Project (http://handbrake.fr)"> +// <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> diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs index 83390faa0..dd2c64dd7 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HandBrakeEncoderHelpers.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HandBrakeEncoderHelpers.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> @@ -14,19 +14,12 @@ namespace HandBrake.Interop.Interop using System.Linq; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Helpers; using HandBrake.Interop.Interop.Model; using HandBrake.Interop.Interop.Model.Encoding; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; - /// <summary> - /// The encoders. - /// </summary> public static class HandBrakeEncoderHelpers { - private static IHbFunctions hbFunctions; private static List<HBAudioEncoder> audioEncoders; private static List<HBVideoEncoder> videoEncoders; private static List<HBRate> videoFramerates; @@ -40,9 +33,6 @@ namespace HandBrake.Interop.Interop /// </summary> static HandBrakeEncoderHelpers() { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - if (!HandBrakeUtils.IsInitialised()) { throw new Exception("Please Initialise with HandBrakeUtils.EnsureGlobalInit before using!"); @@ -58,7 +48,7 @@ namespace HandBrake.Interop.Interop { if (audioEncoders == null) { - audioEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBAudioEncoder>(hbFunctions.hb_audio_encoder_get_next, HandBrakeUnitConversionHelpers.NativeToAudioEncoder); + audioEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBAudioEncoder>(HBFunctions.hb_audio_encoder_get_next, HandBrakeUnitConversionHelpers.NativeToAudioEncoder); } return audioEncoders; @@ -74,7 +64,7 @@ namespace HandBrake.Interop.Interop { if (videoEncoders == null) { - videoEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBVideoEncoder>(hbFunctions.hb_video_encoder_get_next, HandBrakeUnitConversionHelpers.NativeToVideoEncoder); + videoEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBVideoEncoder>(HBFunctions.hb_video_encoder_get_next, HandBrakeUnitConversionHelpers.NativeToVideoEncoder); } return videoEncoders; @@ -90,7 +80,7 @@ namespace HandBrake.Interop.Interop { if (videoFramerates == null) { - videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(hbFunctions.hb_video_framerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate); + videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate); } return videoFramerates; @@ -106,7 +96,7 @@ namespace HandBrake.Interop.Interop { if (mixdowns == null) { - mixdowns = InteropUtilities.ToListFromIterator<hb_mixdown_s, HBMixdown>(hbFunctions.hb_mixdown_get_next, HandBrakeUnitConversionHelpers.NativeToMixdown); + mixdowns = InteropUtilities.ToListFromIterator<hb_mixdown_s, HBMixdown>(HBFunctions.hb_mixdown_get_next, HandBrakeUnitConversionHelpers.NativeToMixdown); } return mixdowns; @@ -122,7 +112,7 @@ namespace HandBrake.Interop.Interop { if (audioBitrates == null) { - audioBitrates = InteropUtilities.ToListFromIterator<hb_rate_s, int>(hbFunctions.hb_audio_bitrate_get_next, b => b.rate); + audioBitrates = InteropUtilities.ToListFromIterator<hb_rate_s, int>(HBFunctions.hb_audio_bitrate_get_next, b => b.rate); } return audioBitrates; @@ -138,7 +128,7 @@ namespace HandBrake.Interop.Interop { if (audioSampleRates == null) { - audioSampleRates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(hbFunctions.hb_audio_samplerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate); + audioSampleRates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_audio_samplerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate); } return audioSampleRates; @@ -154,7 +144,7 @@ namespace HandBrake.Interop.Interop { if (containers == null) { - containers = InteropUtilities.ToListFromIterator<hb_container_s, HBContainer>(hbFunctions.hb_container_get_next, HandBrakeUnitConversionHelpers.NativeToContainer); + containers = InteropUtilities.ToListFromIterator<hb_container_s, HBContainer>(HBFunctions.hb_container_get_next, HandBrakeUnitConversionHelpers.NativeToContainer); } return containers; @@ -168,7 +158,7 @@ namespace HandBrake.Interop.Interop { get { - return hbFunctions.hb_subtitle_can_burn((int)hb_subtitle_s_subsource.IMPORTSRT) > 0; + return HBFunctions.hb_subtitle_can_burn((int)hb_subtitle_s_subsource.IMPORTSRT) > 0; } } @@ -179,7 +169,7 @@ namespace HandBrake.Interop.Interop { get { - return hbFunctions.hb_subtitle_can_burn((int)hb_subtitle_s_subsource.IMPORTSSA) > 0; + return HBFunctions.hb_subtitle_can_burn((int)hb_subtitle_s_subsource.IMPORTSSA) > 0; } } @@ -281,7 +271,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static bool SubtitleCanSetForcedOnly(int source) { - return hbFunctions.hb_subtitle_can_force(source) > 0; + return HBFunctions.hb_subtitle_can_force(source) > 0; } /// <summary> @@ -295,7 +285,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static bool SubtitleCanBurn(int source) { - return hbFunctions.hb_subtitle_can_burn(source) > 0; + return HBFunctions.hb_subtitle_can_burn(source) > 0; } /// <summary> @@ -312,7 +302,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static bool SubtitleCanPassthrough(int subtitleSourceType, int muxer) { - return hbFunctions.hb_subtitle_can_pass(subtitleSourceType, muxer) > 0; + return HBFunctions.hb_subtitle_can_pass(subtitleSourceType, muxer) > 0; } /// <summary> @@ -360,7 +350,7 @@ namespace HandBrake.Interop.Interop /// The encoder to examine. /// </param> /// <returns> - /// True if the given encoder is comatible with the given audio track. + /// True if the given encoder is compatible with the given audio track. /// </returns> /// <remarks> /// Only works with passthrough encoders. @@ -384,7 +374,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static bool MixdownHasRemixSupport(HBMixdown mixdown, ulong layout) { - return hbFunctions.hb_mixdown_has_remix_support(mixdown.Id, layout) > 0; + return HBFunctions.hb_mixdown_has_remix_support(mixdown.Id, layout) > 0; } /// <summary> @@ -401,7 +391,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder) { - return hbFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0; + return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0; } /// <summary> @@ -417,12 +407,15 @@ namespace HandBrake.Interop.Interop /// <returns>True if available.</returns> public static bool MixdownIsSupported(HBMixdown mixdown, HBAudioEncoder encoder, long channelLayout) { - return hbFunctions.hb_mixdown_is_supported(mixdown.Id, (uint)encoder.Id, (uint)channelLayout) > 0; + return HBFunctions.hb_mixdown_is_supported(mixdown.Id, (uint)encoder.Id, (uint)channelLayout) > 0; } /// <summary> /// Determines if DRC can be applied to the given track with the given encoder. /// </summary> + /// <param name="handle"> + /// The handle. + /// </param> /// <param name="trackNumber"> /// The track Number. /// </param> @@ -437,7 +430,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static bool CanApplyDrc(IntPtr handle, int trackNumber, HBAudioEncoder encoder, int title) { - return hbFunctions.hb_audio_can_apply_drc2(handle, title, trackNumber, encoder.Id) > 0; + return HBFunctions.hb_audio_can_apply_drc2(handle, title, trackNumber, encoder.Id) > 0; } /// <summary> @@ -476,7 +469,7 @@ namespace HandBrake.Interop.Interop return null; } - int sanitizedMixdown = hbFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id); + int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id); if (sanitizedMixdown != -1) { return Mixdowns.Single(m => m.Id == sanitizedMixdown); @@ -499,7 +492,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static HBMixdown GetDefaultMixdown(HBAudioEncoder encoder, ulong layout) { - int defaultMixdown = hbFunctions.hb_mixdown_get_default((uint)encoder.Id, layout); + int defaultMixdown = HBFunctions.hb_mixdown_get_default((uint)encoder.Id, layout); return Mixdowns.Single(m => m.Id == defaultMixdown); } @@ -511,7 +504,7 @@ namespace HandBrake.Interop.Interop /// <returns>The sanitized sample rate.</returns> public static int SanitizeSampleRate(HBAudioEncoder encoder, int sampleRate) { - return hbFunctions.hb_audio_samplerate_find_closest(sampleRate, (uint)encoder.Id); + return HBFunctions.hb_audio_samplerate_find_closest(sampleRate, (uint)encoder.Id); } /// <summary> @@ -534,7 +527,7 @@ namespace HandBrake.Interop.Interop int low = 0; int high = 0; - hbFunctions.hb_audio_bitrate_get_limits((uint)encoder.Id, sampleRate, mixdown.Id, ref low, ref high); + HBFunctions.hb_audio_bitrate_get_limits((uint)encoder.Id, sampleRate, mixdown.Id, ref low, ref high); return new BitrateLimits(low, high); } @@ -555,7 +548,7 @@ namespace HandBrake.Interop.Interop float granularity = 0; int direction = 0; - hbFunctions.hb_video_quality_get_limits((uint)encoder.Id, ref low, ref high, ref granularity, ref direction); + HBFunctions.hb_video_quality_get_limits((uint)encoder.Id, ref low, ref high, ref granularity, ref direction); return new VideoQualityLimits(low, high, granularity, direction == 0); } @@ -580,7 +573,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static int SanitizeAudioBitrate(int audioBitrate, HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) { - return hbFunctions.hb_audio_bitrate_get_best((uint)encoder.Id, audioBitrate, sampleRate, mixdown.Id); + return HBFunctions.hb_audio_bitrate_get_best((uint)encoder.Id, audioBitrate, sampleRate, mixdown.Id); } /// <summary> @@ -600,7 +593,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) { - return hbFunctions.hb_audio_bitrate_get_default((uint)encoder.Id, sampleRate, mixdown.Id); + return HBFunctions.hb_audio_bitrate_get_default((uint)encoder.Id, sampleRate, mixdown.Id); } /// <summary> @@ -616,7 +609,7 @@ namespace HandBrake.Interop.Interop { float low = 0, high = 0, granularity = 0; int direction = 0; - hbFunctions.hb_audio_quality_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction); + HBFunctions.hb_audio_quality_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction); return new RangeLimits(direction == 0, granularity, high, low); } @@ -634,7 +627,7 @@ namespace HandBrake.Interop.Interop { float low = 0, high = 0, granularity = 0; int direction = 0; - hbFunctions.hb_audio_compression_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction); + HBFunctions.hb_audio_compression_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction); return new RangeLimits(direction == 0, granularity, high, low); } @@ -650,7 +643,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static double GetDefaultQuality(HBAudioEncoder encoder) { - return hbFunctions.hb_audio_quality_get_default((uint)encoder.Id); + return HBFunctions.hb_audio_quality_get_default((uint)encoder.Id); } /// <summary> @@ -664,7 +657,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static double GetDefaultAudioCompression(HBAudioEncoder encoder) { - return hbFunctions.hb_audio_compression_get_default((uint)encoder.Id); + return HBFunctions.hb_audio_compression_get_default((uint)encoder.Id); } public static uint BuildCopyMask(bool audioAllowMP3Pass, bool audioAllowAACPass, bool audioAllowAC3Pass, bool audioAllowDTSPass, bool audioAllowDTSHDPass, bool audioAllowEac3Pass, bool audioAllowFlacPass, bool audioAllowTruehdPass) @@ -713,5 +706,14 @@ namespace HandBrake.Interop.Interop return mask; } + + public static List<int> GetQsvAdaptorList() + { + IntPtr gpuListPtr = HBFunctions.hb_qsv_adapters_list(); + + List<int> gpuList = InteropUtilities.ToListFromHandBrakeList<int>(gpuListPtr); + + return gpuList; + } } } diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs index c398f2f0a..878b56512 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HandBrakeFilterHelpers.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HandBrakeFilterHelpers.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> @@ -15,12 +15,9 @@ namespace HandBrake.Interop.Interop using System.Runtime.InteropServices; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Helpers; using HandBrake.Interop.Interop.Json.Filters; using HandBrake.Interop.Interop.Model.Encoding; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; using Newtonsoft.Json; @@ -29,14 +26,6 @@ namespace HandBrake.Interop.Interop /// </summary> public class HandBrakeFilterHelpers { - private static IHbFunctions hbFunctions; - - static HandBrakeFilterHelpers() - { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - } - /// <summary> /// The get filter presets. /// </summary> @@ -48,7 +37,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static List<HBPresetTune> GetFilterPresets(int filter) { - IntPtr ptr = hbFunctions.hb_filter_get_presets_json(filter); + IntPtr ptr = HBFunctions.hb_filter_get_presets_json(filter); string result = Marshal.PtrToStringAnsi(ptr); List<PresetTune> list = JsonConvert.DeserializeObject<List<PresetTune>>(result); @@ -66,7 +55,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static List<HBPresetTune> GetFilterTunes(int filter) { - IntPtr ptr = hbFunctions.hb_filter_get_tunes_json(filter); + IntPtr ptr = HBFunctions.hb_filter_get_tunes_json(filter); string result = Marshal.PtrToStringAnsi(ptr); List<PresetTune> list = JsonConvert.DeserializeObject<List<PresetTune>>(result); @@ -80,7 +69,7 @@ namespace HandBrake.Interop.Interop /// <returns>The list of keys for custom settings for the filter.</returns> public static List<string> GetFilterKeys(int filter) { - IntPtr ptr = hbFunctions.hb_filter_get_keys(filter); + IntPtr ptr = HBFunctions.hb_filter_get_keys(filter); return InteropUtilities.ToStringListFromArrayPtr(ptr); } @@ -107,9 +96,16 @@ namespace HandBrake.Interop.Interop return new Dictionary<string, string>(); } - IntPtr ptr = hbFunctions.hb_generate_filter_settings_json(filter, presetName, null, null); + IntPtr ptr = HBFunctions.hb_generate_filter_settings_json(filter, presetName, null, null); string result = Marshal.PtrToStringAnsi(ptr); return JsonConvert.DeserializeObject<Dictionary<string, string>>(result); } + + public static string GenerateFilterSettingJson(int filterId, string preset, string tune, string custom) + { + IntPtr result = HBFunctions.hb_generate_filter_settings_json(filterId, preset, tune, custom); + string unparsedJson = Marshal.PtrToStringAnsi(result); + return unparsedJson; + } } } diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs index 5d4dd98ac..c9ee15cb8 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs @@ -13,7 +13,6 @@ namespace HandBrake.Interop.Interop using System.Collections.Generic; using System.Diagnostics; using System.Linq; - using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using System.Timers; @@ -21,7 +20,6 @@ namespace HandBrake.Interop.Interop using HandBrake.Interop.Interop.EventArgs; using HandBrake.Interop.Interop.Factories; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Helpers; using HandBrake.Interop.Interop.Interfaces; using HandBrake.Interop.Interop.Json.Encode; @@ -29,14 +27,11 @@ namespace HandBrake.Interop.Interop using HandBrake.Interop.Interop.Json.State; using HandBrake.Interop.Interop.Model.Encoding; using HandBrake.Interop.Interop.Model.Preview; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; using Newtonsoft.Json; public class HandBrakeInstance : IHandBrakeInstance, IDisposable { - private IHbFunctions hbFunctions; private const double ScanPollIntervalMs = 250; private const double EncodePollIntervalMs = 250; private Timer scanPollTimer; @@ -74,7 +69,6 @@ namespace HandBrake.Interop.Interop /// </summary> public event EventHandler<EncodeCompletedEventArgs> EncodeCompleted; - /// <summary> /// Gets the number of previews created during scan. /// </summary> @@ -98,12 +92,12 @@ namespace HandBrake.Interop.Interop /// <summary> /// Gets the HandBrake version string. /// </summary> - public string Version => Marshal.PtrToStringAnsi(hbFunctions.hb_get_version(this.Handle)); + public string Version => Marshal.PtrToStringAnsi(HBFunctions.hb_get_version(this.Handle)); /// <summary> /// Gets the HandBrake build number. /// </summary> - public int Build => hbFunctions.hb_get_build(this.Handle); + public int Build => HBFunctions.hb_get_build(this.Handle); public bool IsRemoteInstance => false; @@ -123,13 +117,10 @@ namespace HandBrake.Interop.Interop /// </param> public void Initialize(int verbosity, bool noHardware) { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - HandBrakeUtils.EnsureGlobalInit(noHardware); HandBrakeUtils.RegisterLogger(); - this.Handle = hbFunctions.hb_init(verbosity, update_check: 0); + this.Handle = HBFunctions.hb_init(verbosity, update_check: 0); } /// <summary> @@ -152,7 +143,7 @@ namespace HandBrake.Interop.Interop this.PreviewCount = previewCount; IntPtr pathPtr = InteropUtilities.ToUtf8PtrFromString(path); - hbFunctions.hb_scan(this.Handle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000)); + HBFunctions.hb_scan(this.Handle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000)); Marshal.FreeHGlobal(pathPtr); this.scanPollTimer = new Timer(); @@ -181,7 +172,7 @@ namespace HandBrake.Interop.Interop public void StopScan() { this.scanPollTimer.Stop(); - hbFunctions.hb_scan_stop(this.Handle); + HBFunctions.hb_scan_stop(this.Handle); } /// <summary> @@ -226,7 +217,7 @@ namespace HandBrake.Interop.Interop }; // Fetch the image data from LibHb - IntPtr resultingImageStuct = hbFunctions.hb_get_preview2(this.Handle, settings.TitleNumber, previewNumber, ref uiGeometry, deinterlace ? 1 : 0); + IntPtr resultingImageStuct = HBFunctions.hb_get_preview2(this.Handle, settings.TitleNumber, previewNumber, ref uiGeometry, deinterlace ? 1 : 0); hb_image_s image = InteropUtilities.ToStructureFromPtr<hb_image_s>(resultingImageStuct); // Copy the filled image buffer to a managed array. @@ -242,7 +233,7 @@ namespace HandBrake.Interop.Interop // Close the image so we don't leak memory. IntPtr nativeJobPtrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); Marshal.WriteIntPtr(nativeJobPtrPtr, resultingImageStuct); - hbFunctions.hb_image_close(nativeJobPtrPtr); + HBFunctions.hb_image_close(nativeJobPtrPtr); Marshal.FreeHGlobal(nativeJobPtrPtr); return preview; @@ -257,7 +248,7 @@ namespace HandBrake.Interop.Interop /// <returns>True if DRC can be applied to the track with the given encoder.</returns> public bool CanApplyDrc(int trackNumber, HBAudioEncoder encoder, int title) { - return hbFunctions.hb_audio_can_apply_drc2(this.Handle, title, trackNumber, encoder.Id) > 0; + return HBFunctions.hb_audio_can_apply_drc2(this.Handle, title, trackNumber, encoder.Id) > 0; } /// <summary> @@ -285,8 +276,8 @@ namespace HandBrake.Interop.Interop [HandleProcessCorruptedStateExceptions] public void StartEncode(string encodeJson) { - hbFunctions.hb_add_json(this.Handle, InteropUtilities.ToUtf8PtrFromString(encodeJson)); - hbFunctions.hb_start(this.Handle); + HBFunctions.hb_add_json(this.Handle, InteropUtilities.ToUtf8PtrFromString(encodeJson)); + HBFunctions.hb_start(this.Handle); this.encodePollTimer = new Timer(); this.encodePollTimer.Interval = EncodePollIntervalMs; @@ -311,7 +302,7 @@ namespace HandBrake.Interop.Interop [HandleProcessCorruptedStateExceptions] public void PauseEncode() { - hbFunctions.hb_pause(this.Handle); + HBFunctions.hb_pause(this.Handle); } /// <summary> @@ -320,7 +311,7 @@ namespace HandBrake.Interop.Interop [HandleProcessCorruptedStateExceptions] public void ResumeEncode() { - hbFunctions.hb_resume(this.Handle); + HBFunctions.hb_resume(this.Handle); } /// <summary> @@ -329,20 +320,20 @@ namespace HandBrake.Interop.Interop [HandleProcessCorruptedStateExceptions] public void StopEncode() { - hbFunctions.hb_stop(this.Handle); + HBFunctions.hb_stop(this.Handle); // Also remove all jobs from the queue (in case we stopped a 2-pass encode) var currentJobs = new List<IntPtr>(); - int jobs = hbFunctions.hb_count(this.Handle); + int jobs = HBFunctions.hb_count(this.Handle); for (int i = 0; i < jobs; i++) { - currentJobs.Add(hbFunctions.hb_job(this.Handle, 0)); + currentJobs.Add(HBFunctions.hb_job(this.Handle, 0)); } foreach (IntPtr job in currentJobs) { - hbFunctions.hb_rem(this.Handle, job); + HBFunctions.hb_rem(this.Handle, job); } } @@ -355,7 +346,7 @@ namespace HandBrake.Interop.Interop [HandleProcessCorruptedStateExceptions] public JsonState GetEncodeProgress() { - IntPtr json = hbFunctions.hb_get_state_json(this.Handle); + IntPtr json = HBFunctions.hb_get_state_json(this.Handle); string statusJson = Marshal.PtrToStringAnsi(json); JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson); @@ -403,7 +394,7 @@ namespace HandBrake.Interop.Interop // Free unmanaged objects. IntPtr handlePtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); Marshal.WriteIntPtr(handlePtr, this.Handle); - hbFunctions.hb_close(handlePtr); + HBFunctions.hb_close(handlePtr); Marshal.FreeHGlobal(handlePtr); this.disposed = true; @@ -415,7 +406,7 @@ namespace HandBrake.Interop.Interop [HandleProcessCorruptedStateExceptions] private void PollScanProgress() { - IntPtr json = hbFunctions.hb_get_state_json(this.Handle); + IntPtr json = HBFunctions.hb_get_state_json(this.Handle); string statusJson = Marshal.PtrToStringAnsi(json); JsonState state = null; if (!string.IsNullOrEmpty(statusJson)) @@ -436,7 +427,7 @@ namespace HandBrake.Interop.Interop { this.scanPollTimer.Stop(); - var jsonMsg = hbFunctions.hb_get_title_set_json(this.Handle); + var jsonMsg = HBFunctions.hb_get_title_set_json(this.Handle); this.TitlesJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg); if (!string.IsNullOrEmpty(this.TitlesJson)) @@ -461,7 +452,7 @@ namespace HandBrake.Interop.Interop [HandleProcessCorruptedStateExceptions] private void PollEncodeProgress() { - IntPtr json = hbFunctions.hb_get_state_json(this.Handle); + IntPtr json = HBFunctions.hb_get_state_json(this.Handle); string statusJson = Marshal.PtrToStringAnsi(json); JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson); diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs index b96a38c72..32970ecba 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HandBrakeLanguagesHelper.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HandBrakeLanguagesHelper.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> @@ -12,11 +12,8 @@ namespace HandBrake.Interop.Interop using System.Collections.Generic; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Helpers; using HandBrake.Interop.Interop.Model; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; /// <summary> /// Contains utilities for converting language codes. @@ -25,14 +22,6 @@ namespace HandBrake.Interop.Interop { private static IList<Language> allLanguages; - private static IHbFunctions hbFunctions; - - static HandBrakeLanguagesHelper() - { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - } - /// <summary> /// Gets a list of all languages. /// </summary> @@ -42,7 +31,7 @@ namespace HandBrake.Interop.Interop { return allLanguages ?? (allLanguages = - InteropUtilities.ToListFromIterator<iso639_lang_t, Language>(hbFunctions.lang_get_next, HandBrakeUnitConversionHelpers.NativeToLanguage)); + InteropUtilities.ToListFromIterator<iso639_lang_t, Language>(HBFunctions.lang_get_next, HandBrakeUnitConversionHelpers.NativeToLanguage)); } } @@ -53,7 +42,7 @@ namespace HandBrake.Interop.Interop /// <returns>Object that describes the language.</returns> public static Language Get(string code) { - iso639_lang_t language = InteropUtilities.ToStructureFromPtr<iso639_lang_t>(hbFunctions.lang_for_code2(code)); + iso639_lang_t language = InteropUtilities.ToStructureFromPtr<iso639_lang_t>(HBFunctions.lang_for_code2(code)); return HandBrakeUnitConversionHelpers.NativeToLanguage(language); } } diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs new file mode 100644 index 000000000..03b410a8e --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HandBrakePictureHelpers.cs @@ -0,0 +1,25 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="HandBrakePictureHelpers.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> +// Defines the HandBrakePictureHelpers type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop +{ + using HandBrake.Interop.Interop.HbLib; + + public class HandBrakePictureHelpers + { + public static hb_geometry_s GetAnamorphicSizes(hb_geometry_s sourceGeometry, hb_geometry_settings_s uiGeometry) + { + hb_geometry_s geometry = new hb_geometry_s(); + + HBFunctions.hb_set_anamorphic_size2(ref sourceGeometry, ref uiGeometry, ref geometry); + + return geometry; + } + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs index 38a5ee3d6..c16cf9a59 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HandBrakePresetService.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HandBrakePresetService.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> @@ -14,12 +14,10 @@ namespace HandBrake.Interop.Interop using System.IO; using System.Runtime.InteropServices; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; + using HandBrake.Interop.Interop.HbLib; using HandBrake.Interop.Interop.Helpers; using HandBrake.Interop.Interop.Json.Presets; using HandBrake.Interop.Interop.Model; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; using Newtonsoft.Json; @@ -28,14 +26,6 @@ namespace HandBrake.Interop.Interop /// </summary> public class HandBrakePresetService { - private static IHbFunctions hbFunctions; - - static HandBrakePresetService() - { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - } - /// <summary> /// The get built in presets. /// Requires an hb_init to have been invoked. @@ -45,7 +35,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static IList<HBPresetCategory> GetBuiltInPresets() { - IntPtr presets = hbFunctions.hb_presets_builtin_get_json(); + IntPtr presets = HBFunctions.hb_presets_builtin_get_json(); string presetJson = Marshal.PtrToStringAnsi(presets); IList<HBPresetCategory> presetList = JsonConvert.DeserializeObject<IList<HBPresetCategory>>(presetJson); @@ -63,7 +53,7 @@ namespace HandBrake.Interop.Interop /// </returns> public static PresetTransportContainer GetPresetsFromFile(string filename) { - IntPtr presetStringPointer = hbFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename)); + IntPtr presetStringPointer = HBFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename)); string presetJson = Marshal.PtrToStringAnsi(presetStringPointer); if (!string.IsNullOrEmpty(presetJson)) @@ -106,7 +96,7 @@ namespace HandBrake.Interop.Interop IntPtr minor = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int))); IntPtr micro = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(int))); - hbFunctions.hb_presets_current_version(major, minor, micro); + HBFunctions.hb_presets_current_version(major, minor, micro); int majorVersion = Marshal.ReadInt32(major); int minorVersion = Marshal.ReadInt32(minor); diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeSubtitleHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeSubtitleHelpers.cs new file mode 100644 index 000000000..48a8f32c4 --- /dev/null +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeSubtitleHelpers.cs @@ -0,0 +1,26 @@ +// -------------------------------------------------------------------------------------------------------------------- +// <copyright file="HandBrakeSubtitleHelpers.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> +// Defines the HandBrakeSubtitleHelpers type. +// </summary> +// -------------------------------------------------------------------------------------------------------------------- + +namespace HandBrake.Interop.Interop +{ + using HandBrake.Interop.Interop.HbLib; + + public class HandBrakeSubtitleHelpers + { + public static int CheckCanForceSubtitle(int source) + { + return HBFunctions.hb_subtitle_can_force(source); + } + + public static int CheckCanBurnSubtitle(int source) + { + return HBFunctions.hb_subtitle_can_burn(source); + } + } +} diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs index db2ea9990..698bce11a 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HandBrakeUnitConversionHelpers.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HandBrakeUnitConversionHelpers.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> @@ -12,25 +12,18 @@ namespace HandBrake.Interop.Interop using System; using System.Collections.Generic; using System.Globalization; + using System.Runtime.InteropServices; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Helpers; using HandBrake.Interop.Interop.Model; using HandBrake.Interop.Interop.Model.Encoding; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; /// <summary> /// Converters for various encoding values. /// </summary> public static class HandBrakeUnitConversionHelpers { - private static IHbFunctions hbFunctions; - - /// <summary> - /// Video Frame Rates - /// </summary> private static readonly Dictionary<double, int> VideoRates; /// <summary> @@ -38,9 +31,6 @@ namespace HandBrake.Interop.Interop /// </summary> static HandBrakeUnitConversionHelpers() { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - if (!HandBrakeUtils.IsInitialised()) { throw new Exception("Please Initialise with HandBrakeUtils.EnsureGlobalInit before using!"); @@ -74,6 +64,41 @@ namespace HandBrake.Interop.Interop return VideoRates[framerate]; } + + public static int GetFramerateFromName(string name) + { + IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(name); + + return HBFunctions.hb_video_framerate_get_from_name(frameratePrt); + } + + /// <summary> + /// Converts the PTS amount to a TimeSpan. There may be some accuracy loss here. + /// </summary> + /// <param name="pts"> + /// The PTS to convert. + /// </param> + /// <returns> + /// The timespan for it. + /// </returns> + public static TimeSpan PtsToTimeSpan(ulong pts) + { + return TimeSpan.FromTicks((long)((pts * 10000000) / 90000)); + } + + /// <summary> + /// Converts the PTS amount to seconds. + /// </summary> + /// <param name="pts"> + /// The PTS to convert. + /// </param> + /// <returns> + /// The corresponding number of seconds. + /// </returns> + public static double PtsToSeconds(ulong pts) + { + return (double)pts / 90000; + } /// <summary> /// Converts a native HB encoder structure to an Encoder model. @@ -103,8 +128,8 @@ namespace HandBrake.Interop.Interop var result = new HBAudioEncoder( encoder.muxers, HandBrakeEncoderHelpers.GetAudioCompressionLimits(encoder.codec), - hbFunctions.hb_audio_compression_get_default((uint)encoder.codec), - hbFunctions.hb_audio_quality_get_default((uint)encoder.codec), + HBFunctions.hb_audio_compression_get_default((uint)encoder.codec), + HBFunctions.hb_audio_quality_get_default((uint)encoder.codec), encoder.name, encoder.codec, HandBrakeEncoderHelpers.GetAudioQualityLimits(encoder.codec), @@ -170,33 +195,5 @@ namespace HandBrake.Interop.Interop string nativeName = InteropUtilities.ToStringFromUtf8Ptr(language.native_name); return new Language(englishName, nativeName, language.iso639_2); } - - /// <summary> - /// Converts the PTS amount to a TimeSpan. There may be some accuracy loss here. - /// </summary> - /// <param name="pts"> - /// The PTS to convert. - /// </param> - /// <returns> - /// The timespan for it. - /// </returns> - public static TimeSpan PtsToTimeSpan(ulong pts) - { - return TimeSpan.FromTicks((long)((pts * 10000000) / 90000)); - } - - /// <summary> - /// Converts the PTS amount to seconds. - /// </summary> - /// <param name="pts"> - /// The PTS to convert. - /// </param> - /// <returns> - /// The corresponding number of seconds. - /// </returns> - public static double PtsToSeconds(ulong pts) - { - return (double)pts / 90000; - } } } diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs index aab7d220e..df58e197f 100644 --- a/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HandBrakeUtils.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HandBrakeUtils.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> @@ -11,18 +11,13 @@ namespace HandBrake.Interop.Interop { using System; using System.Collections.Generic; - using System.Linq.Expressions; - using System.Runtime.CompilerServices; using System.Runtime.ExceptionServices; using System.Runtime.InteropServices; using HandBrake.Interop.Interop.EventArgs; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Json.Anamorphic; using HandBrake.Interop.Interop.Json.Shared; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; using Newtonsoft.Json; @@ -59,17 +54,12 @@ namespace HandBrake.Interop.Interop /// </summary> public static event EventHandler<MessageLoggedEventArgs> ErrorLogged; - private static IHbFunctions hbFunctions; - - static HandBrakeUtils() - { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - } - /// <summary> /// Ensures the HB global initialize method has been called. /// </summary> + /// <param name="initNoHardwareMode"> + /// Init without hardware encoders. + /// </param> public static void EnsureGlobalInit(bool initNoHardwareMode) { if (!globalInitialized) @@ -79,7 +69,7 @@ namespace HandBrake.Interop.Interop if (initNoHardwareMode) { initNoHardware = true; - if (hbFunctions.hb_global_init_no_hardware() == -1) + if (HBFunctions.hb_global_init_no_hardware() == -1) { throw new InvalidOperationException("HB global init failed."); } @@ -99,7 +89,7 @@ namespace HandBrake.Interop.Interop // Try without Hardware support. Bad drivers can sometimes cause issues. if (!initSuccess) { - if (hbFunctions.hb_global_init_no_hardware() == -1) + if (HBFunctions.hb_global_init_no_hardware() == -1) { throw new InvalidOperationException("HB global init failed."); } @@ -117,7 +107,7 @@ namespace HandBrake.Interop.Interop /// </param> public static void SetDvdNav(bool enableDvdNav) { - hbFunctions.hb_dvd_set_dvdnav(enableDvdNav ? 1 : 0); + HBFunctions.hb_dvd_set_dvdnav(enableDvdNav ? 1 : 0); } /// <summary> @@ -125,7 +115,7 @@ namespace HandBrake.Interop.Interop /// </summary> public static void DisposeGlobal() { - hbFunctions.hb_global_close(); + HBFunctions.hb_global_close(); } /// <summary> @@ -139,8 +129,8 @@ namespace HandBrake.Interop.Interop // Keep the callback as a member to prevent it from being garbage collected. loggingCallback = LoggingHandler; errorCallback = ErrorHandler; - hbFunctions.hb_register_logger(loggingCallback); - hbFunctions.hb_register_error_handler(errorCallback); + HBFunctions.hb_register_logger(loggingCallback); + HBFunctions.hb_register_error_handler(errorCallback); } } @@ -192,7 +182,7 @@ namespace HandBrake.Interop.Interop public static string SanitizeX264OptName(string name) { IntPtr namePtr = Marshal.StringToHGlobalAnsi(name); - string sanitizedName = Marshal.PtrToStringAnsi(hbFunctions.hb_x264_encopt_name(namePtr)); + string sanitizedName = Marshal.PtrToStringAnsi(HBFunctions.hb_x264_encopt_name(namePtr)); Marshal.FreeHGlobal(namePtr); return sanitizedName; } @@ -226,14 +216,14 @@ namespace HandBrake.Interop.Interop /// </returns> public static bool IsH264LevelValid(string level, int width, int height, int fpsNumerator, int fpsDenominator, bool interlaced, bool fakeInterlaced) { - return hbFunctions.hb_check_h264_level( - level, - width, - height, - fpsNumerator, - fpsDenominator, - interlaced ? 1 : 0, - fakeInterlaced ? 1 : 0) == 0; + return HBFunctions.hb_check_h264_level( + level, + width, + height, + fpsNumerator, + fpsDenominator, + interlaced ? 1 : 0, + fakeInterlaced ? 1 : 0) == 0; } /// <summary> @@ -282,7 +272,7 @@ namespace HandBrake.Interop.Interop throw new ArgumentException("height must be positive."); } - IntPtr ptr = hbFunctions.hb_x264_param_unparse( + IntPtr ptr = HBFunctions.hb_x264_param_unparse( 8, preset, string.Join(",", tunes), @@ -305,7 +295,7 @@ namespace HandBrake.Interop.Interop public static Geometry GetAnamorphicSize(AnamorphicGeometry anamorphicGeometry) { string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); - IntPtr json = hbFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode)); + IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode)); string result = Marshal.PtrToStringAnsi(json); return JsonConvert.DeserializeObject<Geometry>(result); } @@ -370,7 +360,7 @@ namespace HandBrake.Interop.Interop { try { - if (hbFunctions.hb_global_init() == -1) + if (HBFunctions.hb_global_init() == -1) { throw new InvalidOperationException("HB global init failed."); } diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs index 33d3f0bca..ba5b1befb 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBDelegates.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBDelegates.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> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs index c3b99c735..6f55ff9d5 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBFunctions.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBFunctions.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> @@ -307,5 +307,8 @@ namespace HandBrake.Interop.Interop.HbLib [DllImport("hb", EntryPoint = "qsv_hardware_generation", CallingConvention = CallingConvention.Cdecl)] public static extern int qsv_hardware_generation(int cpu_platform); + + [DllImport("hb", EntryPoint = "hb_qsv_adapters_list", CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr hb_qsv_adapters_list(); } } diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs index b0e5d876d..d7a50b7b1 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="NativeConstants.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="NativeConstants.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> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/HbFunctionsDirect.cs b/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/HbFunctionsDirect.cs deleted file mode 100644 index 7a892dc22..000000000 --- a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/HbFunctionsDirect.cs +++ /dev/null @@ -1,511 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// <copyright file="IHbFunctions.cs" company="HandBrake Project (http://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> -// An interface to access the native libhb functions without using static methods. -// </summary> -// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Interop.HbLib.Wrappers -{ - using System; - using System.Runtime.InteropServices; - - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; - - public class HbFunctionsDirect : IHbFunctions - { - public void hb_register_logger(LoggingCallback callback) - { - HBFunctions.hb_register_logger(callback); - } - - public void hb_register_error_handler(LoggingCallback callback) - { - HBFunctions.hb_register_error_handler(callback); - } - - public int hb_global_init() - { - return HBFunctions.hb_global_init(); - } - - public int hb_global_init_no_hardware() - { - return HBFunctions.hb_global_init_no_hardware(); - } - - public IntPtr hb_init(int verbose, int update_check) - { - return HBFunctions.hb_init(verbose, update_check); - } - - public IntPtr hb_init_dl(int verbose, int update_check) - { - return HBFunctions.hb_init_dl(verbose, update_check); - } - - public IntPtr hb_get_version(IntPtr hbHandle) - { - return HBFunctions.hb_get_version(hbHandle); - } - - public int hb_get_build(IntPtr hbHandle) - { - return HBFunctions.hb_get_build(hbHandle); - } - - public IntPtr hb_dvd_name(IntPtr path) - { - return HBFunctions.hb_dvd_name(path); - } - - public void hb_dvd_set_dvdnav(int enable) - { - HBFunctions.hb_dvd_set_dvdnav(enable); - } - - public void hb_scan(IntPtr hbHandle, IntPtr path, int title_index, int preview_count, int store_previews, ulong min_duration) - { - HBFunctions.hb_scan(hbHandle, path, title_index, preview_count, store_previews, min_duration); - } - - public void hb_scan_stop(IntPtr hbHandle) - { - HBFunctions.hb_scan_stop(hbHandle); - } - - public IntPtr hb_get_titles(IntPtr hbHandle) - { - return HBFunctions.hb_get_titles(hbHandle); - } - - public void hb_set_anamorphic_size2(ref hb_geometry_s sourceGeometry, ref hb_geometry_settings_s uiGeometry, ref hb_geometry_s result) - { - HBFunctions.hb_set_anamorphic_size2(ref sourceGeometry, ref uiGeometry, ref result); - } - - public int hb_count(IntPtr hbHandle) - { - return HBFunctions.hb_count(hbHandle); - } - - public IntPtr hb_job(IntPtr hbHandle, int jobIndex) - { - return HBFunctions.hb_job(hbHandle, jobIndex); - } - - public void hb_rem(IntPtr hbHandle, IntPtr job) - { - HBFunctions.hb_rem(hbHandle, job); - } - - public void hb_start(IntPtr hbHandle) - { - HBFunctions.hb_start(hbHandle); - } - - public void hb_pause(IntPtr hbHandle) - { - HBFunctions.hb_pause(hbHandle); - } - - public void hb_resume(IntPtr hbHandle) - { - HBFunctions.hb_resume(hbHandle); - } - - public void hb_stop(IntPtr hbHandle) - { - HBFunctions.hb_stop(hbHandle); - } - - public void hb_close(IntPtr hbHandle) - { - HBFunctions.hb_close(hbHandle); - } - - public void hb_global_close() - { - HBFunctions.hb_global_close(); - } - - public IntPtr hb_list_init() - { - return HBFunctions.hb_list_init(); - } - - public int hb_list_count(IntPtr listPtr) - { - return HBFunctions.hb_list_count(listPtr); - } - - public void hb_list_add(IntPtr listPtr, IntPtr item) - { - HBFunctions.hb_list_add(listPtr, item); - } - - public void hb_list_insert(IntPtr listPtr, int pos, IntPtr item) - { - HBFunctions.hb_list_insert(listPtr, pos, item); - } - - public void hb_list_rem(IntPtr listPtr, IntPtr item) - { - HBFunctions.hb_list_rem(listPtr, item); - } - - public IntPtr hb_list_item(IntPtr listPtr, int itemIndex) - { - return HBFunctions.hb_list_item(listPtr, itemIndex); - } - - public void hb_list_close(IntPtr listPtrPtr) - { - HBFunctions.hb_list_close(listPtrPtr); - } - - public int hb_subtitle_can_force(int source) - { - return HBFunctions.hb_subtitle_can_force(source); - } - - public int hb_subtitle_can_burn(int source) - { - return HBFunctions.hb_subtitle_can_burn(source); - } - - public int hb_subtitle_can_pass(int source, int mux) - { - return HBFunctions.hb_subtitle_can_pass(source, mux); - } - - public int hb_video_framerate_get_from_name(IntPtr name) - { - return HBFunctions.hb_video_framerate_get_from_name(name); - } - - public IntPtr hb_video_framerate_get_next(IntPtr last) - { - return HBFunctions.hb_video_framerate_get_next(last); - } - - public IntPtr hb_audio_samplerate_get_next(IntPtr last) - { - return HBFunctions.hb_audio_samplerate_get_next(last); - } - - public int hb_audio_samplerate_find_closest(int samplerate, uint codec) - { - return HBFunctions.hb_audio_samplerate_find_closest(samplerate, codec); - } - - public int hb_audio_bitrate_get_best(uint codec, int bitrate, int samplerate, int mixdown) - { - return HBFunctions.hb_audio_bitrate_get_best(codec, bitrate, samplerate, mixdown); - } - - public int hb_audio_bitrate_get_default(uint codec, int samplerate, int mixdown) - { - return HBFunctions.hb_audio_bitrate_get_default(codec, samplerate, mixdown); - } - - public int hb_audio_bitrate_get_limits(uint codec, int samplerate, int mixdown, ref int low, ref int high) - { - return HBFunctions.hb_audio_bitrate_get_limits(codec, samplerate, mixdown, ref low, ref high); - } - - public IntPtr hb_audio_bitrate_get_next(IntPtr last) - { - return HBFunctions.hb_audio_bitrate_get_next(last); - } - - public void hb_video_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction) - { - HBFunctions.hb_video_quality_get_limits(codec, ref low, ref high, ref granularity, ref direction); - } - - public IntPtr hb_video_quality_get_name(uint codec) - { - return HBFunctions.hb_video_quality_get_name(codec); - } - - public void hb_audio_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction) - { - HBFunctions.hb_audio_quality_get_limits(codec, ref low, ref high, ref granularity, ref direction); - } - - public float hb_audio_quality_get_default(uint codec) - { - return HBFunctions.hb_audio_quality_get_default(codec); - } - - public void hb_audio_compression_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction) - { - HBFunctions.hb_audio_compression_get_limits(codec, ref low, ref high, ref granularity, ref direction); - } - - public float hb_audio_compression_get_default(uint codec) - { - return HBFunctions.hb_audio_compression_get_default(codec); - } - - public int hb_audio_can_apply_drc2(IntPtr handle, int title_index, int audio_index, int encoder) - { - return HBFunctions.hb_audio_can_apply_drc2(handle, title_index, audio_index, encoder); - } - - public int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout) - { - return HBFunctions.hb_mixdown_is_supported(mixdown, codec, layout); - } - - public int hb_mixdown_has_codec_support(int mixdown, uint codec) - { - return HBFunctions.hb_mixdown_has_codec_support(mixdown, codec); - } - - public int hb_mixdown_has_remix_support(int mixdown, ulong layout) - { - return HBFunctions.hb_mixdown_has_remix_support(mixdown, layout); - } - - public int hb_mixdown_get_best(uint codec, ulong layout, int mixdown) - { - return HBFunctions.hb_mixdown_get_best(codec, layout, mixdown); - } - - public int hb_mixdown_get_default(uint codec, ulong layout) - { - return HBFunctions.hb_mixdown_get_default(codec, layout); - } - - public IntPtr hb_mixdown_get_next(IntPtr last) - { - return HBFunctions.hb_mixdown_get_next(last); - } - - public IntPtr hb_video_encoder_get_next(IntPtr last) - { - return HBFunctions.hb_video_encoder_get_next(last); - } - - public IntPtr hb_audio_encoder_get_next(IntPtr last) - { - return HBFunctions.hb_audio_encoder_get_next(last); - } - - public IntPtr hb_container_get_next(IntPtr last) - { - return HBFunctions.hb_container_get_next(last); - } - - public IntPtr hb_video_encoder_get_presets(int encoder) - { - return HBFunctions.hb_video_encoder_get_presets(encoder); - } - - public IntPtr hb_video_encoder_get_tunes(int encoder) - { - return HBFunctions.hb_video_encoder_get_tunes(encoder); - } - - public IntPtr hb_video_encoder_get_profiles(int encoder) - { - return HBFunctions.hb_video_encoder_get_profiles(encoder); - } - - public IntPtr hb_video_encoder_get_levels(int encoder) - { - return HBFunctions.hb_video_encoder_get_levels(encoder); - } - - public IntPtr lang_get_next(IntPtr last) - { - return HBFunctions.lang_get_next(last); - } - - public IntPtr lang_for_code2([In] [MarshalAs(UnmanagedType.LPStr)] string code2) - { - return HBFunctions.lang_for_code2(code2); - } - - public void hb_job_close(IntPtr job) - { - HBFunctions.hb_job_close(job); - } - - public IntPtr hb_filter_get_keys(int filter_id) - { - return HBFunctions.hb_filter_get_keys(filter_id); - } - - public IntPtr hb_x264_encopt_name(IntPtr name) - { - return HBFunctions.hb_x264_encopt_name(name); - } - - public int hb_check_h264_level( - [In] [MarshalAs(UnmanagedType.LPStr)] string level, - int width, - int height, - int fps_num, - int fps_den, - int interlaced, - int fake_interlaced) - { - return HBFunctions.hb_check_h264_level( - level, - width, - height, - fps_num, - fps_den, - interlaced, - fake_interlaced); - } - - public IntPtr hb_x264_param_unparse( - int bit_depth, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_preset, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_tune, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_encopts, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_profile, - [In] [MarshalAs(UnmanagedType.LPStr)] string h264_level, - int width, - int height) - { - return HBFunctions.hb_x264_param_unparse( - bit_depth, - x264_preset, - x264_tune, - x264_encopts, - x264_profile, - h264_level, - width, - height); - } - - public int hb_qsv_available() - { - return HBFunctions.hb_qsv_available(); - } - - public int hb_vce_h264_available() - { - return HBFunctions.hb_vce_h264_available(); - } - - public int hb_vce_h265_available() - { - return HBFunctions.hb_vce_h265_available(); - } - - public int hb_nvenc_h264_available() - { - return HBFunctions.hb_nvenc_h264_available(); - } - - public int hb_nvenc_h265_available() - { - return HBFunctions.hb_nvenc_h265_available(); - } - - public IntPtr hb_get_preview2(IntPtr hbHandle, int title_idx, int preview_idx, ref hb_geometry_settings_s geo, int deinterlace) - { - return HBFunctions.hb_get_preview2(hbHandle, title_idx, preview_idx, ref geo, deinterlace); - } - - public IntPtr hb_image_close(IntPtr image) - { - return HBFunctions.hb_image_close(image); - } - - /* JSON API */ - - public IntPtr hb_get_title_set_json(IntPtr hbHandle) - { - return HBFunctions.hb_get_title_set_json(hbHandle); - } - - public IntPtr hb_job_init_json(IntPtr hbHandle, int title_index) - { - return HBFunctions.hb_job_init_json(hbHandle, title_index); - } - - public IntPtr hb_json_to_job(IntPtr hbHandle, IntPtr json_job) - { - return HBFunctions.hb_json_to_job(hbHandle, json_job); - } - - public int hb_add_json(IntPtr hbHandle, IntPtr json_job) - { - return HBFunctions.hb_add_json(hbHandle, json_job); - } - - public IntPtr hb_set_anamorphic_size_json(IntPtr json_param) - { - return HBFunctions.hb_set_anamorphic_size_json(json_param); - } - - public IntPtr hb_get_state_json(IntPtr hbHandle) - { - return HBFunctions.hb_get_state_json(hbHandle); - } - - public IntPtr hb_get_preview_params_json(int title_idx, int preview_idx, int deinterlace, ref hb_geometry_settings_s settings) - { - return HBFunctions.hb_get_preview_params_json(title_idx, preview_idx, deinterlace, ref settings); - } - - public void hb_presets_builtin_init() - { - HBFunctions.hb_presets_builtin_init(); - } - - public IntPtr hb_presets_builtin_get_json() - { - return HBFunctions.hb_presets_builtin_get_json(); - } - - public IntPtr hb_presets_read_file_json(IntPtr filename) - { - return HBFunctions.hb_presets_read_file_json(filename); - } - - public IntPtr hb_presets_current_version(IntPtr major, IntPtr minor, IntPtr micro) - { - return HBFunctions.hb_presets_current_version(major, minor, micro); - } - - public IntPtr hb_generate_filter_settings_json( - int filter_id, - [In] [MarshalAs(UnmanagedType.LPStr)] string preset, - [In] [MarshalAs(UnmanagedType.LPStr)] string tune, - [In] [MarshalAs(UnmanagedType.LPStr)] string custom) - { - return HBFunctions.hb_generate_filter_settings_json(filter_id, preset, tune, custom); - } - - public IntPtr hb_filter_get_presets_json(int filter_id) - { - return HBFunctions.hb_filter_get_presets_json(filter_id); - } - - public IntPtr hb_filter_get_tunes_json(int filter_id) - { - return HBFunctions.hb_filter_get_tunes_json(filter_id); - } - - public int hb_get_cpu_platform() - { - return HBFunctions.hb_get_cpu_platform(); - } - - public int qsv_hardware_generation(int cpu_platform) - { - return HBFunctions.qsv_hardware_generation(cpu_platform); - } - } -} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/Interfaces/IHbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/Interfaces/IHbFunctions.cs deleted file mode 100644 index 01c8e614b..000000000 --- a/win/CS/HandBrake.Interop/Interop/HbLib/Wrappers/Interfaces/IHbFunctions.cs +++ /dev/null @@ -1,219 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// <copyright file="IHbFunctions.cs" company="HandBrake Project (http://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> -// An interface to access the native libhb functions without using static methods. -// </summary> -// <auto-generated> Disable Stylecop Warnings for this file </auto-generated> -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces -{ - using System; - using System.Runtime.InteropServices; - - public interface IHbFunctions - { - void hb_register_logger(LoggingCallback callback); - - void hb_register_error_handler(LoggingCallback callback); - - int hb_global_init(); - - int hb_global_init_no_hardware(); - - IntPtr hb_init(int verbose, int update_check); - - IntPtr hb_init_dl(int verbose, int update_check); - - IntPtr hb_get_version(IntPtr hbHandle); - - int hb_get_build(IntPtr hbHandle); - - IntPtr hb_dvd_name(IntPtr path); - - void hb_dvd_set_dvdnav(int enable); - - void hb_scan(IntPtr hbHandle, IntPtr path, int title_index, int preview_count, int store_previews, ulong min_duration); - - void hb_scan_stop(IntPtr hbHandle); - - IntPtr hb_get_titles(IntPtr hbHandle); - - void hb_set_anamorphic_size2(ref hb_geometry_s sourceGeometry, ref hb_geometry_settings_s uiGeometry, ref hb_geometry_s result); - - int hb_count(IntPtr hbHandle); - - IntPtr hb_job(IntPtr hbHandle, int jobIndex); - - void hb_rem(IntPtr hbHandle, IntPtr job); - - void hb_start(IntPtr hbHandle); - - void hb_pause(IntPtr hbHandle); - - void hb_resume(IntPtr hbHandle); - - void hb_stop(IntPtr hbHandle); - - void hb_close(IntPtr hbHandle); - - void hb_global_close(); - - IntPtr hb_list_init(); - - int hb_list_count(IntPtr listPtr); - - void hb_list_add(IntPtr listPtr, IntPtr item); - - void hb_list_insert(IntPtr listPtr, int pos, IntPtr item); - - void hb_list_rem(IntPtr listPtr, IntPtr item); - - IntPtr hb_list_item(IntPtr listPtr, int itemIndex); - - void hb_list_close(IntPtr listPtrPtr); - - int hb_subtitle_can_force(int source); - - int hb_subtitle_can_burn(int source); - - int hb_subtitle_can_pass(int source, int mux); - - int hb_video_framerate_get_from_name(IntPtr name); - - IntPtr hb_video_framerate_get_next(IntPtr last); - - IntPtr hb_audio_samplerate_get_next(IntPtr last); - - int hb_audio_samplerate_find_closest(int samplerate, uint codec); - - int hb_audio_bitrate_get_best(uint codec, int bitrate, int samplerate, int mixdown); - - int hb_audio_bitrate_get_default(uint codec, int samplerate, int mixdown); - - int hb_audio_bitrate_get_limits(uint codec, int samplerate, int mixdown, ref int low, ref int high); - - IntPtr hb_audio_bitrate_get_next(IntPtr last); - - void hb_video_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction); - - IntPtr hb_video_quality_get_name(uint codec); - - void hb_audio_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction); - - float hb_audio_quality_get_default(uint codec); - - void hb_audio_compression_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction); - - float hb_audio_compression_get_default(uint codec); - - int hb_audio_can_apply_drc2(IntPtr handle, int title_index, int audio_index, int encoder); - - int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout); - - int hb_mixdown_has_codec_support(int mixdown, uint codec); - - int hb_mixdown_has_remix_support(int mixdown, ulong layout); - - int hb_mixdown_get_best(uint codec, ulong layout, int mixdown); - - int hb_mixdown_get_default(uint codec, ulong layout); - - IntPtr hb_mixdown_get_next(IntPtr last); - - IntPtr hb_video_encoder_get_next(IntPtr last); - - IntPtr hb_audio_encoder_get_next(IntPtr last); - - IntPtr hb_container_get_next(IntPtr last); - - IntPtr hb_video_encoder_get_presets(int encoder); - - IntPtr hb_video_encoder_get_tunes(int encoder); - - IntPtr hb_video_encoder_get_profiles(int encoder); - - IntPtr hb_video_encoder_get_levels(int encoder); - - IntPtr lang_get_next(IntPtr last); - - IntPtr lang_for_code2([In] [MarshalAs(UnmanagedType.LPStr)] string code2); - - void hb_job_close(IntPtr job); - - IntPtr hb_filter_get_keys(int filter_id); - - IntPtr hb_x264_encopt_name(IntPtr name); - - int hb_check_h264_level( - [In] [MarshalAs(UnmanagedType.LPStr)] string level, - int width, - int height, - int fps_num, - int fps_den, - int interlaced, - int fake_interlaced); - - IntPtr hb_x264_param_unparse( - int bit_depth, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_preset, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_tune, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_encopts, - [In] [MarshalAs(UnmanagedType.LPStr)] string x264_profile, - [In] [MarshalAs(UnmanagedType.LPStr)] string h264_level, - int width, - int height); - - int hb_qsv_available(); - - int hb_vce_h264_available(); - - int hb_vce_h265_available(); - - int hb_nvenc_h264_available(); - - int hb_nvenc_h265_available(); - - IntPtr hb_get_preview2(IntPtr hbHandle, int title_idx, int preview_idx, ref hb_geometry_settings_s geo, int deinterlace); - - IntPtr hb_image_close(IntPtr image); - - IntPtr hb_get_title_set_json(IntPtr hbHandle); - - IntPtr hb_job_init_json(IntPtr hbHandle, int title_index); - - IntPtr hb_json_to_job(IntPtr hbHandle, IntPtr json_job); - - int hb_add_json(IntPtr hbHandle, IntPtr json_job); - - IntPtr hb_set_anamorphic_size_json(IntPtr json_param); - - IntPtr hb_get_state_json(IntPtr hbHandle); - - IntPtr hb_get_preview_params_json(int title_idx, int preview_idx, int deinterlace, ref hb_geometry_settings_s settings); - - void hb_presets_builtin_init(); - - IntPtr hb_presets_builtin_get_json(); - - IntPtr hb_presets_read_file_json(IntPtr filename); - - IntPtr hb_presets_current_version(IntPtr major, IntPtr minor, IntPtr micro); - - IntPtr hb_generate_filter_settings_json( - int filter_id, - [In] [MarshalAs(UnmanagedType.LPStr)] string preset, - [In] [MarshalAs(UnmanagedType.LPStr)] string tune, - [In] [MarshalAs(UnmanagedType.LPStr)] string custom); - - IntPtr hb_filter_get_presets_json(int filter_id); - - IntPtr hb_filter_get_tunes_json(int filter_id); - - int hb_get_cpu_platform(); - - int qsv_hardware_generation(int cpu_platform); - } -} diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs index 949f7d694..46594c2ee 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_job_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_job_s.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> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs index 2611cab47..bee01327a 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_container_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_container_s.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> // <auto-generated>Disable Stylecop Warnings for this file</auto-generated> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs index 54c5b182f..226870122 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_encoder_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_encoder_s.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> // <auto-generated>Disable Stylecop Warnings for this file</auto-generated> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs index f0c996ca8..493c716f5 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs @@ -1,10 +1,11 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_error_code.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_error_code.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> // Defines the hb_error_code type. // </summary> +// <auto-generated> Disable Stylecop. HandBrake internal object. </auto-generated> // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.Interop.Interop.HbLib diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs index 7b962d28b..0bd958f15 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_filter_ids.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_filter_ids.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> // <auto-generated> Disable Stylecop Warnings for this file </auto-generated> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs index c665a5306..54063032a 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_geometry.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_geometry.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> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs index 9edf733af..5e2dc9443 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_image_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_image_s.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> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs index 06fb6af6b..b269b24c1 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_mixdown_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_mixdown_s.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> // <auto-generated>Disable Stylecop Warnings for this file</auto-generated> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs index f10c320ce..563930471 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_rate_s.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_rate_s.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> // <auto-generated>Disable Stylecop Warnings for this file</auto-generated> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs index f51de960f..c8fa3d5ce 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="hb_subtitle.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="hb_subtitle.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> // <auto-generated> Disable Stylecop Warnings for this file </auto-generated> diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs b/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs index 8a9d8ab64..35dae2add 100644 --- a/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs +++ b/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="iso639_lang_t.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="iso639_lang_t.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> // <auto-generated>Disable Stylecop Warnings for this file</auto-generated> diff --git a/win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs b/win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs index 7ff81d407..25eb8caf2 100644 --- a/win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs +++ b/win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="InteropUtilities.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="InteropUtilities.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> @@ -16,23 +16,12 @@ namespace HandBrake.Interop.Interop.Helpers using System.Text; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; /// <summary> /// Helper utilities for native interop. /// </summary> internal static class InteropUtilities { - private static IHbFunctions hbFunctions; - - static InteropUtilities() - { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - } - /// <summary> /// Reads the given native structure pointer. /// </summary> @@ -273,7 +262,7 @@ namespace HandBrake.Interop.Interop.Helpers // Assign the new pointer to the job pointer and tell HB to clean the job up. Marshal.WriteIntPtr(nativeJobPtrPtr, nativeJobPtr); - hbFunctions.hb_job_close(nativeJobPtrPtr); + HBFunctions.hb_job_close(nativeJobPtrPtr); // Free the pointer we used. Marshal.FreeHGlobal(nativeJobPtrPtr); diff --git a/win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs b/win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs index b63789943..0eee0884b 100644 --- a/win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs +++ b/win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="NativeList.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="NativeList.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> @@ -15,16 +15,16 @@ namespace HandBrake.Interop.Interop.Helpers using System.Runtime.InteropServices; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; /// <summary> /// Represents a HandBrake style native list. /// </summary> internal class NativeList : IDisposable { - private static IHbFunctions hbFunctions; + /// <summary> + /// The list of native memory locations allocated for this list. + /// </summary> + private readonly List<IntPtr> allocatedMemory = new List<IntPtr>(); /// <summary> /// Initializes a new instance of the NativeList class. @@ -33,14 +33,7 @@ namespace HandBrake.Interop.Interop.Helpers public NativeList(IntPtr listPtr) { this.Ptr = listPtr; - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); } - - /// <summary> - /// The list of native memory locations allocated for this list. - /// </summary> - private readonly List<IntPtr> allocatedMemory = new List<IntPtr>(); /// <summary> /// Gets the pointer to the native list. @@ -55,7 +48,7 @@ namespace HandBrake.Interop.Interop.Helpers get { Debug.WriteLine("Got a Zero Pointer in the NativeList"); - return this.Ptr == IntPtr.Zero ? 0 : hbFunctions.hb_list_count(this.Ptr); + return this.Ptr == IntPtr.Zero ? 0 : HBFunctions.hb_list_count(this.Ptr); } } @@ -71,12 +64,25 @@ namespace HandBrake.Interop.Interop.Helpers } /// <summary> + /// Gets an item out of the list. + /// </summary> + /// <param name="i">Index in the list.</param> + /// <returns>The item at that index in the list.</returns> + public IntPtr this[int i] + { + get + { + return HBFunctions.hb_list_item(this.Ptr, i); + } + } + + /// <summary> /// Adds an item to the end of the list. /// </summary> /// <param name="item">The item to add.</param> public void Add(IntPtr item) { - hbFunctions.hb_list_add(this.Ptr, item); + HBFunctions.hb_list_add(this.Ptr, item); } /// <summary> @@ -86,7 +92,7 @@ namespace HandBrake.Interop.Interop.Helpers /// <param name="item">The item to insert.</param> public void Insert(int position, IntPtr item) { - hbFunctions.hb_list_insert(this.Ptr, position, item); + HBFunctions.hb_list_insert(this.Ptr, position, item); } /// <summary> @@ -95,20 +101,7 @@ namespace HandBrake.Interop.Interop.Helpers /// <param name="item">The item to remove.</param> public void Remove(IntPtr item) { - hbFunctions.hb_list_rem(this.Ptr, item); - } - - /// <summary> - /// Gets an item out of the list. - /// </summary> - /// <param name="i">Index in the list.</param> - /// <returns>The item at that index in the list.</returns> - public IntPtr this[int i] - { - get - { - return hbFunctions.hb_list_item(this.Ptr, i); - } + HBFunctions.hb_list_rem(this.Ptr, item); } /// <summary> @@ -118,7 +111,7 @@ namespace HandBrake.Interop.Interop.Helpers { IntPtr listPtrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); Marshal.WriteIntPtr(listPtrPtr, this.Ptr); - hbFunctions.hb_list_close(listPtrPtr); + HBFunctions.hb_list_close(listPtrPtr); Marshal.FreeHGlobal(listPtrPtr); } @@ -128,8 +121,7 @@ namespace HandBrake.Interop.Interop.Helpers /// <returns>The created list.</returns> public static NativeList CreateList() { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - return new NativeList(hbFunctionsProvider.GetHbFunctionsWrapper().hb_list_init()); + return new NativeList(HBFunctions.hb_list_init()); } } } diff --git a/win/CS/HandBrake.Interop/Interop/Helpers/Utilities.cs b/win/CS/HandBrake.Interop/Interop/Helpers/Utilities.cs index 369216023..3a7f4fe40 100644 --- a/win/CS/HandBrake.Interop/Interop/Helpers/Utilities.cs +++ b/win/CS/HandBrake.Interop/Interop/Helpers/Utilities.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Utilities.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Utilities.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> diff --git a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs index 193769090..284cde4d6 100644 --- a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="IHandBrakeInstance.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="IHandBrakeInstance.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs index 6f6714caa..088272ca3 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="AnamorphicGeometry.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="AnamorphicGeometry.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs index 99f38439b..ce48ac273 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="DestSettings.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="DestSettings.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs index 59ddd0481..1407454c8 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Audio.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Audio.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs index 51989132a..0a38d33c4 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="AudioTrack.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="AudioTrack.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs index ae8924e5d..879b0180d 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Chapter.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Chapter.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs index ab822c33a..960ce796b 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Destination.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Destination.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs index 9cd5161ac..ae73a8ebd 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Filter.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Filter.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs index 9c664cfa5..b00b5e643 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Filters.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Filters.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs index fa3d26c26..5a27cd9dc 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="JsonEncodeObject.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="JsonEncodeObject.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs index b399880a5..28ec7e38a 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Metadata.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Metadata.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs index 2dc833375..d979fd70e 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Mp4Options.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Mp4Options.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs index 33ed05dc5..614ab27bd 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="QSV.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="QSV.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs index 2327e359f..7a55ade81 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Range.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Range.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs index 7f156c0c6..7727b99dc 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Source.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Source.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubImport.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubImport.cs index 8399daa69..6cbf61c16 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubImport.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubImport.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SRT.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SubImport.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs index 28558f48b..7143fb9d2 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SubtitleSearch.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SubtitleSearch.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs index 4e0d79857..5bba4b981 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SubtitleTrack.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SubtitleTrack.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs index 8c565d185..ef62774d0 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Subtitles.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Subtitles.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs index 12525c3e5..56af62869 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Video.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Video.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs b/win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs index ad7648901..6c79e30a7 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="PresetTune.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="PresetTune.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs index 49f875de9..a69c2a3bb 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="AudioList.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="AudioList.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs index bf49020d4..5753cf573 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBPreset.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBPreset.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> @@ -119,7 +119,9 @@ namespace HandBrake.Interop.Interop.Json.Presets public int PictureDARWidth { get; set; } public string PictureDeblockPreset { get; set; } + public string PictureDeblockTune { get; set; } + public string PictureDeblockCustom { get; set; } /// <summary> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPresetCategory.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPresetCategory.cs index 90f80cd09..e240c9031 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPresetCategory.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPresetCategory.cs @@ -11,34 +11,16 @@ namespace HandBrake.Interop.Interop.Json.Presets { using System.Collections.Generic; - /// <summary> - /// The preset category. - /// </summary> public class HBPresetCategory { - /// <summary> - /// Gets or sets the children array. - /// </summary> public List<HBPreset> ChildrenArray { get; set; } - /// <summary> - /// Gets or sets a value indicating whether folder. - /// </summary> public bool Folder { get; set; } - /// <summary> - /// Gets or sets the preset name. - /// </summary> public string PresetName { get; set; } - /// <summary> - /// Description for the preset group. - /// </summary> public string PresetDescription { get; set; } - /// <summary> - /// Gets or sets the type. - /// </summary> public int Type { get; set; } } }
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs b/win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs index e7a1da64e..b59ca331f 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Task.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Task.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs index 96c6b9065..a8126180c 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="AudioAttributes.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="AudioAttributes.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> @@ -12,10 +12,15 @@ namespace HandBrake.Interop.Interop.Json.Scan public class AudioAttributes { public bool AltCommentary { get; set; } + public bool Commentary { get; set; } + public bool Default { get; set; } + public bool Normal { get; set; } + public bool Secondary { get; set; } + public bool VisuallyImpaired { get; set; } } } diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/Color.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/Color.cs index 65af225c7..14f732504 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/Color.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/Color.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Color.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Color.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs index 533ec05ae..bac455658 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Duration.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Duration.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs index 04fa33c37..f15fc30c0 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="FrameRate.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="FrameRate.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs index cc19e4923..2584ffee9 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="JsonScanObject.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="JsonScanObject.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs index bab5a79de..720b2d400 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs @@ -1,69 +1,69 @@ -// -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SourceAudioTrack.cs" company="HandBrake Project (http://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> -// An audio track from the source video. -// </summary> -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Interop.Json.Scan -{ - /// <summary> - /// An audio track from the source video. - /// </summary> - public class SourceAudioTrack +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceAudioTrack.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>
+// An audio track from the source video.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ /// <summary>
+ /// An audio track from the source video.
+ /// </summary>
+ public class SourceAudioTrack
{
/// <summary>
/// Gets or sets the track number (1-based).
/// </summary>
public int TrackNumber { get; set; }
- - /// <summary> - /// Gets or sets the bit rate. - /// </summary> - public int BitRate { get; set; } - - /// <summary> - /// Gets or sets the channel layout. - /// </summary> - public long ChannelLayout { get; set; } - - /// <summary> - /// Gets or sets the description. - /// </summary> - public string Description { get; set; } - - /// <summary> - /// Gets or sets the language. - /// </summary> - public string Language { get; set; } - - /// <summary> - /// Gets or sets the language code. - /// </summary> - public string LanguageCode { get; set; } - - /// <summary> - /// Gets or sets the sample rate. - /// </summary> - public int SampleRate { get; set; } - - /// <summary> - /// Gets or sets the codec. - /// </summary> - public int Codec { get; set; } - - public string CodecName { get; set; } - - public long LFECount { get; set; } - - public string ChannelLayoutName { get; set; } - - public int ChannelCount { get; set; } - - public AudioAttributes Attributes { get; set; } - - public string Name { get; set; } - } +
+ /// <summary>
+ /// Gets or sets the bit rate.
+ /// </summary>
+ public int BitRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the channel layout.
+ /// </summary>
+ public long ChannelLayout { get; set; }
+
+ /// <summary>
+ /// Gets or sets the description.
+ /// </summary>
+ public string Description { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language.
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the sample rate.
+ /// </summary>
+ public int SampleRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the codec.
+ /// </summary>
+ public int Codec { get; set; }
+
+ public string CodecName { get; set; }
+
+ public long LFECount { get; set; }
+
+ public string ChannelLayoutName { get; set; }
+
+ public int ChannelCount { get; set; }
+
+ public AudioAttributes Attributes { get; set; }
+
+ public string Name { get; set; }
+ }
}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceChapter.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceChapter.cs index 02e83fe1d..7fd73de13 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceChapter.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceChapter.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SourceChapter.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SourceChapter.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs index e41cd1689..8eff6eecf 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SourceMetadata.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SourceMetadata.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> @@ -15,14 +15,23 @@ namespace HandBrake.Interop.Interop.Json.Scan public class SourceMetadata { public string Name { get; set; } + public string Artist { get; set; } + public string Composer { get; set; } + public string Comment { get; set; } + public string Genre { get; set; } + public string Album { get; set; } + public string AlbumArtist { get; set; } + public string Description { get; set; } + public string LongDescription { get; set; } + public string ReleaseDate { get; set; } } }
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceTitle.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceTitle.cs index 4fd5232ff..f133d250d 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceTitle.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceTitle.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SourceTitle.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SourceTitle.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs index 07ac8b032..1cc2eaec4 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SubtitleAttributes.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SubtitleAttributes.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> @@ -15,15 +15,25 @@ namespace HandBrake.Interop.Interop.Json.Scan { [JsonProperty(PropertyName = "4By3")] public bool FourByThree { get; set; } + public bool Children { get; set; } + public bool ClosedCaption { get; set; } + public bool Commentary { get; set; } + public bool Default { get; set; } + public bool Forced { get; set; } + public bool Large { get; set; } + public bool Letterbox { get; set; } + public bool Normal { get; set; } + public bool PanScan { get; set; } + public bool Wide { get; set; } } } diff --git a/win/CS/HandBrake.Interop/Interop/Json/Shared/Geometry.cs b/win/CS/HandBrake.Interop/Interop/Json/Shared/Geometry.cs index 5632b3736..376a6829b 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Shared/Geometry.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Shared/Geometry.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Geometry.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Geometry.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs b/win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs index 075c26672..5269e8a71 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="PAR.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="PAR.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs b/win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs index 4f3cfb22d..32c0db443 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Scanning.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Scanning.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> diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs b/win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs index 5d0f5f92f..26d9b86e4 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="TaskState.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="TaskState.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> @@ -13,6 +13,8 @@ namespace HandBrake.Interop.Interop.Json.State public class TaskState { + private static readonly Dictionary<string, TaskState> TaskStates = new Dictionary<string, TaskState>(); + public static TaskState Idle = new TaskState("IDLE"); public static TaskState Scanning = new TaskState("SCANNING"); public static TaskState ScanDone = new TaskState("SCANDONE"); @@ -23,19 +25,17 @@ namespace HandBrake.Interop.Interop.Json.State public static TaskState Muxing = new TaskState("MUXING"); public static TaskState Unknown = new TaskState("UNKNOWN"); - private static readonly Dictionary<string, TaskState> taskStates = new Dictionary<string, TaskState>(); - static TaskState() { - taskStates.Add("IDLE", Idle); - taskStates.Add("SCANNING", Scanning); - taskStates.Add("SCANDONE", ScanDone); - taskStates.Add("WORKING", Working); - taskStates.Add("PAUSED", Paused); - taskStates.Add("SEARCHING", Searching); - taskStates.Add("WORKDONE", WorkDone); - taskStates.Add("MUXING", Muxing); - taskStates.Add("UNKNOWN", Unknown); + TaskStates.Add("IDLE", Idle); + TaskStates.Add("SCANNING", Scanning); + TaskStates.Add("SCANDONE", ScanDone); + TaskStates.Add("WORKING", Working); + TaskStates.Add("PAUSED", Paused); + TaskStates.Add("SEARCHING", Searching); + TaskStates.Add("WORKDONE", WorkDone); + TaskStates.Add("MUXING", Muxing); + TaskStates.Add("UNKNOWN", Unknown); } public TaskState(string code) @@ -47,8 +47,7 @@ namespace HandBrake.Interop.Interop.Json.State public static TaskState FromRepositoryValue(string code) { - TaskState state = null; - if (taskStates.TryGetValue(code, out state)) + if (TaskStates.TryGetValue(code, out TaskState state)) { return state; } diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs b/win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs index aa821f286..6d27b58da 100644 --- a/win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs +++ b/win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="WorkDone.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="WorkDone.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs b/win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs index 91ee98356..89e0aa960 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="BitrateLimits.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="BitrateLimits.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Cropping.cs b/win/CS/HandBrake.Interop/Interop/Model/Cropping.cs index 63a1b176a..bae0473c8 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Cropping.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Cropping.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Cropping.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Cropping.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> @@ -25,15 +25,15 @@ namespace HandBrake.Interop.Interop.Model /// Initializes a new instance of the <see cref="Cropping"/> class. /// Copy Constructor /// </summary> - /// <param name="croping"> - /// The croping. + /// <param name="cropping"> + /// The cropping. /// </param> - public Cropping(Cropping croping) + public Cropping(Cropping cropping) { - this.Top = croping.Top; - this.Bottom = croping.Bottom; - this.Left = croping.Left; - this.Right = croping.Right; + this.Top = cropping.Top; + this.Bottom = cropping.Bottom; + this.Left = cropping.Left; + this.Right = cropping.Right; } /// <summary> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs index f98875a16..e6b68fc1e 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Anamorphic.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Anamorphic.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs index 922cdbc24..595375a50 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="CombDetect.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="CombDetect.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs index 9ceeb6132..ce7c5c5c2 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Container.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Container.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs index 1ebc03cc6..4b6c60ceb 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="DeinterlaceFilter.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="DeinterlaceFilter.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs index fb6440188..62592f0dc 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Denoise.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Denoise.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs index 0aeebdd7c..1f63d4ee1 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Detelecine.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Detelecine.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs index 4e4f241df..ae1d4b700 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBAudioEncoder.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBAudioEncoder.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs index 487e90362..3580cd726 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBContainer.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBContainer.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs index a96724c31..3130829f6 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBMixdown.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBMixdown.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs index 8f62b30ac..3fd59bcbf 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs @@ -1,9 +1,9 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBPresetTune.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBPresetTune.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> -// An object represetning the key and name of a Filter Preset or Tune option. +// An object represetning the key and name of a Filter Preset or Tune option. // </summary> // -------------------------------------------------------------------------------------------------------------------- @@ -27,9 +27,21 @@ namespace HandBrake.Interop.Interop.Model.Encoding public override bool Equals(object obj) { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + if (obj.GetType() != this.GetType()) + { + return false; + } + return this.Equals((HBPresetTune)obj); } diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs index ecebb0526..8116cfe30 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBRate.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBRate.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs index e60ed2668..da0c4ca73 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HBVideoEncoder.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="HBVideoEncoder.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> @@ -12,18 +12,10 @@ namespace HandBrake.Interop.Interop.Model.Encoding using System.Collections.Generic; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Helpers; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; - /// <summary> - /// The hb video encoder. - /// </summary> public class HBVideoEncoder { - private IHbFunctions hbFunctions; - /// <summary> /// Initializes a new instance of the <see cref="HBVideoEncoder"/> class. /// </summary> @@ -41,9 +33,6 @@ namespace HandBrake.Interop.Interop.Model.Encoding /// </param> public HBVideoEncoder(int compatibleContainers, string displayName, int id, string shortName) { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - this.CompatibleContainers = compatibleContainers; this.DisplayName = displayName; this.Id = id; @@ -77,7 +66,7 @@ namespace HandBrake.Interop.Interop.Model.Encoding { get { - return InteropUtilities.ToStringListFromArrayPtr(hbFunctions.hb_video_encoder_get_presets(this.Id)); + return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_presets(this.Id)); } } @@ -88,7 +77,7 @@ namespace HandBrake.Interop.Interop.Model.Encoding { get { - return InteropUtilities.ToStringListFromArrayPtr(hbFunctions.hb_video_encoder_get_tunes(this.Id)); + return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_tunes(this.Id)); } } @@ -99,7 +88,7 @@ namespace HandBrake.Interop.Interop.Model.Encoding { get { - return InteropUtilities.ToStringListFromArrayPtr(hbFunctions.hb_video_encoder_get_profiles(this.Id)); + return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_profiles(this.Id)); } } @@ -110,7 +99,7 @@ namespace HandBrake.Interop.Interop.Model.Encoding { get { - return InteropUtilities.ToStringListFromArrayPtr(hbFunctions.hb_video_encoder_get_levels(this.Id)); + return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_levels(this.Id)); } } } diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs index 2c0d85b9d..566344fed 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="PictureRotation.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="PictureRotation.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs index 8c1d32174..029ee7295 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="ScaleMethod.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="ScaleMethod.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs index 5924604fe..1f2b93ce4 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Sharpen.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Sharpen.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs index 461b3931d..2ccec4bca 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="VideoEncodeRateType.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="VideoEncodeRateType.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Language.cs b/win/CS/HandBrake.Interop/Interop/Model/Language.cs index 5564a434e..5ca0ca0e6 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Language.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Language.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Language.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Language.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs b/win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs index dbe5578f8..4fe0225b3 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/PresetVersion.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="PresetVersion.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="PresetVersion.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> @@ -19,7 +19,9 @@ namespace HandBrake.Interop.Interop.Model } public int Major { get; } + public int Minor { get; } + public int Micro { get; } } } diff --git a/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs b/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs index beebc12f5..d09d05eda 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="PreviewSettings.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="PreviewSettings.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs b/win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs index 8768d0054..f833b7479 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="RawPreviewData.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="RawPreviewData.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> // -------------------------------------------------------------------------------------------------------------------- @@ -18,9 +18,13 @@ namespace HandBrake.Interop.Interop.Model.Preview } public byte[] RawBitmapData { get; } + public int StrideWidth { get; } + public int StrideHeight { get; } + public int Width { get; } + public int Height { get; } } } diff --git a/win/CS/HandBrake.Interop/Interop/Model/RangeLimits.cs b/win/CS/HandBrake.Interop/Interop/Model/RangeLimits.cs index 3a05f8e38..e8102eb42 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/RangeLimits.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/RangeLimits.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="RangeLimits.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="RangeLimits.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/Size.cs b/win/CS/HandBrake.Interop/Interop/Model/Size.cs index 6113b8bcf..e8f4d28bc 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/Size.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/Size.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="Size.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="Size.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs b/win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs index 23b43df79..5b5972015 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SourceVideoInfo.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SourceVideoInfo.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> diff --git a/win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs b/win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs index 64fbd6f4f..6387763da 100644 --- a/win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs +++ b/win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="VideoQualityLimits.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="VideoQualityLimits.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> diff --git a/win/CS/HandBrake.Interop/Interop/Providers/HbFunctionsProvider.cs b/win/CS/HandBrake.Interop/Interop/Providers/HbFunctionsProvider.cs deleted file mode 100644 index 3b964ff8c..000000000 --- a/win/CS/HandBrake.Interop/Interop/Providers/HbFunctionsProvider.cs +++ /dev/null @@ -1,30 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// <copyright file="HbFunctionsProvider.cs" company="HandBrake Project (http://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> -// Provides an instance of IHbFunctions for use by the GUI. -// </summary> -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Interop.Providers -{ - using HandBrake.Interop.Interop.HbLib.Wrappers; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; - using HandBrake.Interop.Interop.Providers.Interfaces; - - public class HbFunctionsProvider : IHbFunctionsProvider - { - private static IHbFunctions hbFunctions; - - public IHbFunctions GetHbFunctionsWrapper() - { - if (hbFunctions == null) - { - hbFunctions = new HbFunctionsDirect(); - } - - return hbFunctions; - } - } -} diff --git a/win/CS/HandBrake.Interop/Interop/Providers/Interfaces/IHbFunctionsProvider.cs b/win/CS/HandBrake.Interop/Interop/Providers/Interfaces/IHbFunctionsProvider.cs deleted file mode 100644 index f64f54594..000000000 --- a/win/CS/HandBrake.Interop/Interop/Providers/Interfaces/IHbFunctionsProvider.cs +++ /dev/null @@ -1,18 +0,0 @@ -// -------------------------------------------------------------------------------------------------------------------- -// <copyright file="IHbFunctionsProvider.cs" company="HandBrake Project (http://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> -// Provides an instance of IHbFunctions for use by the GUI. -// </summary> -// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Interop.Providers.Interfaces -{ - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; - - public interface IHbFunctionsProvider - { - IHbFunctions GetHbFunctionsWrapper(); - } -}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/Model/VideoScaler.cs b/win/CS/HandBrake.Interop/Model/VideoScaler.cs index 03a19fcf3..cf08f33c2 100644 --- a/win/CS/HandBrake.Interop/Model/VideoScaler.cs +++ b/win/CS/HandBrake.Interop/Model/VideoScaler.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="VideoScaler.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="VideoScaler.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> diff --git a/win/CS/HandBrake.Interop/Settings.StyleCop b/win/CS/HandBrake.Interop/Settings.StyleCop index ac6eb3875..32e6973dc 100644 --- a/win/CS/HandBrake.Interop/Settings.StyleCop +++ b/win/CS/HandBrake.Interop/Settings.StyleCop @@ -1,4 +1,43 @@ <StyleCopSettings Version="105"> + <GlobalSettings> + <CollectionProperty Name="RecognizedWords"> + <Value>avg</Value> + <Value>bd</Value> + <Value>codeset</Value> + <Value>Colour</Value> + <Value>decomb</Value> + <Value>deinterlace</Value> + <Value>denoise</Value> + <Value>dest</Value> + <Value>detelecine</Value> + <Value>drc</Value> + <Value>dvd</Value> + <Value>framerate</Value> + <Value>framerates</Value> + <Value>hb</Value> + <Value>init</Value> + <Value>interop</Value> + <Value>ipod</Value> + <Value>iso</Value> + <Value>itu</Value> + <Value>json</Value> + <Value>libdvdread</Value> + <Value>mixdown</Value> + <Value>mixdowns</Value> + <Value>mp</Value> + <Value>nav</Value> + <Value>num</Value> + <Value>passthrough</Value> + <Value>plist</Value> + <Value>pts</Value> + <Value>qsv</Value> + <Value>samplerate</Value> + <Value>scaler</Value> + <Value>srt</Value> + <Value>vob</Value> + <Value>vrate</Value> + </CollectionProperty> + </GlobalSettings> <Parsers> <Parser ParserId="StyleCop.CSharp.CsParser"> <ParserSettings> @@ -8,6 +47,13 @@ </Parsers> <Analyzers> <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"> + <Rules> + <Rule Name="PropertySummaryDocumentationMustMatchAccessors"> + <RuleSettings> + <BooleanProperty Name="Enabled">False</BooleanProperty> + </RuleSettings> + </Rule> + </Rules> <AnalyzerSettings> <StringProperty Name="CompanyName">HandBrake Project (https://handbrake.fr)</StringProperty> <StringProperty Name="Copyright">This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.</StringProperty> diff --git a/win/CS/HandBrake.Interop/Utilities/CharCodesUtilities.cs b/win/CS/HandBrake.Interop/Utilities/CharCodesUtilities.cs index ced240bb7..9d8d46ad4 100644 --- a/win/CS/HandBrake.Interop/Utilities/CharCodesUtilities.cs +++ b/win/CS/HandBrake.Interop/Utilities/CharCodesUtilities.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="CharCodesUtilities.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="CharCodesUtilities.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> diff --git a/win/CS/HandBrake.Interop/Utilities/LanguageUtilities.cs b/win/CS/HandBrake.Interop/Utilities/LanguageUtilities.cs index 106247577..fad0307b5 100644 --- a/win/CS/HandBrake.Interop/Utilities/LanguageUtilities.cs +++ b/win/CS/HandBrake.Interop/Utilities/LanguageUtilities.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="LanguageUtilities.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="LanguageUtilities.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> @@ -10,17 +10,15 @@ namespace HandBrake.Interop.Utilities { using System.Collections.Generic; - using System.ComponentModel; using System.Linq; - using HandBrake.Interop.Interop.HbLib; - /// <summary> /// Language Utilities /// </summary> public class LanguageUtilities { public static string Any = "(Any)"; + private static IDictionary<string, string> languageMap; /// <summary> diff --git a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs index 6a0c72283..952d0b1c5 100644 --- a/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.Interop/Utilities/SystemInfo.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="SystemInfo.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="SystemInfo.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> @@ -12,26 +12,13 @@ namespace HandBrake.Interop.Utilities using System; using System.Diagnostics; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; - using Interop.HbLib; public class SystemInfo { - private static bool? isNvencH264Available; // Local cache to prevent log spam. + private static bool? isNvencH264Available; // Local cache to prevent log spam. private static bool? isNvencH265Available; - private static IHbFunctions hbFunctions; - - static SystemInfo() - { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - } - - /* QuickSync Support */ public static bool IsQsvAvailable @@ -40,7 +27,7 @@ namespace HandBrake.Interop.Utilities { try { - return hbFunctions.hb_qsv_available() != 0; + return HBFunctions.hb_qsv_available() != 0; } catch (Exception) { @@ -56,7 +43,7 @@ namespace HandBrake.Interop.Utilities { try { - return (hbFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H264) != 0; + return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H264) != 0; } catch (Exception) { @@ -72,7 +59,7 @@ namespace HandBrake.Interop.Utilities { try { - return (hbFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265) != 0; + return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265) != 0; } catch (Exception) { @@ -88,8 +75,8 @@ namespace HandBrake.Interop.Utilities { try { - int cpu_platform = hbFunctions.hb_get_cpu_platform(); - int hardware = hbFunctions.qsv_hardware_generation(cpu_platform); + int cpu_platform = HBFunctions.hb_get_cpu_platform(); + int hardware = HBFunctions.qsv_hardware_generation(cpu_platform); return hardware; } catch (Exception exc) @@ -101,14 +88,13 @@ namespace HandBrake.Interop.Utilities } } - public static bool IsQsvAvailableH26510bit { get { try { - return (hbFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265_10BIT) != 0; + return (HBFunctions.hb_qsv_available() & NativeConstants.HB_VCODEC_QSV_H265_10BIT) != 0; } catch (Exception) { @@ -117,8 +103,7 @@ namespace HandBrake.Interop.Utilities } } } - - + /* AMD VCE Support */ public static bool IsVceH264Available @@ -127,7 +112,7 @@ namespace HandBrake.Interop.Utilities { try { - return hbFunctions.hb_vce_h264_available() != 0; + return HBFunctions.hb_vce_h264_available() != 0; } catch (Exception) { @@ -143,7 +128,7 @@ namespace HandBrake.Interop.Utilities { try { - return hbFunctions.hb_vce_h265_available() != 0; + return HBFunctions.hb_vce_h265_available() != 0; } catch (Exception) { @@ -163,7 +148,7 @@ namespace HandBrake.Interop.Utilities { if (isNvencH264Available == null) { - isNvencH264Available = hbFunctions.hb_nvenc_h264_available() != 0; + isNvencH264Available = HBFunctions.hb_nvenc_h264_available() != 0; } return isNvencH264Available.Value; @@ -189,7 +174,7 @@ namespace HandBrake.Interop.Utilities if (isNvencH265Available == null) { - isNvencH265Available = hbFunctions.hb_nvenc_h265_available() != 0; + isNvencH265Available = HBFunctions.hb_nvenc_h265_available() != 0; } return isNvencH265Available.Value; diff --git a/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs b/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs index 36a04fc63..6b381a6ee 100644 --- a/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs +++ b/win/CS/HandBrake.Interop/Utilities/VersionHelper.cs @@ -1,5 +1,5 @@ // -------------------------------------------------------------------------------------------------------------------- -// <copyright file="VersionHelper.cs" company="HandBrake Project (http://handbrake.fr)"> +// <copyright file="VersionHelper.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> @@ -13,48 +13,9 @@ namespace HandBrake.Interop.Utilities using System.Runtime.InteropServices; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; - using HandBrake.Interop.Interop.Providers; - using HandBrake.Interop.Interop.Providers.Interfaces; public class VersionHelper { - private static IHbFunctions hbFunctions; - - static VersionHelper() - { - IHbFunctionsProvider hbFunctionsProvider = new HbFunctionsProvider(); - hbFunctions = hbFunctionsProvider.GetHbFunctionsWrapper(); - } - - /// <summary> - /// The get build. - /// </summary> - /// <returns> - /// The <see cref="int"/>. - /// </returns> - public static string GetVersion() - { - return IsNightly() ? string.Format("Nightly {0} ({1})", Version, Build) : string.Format("{0} ({1})", Version, Build); - } - - public static string GetVersionShort() - { - return string.Format("{0} {1}", Version, Build); - } - - /// <summary> - /// The is nightly. - /// </summary> - /// <returns> - /// The <see cref="string"/>. - /// </returns> - public static bool IsNightly() - { - // 01 = Unofficial Builds. 00 = Official Tagged Releases. - return Build.ToString().EndsWith("01"); - } - /// <summary> /// Gets the HandBrake version string. /// </summary> @@ -62,7 +23,7 @@ namespace HandBrake.Interop.Utilities { get { - var versionPtr = hbFunctions.hb_get_version(IntPtr.Zero); // Pointer isn't actually used. + var versionPtr = HBFunctions.hb_get_version(IntPtr.Zero); // Pointer isn't actually used. return Marshal.PtrToStringAnsi(versionPtr); } } @@ -74,8 +35,24 @@ namespace HandBrake.Interop.Utilities { get { - return hbFunctions.hb_get_build(IntPtr.Zero); + return HBFunctions.hb_get_build(IntPtr.Zero); } } + + public static string GetVersion() + { + return IsNightly() ? string.Format("Nightly {0} ({1})", Version, Build) : string.Format("{0} ({1})", Version, Build); + } + + public static string GetVersionShort() + { + return string.Format("{0} {1}", Version, Build); + } + + public static bool IsNightly() + { + // 01 = Unofficial Builds. 00 = Official Tagged Releases. + return Build.ToString().EndsWith("01"); + } } } diff --git a/win/CS/HandBrake.sln.DotSettings b/win/CS/HandBrake.sln.DotSettings index d8ac48dec..0882a1550 100644 --- a/win/CS/HandBrake.sln.DotSettings +++ b/win/CS/HandBrake.sln.DotSettings @@ -1414,4 +1414,16 @@ <s:Int64 x:Key="/Default/OptionsGeneral/AutoDeleteWorkspaceOlderNDays/@EntryValue">10</s:Int64> <s:String x:Key="/Default/SnapshotsStore/CurrentStore/@EntryValue">C:\Users\Scott\AppData\Local\JetBrains\Shared\vAny\Sessions</s:String> <s:Int64 x:Key="/Default/StyleCopOptions/ParsingPerformance/@EntryValue">8</s:Int64> - <s:Boolean x:Key="/Default/UserDictionary/Words/=Colours/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
\ No newline at end of file + <s:Boolean x:Key="/Default/UserDictionary/Words/=Colours/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=decomb/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=detelecine/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=interop/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=hb/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=passthrough/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=qsv/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=deinterlace/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=denoise/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=framerate/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=mixdown/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=samplerate/@EntryIndexedValue">True</s:Boolean> + <s:Boolean x:Key="/Default/UserDictionary/Words/=vrate/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs index b34498348..613f3fce4 100644 --- a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs +++ b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs @@ -9,15 +9,10 @@ namespace HandBrakeWPF.Helpers
{
- using Caliburn.Micro;
-
+ using HandBrake.Interop.Interop;
using HandBrake.Interop.Interop.HbLib;
- using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces;
using HandBrake.Interop.Interop.Model;
using HandBrake.Interop.Interop.Model.Encoding;
- using HandBrake.Interop.Interop.Providers.Interfaces;
-
- using HandBrakeWPF.Services.Interfaces;
/// <summary>
/// The picture size Helpers
@@ -215,12 +210,7 @@ namespace HandBrakeWPF.Helpers par = new hb_rational_t { den = title.ParH, num = title.ParW }
};
- hb_geometry_s result = new hb_geometry_s();
-
- IHbFunctionsProvider provider = IoC.Get<IHbFunctionsProvider>(); // TODO make this method non static and remove IoC call.
- IHbFunctions hbFunctions = provider.GetHbFunctionsWrapper();
-
- hbFunctions.hb_set_anamorphic_size2(ref sourceGeometry, ref uiGeometry, ref result);
+ hb_geometry_s result = HandBrakePictureHelpers.GetAnamorphicSizes(sourceGeometry, uiGeometry);
int outputWidth = result.width;
int outputHeight = result.height;
diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs index 6621d3f82..ee4928bc9 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeTaskFactory.cs @@ -9,15 +9,12 @@ namespace HandBrakeWPF.Services.Encode.Factories { - using System; using System.Collections.Generic; using System.Globalization; using System.Linq; - using System.Runtime.InteropServices; using HandBrake.Interop.Interop; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Json.Encode; using HandBrake.Interop.Interop.Json.Shared; using HandBrake.Interop.Interop.Model.Encoding; @@ -49,13 +46,10 @@ namespace HandBrakeWPF.Services.Encode.Factories internal class EncodeTaskFactory { private readonly IUserSettingService userSettingService; - private IHbFunctions hbFunctions; - public EncodeTaskFactory(IUserSettingService userSettingService, IHbFunctions hbFunctionsWrapper) + public EncodeTaskFactory(IUserSettingService userSettingService) { this.userSettingService = userSettingService; - - this.hbFunctions = hbFunctionsWrapper; } internal JsonEncodeObject Create(EncodeTask job, HBConfiguration configuration) @@ -354,8 +348,7 @@ namespace HandBrakeWPF.Services.Encode.Factories // Detelecine if (job.Detelecine != Detelecine.Off) { - IntPtr settingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DETELECINE, null, null, job.CustomDetelecine); - string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_DETELECINE, null, null, job.CustomDetelecine); if (!string.IsNullOrEmpty(unparsedJson)) { JToken settings = JObject.Parse(unparsedJson); @@ -368,8 +361,7 @@ namespace HandBrakeWPF.Services.Encode.Factories // Deinterlace if (job.DeinterlaceFilter == DeinterlaceFilter.Yadif) { - IntPtr settingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DEINTERLACE, job.DeinterlacePreset?.ShortName, null, job.CustomDeinterlaceSettings); - string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_DEINTERLACE, job.DeinterlacePreset?.ShortName, null, job.CustomDeinterlaceSettings); if (!string.IsNullOrEmpty(unparsedJson)) { JToken root = JObject.Parse(unparsedJson); @@ -382,8 +374,7 @@ namespace HandBrakeWPF.Services.Encode.Factories // Decomb if (job.DeinterlaceFilter == DeinterlaceFilter.Decomb) { - IntPtr settingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DECOMB, job.DeinterlacePreset?.ShortName, null, job.CustomDeinterlaceSettings); - string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_DECOMB, job.DeinterlacePreset?.ShortName, null, job.CustomDeinterlaceSettings); if (!string.IsNullOrEmpty(unparsedJson)) { JToken settings = JObject.Parse(unparsedJson); @@ -397,8 +388,7 @@ namespace HandBrakeWPF.Services.Encode.Factories { 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); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_COMB_DETECT, EnumHelper<CombDetect>.GetShortName(job.CombDetect), null, job.CustomCombDetect); if (!string.IsNullOrEmpty(unparsedJson)) { JToken settings = JObject.Parse(unparsedJson); @@ -420,8 +410,7 @@ namespace HandBrakeWPF.Services.Encode.Factories ? hb_filter_ids.HB_FILTER_HQDN3D : hb_filter_ids.HB_FILTER_NLMEANS; - IntPtr settingsPtr = hbFunctions.hb_generate_filter_settings_json((int)id, job.DenoisePreset.ToString().ToLower().Replace(" ", string.Empty), job.DenoiseTune.ToString().ToLower().Replace(" ", string.Empty), job.CustomDenoise); - string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)id, job.DenoisePreset.ToString().ToLower().Replace(" ", string.Empty), job.DenoiseTune.ToString().ToLower().Replace(" ", string.Empty), job.CustomDenoise); if (!string.IsNullOrEmpty(unparsedJson)) { @@ -439,8 +428,7 @@ namespace HandBrakeWPF.Services.Encode.Factories ? hb_filter_ids.HB_FILTER_LAPSHARP : hb_filter_ids.HB_FILTER_UNSHARP; - IntPtr settingsPtr = hbFunctions.hb_generate_filter_settings_json((int)id, job.SharpenPreset.Key, job.SharpenTune.Key, job.SharpenCustom); - string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)id, job.SharpenPreset.Key, job.SharpenTune.Key, job.SharpenCustom); if (!string.IsNullOrEmpty(unparsedJson)) { @@ -454,8 +442,7 @@ namespace HandBrakeWPF.Services.Encode.Factories // Deblock if (job.DeblockPreset != null && job.DeblockPreset.Key != "off") { - IntPtr settingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_DEBLOCK, job.DeblockPreset.Key, job.DeblockTune.Key, job.CustomDeblock); - string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_DEBLOCK, job.DeblockPreset.Key, job.DeblockTune.Key, job.CustomDeblock); if (!string.IsNullOrEmpty(unparsedJson)) { JToken settings = JObject.Parse(unparsedJson); @@ -467,8 +454,7 @@ namespace HandBrakeWPF.Services.Encode.Factories // CropScale Filter string cropSettings = string.Format("width={0}:height={1}:crop-top={2}:crop-bottom={3}:crop-left={4}:crop-right={5}", job.Width, job.Height, job.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right); - IntPtr cropSettingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_CROP_SCALE, null, null, cropSettings); - string unparsedCropSettingsJson = Marshal.PtrToStringAnsi(cropSettingsPtr); + string unparsedCropSettingsJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_CROP_SCALE, null, null, cropSettings); if (!string.IsNullOrEmpty(unparsedCropSettingsJson)) { JToken cropSettingsJson = JObject.Parse(unparsedCropSettingsJson); @@ -485,8 +471,7 @@ namespace HandBrakeWPF.Services.Encode.Factories if (job.Padding.Enabled) { string padSettings = string.Format("width={0}:height={1}:color={2}:x={3}:y={4}", job.Width, job.Height, job.Padding.Color, job.Padding.X, job.Padding.Y); - IntPtr padSettingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_PAD, null, null, padSettings); - string unparsedPadSettingsJson = Marshal.PtrToStringAnsi(padSettingsPtr); + string unparsedPadSettingsJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_PAD, null, null, padSettings); if (!string.IsNullOrEmpty(unparsedPadSettingsJson)) { JToken PadSettingsJson = JObject.Parse(unparsedPadSettingsJson); @@ -511,8 +496,7 @@ namespace HandBrakeWPF.Services.Encode.Factories if (job.Rotation != 0 || job.FlipVideo) { string rotateSettings = string.Format("angle={0}:hflip={1}", job.Rotation, job.FlipVideo ? "1" : "0"); - IntPtr settingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_ROTATE, null, null, rotateSettings); - string unparsedJson = Marshal.PtrToStringAnsi(settingsPtr); + string unparsedJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_ROTATE, null, null, rotateSettings); if (!string.IsNullOrEmpty(unparsedJson)) { JToken settings = JObject.Parse(unparsedJson); @@ -527,8 +511,7 @@ namespace HandBrakeWPF.Services.Encode.Factories int? num = null, den = null; if (job.Framerate != null) { - IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(job.Framerate.Value.ToString(CultureInfo.InvariantCulture)); - int vrate = hbFunctions.hb_video_framerate_get_from_name(frameratePrt); + int vrate = HandBrakeUnitConversionHelpers.GetFramerateFromName(job.Framerate.Value.ToString(CultureInfo.InvariantCulture)); if (vrate > 0) { @@ -538,8 +521,7 @@ namespace HandBrakeWPF.Services.Encode.Factories } string framerateString = num.HasValue ? string.Format("mode={0}:rate={1}/{2}", fm, num, den) : string.Format("mode={0}", fm); // filter_cfr, filter_vrate.num, filter_vrate.den - IntPtr framerateSettingsPtr = hbFunctions.hb_generate_filter_settings_json((int)hb_filter_ids.HB_FILTER_VFR, null, null, framerateString); - string unparsedFramerateJson = Marshal.PtrToStringAnsi(framerateSettingsPtr); + string unparsedFramerateJson = HandBrakeFilterHelpers.GenerateFilterSettingJson((int)hb_filter_ids.HB_FILTER_VFR, null, null, framerateString); if (!string.IsNullOrEmpty(unparsedFramerateJson)) { JToken framerateSettings = JObject.Parse(unparsedFramerateJson); diff --git a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs index 796ddac7b..1474df7e7 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/LibEncode.cs @@ -17,7 +17,6 @@ namespace HandBrakeWPF.Services.Encode using HandBrake.Interop.Interop.Interfaces; using HandBrake.Interop.Interop.Json.Encode; using HandBrake.Interop.Interop.Json.State; - using HandBrake.Interop.Interop.Providers.Interfaces; using HandBrake.Interop.Model; using HandBrakeWPF.Exceptions; @@ -39,7 +38,6 @@ namespace HandBrakeWPF.Services.Encode { private readonly IUserSettingService userSettingService; private readonly ILogInstanceManager logInstanceManager; - private readonly IHbFunctionsProvider hbFunctionsProvider; private readonly IPortService portService; private readonly object portLock = new object(); private readonly EncodeTaskFactory encodeTaskFactory; @@ -51,14 +49,13 @@ namespace HandBrakeWPF.Services.Encode private bool isLoggingInitialised; private int encodeCounter; - public LibEncode(IHbFunctionsProvider hbFunctionsProvider, IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int encodeCounter, IPortService portService) : base(userSettingService) + public LibEncode(IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int encodeCounter, IPortService portService) : base(userSettingService) { this.userSettingService = userSettingService; this.logInstanceManager = logInstanceManager; - this.hbFunctionsProvider = hbFunctionsProvider; this.encodeCounter = encodeCounter; this.portService = portService; - this.encodeTaskFactory = new EncodeTaskFactory(this.userSettingService, hbFunctionsProvider.GetHbFunctionsWrapper()); + this.encodeTaskFactory = new EncodeTaskFactory(this.userSettingService); } public bool IsPasued { get; private set; } diff --git a/win/CS/HandBrakeWPF/Services/Queue/ActiveJob.cs b/win/CS/HandBrakeWPF/Services/Queue/ActiveJob.cs index 8daa6064d..d433e1625 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/ActiveJob.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/ActiveJob.cs @@ -10,10 +10,7 @@ namespace HandBrakeWPF.Services.Queue { using System; - using System.Diagnostics; - - using HandBrake.Interop.Interop.Providers.Interfaces; - + using HandBrakeWPF.Services.Encode; using HandBrakeWPF.Services.Encode.EventArgs; using HandBrakeWPF.Services.Encode.Interfaces; @@ -27,10 +24,10 @@ namespace HandBrakeWPF.Services.Queue private readonly QueueTask job; private readonly IEncode encodeService; - public ActiveJob(QueueTask task, IHbFunctionsProvider hbFunctionsProvider, IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int jobId, IPortService portService) + public ActiveJob(QueueTask task, IUserSettingService userSettingService, ILogInstanceManager logInstanceManager, int jobId, IPortService portService) { this.job = task; - this.encodeService = new LibEncode(hbFunctionsProvider, userSettingService, logInstanceManager, jobId, portService); + this.encodeService = new LibEncode(userSettingService, logInstanceManager, jobId, portService); } public event EventHandler<ActiveJobCompletedEventArgs> JobFinished; diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs index 96de49ade..cbd97029d 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueResourceService.cs @@ -19,11 +19,17 @@ namespace HandBrakeWPF.Services.Queue private readonly object lockOjb = new object(); private HashSet<Guid> qsvInstances = new HashSet<Guid>(); - private HashSet<Guid> nvencInstances = new HashSet<Guid>(); - private HashSet<Guid> vceInstances = new HashSet<Guid>(); + private List<int> qsvGpus = new List<int>(); + + public void Init() + { + // TODO Coming Soon! + // List<int> qsvGpus = hbFunctions.hb_qsv_adapters_list(); + } + public Guid? GetHardwareLock(VideoEncoder encoder) { lock (this.lockOjb) @@ -33,7 +39,7 @@ namespace HandBrakeWPF.Services.Queue case VideoEncoder.QuickSync: case VideoEncoder.QuickSyncH265: case VideoEncoder.QuickSyncH26510b: - if (this.qsvInstances.Count < 1) + if (this.qsvInstances.Count < 3) { Guid guid = Guid.NewGuid(); this.qsvInstances.Add(guid); diff --git a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs index 7789a14fd..1c7746cb6 100644 --- a/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs +++ b/win/CS/HandBrakeWPF/Services/Queue/QueueService.cs @@ -15,13 +15,8 @@ namespace HandBrakeWPF.Services.Queue using System.IO; using System.Linq; using System.Windows; - using System.Windows.Media.Animation; - using Caliburn.Micro; - - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Json.Queue; - using HandBrake.Interop.Interop.Providers.Interfaces; using HandBrake.Interop.Model; using HandBrake.Interop.Utilities; @@ -55,7 +50,6 @@ namespace HandBrakeWPF.Services.Queue private readonly ILog logService; private readonly IErrorService errorService; private readonly ILogInstanceManager logInstanceManager; - private readonly IHbFunctionsProvider hbFunctionsProvider; private readonly DelayedActionProcessor delayedQueueBackupProcessor = new DelayedActionProcessor(); private readonly IPortService portService; @@ -72,13 +66,12 @@ namespace HandBrakeWPF.Services.Queue private EncodeTaskFactory encodeTaskFactory; - public QueueService(IUserSettingService userSettingService, ILog logService, IErrorService errorService, ILogInstanceManager logInstanceManager, IHbFunctionsProvider hbFunctionsProvider, IPortService portService) + public QueueService(IUserSettingService userSettingService, ILog logService, IErrorService errorService, ILogInstanceManager logInstanceManager, IPortService portService) { this.userSettingService = userSettingService; this.logService = logService; this.errorService = errorService; this.logInstanceManager = logInstanceManager; - this.hbFunctionsProvider = hbFunctionsProvider; this.portService = portService; // If this is the first instance, just use the main queue file, otherwise add the instance id to the filename. @@ -87,7 +80,9 @@ namespace HandBrakeWPF.Services.Queue this.allowedInstances = this.userSettingService.GetUserSetting<int>(UserSettingConstants.SimultaneousEncodes); this.processIsolationEnabled = this.userSettingService.GetUserSetting<bool>(UserSettingConstants.ProcessIsolationEnabled); - this.encodeTaskFactory = new EncodeTaskFactory(this.userSettingService, hbFunctionsProvider.GetHbFunctionsWrapper()); + this.encodeTaskFactory = new EncodeTaskFactory(this.userSettingService); + + this.hardwareEncoderResourceManager.Init(); } public event EventHandler<QueueProgressEventArgs> JobProcessingStarted; @@ -621,7 +616,7 @@ namespace HandBrakeWPF.Services.Queue } this.jobIdCounter = this.jobIdCounter + 1; - ActiveJob activeJob = new ActiveJob(job, this.hbFunctionsProvider, this.userSettingService, this.logInstanceManager, this.jobIdCounter, this.portService); + ActiveJob activeJob = new ActiveJob(job, this.userSettingService, this.logInstanceManager, this.jobIdCounter, this.portService); activeJob.JobFinished += this.ActiveJob_JobFinished; activeJob.JobStatusUpdated += this.ActiveJob_JobStatusUpdated; this.activeJobs.Add(activeJob); @@ -705,9 +700,6 @@ namespace HandBrakeWPF.Services.Queue NullValueHandling = NullValueHandling.Ignore, }; - IHbFunctionsProvider provider = IoC.Get<IHbFunctionsProvider>(); // TODO remove IoC call. - IHbFunctions hbFunctions = provider.GetHbFunctionsWrapper(); - List<Task> queueJobs = new List<Task>(); foreach (var item in tasks) { diff --git a/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs b/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs index fde542ab7..495c9a8c6 100644 --- a/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Scan/Factories/TitleFactory.cs @@ -11,16 +11,12 @@ namespace HandBrakeWPF.Services.Scan.Factories { using System; - using Caliburn.Micro; - + using HandBrake.Interop.Interop; using HandBrake.Interop.Interop.HbLib; - using HandBrake.Interop.Interop.HbLib.Wrappers.Interfaces; using HandBrake.Interop.Interop.Json.Scan; using HandBrake.Interop.Interop.Model; - using HandBrake.Interop.Interop.Providers.Interfaces; using HandBrakeWPF.Services.Encode.Model.Models; - using HandBrakeWPF.Services.Interfaces; using HandBrakeWPF.Services.Scan.Model; public class TitleFactory @@ -96,11 +92,8 @@ namespace HandBrakeWPF.Services.Scan.Factories break; } - IHbFunctionsProvider provider = IoC.Get<IHbFunctionsProvider>(); // TODO remove IoC call - IHbFunctions hbFunctions = provider.GetHbFunctionsWrapper(); - - bool canBurn = hbFunctions.hb_subtitle_can_burn(track.Source) > 0; - bool canSetForcedOnly = hbFunctions.hb_subtitle_can_force(track.Source) > 0; + bool canBurn = HandBrakeSubtitleHelpers.CheckCanBurnSubtitle(track.Source) > 0; + bool canSetForcedOnly = HandBrakeSubtitleHelpers.CheckCanForceSubtitle(track.Source) > 0; converted.Subtitles.Add(new Subtitle(track.Source, currentSubtitleTrack, track.Language, track.LanguageCode, convertedType, canBurn, canSetForcedOnly, track.Name)); currentSubtitleTrack++; diff --git a/win/CS/HandBrakeWPF/Settings.StyleCop b/win/CS/HandBrakeWPF/Settings.StyleCop index 29a523332..86ed79b26 100644 --- a/win/CS/HandBrakeWPF/Settings.StyleCop +++ b/win/CS/HandBrakeWPF/Settings.StyleCop @@ -1,4 +1,20 @@ <StyleCopSettings Version="105"> + <GlobalSettings> + <CollectionProperty Name="RecognizedWords"> + <Value>decomb</Value> + <Value>deinterlace</Value> + <Value>denoise</Value> + <Value>detelecine</Value> + <Value>framerate</Value> + <Value>hb</Value> + <Value>interop</Value> + <Value>ipod</Value> + <Value>mixdown</Value> + <Value>qsv</Value> + <Value>samplerate</Value> + <Value>vrate</Value> + </CollectionProperty> + </GlobalSettings> <Parsers> <Parser ParserId="StyleCop.CSharp.CsParser"> <ParserSettings> diff --git a/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs b/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs index 794d9c9c3..9024d503e 100644 --- a/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs +++ b/win/CS/HandBrakeWPF/Startup/AppBootstrapper.cs @@ -14,9 +14,6 @@ namespace HandBrakeWPF.Startup using Caliburn.Micro;
- using HandBrake.Interop.Interop.Providers;
- using HandBrake.Interop.Interop.Providers.Interfaces;
-
using HandBrakeWPF.Services;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Logging;
@@ -30,8 +27,8 @@ namespace HandBrakeWPF.Startup using HandBrakeWPF.ViewModels;
using HandBrakeWPF.ViewModels.Interfaces;
- using IEncode = HandBrakeWPF.Services.Encode.Interfaces.IEncode;
- using LibEncode = HandBrakeWPF.Services.Encode.LibEncode;
+ using IEncode = Services.Encode.Interfaces.IEncode;
+ using LibEncode = Services.Encode.LibEncode;
/// <summary>
/// The Castle Bootstrapper
@@ -85,7 +82,6 @@ namespace HandBrakeWPF.Startup this.container.Singleton<ICountdownAlertViewModel, CountdownAlertViewModel>();
this.container.Singleton<IStaticPreviewViewModel, StaticPreviewViewModel>();
this.container.Singleton<ISystemService, SystemService>();
- this.container.Singleton<IHbFunctionsProvider, HbFunctionsProvider>();
this.container.Singleton<ILogInstanceManager, LogInstanceManager>();
this.container.Singleton<IPortService, PortService>();
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index 761354f34..6b1afaec8 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -20,7 +20,6 @@ namespace HandBrakeWPF.ViewModels using System.Windows.Media.Imaging;
using HandBrake.Interop.Interop.Model.Encoding;
- using HandBrake.Interop.Interop.Providers.Interfaces;
using HandBrakeWPF.Factories;
using HandBrakeWPF.Properties;
@@ -58,7 +57,7 @@ namespace HandBrakeWPF.ViewModels private bool useSystemDefaultPlayer;
private bool previewRotateFlip;
- public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService, IErrorService errorService, IHbFunctionsProvider hbFunctionsProvider, ILog logService, ILogInstanceManager logInstanceManager, IPortService portService)
+ public StaticPreviewViewModel(IScan scanService, IUserSettingService userSettingService, IErrorService errorService, ILog logService, ILogInstanceManager logInstanceManager, IPortService portService)
{
this.scanService = scanService;
this.selectedPreviewImage = 1;
@@ -68,7 +67,7 @@ namespace HandBrakeWPF.ViewModels // Live Preview
this.userSettingService = userSettingService;
this.errorService = errorService;
- this.encodeService = new LibEncode(hbFunctionsProvider, userSettingService, logInstanceManager, 0, portService); // Preview needs a separate instance rather than the shared singleton. This could maybe do with being refactored at some point
+ this.encodeService = new LibEncode(userSettingService, logInstanceManager, 0, portService); // Preview needs a separate instance rather than the shared singleton. This could maybe do with being refactored at some point
this.Title = "Preview";
this.Percentage = "0.00%";
|