summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/Interop
diff options
context:
space:
mode:
authorsr55 <[email protected]>2018-06-05 21:52:23 +0100
committersr55 <[email protected]>2018-06-05 21:52:23 +0100
commit5c5b4d7773126d3f4852deb01856c905d2398b5e (patch)
tree54eaf4d35c86d71372e16b5f4536a8f3ca851f09 /win/CS/HandBrake.Interop/Interop
parent5445592f20e5e645dce0df077afe7ecc2617b95f (diff)
WinGui: Rename HandBrake.ApplicationServices back to HandBrake.Interop. It's moving back to being more of an libhb interop/abstraction library only.
Diffstat (limited to 'win/CS/HandBrake.Interop/Interop')
-rw-r--r--win/CS/HandBrake.Interop/Interop/EventArgs/EncodeCompletedEventArgs.cs35
-rw-r--r--win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs120
-rw-r--r--win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs35
-rw-r--r--win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs71
-rw-r--r--win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs94
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs666
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs104
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs552
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs171
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs52
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs92
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs191
-rw-r--r--win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs346
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs17
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs462
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs69
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs21
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs28
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs24
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs46
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs101
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs41
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs25
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs22
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs28
-rw-r--r--win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs283
-rw-r--r--win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs127
-rw-r--r--win/CS/HandBrake.Interop/Interop/Helpers/Utilities.cs49
-rw-r--r--win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs151
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs69
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs34
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs77
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs22
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs49
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs24
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs64
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs62
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs27
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs27
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs38
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/SRT.cs32
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs37
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs37
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs52
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs90
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs27
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs72
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs416
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Presets/PresetCategory.cs44
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs67
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs24
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs21
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/Color.cs32
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs37
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs27
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs62
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/SourceChapter.cs27
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs18
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/SourceSubtitleTrack.cs44
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/SourceTitle.cs112
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Shared/Geometry.cs32
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs27
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/State/JsonState.cs37
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs42
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs59
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs22
-rw-r--r--win/CS/HandBrake.Interop/Interop/Json/State/Working.cs73
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs42
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Cropping.cs99
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs32
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs34
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs29
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/Decomb.cs34
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/Deinterlace.cs31
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs28
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs28
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs26
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs131
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs60
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs51
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs42
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs42
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs109
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs22
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs27
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs28
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs21
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs71
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Language.cs67
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs81
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs26
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/RangeLimits.cs60
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/Size.cs60
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs42
-rw-r--r--win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs60
102 files changed, 7672 insertions, 0 deletions
diff --git a/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeCompletedEventArgs.cs b/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeCompletedEventArgs.cs
new file mode 100644
index 000000000..ea54e1d1c
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeCompletedEventArgs.cs
@@ -0,0 +1,35 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="EncodeCompletedEventArgs.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>
+// Defines the EncodeCompletedEventArgs type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>
+ /// Encode Completed Event Args
+ /// </summary>
+ public class EncodeCompletedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EncodeCompletedEventArgs"/> class.
+ /// </summary>
+ /// <param name="error">
+ /// The error.
+ /// </param>
+ public EncodeCompletedEventArgs(bool error)
+ {
+ this.Error = error;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether an error occurred during the encode.
+ /// </summary>
+ public bool Error { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs b/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs
new file mode 100644
index 000000000..303995194
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/EventArgs/EncodeProgressEventArgs.cs
@@ -0,0 +1,120 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="EncodeProgressEventArgs.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>
+// Defines the EncodeProgressEventArgs type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>s
+ /// Encode Progress Event Args
+ /// </summary>
+ public class EncodeProgressEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EncodeProgressEventArgs"/> class.
+ /// </summary>
+ /// <param name="fractionComplete">
+ /// The fraction complete.
+ /// </param>
+ /// <param name="currentFrameRate">
+ /// The current frame rate.
+ /// </param>
+ /// <param name="averageFrameRate">
+ /// The average frame rate.
+ /// </param>
+ /// <param name="estimatedTimeLeft">
+ /// The estimated time left.
+ /// </param>
+ /// <param name="passId">
+ /// The pass id.
+ /// </param>
+ /// <param name="pass">
+ /// The pass.
+ /// </param>
+ /// <param name="passCount">
+ /// The pass count.
+ /// </param>
+ /// <param name="stateCode">
+ /// The code for the state the encode process is in.
+ /// </param>
+ public EncodeProgressEventArgs(double fractionComplete, double currentFrameRate, double averageFrameRate, TimeSpan estimatedTimeLeft, int passId, int pass, int passCount, string stateCode)
+ {
+ this.FractionComplete = fractionComplete;
+ this.CurrentFrameRate = currentFrameRate;
+ this.AverageFrameRate = averageFrameRate;
+ this.EstimatedTimeLeft = estimatedTimeLeft;
+ this.PassId = passId;
+ this.Pass = pass;
+ this.PassCount = passCount;
+ this.StateCode = stateCode;
+ }
+
+ /// <summary>
+ /// Gets the % Complete.
+ /// </summary>
+ public double FractionComplete { get; private set; }
+
+ /// <summary>
+ /// Gets the Current FrameRate.
+ /// </summary>
+ public double CurrentFrameRate { get; private set; }
+
+ /// <summary>
+ /// Gets the Average FrameRate.
+ /// </summary>
+ public double AverageFrameRate { get; private set; }
+
+ /// <summary>
+ /// Gets the Estimated Time Left.
+ /// </summary>
+ public TimeSpan EstimatedTimeLeft { get; private set; }
+
+ /// <summary>
+ /// Gets the pass ID.
+ /// </summary>
+ /// <remarks>
+ /// -1: Subtitle scan
+ /// 0: Encode
+ /// 1: Encode first pass
+ /// 2: Encode second pass
+ /// </remarks>
+ public int PassId { get; private set; }
+
+ /// <summary>
+ /// Gets the current encoding pass. (1-based)
+ /// </summary>
+ public int Pass { get; private set; }
+
+ /// <summary>
+ /// Gets the pass count.
+ /// </summary>
+ public int PassCount { get; private set; }
+
+ /// <summary>
+ /// Gets the state code of the encode process.
+ /// </summary>
+ public string StateCode { get; }
+
+ /// <summary>
+ /// Gets a value indicating that we are doing a subtitle scan pass.
+ /// </summary>
+ public bool IsSubtitleScan
+ {
+ get
+ {
+ if (this.PassId == -1)
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs b/win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs
new file mode 100644
index 000000000..2359fff5d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/EventArgs/MessageLoggedEventArgs.cs
@@ -0,0 +1,35 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="MessageLoggedEventArgs.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>
+// Defines the MessageLoggedEventArgs type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>
+ /// The Message Logged Event Args
+ /// </summary>
+ public class MessageLoggedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MessageLoggedEventArgs"/> class.
+ /// </summary>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ public MessageLoggedEventArgs(string message)
+ {
+ this.Message = message;
+ }
+
+ /// <summary>
+ /// Gets the Message.
+ /// </summary>
+ public string Message { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs b/win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs
new file mode 100644
index 000000000..8e87552a2
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/EventArgs/ScanProgressEventArgs.cs
@@ -0,0 +1,71 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ScanProgressEventArgs.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>
+// Defines the ScanProgressEventArgs type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>
+ /// The Scan Progress Event Args
+ /// </summary>
+ public class ScanProgressEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ScanProgressEventArgs"/> class.
+ /// </summary>
+ /// <param name="progress">
+ /// The progress.
+ /// </param>
+ /// <param name="currentPreview">
+ /// The current preview.
+ /// </param>
+ /// <param name="previews">
+ /// The previews.
+ /// </param>
+ /// <param name="currentTitle">
+ /// The current title.
+ /// </param>
+ /// <param name="titles">
+ /// The titles.
+ /// </param>
+ public ScanProgressEventArgs(double progress, int currentPreview, int previews, int currentTitle, int titles)
+ {
+ this.Progress = progress;
+ this.CurrentPreview = currentPreview;
+ this.Previews = previews;
+ this.CurrentTitle = currentTitle;
+ this.Titles = titles;
+ }
+
+ /// <summary>
+ /// Gets the total progress fraction for the scan.
+ /// </summary>
+ public double Progress { get; private set; }
+
+ /// <summary>
+ /// Gets the current preview being processed on the scan.
+ /// </summary>
+ public int CurrentPreview { get; private set; }
+
+ /// <summary>
+ /// Gets the total number of previews to process.
+ /// </summary>
+ public int Previews { get; private set; }
+
+ /// <summary>
+ /// Gets the current title being processed on the scan.
+ /// </summary>
+ public int CurrentTitle { get; private set; }
+
+ /// <summary>
+ /// Gets the total number of titles to process.
+ /// </summary>
+ public int Titles { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs b/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs
new file mode 100644
index 000000000..a1d0207f3
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Factories/AnamorphicFactory.cs
@@ -0,0 +1,94 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AnamorphicFactory.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>
+// The Anamorphic factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Factories
+{
+ using System.Collections.Generic;
+
+ using HandBrake.Interop.Interop.Json.Anamorphic;
+ using HandBrake.Interop.Interop.Json.Shared;
+ using HandBrake.Interop.Interop.Model;
+ using HandBrake.Interop.Interop.Model.Encoding;
+ using HandBrake.Interop.Interop.Model.Preview;
+
+ /// <summary>
+ /// The anamorphic factory.
+ /// </summary>
+ public class AnamorphicFactory
+ {
+ /// <summary>
+ /// The keep setting.
+ /// </summary>
+ public enum KeepSetting
+ {
+ HB_KEEP_WIDTH = 0x01,
+ HB_KEEP_HEIGHT = 0x02,
+ HB_KEEP_DISPLAY_ASPECT = 0x04
+ }
+
+ /// <summary>
+ /// Finds output geometry for the given preview settings and title.
+ /// </summary>
+ /// <param name="settings">
+ /// The preview settings.
+ /// </param>
+ /// <param name="title">
+ /// Information on the title to consider.
+ /// </param>
+ /// <returns>
+ /// Geometry Information
+ /// </returns>
+ public static Geometry CreateGeometry(PreviewSettings settings, SourceVideoInfo title)
+ {
+ int settingMode = settings.KeepDisplayAspect ? 0x04 : 0;
+
+ // Sanitize the Geometry First.
+ AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry
+ {
+ SourceGeometry = new Geometry
+ {
+ Width = title.Resolution.Width,
+ Height = title.Resolution.Height,
+ PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height }
+ },
+ DestSettings = new DestSettings
+ {
+ AnamorphicMode = (int)settings.Anamorphic,
+ Geometry =
+ {
+ Width = settings.Width,
+ Height = settings.Height,
+ PAR = new PAR
+ {
+ Num = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : settings.PixelAspectX,
+ Den = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : settings.PixelAspectY,
+ }
+ },
+ Keep = settingMode,
+ Crop = new List<int> { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right },
+ Modulus = settings.Modulus ?? 16,
+ MaxWidth = settings.MaxWidth,
+ MaxHeight = settings.MaxHeight,
+ ItuPAR = false
+ }
+ };
+
+ if (settings.Anamorphic == Anamorphic.Custom)
+ {
+ anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = settings.PixelAspectX, Den = settings.PixelAspectY };
+ }
+ else
+ {
+ anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height };
+ }
+
+ return HandBrakeUtils.GetAnamorphicSize(anamorphicGeometry);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs
new file mode 100644
index 000000000..db5744315
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeEncoderHelpers.cs
@@ -0,0 +1,666 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeEncoderHelpers.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>
+// The encoders.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System.Collections.Generic;
+ using System.Linq;
+
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Helpers;
+ using HandBrake.Interop.Interop.Model;
+ using HandBrake.Interop.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The encoders.
+ /// </summary>
+ public static class HandBrakeEncoderHelpers
+ {
+ /// <summary>
+ /// The audio encoders.
+ /// </summary>
+ private static List<HBAudioEncoder> audioEncoders;
+
+ /// <summary>
+ /// The video encoders.
+ /// </summary>
+ private static List<HBVideoEncoder> videoEncoders;
+
+ /// <summary>
+ /// Video framerates in pts.
+ /// </summary>
+ private static List<HBRate> videoFramerates;
+
+ /// <summary>
+ /// List of HandBrake mixdowns.
+ /// </summary>
+ private static List<HBMixdown> mixdowns;
+
+ /// <summary>
+ /// List of HandBrake containers.
+ /// </summary>
+ private static List<HBContainer> containers;
+
+ /// <summary>
+ /// The audio bitrates.
+ /// </summary>
+ private static List<int> audioBitrates;
+
+ /// <summary>
+ /// Audio sample rates in Hz.
+ /// </summary>
+ private static List<HBRate> audioSampleRates;
+
+ /// <summary>
+ /// Initializes static members of the HandBrakeEncoderHelpers class.
+ /// </summary>
+ static HandBrakeEncoderHelpers()
+ {
+ HandBrakeUtils.EnsureGlobalInit();
+ }
+
+ /// <summary>
+ /// Gets a list of supported audio encoders.
+ /// </summary>
+ public static List<HBAudioEncoder> AudioEncoders
+ {
+ get
+ {
+ if (audioEncoders == null)
+ {
+ audioEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBAudioEncoder>(HBFunctions.hb_audio_encoder_get_next, HandBrakeUnitConversionHelpers.NativeToAudioEncoder);
+ }
+
+ return audioEncoders;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of supported video encoders.
+ /// </summary>
+ public static List<HBVideoEncoder> VideoEncoders
+ {
+ get
+ {
+ if (videoEncoders == null)
+ {
+ videoEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBVideoEncoder>(HBFunctions.hb_video_encoder_get_next, HandBrakeUnitConversionHelpers.NativeToVideoEncoder);
+ }
+
+ return videoEncoders;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of supported video framerates (in pts).
+ /// </summary>
+ public static List<HBRate> VideoFramerates
+ {
+ get
+ {
+ if (videoFramerates == null)
+ {
+ videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate);
+ }
+
+ return videoFramerates;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of supported mixdowns.
+ /// </summary>
+ public static List<HBMixdown> Mixdowns
+ {
+ get
+ {
+ if (mixdowns == null)
+ {
+ mixdowns = InteropUtilities.ToListFromIterator<hb_mixdown_s, HBMixdown>(HBFunctions.hb_mixdown_get_next, HandBrakeUnitConversionHelpers.NativeToMixdown);
+ }
+
+ return mixdowns;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of supported audio bitrates.
+ /// </summary>
+ public static List<int> AudioBitrates
+ {
+ get
+ {
+ if (audioBitrates == null)
+ {
+ audioBitrates = InteropUtilities.ToListFromIterator<hb_rate_s, int>(HBFunctions.hb_audio_bitrate_get_next, b => b.rate);
+ }
+
+ return audioBitrates;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of supported audio sample rates (in Hz).
+ /// </summary>
+ public static List<HBRate> AudioSampleRates
+ {
+ get
+ {
+ if (audioSampleRates == null)
+ {
+ audioSampleRates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_audio_samplerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate);
+ }
+
+ return audioSampleRates;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of supported containers.
+ /// </summary>
+ public static List<HBContainer> Containers
+ {
+ get
+ {
+ if (containers == null)
+ {
+ containers = InteropUtilities.ToListFromIterator<hb_container_s, HBContainer>(HBFunctions.hb_container_get_next, HandBrakeUnitConversionHelpers.NativeToContainer);
+ }
+
+ return containers;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether SRT subtitles can be burnt in.
+ /// </summary>
+ public static bool CanBurnSrt
+ {
+ get
+ {
+ return HBFunctions.hb_subtitle_can_burn((int)hb_subtitle_s_subsource.SRTSUB) > 0;
+ }
+ }
+
+ /// <summary>
+ /// Gets the audio encoder with the specified short name.
+ /// </summary>
+ /// <param name="shortName">
+ /// The name of the audio encoder.
+ /// </param>
+ /// <returns>
+ /// The requested audio encoder.
+ /// </returns>
+ public static HBAudioEncoder GetAudioEncoder(string shortName)
+ {
+ return AudioEncoders.SingleOrDefault(e => e.ShortName == shortName);
+ }
+
+ /// <summary>
+ /// Gets the audio encoder with the specified codec ID.
+ /// </summary>
+ /// <param name="codecId">
+ /// The ID of the audio encoder.
+ /// </param>
+ /// <returns>
+ /// The requested audio encoder.
+ /// </returns>
+ public static HBAudioEncoder GetAudioEncoder(int codecId)
+ {
+ return AudioEncoders.SingleOrDefault(e => e.Id == codecId);
+ }
+
+ /// <summary>
+ /// Gets the video encoder with the specified short name.
+ /// </summary>
+ /// <param name="shortName">
+ /// The name of the video encoder.
+ /// </param>
+ /// <returns>
+ /// The requested video encoder.
+ /// </returns>
+ public static HBVideoEncoder GetVideoEncoder(string shortName)
+ {
+ return VideoEncoders.SingleOrDefault(e => e.ShortName == shortName);
+ }
+
+ /// <summary>
+ /// Gets the mixdown with the specified short name.
+ /// </summary>
+ /// <param name="shortName">
+ /// The name of the mixdown.
+ /// </param>
+ /// <returns>
+ /// The requested mixdown.
+ /// </returns>
+ public static HBMixdown GetMixdown(string shortName)
+ {
+ return Mixdowns.SingleOrDefault(m => m.ShortName == shortName);
+ }
+
+ /// <summary>
+ /// Gets the mixdown with the specified ID.
+ /// </summary>
+ /// <param name="id">The mixdown ID.</param>
+ /// <returns>The requested mixdown.</returns>
+ public static HBMixdown GetMixdown(int id)
+ {
+ return Mixdowns.SingleOrDefault(m => m.Id == id);
+ }
+
+ /// <summary>
+ /// Gets the container with the specified short name.
+ /// </summary>
+ /// <param name="shortName">
+ /// The name of the container.
+ /// </param>
+ /// <returns>
+ /// The requested container.
+ /// </returns>
+ public static HBContainer GetContainer(string shortName)
+ {
+ return Containers.SingleOrDefault(c => c.ShortName == shortName);
+ }
+
+ /// <summary>
+ /// Returns true if the subtitle source type can be set to forced only.
+ /// </summary>
+ /// <param name="source">
+ /// The subtitle source type (SSA, VobSub, etc)
+ /// </param>
+ /// <returns>
+ /// True if the subtitle source type can be set to forced only.
+ /// </returns>
+ public static bool SubtitleCanSetForcedOnly(int source)
+ {
+ return HBFunctions.hb_subtitle_can_force(source) > 0;
+ }
+
+ /// <summary>
+ /// Returns true if the subtitle source type can be burned in.
+ /// </summary>
+ /// <param name="source">
+ /// The subtitle source type (SSA, VobSub, etc)
+ /// </param>
+ /// <returns>
+ /// True if the subtitle source type can be burned in.
+ /// </returns>
+ public static bool SubtitleCanBurn(int source)
+ {
+ return HBFunctions.hb_subtitle_can_burn(source) > 0;
+ }
+
+ /// <summary>
+ /// Returns true if the subtitle type can be passed through using the given muxer.
+ /// </summary>
+ /// <param name="subtitleSourceType">
+ /// The subtitle source type (SSA, VobSub, etc)
+ /// </param>
+ /// <param name="muxer">
+ /// The ID of the muxer.
+ /// </param>
+ /// <returns>
+ /// True if the subtitle type can be passed through with the given muxer.
+ /// </returns>
+ public static bool SubtitleCanPassthrough(int subtitleSourceType, int muxer)
+ {
+ return HBFunctions.hb_subtitle_can_pass(subtitleSourceType, muxer) > 0;
+ }
+
+ /// <summary>
+ /// Gets the subtitle source type's name.
+ /// </summary>
+ /// <param name="source">
+ /// The subtitle source type (SSA, VobSub, etc).
+ /// </param>
+ /// <returns>
+ /// The name of the subtitle source.
+ /// </returns>
+ public static string GetSubtitleSourceName(int source)
+ {
+ switch ((hb_subtitle_s_subsource)source)
+ {
+ case hb_subtitle_s_subsource.CC608SUB:
+ return "CC608";
+ case hb_subtitle_s_subsource.CC708SUB:
+ return "CC708";
+ case hb_subtitle_s_subsource.SRTSUB:
+ return "SRT";
+ case hb_subtitle_s_subsource.SSASUB:
+ return "SSA";
+ case hb_subtitle_s_subsource.TX3GSUB:
+ return "TX3G";
+ case hb_subtitle_s_subsource.UTF8SUB:
+ return "UTF8";
+ case hb_subtitle_s_subsource.VOBSUB:
+ return "VobSub";
+ case hb_subtitle_s_subsource.PGSSUB:
+ return "PGS";
+ default:
+ return string.Empty;
+ }
+ }
+
+ /// <summary>
+ /// Determines if the given encoder is compatible with the given track.
+ /// </summary>
+ /// <param name="codecId">
+ /// The codec Id.
+ /// </param>
+ /// <param name="encoder">
+ /// The encoder to examine.
+ /// </param>
+ /// <returns>
+ /// True if the given encoder is comatible with the given audio track.
+ /// </returns>
+ /// <remarks>
+ /// Only works with passthrough encoders.
+ /// </remarks>
+ public static bool AudioEncoderIsCompatible(int codecId, HBAudioEncoder encoder)
+ {
+ return (codecId & encoder.Id) > 0;
+ }
+
+ /// <summary>
+ /// Determines if the given mixdown supports the given channel layout.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The mixdown to evaluate.
+ /// </param>
+ /// <param name="layout">
+ /// The channel layout to evaluate.
+ /// </param>
+ /// <returns>
+ /// True if the mixdown supports the given channel layout.
+ /// </returns>
+ public static bool MixdownHasRemixSupport(HBMixdown mixdown, ulong layout)
+ {
+ return HBFunctions.hb_mixdown_has_remix_support(mixdown.Id, layout) > 0;
+ }
+
+ /// <summary>
+ /// Determines if the given encoder supports the given mixdown.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The mixdown to evaluate.
+ /// </param>
+ /// <param name="encoder">
+ /// The encoder to evaluate.
+ /// </param>
+ /// <returns>
+ /// True if the encoder supports the mixdown.
+ /// </returns>
+ public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder)
+ {
+ return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0;
+ }
+
+ /// <summary>
+ /// Determines if a mixdown is available for a given track and encoder.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The mixdown to evaluate.
+ /// </param>
+ /// <param name="encoder">
+ /// The encoder to evaluate.
+ /// </param>
+ /// <param name="channelLayout">channel layout of the source track</param>
+ /// <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;
+ }
+
+ /// <summary>
+ /// Determines if DRC can be applied to the given track with the given encoder.
+ /// </summary>
+ /// <param name="trackNumber">
+ /// The track Number.
+ /// </param>
+ /// <param name="encoder">
+ /// The encoder to use for DRC.
+ /// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <returns>
+ /// True if DRC can be applied to the track with the given encoder.
+ /// </returns>
+ public static bool CanApplyDrc(int trackNumber, HBAudioEncoder encoder, int title)
+ {
+ return HBFunctions.hb_audio_can_apply_drc2(HandBrakeInstanceManager.LastScanHandle, title, trackNumber, encoder.Id) > 0;
+ }
+
+ /// <summary>
+ /// Determines if the given input audio codec can be passed through.
+ /// </summary>
+ /// <param name="codecId">
+ /// The input codec to consider.
+ /// </param>
+ /// <returns>
+ /// True if the codec can be passed through.
+ /// </returns>
+ public static bool CanPassthroughAudio(int codecId)
+ {
+ return (codecId & NativeConstants.HB_ACODEC_PASS_MASK) > 0;
+ }
+
+ /// <summary>
+ /// Sanitizes a mixdown given the output codec and input channel layout.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The desired mixdown.
+ /// </param>
+ /// <param name="encoder">
+ /// The output encoder to be used.
+ /// </param>
+ /// <param name="layout">
+ /// The input channel layout.
+ /// </param>
+ /// <returns>
+ /// A sanitized mixdown value.
+ /// </returns>
+ public static HBMixdown SanitizeMixdown(HBMixdown mixdown, HBAudioEncoder encoder, ulong layout)
+ {
+ if (mixdown == null)
+ {
+ return null;
+ }
+
+ int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id);
+ if (sanitizedMixdown != -1)
+ {
+ return Mixdowns.Single(m => m.Id == sanitizedMixdown);
+ }
+ return Mixdowns.FirstOrDefault(); // "none"
+ }
+
+ /// <summary>
+ /// Gets the default mixdown for the given audio encoder and channel layout.
+ /// </summary>
+ /// <param name="encoder">
+ /// The output codec to be used.
+ /// </param>
+ /// <param name="layout">
+ /// The input channel layout.
+ /// </param>
+ /// <returns>
+ /// The default mixdown for the given codec and channel layout.
+ /// </returns>
+ public static HBMixdown GetDefaultMixdown(HBAudioEncoder encoder, ulong layout)
+ {
+ int defaultMixdown = HBFunctions.hb_mixdown_get_default((uint)encoder.Id, layout);
+ return Mixdowns.Single(m => m.Id == defaultMixdown);
+ }
+
+ /// <summary>
+ /// Sanitizes the given sample rate for the given encoder.
+ /// </summary>
+ /// <param name="encoder">The encoder.</param>
+ /// <param name="sampleRate">The sample rate to sanitize.</param>
+ /// <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);
+ }
+
+ /// <summary>
+ /// Gets the bitrate limits for the given audio codec, sample rate and mixdown.
+ /// </summary>
+ /// <param name="encoder">
+ /// The audio encoder used.
+ /// </param>
+ /// <param name="sampleRate">
+ /// The sample rate used (Hz).
+ /// </param>
+ /// <param name="mixdown">
+ /// The mixdown used.
+ /// </param>
+ /// <returns>
+ /// Limits on the audio bitrate for the given settings.
+ /// </returns>
+ public static BitrateLimits GetBitrateLimits(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown)
+ {
+ int low = 0;
+ int high = 0;
+
+ HBFunctions.hb_audio_bitrate_get_limits((uint)encoder.Id, sampleRate, mixdown.Id, ref low, ref high);
+
+ return new BitrateLimits(low, high);
+ }
+
+ /// <summary>
+ /// Gets the video quality limits for the given video codec.
+ /// </summary>
+ /// <param name="encoder">
+ /// The video encoder to check.
+ /// </param>
+ /// <returns>
+ /// Limits on the video quality for the encoder.
+ /// </returns>
+ public static VideoQualityLimits GetVideoQualityLimits(HBVideoEncoder encoder)
+ {
+ float low = 0;
+ float high = 0;
+ float granularity = 0;
+ int direction = 0;
+
+ 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);
+ }
+
+ /// <summary>
+ /// Sanitizes an audio bitrate given the output codec, sample rate and mixdown.
+ /// </summary>
+ /// <param name="audioBitrate">
+ /// The desired audio bitrate.
+ /// </param>
+ /// <param name="encoder">
+ /// The output encoder to be used.
+ /// </param>
+ /// <param name="sampleRate">
+ /// The output sample rate to be used.
+ /// </param>
+ /// <param name="mixdown">
+ /// The mixdown to be used.
+ /// </param>
+ /// <returns>
+ /// A sanitized audio bitrate.
+ /// </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);
+ }
+
+ /// <summary>
+ /// Gets the default audio bitrate for the given parameters.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder to use.
+ /// </param>
+ /// <param name="sampleRate">
+ /// The sample rate to use.
+ /// </param>
+ /// <param name="mixdown">
+ /// The mixdown to use.
+ /// </param>
+ /// <returns>
+ /// The default bitrate for these parameters.
+ /// </returns>
+ public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown)
+ {
+ return HBFunctions.hb_audio_bitrate_get_default((uint)encoder.Id, sampleRate, mixdown.Id);
+ }
+
+ /// <summary>
+ /// Gets limits on audio quality for a given encoder.
+ /// </summary>
+ /// <param name="encoderId">
+ /// The audio encoder ID.
+ /// </param>
+ /// <returns>
+ /// Limits on the audio quality for the given encoder.
+ /// </returns>
+ public static RangeLimits GetAudioQualityLimits(int encoderId)
+ {
+ 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);
+
+ return new RangeLimits(direction == 0, granularity, high, low);
+ }
+
+ /// <summary>
+ /// Gets limits on audio compression for a given encoder.
+ /// </summary>
+ /// <param name="encoderId">
+ /// The audio encoder ID.
+ /// </param>
+ /// <returns>
+ /// Limits on the audio compression for the given encoder.
+ /// </returns>
+ public static RangeLimits GetAudioCompressionLimits(int encoderId)
+ {
+ 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);
+
+ return new RangeLimits(direction == 0, granularity, high, low);
+ }
+
+ /// <summary>
+ /// The get default quality.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder.
+ /// </param>
+ /// <returns>
+ /// The <see cref="double"/>.
+ /// </returns>
+ public static double GetDefaultQuality(HBAudioEncoder encoder)
+ {
+ return HBFunctions.hb_audio_quality_get_default((uint)encoder.Id);
+ }
+
+ /// <summary>
+ /// The get default audio compression.
+ /// </summary>
+ /// <param name="encoder">
+ /// The encoder.
+ /// </param>
+ /// <returns>
+ /// The <see cref="double"/>.
+ /// </returns>
+ public static double GetDefaultAudioCompression(HBAudioEncoder encoder)
+ {
+ return HBFunctions.hb_audio_compression_get_default((uint)encoder.Id);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs
new file mode 100644
index 000000000..e8d7f5f31
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeFilterHelpers.cs
@@ -0,0 +1,104 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeFilterHelpers.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>
+// Defines the HandBrakeFilterHelpers type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Helpers;
+ using HandBrake.Interop.Interop.Json.Filters;
+ using HandBrake.Interop.Interop.Model.Encoding;
+
+ using Newtonsoft.Json;
+
+ /// <summary>
+ /// The hand brake filter helpers.
+ /// </summary>
+ public class HandBrakeFilterHelpers
+ {
+ /// <summary>
+ /// The get filter presets.
+ /// </summary>
+ /// <param name="filter">
+ /// The filter.
+ /// </param>
+ /// <returns>
+ /// The <see cref="List{T}"/>.
+ /// </returns>
+ public static List<HBPresetTune> GetFilterPresets(int filter)
+ {
+ IntPtr ptr = HBFunctions.hb_filter_get_presets_json(filter);
+ string result = Marshal.PtrToStringAnsi(ptr);
+ List<PresetTune> list = JsonConvert.DeserializeObject<List<PresetTune>>(result);
+
+ return list.Select(item => new HBPresetTune(item.Name, item.Short_Name)).ToList();
+ }
+
+ /// <summary>
+ /// The get filter tunes.
+ /// </summary>
+ /// <param name="filter">
+ /// The filter.
+ /// </param>
+ /// <returns>
+ /// The <see cref="List{T}"/>.
+ /// </returns>
+ public static List<HBPresetTune> GetFilterTunes(int filter)
+ {
+ IntPtr ptr = HBFunctions.hb_filter_get_tunes_json(filter);
+ string result = Marshal.PtrToStringAnsi(ptr);
+ List<PresetTune> list = JsonConvert.DeserializeObject<List<PresetTune>>(result);
+
+ return list.Select(item => new HBPresetTune(item.Name, item.Short_Name)).ToList();
+ }
+
+ /// <summary>
+ /// Gets a list of keys for custom settings for the filter.
+ /// </summary>
+ /// <param name="filter">The filter to look up.</param>
+ /// <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);
+ return InteropUtilities.ToStringListFromArrayPtr(ptr);
+ }
+
+ /// <summary>
+ /// Gets the default settings for the filter.
+ /// </summary>
+ /// <param name="filter">The filter to look up.</param>
+ /// <returns>The default settings for that filter.</returns>
+ public static IDictionary<string, string> GetDefaultCustomSettings(int filter)
+ {
+ string presetName;
+
+ List<HBPresetTune> presets = GetFilterPresets(filter);
+ if (presets.Any(p => p.ShortName == "default"))
+ {
+ presetName = "default";
+ }
+ else if (presets.Any(p => p.ShortName == "medium"))
+ {
+ presetName = "medium";
+ }
+ else
+ {
+ return new Dictionary<string, string>();
+ }
+
+ IntPtr ptr = HBFunctions.hb_generate_filter_settings_json(filter, presetName, null, null);
+ string result = Marshal.PtrToStringAnsi(ptr);
+ return JsonConvert.DeserializeObject<Dictionary<string, string>>(result);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs
new file mode 100644
index 000000000..9f5420d3f
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeInstance.cs
@@ -0,0 +1,552 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeInstance.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>
+// A wrapper for a HandBrake instance.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Linq;
+ using System.Runtime.ExceptionServices;
+ using System.Runtime.InteropServices;
+ using System.Timers;
+
+ using HandBrake.Interop.Interop.EventArgs;
+ using HandBrake.Interop.Interop.Factories;
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Helpers;
+ using HandBrake.Interop.Interop.Interfaces;
+ using HandBrake.Interop.Interop.Json.Encode;
+ using HandBrake.Interop.Interop.Json.Scan;
+ using HandBrake.Interop.Interop.Json.State;
+ using HandBrake.Interop.Interop.Model.Encoding;
+ using HandBrake.Interop.Interop.Model.Preview;
+
+ using Newtonsoft.Json;
+
+ /// <summary>
+ /// A wrapper for a HandBrake instance.
+ /// </summary>
+ public class HandBrakeInstance : IHandBrakeInstance, IDisposable
+ {
+ /// <summary>
+ /// The number of MS between status polls when scanning.
+ /// </summary>
+ private const double ScanPollIntervalMs = 250;
+
+ /// <summary>
+ /// The number of MS between status polls when encoding.
+ /// </summary>
+ private const double EncodePollIntervalMs = 250;
+
+ /// <summary>
+ /// The native handle to the HandBrake instance.
+ /// </summary>
+ private IntPtr hbHandle;
+
+ /// <summary>
+ /// The number of previews created during scan.
+ /// </summary>
+ private int previewCount;
+
+ /// <summary>
+ /// The timer to poll for scan status.
+ /// </summary>
+ private Timer scanPollTimer;
+
+ /// <summary>
+ /// The timer to poll for encode status.
+ /// </summary>
+ private Timer encodePollTimer;
+
+ /// <summary>
+ /// The list of titles on this instance.
+ /// </summary>
+ private JsonScanObject titles;
+
+ /// <summary>
+ /// The raw JSON for the titles list.
+ /// </summary>
+ private string titlesJson;
+
+ /// <summary>
+ /// The index of the default title.
+ /// </summary>
+ private int featureTitle;
+
+ /// <summary>
+ /// A value indicating whether this object has been disposed or not.
+ /// </summary>
+ private bool disposed;
+
+ /// <summary>
+ /// Finalizes an instance of the HandBrakeInstance class.
+ /// </summary>
+ ~HandBrakeInstance()
+ {
+ this.Dispose(false);
+ }
+
+ /// <summary>
+ /// Fires for progress updates when scanning.
+ /// </summary>
+ public event EventHandler<ScanProgressEventArgs> ScanProgress;
+
+ /// <summary>
+ /// Fires when a scan has completed.
+ /// </summary>
+ public event EventHandler<System.EventArgs> ScanCompleted;
+
+ /// <summary>
+ /// Fires for progress updates when encoding.
+ /// </summary>
+ public event EventHandler<EncodeProgressEventArgs> EncodeProgress;
+
+ /// <summary>
+ /// Fires when an encode has completed.
+ /// </summary>
+ public event EventHandler<EncodeCompletedEventArgs> EncodeCompleted;
+
+ /// <summary>
+ /// Gets the handle.
+ /// </summary>
+ internal IntPtr Handle
+ {
+ get
+ {
+ return this.hbHandle;
+ }
+ }
+
+ /// <summary>
+ /// Gets the number of previews created during scan.
+ /// </summary>
+ public int PreviewCount
+ {
+ get
+ {
+ return this.previewCount;
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of titles on this instance.
+ /// </summary>
+ public JsonScanObject Titles
+ {
+ get
+ {
+ return this.titles;
+ }
+ }
+
+ /// <summary>
+ /// Gets the raw JSON for the list of titles on this instance.
+ /// </summary>
+ public string TitlesJson
+ {
+ get
+ {
+ return this.titlesJson;
+ }
+ }
+
+ /// <summary>
+ /// Gets the index of the default title.
+ /// </summary>
+ public int FeatureTitle
+ {
+ get
+ {
+ return this.featureTitle;
+ }
+ }
+
+ /// <summary>
+ /// Gets the HandBrake version string.
+ /// </summary>
+ public string Version
+ {
+ get
+ {
+ var versionPtr = HBFunctions.hb_get_version(this.hbHandle);
+ return Marshal.PtrToStringAnsi(versionPtr);
+ }
+ }
+
+ /// <summary>
+ /// Gets the HandBrake build number.
+ /// </summary>
+ public int Build
+ {
+ get
+ {
+ return HBFunctions.hb_get_build(this.hbHandle);
+ }
+ }
+
+ /// <summary>
+ /// Initializes this instance.
+ /// </summary>
+ /// <param name="verbosity">
+ /// The code for the logging verbosity to use.
+ /// </param>
+ public void Initialize(int verbosity)
+ {
+ HandBrakeUtils.EnsureGlobalInit();
+
+ HandBrakeUtils.RegisterLogger();
+ this.hbHandle = HBFunctions.hb_init(verbosity, update_check: 0);
+ }
+
+ /// <summary>
+ /// Starts a scan of the given path.
+ /// </summary>
+ /// <param name="path">
+ /// The path of the video to scan.
+ /// </param>
+ /// <param name="previewCount">
+ /// The number of previews to make on each title.
+ /// </param>
+ /// <param name="minDuration">
+ /// The minimum duration of a title to show up on the scan.
+ /// </param>
+ /// <param name="titleIndex">
+ /// The title index to scan (1-based, 0 for all titles).
+ /// </param>
+ public void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex)
+ {
+ this.previewCount = previewCount;
+
+ IntPtr pathPtr = InteropUtilities.ToUtf8PtrFromString(path);
+ HBFunctions.hb_scan(this.hbHandle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000));
+ Marshal.FreeHGlobal(pathPtr);
+
+ this.scanPollTimer = new Timer();
+ this.scanPollTimer.Interval = ScanPollIntervalMs;
+
+ // Lambda notation used to make sure we can view any JIT exceptions the method throws
+ this.scanPollTimer.Elapsed += (o, e) =>
+ {
+ try
+ {
+ this.PollScanProgress();
+ }
+ catch (Exception exc)
+ {
+ Debug.WriteLine(exc);
+ HandBrakeUtils.SendErrorEvent(exc.ToString());
+ }
+ };
+ this.scanPollTimer.Start();
+ }
+
+ /// <summary>
+ /// Stops an ongoing scan.
+ /// </summary>
+ [HandleProcessCorruptedStateExceptions]
+ public void StopScan()
+ {
+ HBFunctions.hb_scan_stop(this.hbHandle);
+ }
+
+ /// <summary>
+ /// Gets an image for the given job and preview
+ /// </summary>
+ /// <remarks>
+ /// Only incorporates sizing and aspect ratio into preview image.
+ /// </remarks>
+ /// <param name="settings">
+ /// The encode job to preview.
+ /// </param>
+ /// <param name="previewNumber">
+ /// The index of the preview to get (0-based).
+ /// </param>
+ /// <param name="deinterlace">
+ /// True to enable basic deinterlace of preview images.
+ /// </param>
+ /// <returns>
+ /// An image with the requested preview.
+ /// </returns>
+ [HandleProcessCorruptedStateExceptions]
+ public RawPreviewData GetPreview(PreviewSettings settings, int previewNumber, bool deinterlace)
+ {
+ SourceTitle title = this.Titles.TitleList.FirstOrDefault(t => t.Index == settings.TitleNumber);
+
+ // Create the Expected Output Geometry details for libhb.
+ hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s
+ {
+ crop = new[] { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right },
+ itu_par = 0,
+ keep = (int)AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH + (settings.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width?
+ maxWidth = settings.MaxWidth,
+ maxHeight = settings.MaxHeight,
+ mode = (int)(hb_anamorphic_mode_t)settings.Anamorphic,
+ modulus = settings.Modulus ?? 16,
+ geometry = new hb_geometry_s
+ {
+ height = settings.Height,
+ width = settings.Width,
+ par = settings.Anamorphic != Anamorphic.Custom && settings.Anamorphic != Anamorphic.Automatic
+ ? new hb_rational_t { den = title.Geometry.PAR.Den, num = title.Geometry.PAR.Num }
+ : new hb_rational_t { den = settings.PixelAspectY, num = settings.PixelAspectX }
+ }
+ };
+
+ // Fetch the image data from LibHb
+ IntPtr resultingImageStuct = HBFunctions.hb_get_preview2(this.hbHandle, 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.
+ int stride_width = image.plane[0].stride;
+ int stride_height = image.plane[0].height_stride;
+ int imageBufferSize = stride_width * stride_height; // int imageBufferSize = outputWidth * outputHeight * 4;
+
+ byte[] managedBuffer = new byte[imageBufferSize];
+ Marshal.Copy(image.plane[0].data, managedBuffer, 0, imageBufferSize);
+
+ RawPreviewData preview = new RawPreviewData(managedBuffer, stride_width, stride_height, image.width, image.height);
+
+ // 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);
+ Marshal.FreeHGlobal(nativeJobPtrPtr);
+
+ return preview;
+ }
+
+ /// <summary>
+ /// Determines if DRC can be applied to the given track with the given encoder.
+ /// </summary>
+ /// <param name="trackNumber">The track Number.</param>
+ /// <param name="encoder">The encoder to use for DRC.</param>
+ /// <param name="title">The title.</param>
+ /// <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.hbHandle, title, trackNumber, encoder.Id) > 0;
+ }
+
+ /// <summary>
+ /// Starts an encode with the given job.
+ /// </summary>
+ /// <param name="encodeObject">
+ /// The encode Object.
+ /// </param>
+ [HandleProcessCorruptedStateExceptions]
+ public void StartEncode(JsonEncodeObject encodeObject)
+ {
+ JsonSerializerSettings settings = new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore,
+ };
+
+ string encode = JsonConvert.SerializeObject(encodeObject, Formatting.Indented, settings);
+ this.StartEncode(encode);
+ }
+
+ /// <summary>
+ /// Starts an encode with the given job JSON.
+ /// </summary>
+ /// <param name="encodeJson">The JSON for the job to start.</param>
+ [HandleProcessCorruptedStateExceptions]
+ public void StartEncode(string encodeJson)
+ {
+ HBFunctions.hb_add_json(this.hbHandle, InteropUtilities.ToUtf8PtrFromString(encodeJson));
+ HBFunctions.hb_start(this.hbHandle);
+
+ this.encodePollTimer = new Timer();
+ this.encodePollTimer.Interval = EncodePollIntervalMs;
+
+ this.encodePollTimer.Elapsed += (o, e) =>
+ {
+ try
+ {
+ this.PollEncodeProgress();
+ }
+ catch (Exception exc)
+ {
+ Debug.WriteLine(exc);
+ }
+ };
+ this.encodePollTimer.Start();
+ }
+
+ /// <summary>
+ /// Pauses the current encode.
+ /// </summary>
+ [HandleProcessCorruptedStateExceptions]
+ public void PauseEncode()
+ {
+ HBFunctions.hb_pause(this.hbHandle);
+ }
+
+ /// <summary>
+ /// Resumes a paused encode.
+ /// </summary>
+ [HandleProcessCorruptedStateExceptions]
+ public void ResumeEncode()
+ {
+ HBFunctions.hb_resume(this.hbHandle);
+ }
+
+ /// <summary>
+ /// Stops the current encode.
+ /// </summary>
+ [HandleProcessCorruptedStateExceptions]
+ public void StopEncode()
+ {
+ HBFunctions.hb_stop(this.hbHandle);
+
+ // 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.hbHandle);
+ for (int i = 0; i < jobs; i++)
+ {
+ currentJobs.Add(HBFunctions.hb_job(this.hbHandle, 0));
+ }
+
+ foreach (IntPtr job in currentJobs)
+ {
+ HBFunctions.hb_rem(this.hbHandle, job);
+ }
+ }
+
+ /// <summary>
+ /// Frees any resources associated with this object.
+ /// </summary>
+ public void Dispose()
+ {
+ if (this.disposed)
+ {
+ return;
+ }
+
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the object is disposed.
+ /// </summary>
+ public bool IsDisposed
+ {
+ get
+ {
+ return this.disposed;
+ }
+ }
+
+ /// <summary>
+ /// Frees any resources associated with this object.
+ /// </summary>
+ /// <param name="disposing">
+ /// True if managed objects as well as unmanaged should be disposed.
+ /// </param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // Free other state (managed objects).
+ }
+
+ // Free unmanaged objects.
+ IntPtr handlePtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
+ Marshal.WriteIntPtr(handlePtr, this.hbHandle);
+ HBFunctions.hb_close(handlePtr);
+ Marshal.FreeHGlobal(handlePtr);
+
+ this.disposed = true;
+ }
+
+ /// <summary>
+ /// Checks the status of the ongoing scan.
+ /// </summary>
+ [HandleProcessCorruptedStateExceptions]
+ private void PollScanProgress()
+ {
+ IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle);
+ string statusJson = Marshal.PtrToStringAnsi(json);
+ JsonState state = null;
+ if (!string.IsNullOrEmpty(statusJson))
+ {
+ state = JsonConvert.DeserializeObject<JsonState>(statusJson);
+ }
+
+ TaskState taskState = state != null ? TaskState.FromRepositoryValue(state.State) : null;
+
+ if (taskState != null && (taskState == TaskState.Scanning || taskState == TaskState.Searching))
+ {
+ if (this.ScanProgress != null && state.Scanning != null)
+ {
+ this.ScanProgress(this, new ScanProgressEventArgs(state.Scanning.Progress, state.Scanning.Preview, state.Scanning.PreviewCount, state.Scanning.Title, state.Scanning.TitleCount));
+ }
+ }
+ else if (taskState != null && taskState == TaskState.ScanDone)
+ {
+ this.scanPollTimer.Stop();
+
+ var jsonMsg = HBFunctions.hb_get_title_set_json(this.hbHandle);
+ this.titlesJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg);
+
+ if (!string.IsNullOrEmpty(this.titlesJson))
+ {
+ this.titles = JsonConvert.DeserializeObject<JsonScanObject>(this.titlesJson);
+ if (this.titles != null)
+ {
+ this.featureTitle = this.titles.MainFeature;
+ }
+ }
+
+ if (this.ScanCompleted != null)
+ {
+ this.ScanCompleted(this, new System.EventArgs());
+ }
+ }
+ }
+
+ /// <summary>
+ /// Checks the status of the ongoing encode.
+ /// </summary>
+ [HandleProcessCorruptedStateExceptions]
+ private void PollEncodeProgress()
+ {
+ IntPtr json = HBFunctions.hb_get_state_json(this.hbHandle);
+ string statusJson = Marshal.PtrToStringAnsi(json);
+
+ JsonState state = JsonConvert.DeserializeObject<JsonState>(statusJson);
+
+ TaskState taskState = state != null ? TaskState.FromRepositoryValue(state.State) : null;
+
+ if (taskState != null && (taskState == TaskState.Working || taskState == TaskState.Muxing || taskState == TaskState.Searching))
+ {
+ if (this.EncodeProgress != null)
+ {
+ var progressEventArgs = new EncodeProgressEventArgs(state.Working.Progress, state.Working.Rate, state.Working.RateAvg, new TimeSpan(state.Working.Hours, state.Working.Minutes, state.Working.Seconds),
+ state.Working.PassID, state.Working.Pass, state.Working.PassCount, taskState.Code);
+
+ this.EncodeProgress(this, progressEventArgs);
+ }
+ }
+ else if (taskState != null && taskState == TaskState.WorkDone)
+ {
+ this.encodePollTimer.Stop();
+
+ if (this.EncodeCompleted != null)
+ {
+ this.EncodeCompleted(
+ this,
+ new EncodeCompletedEventArgs(state.WorkDone.Error != (int)hb_error_code.HB_ERROR_NONE));
+ }
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs
new file mode 100644
index 000000000..07ddb8a15
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeInstanceManager.cs
@@ -0,0 +1,171 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeInstanceManager.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>
+// The hand brake instance manager.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System;
+
+ using HandBrake.Interop.Interop.Interfaces;
+
+ /// <summary>
+ /// The HandBrake Instance manager.
+ /// Only supports scanning right now.
+ /// </summary>
+ public static class HandBrakeInstanceManager
+ {
+ private static HandBrakeInstance scanInstance;
+ private static HandBrakeInstance encodeInstance;
+ private static HandBrakeInstance previewInstance;
+ private static HandBrakeInstance masterInstance;
+
+ /// <summary>
+ /// Initializes static members of the <see cref="HandBrakeInstanceManager"/> class.
+ /// </summary>
+ static HandBrakeInstanceManager()
+ {
+ masterInstance = new HandBrakeInstance();
+ masterInstance.Initialize(2);
+ }
+
+ /// <summary>
+ /// The init.
+ /// </summary>
+ public static void Init()
+ {
+ // Nothing to do. Triggers static constructor.
+ }
+
+ /// <summary>
+ /// Gets the scanInstance.
+ /// </summary>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IHandBrakeInstance"/>.
+ /// </returns>
+ public static IHandBrakeInstance GetScanInstance(int verbosity)
+ {
+ if (scanInstance != null)
+ {
+ scanInstance.Dispose();
+ scanInstance = null;
+ }
+
+ HandBrakeInstance newInstance = new HandBrakeInstance();
+ newInstance.Initialize(verbosity);
+ scanInstance = newInstance;
+
+ return scanInstance;
+ }
+
+ /// <summary>
+ /// The get encode instance.
+ /// </summary>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IHandBrakeInstance"/>.
+ /// </returns>
+ public static IHandBrakeInstance GetEncodeInstance(int verbosity)
+ {
+ if (encodeInstance != null)
+ {
+ encodeInstance.Dispose();
+ encodeInstance = null;
+ }
+
+ HandBrakeInstance newInstance = new HandBrakeInstance();
+ newInstance.Initialize(verbosity);
+ encodeInstance = newInstance;
+
+ return encodeInstance;
+ }
+
+ /// <summary>
+ /// The get encode instance.
+ /// </summary>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IHandBrakeInstance"/>.
+ /// </returns>
+ public static IHandBrakeInstance GetPreviewInstance(int verbosity)
+ {
+ if (previewInstance != null)
+ {
+ previewInstance.Dispose();
+ previewInstance = null;
+ }
+
+ HandBrakeInstance newInstance = new HandBrakeInstance();
+ newInstance.Initialize(verbosity);
+ previewInstance = newInstance;
+
+ return previewInstance;
+ }
+
+ /// <summary>
+ /// Gets the master instance.
+ /// </summary>
+ internal static IHandBrakeInstance MasterInstance
+ {
+ get
+ {
+ return masterInstance;
+ }
+ }
+
+ /// <summary>
+ /// Gets the last scan scan instance.
+ /// </summary>
+ internal static IHandBrakeInstance LastScanScanInstance
+ {
+ get
+ {
+ return scanInstance;
+ }
+ }
+
+ /// <summary>
+ /// Gets the handle.
+ /// </summary>
+ internal static IntPtr LastScanHandle
+ {
+ get
+ {
+ return scanInstance.Handle;
+ }
+ }
+
+ /// <summary>
+ /// Gets the last encode scan instance.
+ /// </summary>
+ internal static IHandBrakeInstance LastEncodeScanInstance
+ {
+ get
+ {
+ return encodeInstance;
+ }
+ }
+
+ /// <summary>
+ /// Gets the encode handle.
+ /// </summary>
+ internal static IntPtr LastEncodeHandle
+ {
+ get
+ {
+ return encodeInstance.Handle;
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs
new file mode 100644
index 000000000..36b7a19e1
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeLanguagesHelper.cs
@@ -0,0 +1,52 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeLanguagesHelper.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>
+// Contains utilities for converting language codes.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System.Collections.Generic;
+
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Helpers;
+ using HandBrake.Interop.Interop.Model;
+
+ /// <summary>
+ /// Contains utilities for converting language codes.
+ /// </summary>
+ public static class HandBrakeLanguagesHelper
+ {
+ /// <summary>
+ /// The list of all languages.
+ /// </summary>
+ private static IList<Language> allLanguages;
+
+ /// <summary>
+ /// Gets a list of all languages.
+ /// </summary>
+ public static IList<Language> AllLanguages
+ {
+ get
+ {
+ return allLanguages
+ ?? (allLanguages =
+ InteropUtilities.ToListFromIterator<iso639_lang_t, Language>(HBFunctions.lang_get_next, HandBrakeUnitConversionHelpers.NativeToLanguage));
+ }
+ }
+
+ /// <summary>
+ /// Gets the language object for the given code.
+ /// </summary>
+ /// <param name="code">The ISO-639-2 code for the language.</param>
+ /// <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));
+ return HandBrakeUnitConversionHelpers.NativeToLanguage(language);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
new file mode 100644
index 000000000..a51a44fd1
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakePresetService.cs
@@ -0,0 +1,92 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakePresetService.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>
+// The hand brake preset service.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.IO;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Helpers;
+ using HandBrake.Interop.Interop.Json.Presets;
+
+ using Newtonsoft.Json;
+
+ /// <summary>
+ /// The hand brake preset service.
+ /// </summary>
+ public class HandBrakePresetService
+ {
+ /// <summary>
+ /// The get built in presets.
+ /// Requires an hb_init to have been invoked.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ public static IList<PresetCategory> GetBuiltInPresets()
+ {
+ IntPtr presets = HBFunctions.hb_presets_builtin_get_json();
+ string presetJson = Marshal.PtrToStringAnsi(presets);
+ IList<PresetCategory> presetList = JsonConvert.DeserializeObject<IList<PresetCategory>>(presetJson);
+
+ return presetList;
+ }
+
+ /// <summary>
+ /// The get preset from file.
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <returns>
+ /// The <see cref="PresetCategory"/>.
+ /// </returns>
+ public static PresetTransportContainer GetPresetFromFile(string filename)
+ {
+ IntPtr presetStringPointer = HBFunctions.hb_presets_read_file_json(InteropUtilities.ToUtf8PtrFromString(filename));
+ string presetJson = Marshal.PtrToStringAnsi(presetStringPointer);
+
+ if (!string.IsNullOrEmpty(presetJson))
+ {
+ // Check to see if we have a list of presets.
+ if (presetJson.StartsWith("["))
+ {
+ presetJson = "{ \"PresetList\":" + presetJson + " } ";
+ }
+
+ PresetTransportContainer preset = JsonConvert.DeserializeObject<PresetTransportContainer>(presetJson);
+
+ return preset;
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// The export preset.
+ /// </summary>
+ /// <param name="filename">
+ /// The filename.
+ /// </param>
+ /// <param name="container">
+ /// The container.
+ /// </param>
+ public static void ExportPreset(string filename, PresetTransportContainer container)
+ {
+ string preset = JsonConvert.SerializeObject(container, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
+ using (StreamWriter writer = new StreamWriter(filename))
+ {
+ writer.Write(preset);
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs b/win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs
new file mode 100644
index 000000000..93cc0fc0c
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeUnitConversionHelpers.cs
@@ -0,0 +1,191 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeUnitConversionHelpers.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>
+// Defines the HandrakeUnitConversionHelpers type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Helpers;
+ using HandBrake.Interop.Interop.Model;
+ using HandBrake.Interop.Interop.Model.Encoding;
+
+ /// <summary>
+ /// Converters for various encoding values.
+ /// </summary>
+ public static class HandBrakeUnitConversionHelpers
+ {
+ /// <summary>
+ /// Video Frame Rates
+ /// </summary>
+ private static readonly Dictionary<double, int> VideoRates;
+
+ /// <summary>
+ /// Initializes static members of the HandBrakeUnitConversionHelpers class.
+ /// </summary>
+ static HandBrakeUnitConversionHelpers()
+ {
+ HandBrakeUtils.EnsureGlobalInit();
+
+ VideoRates = new Dictionary<double, int>();
+ foreach (var framerate in HandBrakeEncoderHelpers.VideoFramerates)
+ {
+ VideoRates.Add(double.Parse(framerate.Name, CultureInfo.InvariantCulture), framerate.Rate);
+ }
+ }
+
+ /// <summary>
+ /// Convert Framerate to Video Rates
+ /// </summary>
+ /// <param name="framerate">
+ /// The framerate.
+ /// </param>
+ /// <returns>
+ /// The vrate if a valid framerate is passed in.
+ /// </returns>
+ /// <exception cref="ArgumentException">
+ /// Thrown when framerate is invalid.
+ /// </exception>
+ public static int FramerateToVrate(double framerate)
+ {
+ if (!VideoRates.ContainsKey(framerate))
+ {
+ throw new ArgumentException("Framerate not recognized.", "framerate");
+ }
+
+ return VideoRates[framerate];
+ }
+
+ /// <summary>
+ /// Converts a native HB encoder structure to an Encoder model.
+ /// </summary>
+ /// <param name="encoder">
+ /// The structure to convert.
+ /// </param>
+ /// <returns>
+ /// The converted model.
+ /// </returns>
+ internal static HBVideoEncoder NativeToVideoEncoder(hb_encoder_s encoder)
+ {
+ return new HBVideoEncoder(encoder.muxers, encoder.name, encoder.codec, encoder.short_name);
+ }
+
+ /// <summary>
+ /// Converts a native HB encoder structure to an Encoder model.
+ /// </summary>
+ /// <param name="encoder">
+ /// The structure to convert.
+ /// </param>
+ /// <returns>
+ /// The converted model.
+ /// </returns>
+ internal static HBAudioEncoder NativeToAudioEncoder(hb_encoder_s encoder)
+ {
+ 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),
+ encoder.name,
+ encoder.codec,
+ HandBrakeEncoderHelpers.GetAudioQualityLimits(encoder.codec),
+ encoder.short_name);
+
+ return result;
+ }
+
+ /// <summary>
+ /// Converts a native HB rate structure to an HBRate object.
+ /// </summary>
+ /// <param name="rate">
+ /// The structure to convert.
+ /// </param>
+ /// <returns>
+ /// The converted rate object.
+ /// </returns>
+ internal static HBRate NativeToRate(hb_rate_s rate)
+ {
+ return new HBRate(rate.name, rate.rate);
+ }
+
+ /// <summary>
+ /// Converts a native HB mixdown structure to a Mixdown model.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The structure to convert.
+ /// </param>
+ /// <returns>
+ /// The converted model.
+ /// </returns>
+ internal static HBMixdown NativeToMixdown(hb_mixdown_s mixdown)
+ {
+ return new HBMixdown(mixdown.name, mixdown.amixdown, mixdown.short_name);
+ }
+
+ /// <summary>
+ /// Converts a native HB container structure into an HBContainer object.
+ /// </summary>
+ /// <param name="container">
+ /// The structure to convert.
+ /// </param>
+ /// <returns>
+ /// The converted structure.
+ /// </returns>
+ internal static HBContainer NativeToContainer(hb_container_s container)
+ {
+ return new HBContainer(container.default_extension, container.name, container.format, container.short_name);
+ }
+
+ /// <summary>
+ /// Converts a native language structure to a Language object.
+ /// </summary>
+ /// <param name="language">
+ /// The structure to convert.
+ /// </param>
+ /// <returns>
+ /// The converted structure.
+ /// </returns>
+ internal static Language NativeToLanguage(iso639_lang_t language)
+ {
+ string englishName = InteropUtilities.ToStringFromUtf8Ptr(language.eng_name);
+ 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
new file mode 100644
index 000000000..bd8630911
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HandBrakeUtils.cs
@@ -0,0 +1,346 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeUtils.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>
+// Defines the HandBrakeUtils type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.Interop.Interop.EventArgs;
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Json.Anamorphic;
+ using HandBrake.Interop.Interop.Json.Shared;
+
+ using Newtonsoft.Json;
+
+ /// <summary>
+ /// HandBrake Interop Utilities
+ /// </summary>
+ public static class HandBrakeUtils
+ {
+ /// <summary>
+ /// The callback for log messages from HandBrake.
+ /// </summary>
+ private static LoggingCallback loggingCallback;
+
+ /// <summary>
+ /// The callback for error messages from HandBrake.
+ /// </summary>
+ private static LoggingCallback errorCallback;
+
+ /// <summary>
+ /// True if the global initialize function has been called.
+ /// </summary>
+ private static bool globalInitialized;
+
+ /// <summary>
+ /// Fires when HandBrake has logged a message.
+ /// </summary>
+ public static event EventHandler<MessageLoggedEventArgs> MessageLogged;
+
+ /// <summary>
+ /// Fires when HandBrake has logged an error.
+ /// </summary>
+ public static event EventHandler<MessageLoggedEventArgs> ErrorLogged;
+
+ /// <summary>
+ /// Initializes static members of the HandBrakeUtils class.
+ /// </summary>
+ static HandBrakeUtils()
+ {
+ if (!globalInitialized)
+ {
+ if (HBFunctions.hb_global_init() == -1)
+ {
+ throw new InvalidOperationException("HB global init failed.");
+ }
+
+ globalInitialized = true;
+ }
+ }
+
+ /// <summary>
+ /// Gets the HandBrake version string.
+ /// </summary>
+ public static string Version
+ {
+ get
+ {
+ var versionPtr = HBFunctions.hb_get_version(IntPtr.Zero); // Pointer isn't actually used.
+ return Marshal.PtrToStringAnsi(versionPtr);
+ }
+ }
+
+ /// <summary>
+ /// Gets the HandBrake build number.
+ /// </summary>
+ public static int Build
+ {
+ get
+ {
+ return HBFunctions.hb_get_build(IntPtr.Zero);
+ }
+ }
+
+ /// <summary>
+ /// Ensures the HB global initialize method has been called.
+ /// </summary>
+ public static void EnsureGlobalInit()
+ {
+ // Does nothing, but invokes static ctor.
+ }
+
+ /// <summary>
+ /// Enables or disables LibDVDNav. If disabled libdvdread will be used instead.
+ /// </summary>
+ /// <param name="enableDvdNav">
+ /// True to enable LibDVDNav.
+ /// </param>
+ public static void SetDvdNav(bool enableDvdNav)
+ {
+ HBFunctions.hb_dvd_set_dvdnav(enableDvdNav ? 1 : 0);
+ }
+
+ /// <summary>
+ /// Call before app shutdown. Performs global cleanup.
+ /// </summary>
+ public static void DisposeGlobal()
+ {
+ HBFunctions.hb_global_close();
+ }
+
+ /// <summary>
+ /// Register the logger.
+ /// </summary>
+ public static void RegisterLogger()
+ {
+ // Register the logger if we have not already
+ if (loggingCallback == null)
+ {
+ // 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);
+ }
+ }
+
+ /// <summary>
+ /// Handles log messages from HandBrake.
+ /// </summary>
+ /// <param name="message">
+ /// The log message (including newline).
+ /// </param>
+ public static void LoggingHandler(string message)
+ {
+ message = message.TrimEnd();
+ if (!string.IsNullOrEmpty(message))
+ {
+ SendMessageEvent(message);
+ }
+ }
+
+ /// <summary>
+ /// Handles errors from HandBrake.
+ /// </summary>
+ /// <param name="message">
+ /// The error message.
+ /// </param>
+ public static void ErrorHandler(string message)
+ {
+ if (!string.IsNullOrEmpty(message))
+ {
+ // These errors happen in normal operations. Log them as messages.
+ if (message == "dvd: ifoOpen failed" || message.Contains("avformat_seek_file failed") || message.Contains("nav_get_title_list"))
+ {
+ SendMessageEvent(message);
+ return;
+ }
+
+ SendErrorEvent(message);
+ }
+ }
+
+ /// <summary>
+ /// Gets the standard x264 option name given the starting point.
+ /// </summary>
+ /// <param name="name">
+ /// The name.
+ /// </param>
+ /// <returns>
+ /// The standard x264 option name.
+ /// </returns>
+ public static string SanitizeX264OptName(string name)
+ {
+ IntPtr namePtr = Marshal.StringToHGlobalAnsi(name);
+ string sanitizedName = Marshal.PtrToStringAnsi(HBFunctions.hb_x264_encopt_name(namePtr));
+ Marshal.FreeHGlobal(namePtr);
+ return sanitizedName;
+ }
+
+ /// <summary>
+ /// Checks to see if the given H.264 level is valid given the inputs.
+ /// </summary>
+ /// <param name="level">
+ /// The level to check.
+ /// </param>
+ /// <param name="width">
+ /// The output picture width.
+ /// </param>
+ /// <param name="height">
+ /// The output picture height.
+ /// </param>
+ /// <param name="fpsNumerator">
+ /// The rate numerator.
+ /// </param>
+ /// <param name="fpsDenominator">
+ /// The rate denominator.
+ /// </param>
+ /// <param name="interlaced">
+ /// True if x264 interlaced output is enabled.
+ /// </param>
+ /// <param name="fakeInterlaced">
+ /// True if x264 fake interlacing is enabled.
+ /// </param>
+ /// <returns>
+ /// True if the level is valid.
+ /// </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;
+ }
+
+ /// <summary>
+ /// Creates an X264 options string from the given settings.
+ /// </summary>
+ /// <param name="preset">
+ /// The x264 preset.
+ /// </param>
+ /// <param name="tunes">
+ /// The x264 tunes being used.
+ /// </param>
+ /// <param name="extraOptions">
+ /// The extra options string.
+ /// </param>
+ /// <param name="profile">
+ /// The H.264 profile.
+ /// </param>
+ /// <param name="level">
+ /// The H.264 level.
+ /// </param>
+ /// <param name="width">
+ /// The width of the final picture.
+ /// </param>
+ /// <param name="height">
+ /// The height of the final picture.
+ /// </param>
+ /// <returns>
+ /// The full x264 options string from the given inputs.
+ /// </returns>
+ public static string CreateX264OptionsString(
+ string preset,
+ IList<string> tunes,
+ string extraOptions,
+ string profile,
+ string level,
+ int width,
+ int height)
+ {
+ if (width <= 0)
+ {
+ throw new ArgumentException("width must be positive.");
+ }
+
+ if (height <= 0)
+ {
+ throw new ArgumentException("height must be positive.");
+ }
+
+ IntPtr ptr = HBFunctions.hb_x264_param_unparse(
+ 8,
+ preset,
+ string.Join(",", tunes),
+ extraOptions,
+ profile,
+ level,
+ width,
+ height); // TODO add bit-depth support.
+
+ string x264Settings = Marshal.PtrToStringAnsi(ptr);
+
+ return x264Settings;
+ }
+
+ /// <summary>
+ /// Gets the final size and PAR of the video, given anamorphic inputs.
+ /// </summary>
+ /// <param name="anamorphicGeometry">Anamorphic inputs.</param>
+ /// <returns>The final size and PAR of the video.</returns>
+ 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));
+ string result = Marshal.PtrToStringAnsi(json);
+ return JsonConvert.DeserializeObject<Geometry>(result);
+ }
+
+ public static void Reduce(long den, long num, out long x, out long y)
+ {
+ // find the greatest common divisor of num & den by Euclid's algorithm
+ long n = num, d = den;
+ while (d > 0)
+ {
+ long t = d;
+ d = n % d;
+ n = t;
+ }
+
+ // at this point n is the gcd. if it's non-zero remove it from num
+ // and den. Otherwise just return the original values.
+ if (n > 0)
+ {
+ num /= n;
+ den /= n;
+ }
+
+ x = num;
+ y = den;
+ }
+
+ /// <summary>
+ /// Sends the message logged event to any registered listeners.
+ /// </summary>
+ /// <param name="message">
+ /// The message to send.
+ /// </param>
+ public static void SendMessageEvent(string message)
+ {
+ MessageLogged?.Invoke(null, new MessageLoggedEventArgs(message));
+ }
+
+ /// <summary>
+ /// Sends the error logged event to any registered listeners.
+ /// </summary>
+ /// <param name="message">
+ /// The message to send
+ /// </param>
+ public static void SendErrorEvent(string message)
+ {
+ ErrorLogged?.Invoke(null, new MessageLoggedEventArgs(message));
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs
new file mode 100644
index 000000000..33d3f0bca
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/HBDelegates.cs
@@ -0,0 +1,17 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBDelegates.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>
+// Contains delegates for HandBrake interop.
+// </summary>
+// <auto-generated> Disable Stylecop Warnings for this file </auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void LoggingCallback(string message);
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs
new file mode 100644
index 000000000..c55c8a927
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/HbFunctions.cs
@@ -0,0 +1,462 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBFunctions.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>
+// Defines the HBFunctions type.
+// </summary>
+// <auto-generated> Disable Stylecop Warnings for this file </auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ /// <summary>
+ /// Contains p-invoke function declarations to hblib.
+ /// </summary>
+ public static class HBFunctions
+ {
+ [DllImport("hb", EntryPoint = "hb_register_logger", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_register_logger(LoggingCallback callback);
+
+ [DllImport("hb", EntryPoint = "hb_register_error_handler", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_register_error_handler(LoggingCallback callback);
+
+ [DllImport("hb", EntryPoint = "hb_global_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_global_init();
+
+ /// Return Type: hb_handle_t*
+ ///verbose: int
+ ///update_check: int
+ [DllImport("hb", EntryPoint = "hb_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_init(int verbose, int update_check);
+
+
+ /// Return Type: hb_handle_t*
+ ///verbose: int
+ ///update_check: int
+ [DllImport("hb", EntryPoint = "hb_init_dl", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_init_dl(int verbose, int update_check);
+
+
+ /// Return Type: char*
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_get_version", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_version(IntPtr hbHandle);
+
+
+ /// Return Type: int
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_get_build", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_get_build(IntPtr hbHandle);
+
+
+ /// Return Type: int
+ ///h: hb_handle_t*
+ ///version: char**
+ [DllImport("hb", EntryPoint = "hb_check_update", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_check_update(IntPtr handle, ref IntPtr version);
+
+
+ /// Return Type: char*
+ ///path: char*
+ [DllImport("hb", EntryPoint = "hb_dvd_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_dvd_name(IntPtr path);
+
+
+ /// Return Type: void
+ ///enable: int
+ [DllImport("hb", EntryPoint = "hb_dvd_set_dvdnav", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_dvd_set_dvdnav(int enable);
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ ///path: char*
+ ///title_index: int
+ ///preview_count: int
+ ///store_previews: int
+ [DllImport("hb", EntryPoint = "hb_scan", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_scan(IntPtr hbHandle, IntPtr path, int title_index, int preview_count, int store_previews, ulong min_duration);
+
+ [DllImport("hb", EntryPoint = "hb_scan_stop", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_scan_stop(IntPtr hbHandle);
+
+ /// Return Type: hb_list_t*
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_get_titles", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_titles(IntPtr hbHandle);
+
+ [DllImport("hb", EntryPoint = "hb_set_anamorphic_size2", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_set_anamorphic_size2(ref hb_geometry_s sourceGeometry, ref hb_geometry_settings_s uiGeometry, ref hb_geometry_s result);
+
+
+ /// Return Type: int
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_count", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_count(IntPtr hbHandle);
+
+
+ /// Return Type: hb_job_t*
+ ///param0: hb_handle_t*
+ ///param1: int
+ [DllImport("hb", EntryPoint = "hb_job", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_job(IntPtr hbHandle, int jobIndex);
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ ///param1: hb_job_t*
+ [DllImport("hb", EntryPoint = "hb_rem", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_rem(IntPtr hbHandle, IntPtr job);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_start", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_start(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_pause", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_pause(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_resume", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_resume(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ [DllImport("hb", EntryPoint = "hb_stop", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_stop(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t**
+ [DllImport("hb", EntryPoint = "hb_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_close(IntPtr hbHandle);
+
+ [DllImport("hb", EntryPoint = "hb_global_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_global_close();
+
+ //hb_list_t * hb_list_init();
+ [DllImport("hb", EntryPoint = "hb_list_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_list_init();
+
+ //int hb_list_count( const hb_list_t * );
+ [DllImport("hb", EntryPoint = "hb_list_count", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_list_count(IntPtr listPtr);
+
+ //void hb_list_add( hb_list_t *, void * );
+ [DllImport("hb", EntryPoint = "hb_list_add", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_add(IntPtr listPtr, IntPtr item);
+
+ //void hb_list_insert( hb_list_t * l, int pos, void * p );
+ [DllImport("hb", EntryPoint = "hb_list_insert", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_insert(IntPtr listPtr, int pos, IntPtr item);
+
+ //void hb_list_rem( hb_list_t *, void * );
+ [DllImport("hb", EntryPoint = "hb_list_rem", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_rem(IntPtr listPtr, IntPtr item);
+
+ //void * hb_list_item( const hb_list_t *, int );
+ [DllImport("hb", EntryPoint = "hb_list_item", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_list_item(IntPtr listPtr, int itemIndex);
+
+ //void hb_list_close( hb_list_t ** );
+ [DllImport("hb", EntryPoint = "hb_list_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_close(IntPtr listPtrPtr);
+
+ [DllImport("hb", EntryPoint = "hb_subtitle_can_force", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_subtitle_can_force(int source);
+
+ [DllImport("hb", EntryPoint = "hb_subtitle_can_burn", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_subtitle_can_burn(int source);
+
+ [DllImport("hb", EntryPoint = "hb_subtitle_can_pass", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_subtitle_can_pass(int source, int mux);
+
+
+ // int hb_video_framerate_get_from_name(const char *name)
+ [DllImport("hb", EntryPoint = "hb_video_framerate_get_from_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_video_framerate_get_from_name(IntPtr name);
+
+//const char* hb_video_framerate_get_name(int framerate);
+//const char* hb_video_framerate_sanitize_name(const char *name);
+
+ // returns hb_rate_s
+ [DllImport("hb", EntryPoint = "hb_video_framerate_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_framerate_get_next(IntPtr last);
+
+
+//int hb_audio_samplerate_get_best(uint32_t codec, int samplerate, int *sr_shift);
+//int hb_audio_samplerate_get_from_name(const char *name);
+//const char* hb_audio_samplerate_get_name(int samplerate);
+
+ // returns hb_rate_s
+ [DllImport("hb", EntryPoint = "hb_audio_samplerate_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_audio_samplerate_get_next(IntPtr last);
+
+ [DllImport("hb", EntryPoint = "hb_audio_samplerate_find_closest", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_audio_samplerate_find_closest(int samplerate, uint codec);
+
+ [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_best", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_audio_bitrate_get_best(uint codec, int bitrate, int samplerate, int mixdown);
+
+ [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_default", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_audio_bitrate_get_default(uint codec, int samplerate, int mixdown);
+
+ [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_limits", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_audio_bitrate_get_limits(uint codec, int samplerate, int mixdown, ref int low, ref int high);
+
+ [DllImport("hb", EntryPoint = "hb_audio_bitrate_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_audio_bitrate_get_next(IntPtr last);
+
+ [DllImport("hb", EntryPoint = "hb_video_quality_get_limits", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_video_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction);
+
+ [DllImport("hb", EntryPoint = "hb_video_quality_get_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_quality_get_name(uint codec);
+
+ [DllImport("hb", EntryPoint = "hb_audio_quality_get_limits", CallingConvention = CallingConvention.Cdecl)]
+ public static extern 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_best(uint32_t codec, float quality);
+
+ [DllImport("hb", EntryPoint = "hb_audio_quality_get_default", CallingConvention = CallingConvention.Cdecl)]
+ public static extern float hb_audio_quality_get_default(uint codec);
+
+
+ [DllImport("hb", EntryPoint = "hb_audio_compression_get_limits", CallingConvention = CallingConvention.Cdecl)]
+ public static extern 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_best(uint32_t codec, float compression);
+
+ [DllImport("hb", EntryPoint = "hb_audio_compression_get_default", CallingConvention = CallingConvention.Cdecl)]
+ public static extern float hb_audio_compression_get_default(uint codec);
+
+
+//int hb_audio_dither_get_default();
+//int hb_audio_dither_get_default_method(); // default method, if enabled && supported
+//int hb_audio_dither_is_supported(uint32_t codec);
+//int hb_audio_dither_get_from_name(const char *name);
+//const char* hb_audio_dither_get_description(int method);
+//const hb_dither_t* hb_audio_dither_get_next(const hb_dither_t *last);
+
+ // hb_audio_can_apply_drc2(hb_handle_t *h, int title_idx, int audio_idx, int encoder)
+ [DllImport("hb", EntryPoint = "hb_audio_can_apply_drc2", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_audio_can_apply_drc2(IntPtr handle, int title_index, int audio_index, int encoder);
+
+ [DllImport("hb", EntryPoint = "hb_mixdown_is_supported", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout);
+
+ [DllImport("hb", EntryPoint = "hb_mixdown_has_codec_support", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_has_codec_support(int mixdown, uint codec);
+
+ [DllImport("hb", EntryPoint = "hb_mixdown_has_remix_support", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_has_remix_support(int mixdown, ulong layout);
+
+//int hb_mixdown_get_discrete_channel_count(int mixdown);
+//int hb_mixdown_get_low_freq_channel_count(int mixdown);
+
+ [DllImport("hb", EntryPoint = "hb_mixdown_get_best", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_get_best(uint codec, ulong layout, int mixdown);
+
+ [DllImport("hb", EntryPoint = "hb_mixdown_get_default", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_get_default(uint codec, ulong layout);
+
+//int hb_mixdown_get_from_name(const char *name);
+//const char* hb_mixdown_get_name(int mixdown);
+//const char* hb_mixdown_get_short_name(int mixdown);
+//const char* hb_mixdown_sanitize_name(const char *name);
+
+ [DllImport("hb", EntryPoint = "hb_mixdown_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_mixdown_get_next(IntPtr last);
+
+//int hb_video_encoder_get_default(int muxer);
+//int hb_video_encoder_get_from_name(const char *name);
+//const char* hb_video_encoder_get_name(int encoder);
+//const char* hb_video_encoder_get_short_name(int encoder);
+//const char* hb_video_encoder_get_long_name(int encoder);
+//const char* hb_video_encoder_sanitize_name(const char *name);
+
+ [DllImport("hb", EntryPoint = "hb_video_encoder_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_next(IntPtr last);
+
+/*
+ * hb_audio_encoder_get_fallback_for_passthru() will sanitize a passthru codec
+ * to the matching audio encoder (if any is available).
+ *
+ * hb_audio_encoder_get_from_name(), hb_audio_encoder_sanitize_name() will
+ * sanitize legacy encoder names, but won't convert passthru to an encoder.
+ */
+//int hb_audio_encoder_get_fallback_for_passthru(int passthru);
+//int hb_audio_encoder_get_default(int muxer);
+//int hb_audio_encoder_get_from_name(const char *name);
+//const char* hb_audio_encoder_get_name(int encoder);
+//const char* hb_audio_encoder_get_short_name(int encoder);
+//const char* hb_audio_encoder_get_long_name(int encoder);
+//const char* hb_audio_encoder_sanitize_name(const char *name);
+
+ [DllImport("hb", EntryPoint = "hb_audio_encoder_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_audio_encoder_get_next(IntPtr last);
+
+//int hb_container_get_from_name(const char *name);
+//int hb_container_get_from_extension(const char *extension); // not really a container name
+//const char* hb_container_get_name(int format);
+//const char* hb_container_get_short_name(int format);
+//const char* hb_container_get_long_name(int format);
+//const char* hb_container_get_default_extension(int format);
+//const char* hb_container_sanitize_name(const char *name);
+
+ [DllImport("hb", EntryPoint = "hb_container_get_from_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_container_get_from_name([In] [MarshalAs(UnmanagedType.LPStr)] string name);
+
+ [DllImport("hb", EntryPoint = "hb_container_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_container_get_next(IntPtr last);
+
+ [DllImport("hb", EntryPoint = "hb_video_encoder_get_presets", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_presets(int encoder);
+
+ [DllImport("hb", EntryPoint = "hb_video_encoder_get_tunes", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_tunes(int encoder);
+
+ [DllImport("hb", EntryPoint = "hb_video_encoder_get_profiles", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_profiles(int encoder);
+
+ [DllImport("hb", EntryPoint = "hb_video_encoder_get_levels", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_levels(int encoder);
+
+
+ [DllImport("hb", EntryPoint = "lang_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr lang_get_next(IntPtr last);
+
+ [DllImport("hb", EntryPoint = "lang_for_code2", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr lang_for_code2([In] [MarshalAs(UnmanagedType.LPStr)] string code2);
+
+
+ ///hb_title_set_t * hb_get_title_set( hb_handle_t * );
+ [DllImport("hb", EntryPoint = "hb_get_title_set", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_title_set(IntPtr hbHandle);
+
+ ///hb_job_t * hb_job_init_by_index( hb_handle_t *h, int title_index );
+ [DllImport("hb", EntryPoint = "hb_job_init_by_index", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_job_init_by_index(IntPtr hbHandle, int title_index);
+
+ ///void hb_job_close( hb_job_t ** job );
+ [DllImport("hb", EntryPoint = "hb_job_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_job_close(IntPtr job);
+
+ ///void hb_chapter_set_title(hb_chapter_t *chapter, const char *title);
+ [DllImport("hb", EntryPoint = "hb_chapter_set_title", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_chapter_set_title(IntPtr chapter, [In] [MarshalAs(UnmanagedType.LPStr)] string title);
+
+ ///void hb_chapter_set_title(hb_chapter_t *chapter, const char *title);
+ [DllImport("hb", EntryPoint = "hb_chapter_set_title", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_chapter_set_title__ptr(IntPtr chapter, IntPtr title);
+
+ /// hb_filter_object_t * hb_filter_init( int filter_id );
+ [DllImport("hb", EntryPoint = "hb_filter_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_filter_init(int filter_id);
+
+ [DllImport("hb", EntryPoint = "hb_generate_filter_settings_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern 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);
+
+ /// char* hb_filter_get_presets_json(int filter_id);
+ [DllImport("hb", EntryPoint = "hb_filter_get_presets_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_filter_get_presets_json(int filter_id);
+
+ /// char* hb_filter_get_tuness_json(int filter_id);
+ [DllImport("hb", EntryPoint = "hb_filter_get_tunes_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_filter_get_tunes_json(int filter_id);
+
+ // char ** hb_filter_get_keys(int filter_id);
+ [DllImport("hb", EntryPoint = "hb_filter_get_keys", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_filter_get_keys(int filter_id);
+
+ [DllImport("hb", EntryPoint = "hb_x264_encopt_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_x264_encopt_name(IntPtr name);
+
+ [DllImport("hb", EntryPoint = "hb_check_h264_level", CallingConvention = CallingConvention.Cdecl)]
+ public static extern 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);
+
+ [DllImport("hb", EntryPoint = "hb_x264_param_unparse", CallingConvention = CallingConvention.Cdecl)]
+ public static extern 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);
+
+
+ [DllImport("hb", EntryPoint = "hb_get_opencl_env", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_get_opencl_env();
+
+ [DllImport("hb", EntryPoint = "hb_qsv_available", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_qsv_available();
+
+ [DllImport("hb", EntryPoint = "hb_qsv_info_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_qsv_info_init();
+
+ // hb_image_t* hb_get_preview2(hb_handle_t* h, int title_idx, int picture, hb_geometry_settings_t* geo, int deinterlace);
+ [DllImport("hb", EntryPoint = "hb_get_preview2", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_preview2(IntPtr hbHandle, int title_idx, int preview_idx, ref hb_geometry_settings_s geo, int deinterlace);
+
+ // void hb_image_close(hb_image_t **_image);
+ [DllImport("hb", EntryPoint = "hb_image_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_image_close(IntPtr image);
+
+ /* JSON API */
+
+ // char * hb_get_title_set_json(hb_handle_t * h);
+ [DllImport("hb", EntryPoint = "hb_get_title_set_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_title_set_json(IntPtr hbHandle);
+
+ // char * hb_job_init_json(hb_handle_t *h, int title_index);
+ [DllImport("hb", EntryPoint = "hb_job_init_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_job_init_json(IntPtr hbHandle, int title_index);
+
+ // hb_job_t * hb_json_to_job(hb_handle_t * h, const char * json_job);
+ [DllImport("hb", EntryPoint = "hb_json_to_job", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_json_to_job(IntPtr hbHandle, IntPtr json_job);
+
+ // int hb_add_json( hb_handle_t *, const char * )
+ [DllImport("hb", EntryPoint = "hb_add_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_add_json(IntPtr hbHandle, IntPtr json_job);
+
+ //char * hb_set_anamorphic_size_json(const char * json_param);
+ [DllImport("hb", EntryPoint = "hb_set_anamorphic_size_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_set_anamorphic_size_json(IntPtr json_param);
+
+ // char * hb_get_state_json(hb_handle_t * h);
+ [DllImport("hb", EntryPoint = "hb_get_state_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_state_json(IntPtr hbHandle);
+
+ // char* hb_get_preview_params_json(int title_idx, int preview_idx, int deinterlace, hb_geometry_settings_t *settings)
+ [DllImport("hb", EntryPoint = "hb_get_preview_params_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern 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(void);
+ [DllImport("hb", EntryPoint = "hb_presets_builtin_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_presets_builtin_init();
+
+ // char * hb_presets_builtin_get_json(void); // Get list of HandBrake builtin presets as json string
+ [DllImport("hb", EntryPoint = "hb_presets_builtin_get_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_presets_builtin_get_json();
+
+ // char * hb_presets_read_file_json(const char *filename);
+ [DllImport("hb", EntryPoint = "hb_presets_read_file_json", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_presets_read_file_json(IntPtr filename);
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs
new file mode 100644
index 000000000..aacec1bcf
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/NativeConstants.cs
@@ -0,0 +1,69 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="NativeConstants.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>
+// Defines the NativeConstants type.
+// </summary>
+// <auto-generated> Disable Stylecop Warnings for this file </auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ public class NativeConstants
+ {
+ // Audio encoders
+ public const uint HB_ACODEC_MASK = 0x03FFFF00;
+ public const uint HB_ACODEC_LAME = 0x00000200;
+ public const uint HB_ACODEC_VORBIS = 0x00000400;
+ public const uint HB_ACODEC_AC3 = 0x00000800;
+ public const uint HB_ACODEC_LPCM = 0x00001000;
+ public const uint HB_ACODEC_DCA = 0x00002000;
+ public const uint HB_ACODEC_CA_AAC = 0x00004000;
+ public const uint HB_ACODEC_CA_HAAC = 0x00008000;
+ public const uint HB_ACODEC_FFAAC = 0x00010000;
+ public const uint HB_ACODEC_FFMPEG = 0x00020000;
+ public const uint HB_ACODEC_DCA_HD = 0x00040000;
+ public const uint HB_ACODEC_MP3 = 0x00080000;
+ public const uint HB_ACODEC_FFFLAC = 0x00100000;
+ public const uint HB_ACODEC_FFFLAC24 = 0x00200000;
+ public const uint HB_ACODEC_FDK_AAC = 0x00400000;
+ public const uint HB_ACODEC_FDK_HAAC = 0x00800000;
+ public const uint HB_ACODEC_FFEAC3 = 0x01000000;
+ public const uint HB_ACODEC_FFTRUEHD = 0x02000000;
+ public const uint HB_ACODEC_FF_MASK = 0x03FF2800;
+ public const uint HB_ACODEC_PASS_FLAG = 0x40000000;
+ public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_AC3 | HB_ACODEC_DCA | HB_ACODEC_DCA_HD | HB_ACODEC_FFAAC | HB_ACODEC_FFEAC3 | HB_ACODEC_FFFLAC | HB_ACODEC_MP3 | HB_ACODEC_FFTRUEHD);
+ public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_MP3_PASS = (HB_ACODEC_MP3 | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_AAC_PASS = (HB_ACODEC_FFAAC | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_AC3_PASS = (HB_ACODEC_AC3 | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_DCA_PASS = (HB_ACODEC_DCA | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_DCA_HD_PASS = (HB_ACODEC_DCA_HD | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_EAC3_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFEAC3);
+ public const uint HB_ACODEC_FLAC_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFFLAC);
+ public const uint HB_ACODEC_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG);
+ public const uint HB_ACODEC_TRUEHD_PASS = (HB_ACODEC_PASS_FLAG | HB_ACODEC_FFTRUEHD);
+
+ // VideoEncoders
+ public const uint HB_VCODEC_QSV_H264 = 0x0000100;
+ public const uint HB_VCODEC_QSV_H265 = 0x0000200;
+ public const uint HB_VCODEC_QSV_H265_10BIT = 0x0000400;
+ public const uint HB_VCODEC_QSV_MASK = 0x0000F00;
+
+ // Encode state
+ public const int HB_STATE_IDLE = 1;
+ public const int HB_STATE_SCANNING = 2;
+ public const int HB_STATE_SCANDONE = 4;
+ public const int HB_STATE_WORKING = 8;
+ public const int HB_STATE_PAUSED = 16;
+ public const int HB_STATE_WORKDONE = 32;
+ public const int HB_STATE_MUXING = 64;
+ public const int HB_STATE_SEARCHING = 128;
+
+ // Keep aspect ratio values
+ public const int HB_KEEP_WIDTH = 0x01;
+ public const int HB_KEEP_HEIGHT = 0x02;
+ public const int HB_KEEP_DISPLAY_ASPECT = 0x04;
+ }
+}
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
new file mode 100644
index 000000000..949f7d694
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_anamorphic_mode_t.cs
@@ -0,0 +1,21 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_job_s.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>
+// Defines the hb_job_s type.
+// </summary>
+// <auto-generated> Disable Stylecop Warnings for this file </auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ internal enum hb_anamorphic_mode_t
+ {
+ HB_ANAMORPHIC_NONE,
+ HB_ANAMORPHIC_STRICT,
+ HB_ANAMORPHIC_LOOSE,
+ HB_ANAMORPHIC_CUSTOM,
+ HB_ANAMORPHIC_AUTO
+ } ;
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs
new file mode 100644
index 000000000..2611cab47
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_container_s.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_container_s.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>
+// <auto-generated>Disable Stylecop Warnings for this file</auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct hb_container_s
+ {
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string name;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string short_name;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string long_name;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string default_extension;
+
+ public int format;
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs
new file mode 100644
index 000000000..54c5b182f
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_encoder_s.cs
@@ -0,0 +1,28 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_encoder_s.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>
+// <auto-generated>Disable Stylecop Warnings for this file</auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct hb_encoder_s
+ {
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string name;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string short_name;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string long_name;
+
+ public int codec;
+
+ public int muxers;
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs
new file mode 100644
index 000000000..f0c996ca8
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_error_code.cs
@@ -0,0 +1,24 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_error_code.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>
+// Defines the hb_error_code type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ /// <summary>
+ /// The hb_error_code.
+ /// </summary>
+ internal enum hb_error_code
+ {
+ HB_ERROR_NONE = 0,
+ HB_ERROR_CANCELED,
+ HB_ERROR_WRONG_INPUT,
+ HB_ERROR_INIT,
+ HB_ERROR_UNKNOWN,
+ HB_ERROR_READ
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs
new file mode 100644
index 000000000..62b0889cb
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_filter_ids.cs
@@ -0,0 +1,46 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_filter_ids.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>
+// <auto-generated> Disable Stylecop Warnings for this file </auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ public enum hb_filter_ids
+ {
+ HB_FILTER_INVALID = 0,
+ // for QSV - important to have before other filters
+ HB_FILTER_FIRST = 1,
+ HB_FILTER_QSV_PRE = 1,
+
+ // First, filters that may change the framerate (drop or dup frames)
+ HB_FILTER_DETELECINE,
+ HB_FILTER_COMB_DETECT,
+ HB_FILTER_DECOMB,
+ HB_FILTER_DEINTERLACE,
+ HB_FILTER_VFR,
+ // Filters that must operate on the original source image are next
+ HB_FILTER_DEBLOCK,
+ HB_FILTER_DENOISE,
+ HB_FILTER_HQDN3D = HB_FILTER_DENOISE,
+ HB_FILTER_NLMEANS,
+ HB_FILTER_RENDER_SUB,
+ HB_FILTER_CROP_SCALE,
+ HB_FILTER_LAPSHARP,
+ HB_FILTER_UNSHARP,
+ HB_FILTER_ROTATE,
+ HB_FILTER_GRAYSCALE,
+ HB_FILTER_PAD,
+
+ // Finally filters that don't care what order they are in,
+ // except that they must be after the above filters
+ HB_FILTER_AVFILTER,
+
+ // for QSV - important to have as a last one
+ HB_FILTER_QSV_POST,
+ // default MSDK VPP filter
+ HB_FILTER_QSV,
+ HB_FILTER_LAST = HB_FILTER_QSV
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs
new file mode 100644
index 000000000..c665a5306
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_geometry.cs
@@ -0,0 +1,101 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_geometry.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>
+// Defines the hb_geometry type.
+// </summary>
+// <auto-generated>Disable Stylecop Warnings for this file</auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ /// <summary>
+ /// The hb_geometry_s.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct hb_geometry_s
+ {
+ /// <summary>
+ /// The width.
+ /// </summary>
+ public int width;
+
+ /// <summary>
+ /// The height.
+ /// </summary>
+ public int height;
+
+ /// <summary>
+ /// The par.
+ /// </summary>
+ public hb_rational_t par;
+ }
+
+ /// <summary>
+ /// The hb_ui_geometry_s.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct hb_geometry_settings_s
+ {
+ /// <summary>
+ /// Anamorphic mode, see job struct anamorphic
+ /// </summary>
+ public int mode;
+
+ /// <summary>
+ /// Specifies settings that shouldn't be changed
+ /// </summary>
+ public int keep;
+
+ /// <summary>
+ /// use dvd dimensions to determine PAR
+ /// </summary>
+ public int itu_par;
+
+ /// <summary>
+ /// pixel alignment for loose anamorphic
+ /// </summary>
+ public int modulus;
+
+ /// <summary>
+ /// Cropping
+ /// </summary>
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I4)]
+ public int[] crop;
+
+ /// <summary>
+ /// max destination storage width
+ /// </summary>
+ public int maxWidth;
+
+ /// <summary>
+ /// max destination storage height
+ /// </summary>
+ public int maxHeight;
+
+ /// <summary>
+ /// Pixel aspect used in custom anamorphic
+ /// </summary>
+ public hb_geometry_s geometry;
+ }
+
+ /// <summary>
+ /// The hb_rational_t.
+ /// </summary>
+ [StructLayout(LayoutKind.Sequential)]
+ public struct hb_rational_t
+ {
+ /// <summary>
+ /// The num. W
+ /// </summary>
+ public int num;
+
+ /// <summary>
+ /// The den. H
+ /// </summary>
+ public int den;
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs
new file mode 100644
index 000000000..2d2632622
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_image_s.cs
@@ -0,0 +1,41 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_image_s.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>
+// Defines the hb_image_s type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ /// <summary>
+ /// The hb_image_s.
+ /// </summary>
+ internal struct hb_image_s
+ {
+ public int format;
+ public int width;
+ public int height;
+ public IntPtr data;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4, ArraySubType = UnmanagedType.I4)]
+ public image_plane[] plane;
+ }
+
+ /// <summary>
+ /// The image_plane.
+ /// </summary>
+ internal struct image_plane
+ {
+ public IntPtr data;
+ public int width;
+ public int height;
+ public int stride;
+ public int height_stride;
+ public int size;
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs
new file mode 100644
index 000000000..06fb6af6b
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_mixdown_s.cs
@@ -0,0 +1,25 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_mixdown_s.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>
+// <auto-generated>Disable Stylecop Warnings for this file</auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct hb_mixdown_s
+ {
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string name;
+
+ /// char*
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string short_name;
+
+ /// int
+ public int amixdown;
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs
new file mode 100644
index 000000000..f10c320ce
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_rate_s.cs
@@ -0,0 +1,22 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_rate_s.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>
+// <auto-generated>Disable Stylecop Warnings for this file</auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct hb_rate_s
+ {
+ /// char*
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string name;
+
+ /// int
+ public int rate;
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs b/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs
new file mode 100644
index 000000000..0cfb0038b
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/hb_subtitle.cs
@@ -0,0 +1,28 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="hb_subtitle.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>
+// <auto-generated> Disable Stylecop Warnings for this file </auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ public enum hb_subtitle_s_subsource
+ {
+ VOBSUB,
+
+ SRTSUB,
+
+ CC608SUB,
+
+ CC708SUB,
+
+ UTF8SUB,
+
+ TX3GSUB,
+
+ SSASUB,
+
+ PGSSUB
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs b/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs
new file mode 100644
index 000000000..8a9d8ab64
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/HbLib/iso639_lang_t.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="iso639_lang_t.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>
+// <auto-generated>Disable Stylecop Warnings for this file</auto-generated>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.HbLib
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct iso639_lang_t
+ {
+ public IntPtr eng_name;
+
+ public IntPtr native_name;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string iso639_1;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string iso639_2;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string iso639_2b;
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs b/win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs
new file mode 100644
index 000000000..c63fde326
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Helpers/InteropUtilities.cs
@@ -0,0 +1,283 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="InteropUtilities.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>
+// Helper utilities for native interop.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Helpers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Runtime.InteropServices;
+ using System.Text;
+
+ using HandBrake.Interop.Interop.HbLib;
+
+ /// <summary>
+ /// Helper utilities for native interop.
+ /// </summary>
+ internal static class InteropUtilities
+ {
+ /// <summary>
+ /// Reads the given native structure pointer.
+ /// </summary>
+ /// <typeparam name="T">The type to convert the structure to.</typeparam>
+ /// <param name="structPtr">The pointer to the native structure.</param>
+ /// <returns>The converted structure.</returns>
+ public static T ToStructureFromPtr<T>(IntPtr structPtr)
+ {
+ return (T)Marshal.PtrToStructure(structPtr, typeof(T));
+ }
+
+ /// <summary>
+ /// Reads the given native UTF-8 string.
+ /// </summary>
+ /// <param name="stringPtr">The pointer to the string.</param>
+ /// <returns>The resulting string.</returns>
+ public static string ToStringFromUtf8Ptr(IntPtr stringPtr)
+ {
+ var data = new List<byte>();
+ var ptr = stringPtr;
+ var offset = 0;
+ while (true)
+ {
+ byte ch = Marshal.ReadByte(ptr, offset++);
+ if (ch == 0)
+ {
+ break;
+ }
+
+ data.Add(ch);
+ }
+
+ return Encoding.UTF8.GetString(data.ToArray());
+ }
+
+ /// <summary>
+ /// Creates a pointer to a UTF-8 null-terminated string.
+ /// </summary>
+ /// <param name="str">
+ /// The string to encode.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IntPtr"/>.
+ /// </returns>
+ public static IntPtr ToUtf8PtrFromString(string str)
+ {
+ byte[] bytes = Encoding.UTF8.GetBytes(str);
+ IntPtr stringPtr = Marshal.AllocHGlobal(bytes.Length + 1);
+ var offset = 0;
+ foreach (byte b in bytes)
+ {
+ Marshal.WriteByte(stringPtr, offset, b);
+ offset++;
+ }
+
+ Marshal.WriteByte(stringPtr, offset, 0);
+ return stringPtr;
+ }
+
+ /// <summary>
+ /// Converts the given native HandBrake list to a managed list.
+ /// </summary>
+ /// <typeparam name="T">The type of structure in the list.</typeparam>
+ /// <param name="listPtr">The pointer to the native list.</param>
+ /// <returns>The converted managed list.</returns>
+ public static List<T> ToListFromHandBrakeList<T>(this IntPtr listPtr)
+ {
+ List<T> returnList = new List<T>();
+ NativeList nativeList = new NativeList(listPtr);
+
+ for (int i = 0; i < nativeList.Count; i++)
+ {
+ IntPtr itemPtr = nativeList[i];
+ returnList.Add(ToStructureFromPtr<T>(itemPtr));
+ }
+
+ return returnList;
+ }
+
+ /// <summary>
+ /// Converts the HB list to a managed list of pointers.
+ /// </summary>
+ /// <param name="listPtr">The list to convert.</param>
+ /// <returns>The managed list of pointers.</returns>
+ public static List<IntPtr> ToIntPtrList(this IntPtr listPtr)
+ {
+ var returnList = new List<IntPtr>();
+ NativeList nativeList = new NativeList(listPtr);
+
+ for (int i = 0; i < nativeList.Count; i++)
+ {
+ IntPtr itemPtr = nativeList[i];
+ returnList.Add(itemPtr);
+ }
+
+ return returnList;
+ }
+
+ /// <summary>
+ /// Converts the given native array to a managed collection.
+ /// </summary>
+ /// <typeparam name="T">The type of item in the list.</typeparam>
+ /// <param name="arrayPtr">The pointer to the array.</param>
+ /// <param name="count">The number of items in the array.</param>
+ /// <returns>The converted collection.</returns>
+ public static List<T> ToListFromNativeArray<T>(IntPtr arrayPtr, int count)
+ {
+ IntPtr currentItem = arrayPtr;
+
+ var result = new List<T>();
+ for (int i = 0; i < count; i++)
+ {
+ T nativeEncoder = ToStructureFromPtr<T>(currentItem);
+ result.Add(nativeEncoder);
+
+ currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(typeof(T)));
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Takes an array pointer and converts it into a list of strings.
+ /// </summary>
+ /// <param name="arrayPtr">A pointer to a raw list of strings.</param>
+ /// <returns>The list of strings.</returns>
+ public static List<string> ToStringListFromArrayPtr(IntPtr arrayPtr)
+ {
+ if (arrayPtr == IntPtr.Zero)
+ {
+ return null;
+ }
+
+ return ToPtrListFromPtr(arrayPtr).Select(ptr => Marshal.PtrToStringAnsi(ptr)).ToList();
+ }
+
+ /// <summary>
+ /// Finds all the pointers starting at the given location and puts them in a list. Stops when it finds zero for a pointer.
+ /// </summary>
+ /// <param name="arrayPtr">The address of the list of pointers.</param>
+ /// <returns>The list of pointers.</returns>
+ public static List<IntPtr> ToPtrListFromPtr(IntPtr arrayPtr)
+ {
+ var result = new List<IntPtr>();
+ int ptrSize = Marshal.SizeOf(typeof(IntPtr));
+ IntPtr currentPtr = Marshal.ReadIntPtr(arrayPtr);
+ for (int i = 0; currentPtr != IntPtr.Zero; i++)
+ {
+ result.Add(currentPtr);
+ currentPtr = Marshal.ReadIntPtr(arrayPtr, (i + 1) * ptrSize);
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Creates a native HandBrake list from the given managed list of pointers.
+ /// </summary>
+ /// <param name="list">The managed list to convert.</param>
+ /// <returns>The converted native list.</returns>
+ public static NativeList ToHandBrakeListFromPtrList(List<IntPtr> list)
+ {
+ NativeList returnList = NativeList.CreateList();
+
+ foreach (IntPtr ptr in list)
+ {
+ returnList.Add(ptr);
+ }
+
+ return returnList;
+ }
+
+ /// <summary>
+ /// Creates a native HandBrake list from the given managed list of structures.
+ /// </summary>
+ /// <typeparam name="T">The type of structures in the list.</typeparam>
+ /// <param name="list">The managed list to convert.</param>
+ /// <returns>The converted native list.</returns>
+ public static NativeList ToHandBrakeListFromList<T>(List<T> list)
+ {
+ NativeList returnList = NativeList.CreateList();
+ foreach (T item in list)
+ {
+ IntPtr itemPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(T)));
+ returnList.AllocatedMemory.Add(itemPtr);
+ Marshal.StructureToPtr(item, itemPtr, false);
+
+ returnList.Add(itemPtr);
+ }
+
+ return returnList;
+ }
+
+ /// <summary>
+ /// Reads in a list of objects given an iterator and a conversion function.
+ /// </summary>
+ /// <typeparam name="T1">The type of the struct given by the iterator.</typeparam>
+ /// <typeparam name="T2">The object type to convert to.</typeparam>
+ /// <param name="iterator">The iterator to use to build the list.</param>
+ /// <param name="converter">The converter to convert from the struct to the object.</param>
+ /// <returns>The list of objects.</returns>
+ public static List<T2> ToListFromIterator<T1, T2>(Func<IntPtr, IntPtr> iterator, Func<T1, T2> converter)
+ {
+ return ToListFromIterator<T1>(iterator).Select(converter).ToList();
+ }
+
+ /// <summary>
+ /// Reads in a list of structs given an iterator.
+ /// </summary>
+ /// <typeparam name="T">The type of the struct.</typeparam>
+ /// <param name="iterator">The iterator to use to build the list.</param>
+ /// <returns>The list of structs.</returns>
+ public static List<T> ToListFromIterator<T>(Func<IntPtr, IntPtr> iterator)
+ {
+ var structureList = new List<T>();
+ IntPtr current = IntPtr.Zero;
+
+ current = iterator(current);
+ while (current != IntPtr.Zero)
+ {
+ T encoder = ToStructureFromPtr<T>(current);
+ structureList.Add(encoder);
+
+ current = iterator(current);
+ }
+
+ return structureList;
+ }
+
+ /// <summary>
+ /// Closes the given job.
+ /// </summary>
+ /// <param name="nativeJobPtr">The pointer to the job.</param>
+ public static void CloseJob(IntPtr nativeJobPtr)
+ {
+ // Create a point to the job pointer first.
+ IntPtr nativeJobPtrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
+
+ // 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);
+
+ // Free the pointer we used.
+ Marshal.FreeHGlobal(nativeJobPtrPtr);
+ }
+
+ /// <summary>
+ /// Frees all the memory locations in the given list.
+ /// </summary>
+ /// <param name="memoryList">The list of memory locations to free.</param>
+ public static void FreeMemory(List<IntPtr> memoryList)
+ {
+ foreach (IntPtr memoryLocation in memoryList)
+ {
+ Marshal.FreeHGlobal(memoryLocation);
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs b/win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs
new file mode 100644
index 000000000..dc0f9c3db
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Helpers/NativeList.cs
@@ -0,0 +1,127 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="NativeList.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>
+// Represents a HandBrake style native list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Helpers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.Interop.Interop.HbLib;
+
+ /// <summary>
+ /// Represents a HandBrake style native list.
+ /// </summary>
+ internal class NativeList : IDisposable
+ {
+ /// <summary>
+ /// Initializes a new instance of the NativeList class.
+ /// </summary>
+ /// <param name="listPtr">The pointer to use for the list.</param>
+ public NativeList(IntPtr listPtr)
+ {
+ this.Ptr = listPtr;
+ }
+
+ /// <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.
+ /// </summary>
+ public IntPtr Ptr { get; private set; }
+
+ /// <summary>
+ /// Gets the number of items in the list.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ Debug.WriteLine("Got a Zero Pointer in the NativeList");
+ return this.Ptr == IntPtr.Zero ? 0 : HBFunctions.hb_list_count(this.Ptr);
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of native memory locations allocated for this list.
+ /// </summary>
+ public List<IntPtr> AllocatedMemory
+ {
+ get
+ {
+ return this.allocatedMemory;
+ }
+ }
+
+ /// <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);
+ }
+
+ /// <summary>
+ /// Inserts an item into the list.
+ /// </summary>
+ /// <param name="position">The index to insert the item at.</param>
+ /// <param name="item">The item to insert.</param>
+ public void Insert(int position, IntPtr item)
+ {
+ HBFunctions.hb_list_insert(this.Ptr, position, item);
+ }
+
+ /// <summary>
+ /// Removes an item from the list.
+ /// </summary>
+ /// <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);
+ }
+ }
+
+ /// <summary>
+ /// Disposes resources associated with this object.
+ /// </summary>
+ public void Dispose()
+ {
+ IntPtr listPtrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
+ Marshal.WriteIntPtr(listPtrPtr, this.Ptr);
+ HBFunctions.hb_list_close(listPtrPtr);
+ Marshal.FreeHGlobal(listPtrPtr);
+ }
+
+ /// <summary>
+ /// Creates a new list in unmanaged memory.
+ /// </summary>
+ /// <returns>The created list.</returns>
+ public static NativeList CreateList()
+ {
+ 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
new file mode 100644
index 000000000..369216023
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Helpers/Utilities.cs
@@ -0,0 +1,49 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Utilities.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>
+// Defines the Utilities type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Helpers
+{
+ /// <summary>
+ /// The utilities.
+ /// </summary>
+ internal static class Utilities
+ {
+ /// <summary>
+ /// Get the Greatest Common Factor
+ /// </summary>
+ /// <param name="a">
+ /// The a.
+ /// </param>
+ /// <param name="b">
+ /// The b.
+ /// </param>
+ /// <returns>
+ /// The greatest common factor
+ /// </returns>
+ public static int GreatestCommonFactor(int a, int b)
+ {
+ if (a == 0)
+ {
+ return b;
+ }
+
+ if (b == 0)
+ {
+ return a;
+ }
+
+ if (a > b)
+ {
+ return GreatestCommonFactor(a % b, b);
+ }
+
+ return GreatestCommonFactor(a, b % a);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs
new file mode 100644
index 000000000..7714e5222
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Interfaces/IHandBrakeInstance.cs
@@ -0,0 +1,151 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IHandBrakeInstance.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>
+// The Interface for HandBrakeInstance
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Interfaces
+{
+ using System;
+
+ using HandBrake.Interop.Interop.EventArgs;
+ using HandBrake.Interop.Interop.Json.Encode;
+ using HandBrake.Interop.Interop.Json.Scan;
+ using HandBrake.Interop.Interop.Model.Preview;
+
+ /// <summary>
+ /// The Interface for HandBrakeInstance
+ /// </summary>
+ public interface IHandBrakeInstance
+ {
+ #region Events
+
+ /// <summary>
+ /// Fires when an encode has completed.
+ /// </summary>
+ event EventHandler<EncodeCompletedEventArgs> EncodeCompleted;
+
+ /// <summary>
+ /// Fires for progress updates when encoding.
+ /// </summary>
+ event EventHandler<EncodeProgressEventArgs> EncodeProgress;
+
+ /// <summary>
+ /// Fires when a scan has completed.
+ /// </summary>
+ event EventHandler<EventArgs> ScanCompleted;
+
+ /// <summary>
+ /// Fires for progress updates when scanning.
+ /// </summary>
+ event EventHandler<ScanProgressEventArgs> ScanProgress;
+
+ #endregion
+
+ #region Properties
+
+ /// <summary>
+ /// Gets the index of the default title.
+ /// </summary>
+ int FeatureTitle { get; }
+
+ /// <summary>
+ /// Gets the list of titles on this instance.
+ /// </summary>
+ JsonScanObject Titles { get; }
+
+ /// <summary>
+ /// Gets the HandBrake version string.
+ /// </summary>
+ string Version { get; }
+
+ /// <summary>
+ /// Gets the HandBrake build number.
+ /// </summary>
+ int Build { get; }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Initializes this instance.
+ /// </summary>
+ /// <param name="verbosity">
+ /// The code for the logging verbosity to use.
+ /// </param>
+ void Initialize(int verbosity);
+
+ /// <summary>
+ /// Frees any resources associated with this object.
+ /// </summary>
+ void Dispose();
+
+ /// <summary>
+ /// Gets an image for the given job and preview
+ /// </summary>
+ /// <remarks>
+ /// Only incorporates sizing and aspect ratio into preview image.
+ /// </remarks>
+ /// <param name="job">
+ /// The encode job to preview.
+ /// </param>
+ /// <param name="previewNumber">
+ /// The index of the preview to get (0-based).
+ /// </param>
+ /// <param name="deinterlace">
+ /// True to enable basic deinterlace of preview images.
+ /// </param>
+ /// <returns>
+ /// An image with the requested preview.
+ /// </returns>
+ RawPreviewData GetPreview(PreviewSettings job, int previewNumber, bool deinterlace);
+
+ /// <summary>
+ /// Pauses the current encode.
+ /// </summary>
+ void PauseEncode();
+
+ /// <summary>
+ /// Resumes a paused encode.
+ /// </summary>
+ void ResumeEncode();
+
+ /// <summary>
+ /// Starts an encode with the given job.
+ /// </summary>
+ /// <param name="jobToStart">
+ /// The job to start.
+ /// </param>
+ void StartEncode(JsonEncodeObject jobToStart);
+
+ /// <summary>
+ /// Starts a scan of the given path.
+ /// </summary>
+ /// <param name="path">
+ /// The path of the video to scan.
+ /// </param>
+ /// <param name="previewCount">
+ /// The number of previews to make on each title.
+ /// </param>
+ /// <param name="minDuration">
+ /// The min Duration.
+ /// </param>
+ void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex);
+
+ /// <summary>
+ /// Stops the current encode.
+ /// </summary>
+ void StopEncode();
+
+ /// <summary>
+ /// Stop any running scans
+ /// </summary>
+ void StopScan();
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs
new file mode 100644
index 000000000..6f6714caa
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/AnamorphicGeometry.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AnamorphicGeometry.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>
+// The geometry.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Anamorphic
+{
+ using HandBrake.Interop.Interop.Json.Shared;
+
+ /// <summary>
+ /// The geometry.
+ /// </summary>
+ public class AnamorphicGeometry
+ {
+ /// <summary>
+ /// Gets or sets the dest geometry.
+ /// </summary>
+ public DestSettings DestSettings { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source geometry.
+ /// </summary>
+ public Geometry SourceGeometry { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs
new file mode 100644
index 000000000..99f38439b
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Anamorphic/DestSettings.cs
@@ -0,0 +1,69 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DestSettings.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>
+// The dest geometry.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Anamorphic
+{
+ using System.Collections.Generic;
+
+ using HandBrake.Interop.Interop.Json.Shared;
+
+ /// <summary>
+ /// The dest geometry.
+ /// </summary>
+ public class DestSettings
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="DestSettings"/> class.
+ /// </summary>
+ public DestSettings()
+ {
+ this.Geometry = new Geometry();
+ }
+
+ /// <summary>
+ /// Gets or sets the anamorphic mode.
+ /// </summary>
+ public int AnamorphicMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the crop.
+ /// </summary>
+ public List<int> Crop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Geometry
+ /// </summary>
+ public Geometry Geometry { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether itu par.
+ /// </summary>
+ public bool ItuPAR { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether keep display aspect.
+ /// </summary>
+ public int Keep { get; set; }
+
+ /// <summary>
+ /// Gets or sets the max height.
+ /// </summary>
+ public int MaxHeight { get; set; }
+
+ /// <summary>
+ /// Gets or sets the max width.
+ /// </summary>
+ public int MaxWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets the modulus.
+ /// </summary>
+ public int Modulus { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs
new file mode 100644
index 000000000..924185f50
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Audio.cs
@@ -0,0 +1,34 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Audio.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>
+// The audio.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The audio.
+ /// </summary>
+ public class Audio
+ {
+ /// <summary>
+ /// Gets or sets the audio list.
+ /// </summary>
+ public List<AudioTrack> AudioList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the copy mask.
+ /// </summary>
+ public uint[] CopyMask { get; set; }
+
+ /// <summary>
+ /// Gets or sets the fallback encoder.
+ /// </summary>
+ public int FallbackEncoder { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs
new file mode 100644
index 000000000..64ef94fd7
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/AudioTrack.cs
@@ -0,0 +1,77 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioTrack.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>
+// Represents an audio track to encode.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// Represents an audio track to encode.
+ /// </summary>
+ public class AudioTrack
+ {
+ /// <summary>
+ /// Gets or sets the bitrate.
+ /// </summary>
+ public int? Bitrate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the compression level.
+ /// </summary>
+ public double? CompressionLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the drc.
+ /// </summary>
+ public double DRC { get; set; }
+
+ /// <summary>
+ /// Gets or sets the encoder.
+ /// </summary>
+ public int Encoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets the gain.
+ /// </summary>
+ public double Gain { get; set; }
+
+ /// <summary>
+ /// Gets or sets the mixdown.
+ /// </summary>
+ public int Mixdown { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether normalize mix level.
+ /// </summary>
+ public bool NormalizeMixLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the quality.
+ /// </summary>
+ public double? Quality { get; set; }
+
+ /// <summary>
+ /// Gets or sets the samplerate.
+ /// </summary>
+ public int Samplerate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Name of the audio track.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the track.
+ /// </summary>
+ public int Track { get; set; }
+
+ /// <summary>
+ /// Gets or sets the dither method.
+ /// </summary>
+ public int DitherMethod { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs
new file mode 100644
index 000000000..ae8924e5d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Chapter.cs
@@ -0,0 +1,22 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Chapter.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>
+// Represents a chapter to encode.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// Represents a chapter to encode.
+ /// </summary>
+ public class Chapter
+ {
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs
new file mode 100644
index 000000000..0d8b2daeb
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Destination.cs
@@ -0,0 +1,49 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Destination.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>
+// The destination.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The destination.
+ /// </summary>
+ public class Destination
+ {
+ /// <summary>
+ /// Gets or sets the chapter list.
+ /// </summary>
+ public List<Chapter> ChapterList { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether chapter markers.
+ /// </summary>
+ public bool ChapterMarkers { get; set; }
+
+ /// <summary>
+ /// Use Legacy A/V Alignment rather than Edit Lists.
+ /// </summary>
+ public bool AlignAVStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the file.
+ /// </summary>
+ public string File { get; set; }
+
+ /// <summary>
+ /// Gets or sets the mp 4 options.
+ /// </summary>
+ public Mp4Options Mp4Options { get; set; }
+
+ /// <summary>
+ /// Gets or sets the mux.
+ /// </summary>
+ public int Mux { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs
new file mode 100644
index 000000000..9cd5161ac
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filter.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Filter.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>
+// The filter list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ using Newtonsoft.Json.Linq;
+
+ /// <summary>
+ /// The filter list.
+ /// </summary>
+ public class Filter
+ {
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int ID { get; set; }
+
+ /// <summary>
+ /// Gets or sets the settings.
+ /// </summary>
+ public JToken Settings { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs
new file mode 100644
index 000000000..9c664cfa5
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Filters.cs
@@ -0,0 +1,24 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Filters.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>
+// The filter.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The filter.
+ /// </summary>
+ public class Filters
+ {
+ /// <summary>
+ /// Gets or sets the filter list.
+ /// </summary>
+ public List<Filter> FilterList { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs
new file mode 100644
index 000000000..fa3d26c26
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/JsonEncodeObject.cs
@@ -0,0 +1,64 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="JsonEncodeObject.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>
+// The root object.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ using HandBrake.Interop.Interop.Json.Shared;
+
+ /// <summary>
+ /// The root object.
+ /// </summary>
+ public class JsonEncodeObject
+ {
+ /// <summary>
+ /// Gets or sets the audio.
+ /// </summary>
+ public Audio Audio { get; set; }
+
+ /// <summary>
+ /// Gets or sets the destination.
+ /// </summary>
+ public Destination Destination { get; set; }
+
+ /// <summary>
+ /// Gets or sets the filter.
+ /// </summary>
+ public Filters Filters { get; set; }
+
+ /// <summary>
+ /// Gets or sets the PAR
+ /// </summary>
+ public PAR PAR { get; set; }
+
+ /// <summary>
+ /// Gets or sets the meta data.
+ /// </summary>
+ public Metadata Metadata { get; set; }
+
+ /// <summary>
+ /// Gets or sets the sequence id.
+ /// </summary>
+ public int SequenceID { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source.
+ /// </summary>
+ public Source Source { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle.
+ /// </summary>
+ public Subtitles Subtitle { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video.
+ /// </summary>
+ public Video Video { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs
new file mode 100644
index 000000000..adf82c09c
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Metadata.cs
@@ -0,0 +1,62 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Metadata.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>
+// The meta data.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The meta data.
+ /// </summary>
+ public class Metadata
+ {
+ /// <summary>
+ /// Gets or sets the album artist.
+ /// </summary>
+ public string AlbumArtist { get; set; }
+
+ /// <summary>
+ /// Gets or sets the artist.
+ /// </summary>
+ public string Artist { get; set; }
+
+ /// <summary>
+ /// Gets or sets the comment.
+ /// </summary>
+ public string Comment { get; set; }
+
+ /// <summary>
+ /// Gets or sets the composer.
+ /// </summary>
+ public string Composer { get; set; }
+
+ /// <summary>
+ /// Gets or sets the description.
+ /// </summary>
+ public string Description { get; set; }
+
+ /// <summary>
+ /// Gets or sets the genre.
+ /// </summary>
+ public string Genre { get; set; }
+
+ /// <summary>
+ /// Gets or sets the long description.
+ /// </summary>
+ public string LongDescription { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the release date.
+ /// </summary>
+ public string ReleaseDate { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs
new file mode 100644
index 000000000..2dc833375
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Mp4Options.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Mp4Options.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>
+// The mp 4 options.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The mp 4 options.
+ /// </summary>
+ public class Mp4Options
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether ipod atom.
+ /// </summary>
+ public bool IpodAtom { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether mp 4 optimize.
+ /// </summary>
+ public bool Mp4Optimize { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs
new file mode 100644
index 000000000..64286ab28
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/QSV.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QSV.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>
+// The qsv.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The qsv.
+ /// </summary>
+ public class QSV
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether decode.
+ /// </summary>
+ public bool Decode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the async depth.
+ /// </summary>
+ public int AsyncDepth { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs
new file mode 100644
index 000000000..2327e359f
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Range.cs
@@ -0,0 +1,38 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Range.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>
+// The range.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The range.
+ /// </summary>
+ public class Range
+ {
+ /// <summary>
+ /// Gets or sets the chapter end.
+ /// Type is "chapter", "time", "frame", or "preview".
+ /// </summary>
+ public string Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter start.
+ /// </summary>
+ public long? Start { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frame to start.
+ /// </summary>
+ public long? End { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seek points.
+ /// </summary>
+ public long? SeekPoints { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/SRT.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/SRT.cs
new file mode 100644
index 000000000..96f42a52f
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/SRT.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SRT.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>
+// The srt.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The srt.
+ /// </summary>
+ public class SRT
+ {
+ /// <summary>
+ /// Gets or sets the codeset.
+ /// </summary>
+ public string Codeset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the filename.
+ /// </summary>
+ public string Filename { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language.
+ /// </summary>
+ public string Language { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs
new file mode 100644
index 000000000..7f156c0c6
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Source.cs
@@ -0,0 +1,37 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Source.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>
+// The source.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The source.
+ /// </summary>
+ public class Source
+ {
+ /// <summary>
+ /// Gets or sets the angle.
+ /// </summary>
+ public int Angle { get; set; }
+
+ /// <summary>
+ /// Gets or sets the range.
+ /// </summary>
+ public Range Range { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title.
+ /// </summary>
+ public int Title { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ public string Path { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs
new file mode 100644
index 000000000..28558f48b
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleSearch.cs
@@ -0,0 +1,37 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleSearch.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>
+// The search.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The search.
+ /// </summary>
+ public class SubtitleSearch
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether burn.
+ /// </summary>
+ public bool Burn { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether default.
+ /// </summary>
+ public bool Default { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether enable.
+ /// </summary>
+ public bool Enable { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether forced.
+ /// </summary>
+ public bool Forced { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs
new file mode 100644
index 000000000..ab51a1db9
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/SubtitleTrack.cs
@@ -0,0 +1,52 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleTrack.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>
+// Represents a subtitle track to encode.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// Represents a subtitle track to encode.
+ /// </summary>
+ public class SubtitleTrack
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether burn.
+ /// </summary>
+ public bool Burn { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether default.
+ /// </summary>
+ public bool Default { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether force.
+ /// </summary>
+ public bool Forced { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int ID { get; set; }
+
+ /// <summary>
+ /// Gets or sets the offset.
+ /// </summary>
+ public int Offset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the track.
+ /// </summary>
+ public int Track { get; set; }
+
+ /// <summary>
+ /// Gets or sets the srt.
+ /// </summary>
+ public SRT SRT { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs
new file mode 100644
index 000000000..8c565d185
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Subtitles.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Subtitles.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>
+// The subtitle.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The subtitle.
+ /// </summary>
+ public class Subtitles
+ {
+ /// <summary>
+ /// Gets or sets the search.
+ /// </summary>
+ public SubtitleSearch Search { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle list.
+ /// </summary>
+ public List<SubtitleTrack> SubtitleList { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs b/win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs
new file mode 100644
index 000000000..f77c0d335
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Encode/Video.cs
@@ -0,0 +1,90 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Video.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>
+// The video.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Encode
+{
+ /// <summary>
+ /// The video.
+ /// </summary>
+ public class Video
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Video"/> class.
+ /// </summary>
+ public Video()
+ {
+ this.QSV = new QSV();
+ }
+
+ /// <summary>
+ /// Gets or sets the codec.
+ /// </summary>
+ public int Encoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets the level.
+ /// </summary>
+ public string Level { get; set; }
+
+ /// <summary>
+ /// Gets or sets the bitrate for the encode.
+ /// </summary>
+ public int? Bitrate { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether two pass.
+ /// </summary>
+ public bool TwoPass { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether Turbo First Pass. For x264/5
+ /// </summary>
+ public bool Turbo { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Colour Matrix Code
+ /// </summary>
+ public int ColorMatrixCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the options.
+ /// </summary>
+ public string Options { get; set; }
+
+ /// <summary>
+ /// Gets or sets the preset.
+ /// </summary>
+ public string Preset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the profile.
+ /// </summary>
+ public string Profile { get; set; }
+
+ /// <summary>
+ /// Gets or sets the quality.
+ /// </summary>
+ public double? Quality { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tune.
+ /// </summary>
+ public string Tune { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether hw decode.
+ /// </summary>
+ public bool HWDecode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the qsv.
+ /// </summary>
+ public QSV QSV { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs b/win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs
new file mode 100644
index 000000000..ad7648901
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Filters/PresetTune.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PresetTune.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>
+// Defines the PresetTune type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Filters
+{
+ /// <summary>
+ /// The preset tune.
+ /// </summary>
+ public class PresetTune
+ {
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string Short_Name { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs
new file mode 100644
index 000000000..49f875de9
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/AudioList.cs
@@ -0,0 +1,72 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioList.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>
+// The audio list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Presets
+{
+ /// <summary>
+ /// The audio list.
+ /// </summary>
+ public class AudioList
+ {
+ /// <summary>
+ /// Gets or sets the audio bitrate.
+ /// </summary>
+ public int AudioBitrate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio compression level.
+ /// </summary>
+ public double AudioCompressionLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio dither method.
+ /// </summary>
+ public string AudioDitherMethod { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio encoder.
+ /// </summary>
+ public string AudioEncoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio mixdown. (ShortName)
+ /// </summary>
+ public string AudioMixdown { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether audio normalize mix level.
+ /// </summary>
+ public bool AudioNormalizeMixLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio samplerate.
+ /// </summary>
+ public string AudioSamplerate { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether audio track quality enable.
+ /// </summary>
+ public bool AudioTrackQualityEnable { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio track quality.
+ /// </summary>
+ public double AudioTrackQuality { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio track gain slider.
+ /// </summary>
+ public double AudioTrackGainSlider { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio track drc slider.
+ /// </summary>
+ public double AudioTrackDRCSlider { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs
new file mode 100644
index 000000000..2ea758d5d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/HBPreset.cs
@@ -0,0 +1,416 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBPreset.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>
+// The preset.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Presets
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The preset.
+ /// </summary>
+ public class HBPreset
+ {
+ public bool AlignAVStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio copy mask.
+ /// </summary>
+ public List<string> AudioCopyMask { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio encoder fallback.
+ /// </summary>
+ public string AudioEncoderFallback { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio language list.
+ /// </summary>
+ public List<string> AudioLanguageList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio list.
+ /// </summary>
+ public List<AudioList> AudioList { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether audio secondary encoder mode.
+ /// </summary>
+ public bool AudioSecondaryEncoderMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio track selection behavior.
+ /// </summary>
+ public string AudioTrackSelectionBehavior { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether chapter markers.
+ /// </summary>
+ public bool ChapterMarkers { get; set; }
+
+ /// <summary>
+ /// Gets or sets the children array.
+ /// </summary>
+ public List<object> ChildrenArray { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether default.
+ /// </summary>
+ public bool Default { get; set; }
+
+ /// <summary>
+ /// Gets or sets the file format.
+ /// </summary>
+ public string FileFormat { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether folder.
+ /// </summary>
+ public bool Folder { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether folder open.
+ /// </summary>
+ public bool FolderOpen { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether mp 4 http optimize.
+ /// </summary>
+ public bool Mp4HttpOptimize { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether mp 4 i pod compatible.
+ /// </summary>
+ public bool Mp4iPodCompatible { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether picture auto crop.
+ /// </summary>
+ public bool PictureAutoCrop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture bottom crop.
+ /// </summary>
+ public int PictureBottomCrop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture left crop.
+ /// </summary>
+ public int PictureLeftCrop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture right crop.
+ /// </summary>
+ public int PictureRightCrop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture top crop.
+ /// </summary>
+ public int PictureTopCrop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture dar width.
+ /// </summary>
+ public int PictureDARWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture deblock.
+ /// </summary>
+ public int PictureDeblock { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether picture decomb deinterlace.
+ /// </summary>
+ public string PictureDeinterlaceFilter { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture comb detect preset.
+ /// </summary>
+ public string PictureCombDetectPreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture comb detect custom.
+ /// </summary>
+ public string PictureCombDetectCustom { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture deinterlace preset.
+ /// </summary>
+ public string PictureDeinterlacePreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture deinterlace custom.
+ /// </summary>
+ public string PictureDeinterlaceCustom { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture denoise custom.
+ /// </summary>
+ public string PictureDenoiseCustom { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture denoise filter.
+ /// </summary>
+ public string PictureDenoiseFilter { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture denoise preset.
+ /// </summary>
+ public string PictureDenoisePreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture denoise tune.
+ /// </summary>
+ public string PictureDenoiseTune { get; set; }
+
+ public string PictureSharpenCustom { get; set; }
+ public string PictureSharpenFilter { get; set; }
+ public string PictureSharpenPreset { get; set; }
+ public string PictureSharpenTune { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture detelecine.
+ /// </summary>
+ public string PictureDetelecine { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture detelecine custom.
+ /// </summary>
+ public string PictureDetelecineCustom { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether picture itu par.
+ /// </summary>
+ public bool PictureItuPAR { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether picture keep ratio.
+ /// </summary>
+ public bool PictureKeepRatio { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether picture loose crop.
+ /// </summary>
+ public bool PictureLooseCrop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture modulus.
+ /// </summary>
+ public int PictureModulus { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture par.
+ /// </summary>
+ public string PicturePAR { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture par width.
+ /// </summary>
+ public int PicturePARWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture par height.
+ /// </summary>
+ public int PicturePARHeight { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture rotate.
+ /// </summary>
+ public string PictureRotate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture width.
+ /// </summary>
+ public int? PictureWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture height.
+ /// </summary>
+ public int? PictureHeight { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture force height.
+ /// </summary>
+ public int PictureForceHeight { get; set; }
+
+ /// <summary>
+ /// Gets or sets the picture force width.
+ /// </summary>
+ public int PictureForceWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets the preset description.
+ /// </summary>
+ public string PresetDescription { get; set; }
+
+ /// <summary>
+ /// Gets or sets the preset name.
+ /// </summary>
+ public string PresetName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type.
+ /// </summary>
+ public int Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether uses picture filters.
+ /// </summary>
+ public bool UsesPictureFilters { get; set; }
+
+ /// <summary>
+ /// Gets or sets the uses picture settings.
+ /// </summary>
+ public int UsesPictureSettings { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether subtitle add cc.
+ /// </summary>
+ public bool SubtitleAddCC { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether subtitle add foreign audio search.
+ /// </summary>
+ public bool SubtitleAddForeignAudioSearch { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether subtitle add foreign audio subtitle.
+ /// </summary>
+ public bool SubtitleAddForeignAudioSubtitle { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle burn behavior.
+ /// </summary>
+ public string SubtitleBurnBehavior { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether subtitle burn bd sub.
+ /// </summary>
+ public bool SubtitleBurnBDSub { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether subtitle burn dvd sub.
+ /// </summary>
+ public bool SubtitleBurnDVDSub { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle language list.
+ /// </summary>
+ public List<string> SubtitleLanguageList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle track selection behavior.
+ /// </summary>
+ public string SubtitleTrackSelectionBehavior { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video avg bitrate.
+ /// </summary>
+ public int? VideoAvgBitrate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video color matrix code.
+ /// </summary>
+ public int VideoColorMatrixCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video encoder.
+ /// </summary>
+ public string VideoEncoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video framerate.
+ /// </summary>
+ public string VideoFramerate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video framerate mode.
+ /// </summary>
+ public string VideoFramerateMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether video gray scale.
+ /// </summary>
+ public bool VideoGrayScale { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether video hw decode.
+ /// </summary>
+ public bool VideoHWDecode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video scaler.
+ /// </summary>
+ public string VideoScaler { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video preset.
+ /// </summary>
+ public string VideoPreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video tune.
+ /// </summary>
+ public string VideoTune { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video profile.
+ /// </summary>
+ public string VideoProfile { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video level.
+ /// </summary>
+ public string VideoLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video option extra.
+ /// </summary>
+ public string VideoOptionExtra { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video quality type.
+ /// </summary>
+ public int VideoQualityType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video quality slider.
+ /// </summary>
+ public double VideoQualitySlider { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether video qsv decode.
+ /// </summary>
+ public bool VideoQSVDecode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video qsv async depth.
+ /// </summary>
+ public int VideoQSVAsyncDepth { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether video two pass.
+ /// </summary>
+ public bool VideoTwoPass { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether video turbo two pass.
+ /// </summary>
+ public bool VideoTurboTwoPass { get; set; }
+
+ /// <summary>
+ /// Gets or sets the x 264 option.
+ /// </summary>
+ public string x264Option { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether x 264 use advanced options.
+ /// </summary>
+ public bool x264UseAdvancedOptions { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetCategory.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetCategory.cs
new file mode 100644
index 000000000..2cab7d25d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetCategory.cs
@@ -0,0 +1,44 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PresetCategory.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>
+// The preset category.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Presets
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The preset category.
+ /// </summary>
+ public class PresetCategory
+ {
+ /// <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/Presets/PresetTransportContainer.cs b/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs
new file mode 100644
index 000000000..91ce48de5
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Presets/PresetTransportContainer.cs
@@ -0,0 +1,67 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PresetTransportContainer.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>
+// The preset transport container.
+// This is a model for importing the JSON / Plist presets into the GUI.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Presets
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The preset transport container.
+ /// This is a model for importing the JSON / Plist presets into the GUI.
+ /// </summary>
+ public class PresetTransportContainer
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PresetTransportContainer"/> class.
+ /// </summary>
+ public PresetTransportContainer()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PresetTransportContainer"/> class.
+ /// </summary>
+ /// <param name="versionMajor">
+ /// The version major.
+ /// </param>
+ /// <param name="versionMinor">
+ /// The version minor.
+ /// </param>
+ /// <param name="versionMicro">
+ /// The version micro.
+ /// </param>
+ public PresetTransportContainer(string versionMajor, string versionMinor, string versionMicro)
+ {
+ this.VersionMajor = versionMajor;
+ this.VersionMicro = versionMicro;
+ this.VersionMinor = versionMinor;
+ }
+
+ /// <summary>
+ /// Gets or sets the children array.
+ /// </summary>
+ public List<object> PresetList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the version major.
+ /// </summary>
+ public string VersionMajor { get; set; }
+
+ /// <summary>
+ /// Gets or sets the version micro.
+ /// </summary>
+ public string VersionMicro { get; set; }
+
+ /// <summary>
+ /// Gets or sets the version minor.
+ /// </summary>
+ public string VersionMinor { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs b/win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs
new file mode 100644
index 000000000..e7a1da64e
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Queue/Task.cs
@@ -0,0 +1,24 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Task.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>
+// The task.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Queue
+{
+ using HandBrake.Interop.Interop.Json.Encode;
+
+ /// <summary>
+ /// The task.
+ /// </summary>
+ public class Task
+ {
+ /// <summary>
+ /// Gets or sets the job.
+ /// </summary>
+ public JsonEncodeObject Job { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs
new file mode 100644
index 000000000..96c6b9065
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/AudioAttributes.cs
@@ -0,0 +1,21 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioAttributes.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>
+// The color.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+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
new file mode 100644
index 000000000..65af225c7
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/Color.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Color.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>
+// The color.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ /// <summary>
+ /// The color.
+ /// </summary>
+ public class Color
+ {
+ /// <summary>
+ /// Gets or sets the matrix.
+ /// </summary>
+ public int Matrix { get; set; }
+
+ /// <summary>
+ /// Gets or sets the primary.
+ /// </summary>
+ public int Primary { get; set; }
+
+ /// <summary>
+ /// Gets or sets the transfer.
+ /// </summary>
+ public int Transfer { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs
new file mode 100644
index 000000000..533ec05ae
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/Duration.cs
@@ -0,0 +1,37 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Duration.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>
+// The duration.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ /// <summary>
+ /// The duration.
+ /// </summary>
+ public class Duration
+ {
+ /// <summary>
+ /// Gets or sets the hours.
+ /// </summary>
+ public int Hours { get; set; }
+
+ /// <summary>
+ /// Gets or sets the minutes.
+ /// </summary>
+ public int Minutes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds.
+ /// </summary>
+ public int Seconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the ticks.
+ /// </summary>
+ public long Ticks { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs
new file mode 100644
index 000000000..04fa33c37
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/FrameRate.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="FrameRate.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>
+// The frame rate.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ /// <summary>
+ /// The frame rate.
+ /// </summary>
+ public class FrameRate
+ {
+ /// <summary>
+ /// Gets or sets the den.
+ /// </summary>
+ public int Den { get; set; }
+
+ /// <summary>
+ /// Gets or sets the num.
+ /// </summary>
+ public int Num { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs
new file mode 100644
index 000000000..cc19e4923
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/JsonScanObject.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="JsonScanObject.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>
+// The root object.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The root object.
+ /// </summary>
+ public class JsonScanObject
+ {
+ /// <summary>
+ /// Gets or sets the main feature.
+ /// </summary>
+ public int MainFeature { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title list.
+ /// </summary>
+ public List<SourceTitle> TitleList { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs
new file mode 100644
index 000000000..e0d9bafd8
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceAudioTrack.cs
@@ -0,0 +1,62 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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
+ {
+ /// <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; }
+ }
+} \ 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
new file mode 100644
index 000000000..02e83fe1d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceChapter.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceChapter.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>
+// The a chapter from a video source.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ /// <summary>
+ /// The a chapter from a video source.
+ /// </summary>
+ public class SourceChapter
+ {
+ /// <summary>
+ /// Gets or sets the duration.
+ /// </summary>
+ public Duration Duration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs
new file mode 100644
index 000000000..240635cc6
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceMetadata.cs
@@ -0,0 +1,18 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceMetadata.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>
+// The meta data.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ /// <summary>
+ /// The meta data.
+ /// </summary>
+ public class SourceMetadata
+ {
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceSubtitleTrack.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceSubtitleTrack.cs
new file mode 100644
index 000000000..eaeda2a69
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceSubtitleTrack.cs
@@ -0,0 +1,44 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceSubtitleTrack.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>
+// The subtitle list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ /// <summary>
+ /// The subtitle list.
+ /// </summary>
+ public class SourceSubtitleTrack
+ {
+ /// <summary>
+ /// Gets or sets the format.
+ /// </summary>
+ public string Format { 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 source.
+ /// </summary>
+ public int Source { get; set; }
+
+ public string SourceName { get; set; }
+
+ /// <summary>
+ /// Gets or sets subtitle attribute information.
+ /// </summary>
+ public SubtitleAttributes Attributes { 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
new file mode 100644
index 000000000..4fd5232ff
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SourceTitle.cs
@@ -0,0 +1,112 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceTitle.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>
+// The title list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ using System.Collections.Generic;
+
+ using HandBrake.Interop.Interop.Json.Shared;
+
+ /// <summary>
+ /// The title list.
+ /// </summary>
+ public class SourceTitle
+ {
+ /// <summary>
+ /// Gets or sets the angle count.
+ /// </summary>
+ public int AngleCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio list.
+ /// </summary>
+ public List<SourceAudioTrack> AudioList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter list.
+ /// </summary>
+ public List<SourceChapter> ChapterList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the color.
+ /// </summary>
+ public Color Color { get; set; }
+
+ /// <summary>
+ /// Gets or sets the input file container.
+ /// </summary>
+ public string Container { get; set; }
+
+ /// <summary>
+ /// Gets or sets the cropping values
+ /// </summary>
+ public List<int> Crop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the duration.
+ /// </summary>
+ public Duration Duration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frame rate.
+ /// </summary>
+ public FrameRate FrameRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the geometry.
+ /// </summary>
+ public Geometry Geometry { get; set; }
+
+ /// <summary>
+ /// Gets or sets the index.
+ /// </summary>
+ public int Index { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether interlace detected.
+ /// </summary>
+ public bool InterlaceDetected { get; set; }
+
+ /// <summary>
+ /// Gets or sets the meta data.
+ /// </summary>
+ public SourceMetadata MetaData { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ public string Path { get; set; }
+
+ /// <summary>
+ /// Gets or sets the playlist.
+ /// </summary>
+ public int Playlist { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle list.
+ /// </summary>
+ public List<SourceSubtitleTrack> SubtitleList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type.
+ /// HB_DVD_TYPE = 0, HB_BD_TYPE, HB_STREAM_TYPE, HB_FF_STREAM_TYPE
+ /// </summary>
+ public int Type { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video codec.
+ /// </summary>
+ public string VideoCodec { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs b/win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs
new file mode 100644
index 000000000..07ac8b032
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Scan/SubtitleAttributes.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleAttributes.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>
+// The color.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Scan
+{
+ using Newtonsoft.Json;
+
+ public class SubtitleAttributes
+ {
+ [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
new file mode 100644
index 000000000..5632b3736
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Shared/Geometry.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Geometry.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>
+// The geometry.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Shared
+{
+ /// <summary>
+ /// The geometry.
+ /// </summary>
+ public class Geometry
+ {
+ /// <summary>
+ /// Gets or sets the height.
+ /// </summary>
+ public int Height { get; set; }
+
+ /// <summary>
+ /// Gets or sets the par.
+ /// </summary>
+ public PAR PAR { get; set; }
+
+ /// <summary>
+ /// Gets or sets the width.
+ /// </summary>
+ public int Width { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs b/win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs
new file mode 100644
index 000000000..075c26672
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/Shared/PAR.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PAR.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>
+// The par.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.Shared
+{
+ /// <summary>
+ /// The par.
+ /// </summary>
+ public class PAR
+ {
+ /// <summary>
+ /// Gets or sets the Number.
+ /// </summary>
+ public int Num { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Denominator.
+ /// </summary>
+ public int Den { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/JsonState.cs b/win/CS/HandBrake.Interop/Interop/Json/State/JsonState.cs
new file mode 100644
index 000000000..6f8513671
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/State/JsonState.cs
@@ -0,0 +1,37 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="JsonState.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>
+// The hand brake state.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.State
+{
+ /// <summary>
+ /// The hand brake state.
+ /// </summary>
+ public class JsonState
+ {
+ /// <summary>
+ /// Gets or sets the scanning.
+ /// </summary>
+ public Scanning Scanning { get; set; }
+
+ /// <summary>
+ /// Gets or sets the working.
+ /// </summary>
+ public Working Working { get; set; }
+
+ /// <summary>
+ /// Gets or sets the work done.
+ /// </summary>
+ public WorkDone WorkDone { get; set; }
+
+ /// <summary>
+ /// Gets or sets the state.
+ /// </summary>
+ public string State { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs b/win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs
new file mode 100644
index 000000000..4f3cfb22d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/State/Scanning.cs
@@ -0,0 +1,42 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Scanning.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>
+// The scanning.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.State
+{
+ /// <summary>
+ /// The scanning.
+ /// </summary>
+ public class Scanning
+ {
+ /// <summary>
+ /// Gets or sets the preview.
+ /// </summary>
+ public int Preview { get; set; }
+
+ /// <summary>
+ /// Gets or sets the preview count.
+ /// </summary>
+ public int PreviewCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the progress.
+ /// </summary>
+ public double Progress { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title.
+ /// </summary>
+ public int Title { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title count.
+ /// </summary>
+ public int TitleCount { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs b/win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs
new file mode 100644
index 000000000..5d0f5f92f
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/State/TaskState.cs
@@ -0,0 +1,59 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="TaskState.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>
+// The status of the current task being processed.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.State
+{
+ using System.Collections.Generic;
+
+ public class TaskState
+ {
+ public static TaskState Idle = new TaskState("IDLE");
+ public static TaskState Scanning = new TaskState("SCANNING");
+ public static TaskState ScanDone = new TaskState("SCANDONE");
+ public static TaskState Working = new TaskState("WORKING");
+ public static TaskState Paused = new TaskState("PAUSED");
+ public static TaskState Searching = new TaskState("SEARCHING");
+ public static TaskState WorkDone = new TaskState("WORKDONE");
+ 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);
+ }
+
+ public TaskState(string code)
+ {
+ this.Code = code;
+ }
+
+ public string Code { get; }
+
+ public static TaskState FromRepositoryValue(string code)
+ {
+ TaskState state = null;
+ if (taskStates.TryGetValue(code, out state))
+ {
+ return state;
+ }
+
+ return null;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs b/win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs
new file mode 100644
index 000000000..aa821f286
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/State/WorkDone.cs
@@ -0,0 +1,22 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="WorkDone.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>
+// The work done.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.State
+{
+ /// <summary>
+ /// The work done.
+ /// </summary>
+ public class WorkDone
+ {
+ /// <summary>
+ /// Gets or sets the error.
+ /// </summary>
+ public int Error { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Json/State/Working.cs b/win/CS/HandBrake.Interop/Interop/Json/State/Working.cs
new file mode 100644
index 000000000..a1b7fb0e5
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Json/State/Working.cs
@@ -0,0 +1,73 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Working.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>
+// The working.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Json.State
+{
+ /// <summary>
+ /// The working.
+ /// </summary>
+ public class Working
+ {
+ /// <summary>
+ /// Gets or sets the hours.
+ /// </summary>
+ public int Hours { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Pass ID.
+ /// </summary>
+ /// <remarks>
+ /// -1: Subtitle scan
+ /// 0: Encode
+ /// 1: Encode first pass
+ /// 2: Encode second pass
+ /// </remarks>
+ public int PassID { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pass number (1-based).
+ /// </summary>
+ public int Pass { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pass count.
+ /// </summary>
+ public int PassCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the minutes.
+ /// </summary>
+ public int Minutes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the progress.
+ /// </summary>
+ public double Progress { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rate.
+ /// </summary>
+ public double Rate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rate avg.
+ /// </summary>
+ public double RateAvg { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds.
+ /// </summary>
+ public int Seconds { get; set; }
+
+ /// <summary>
+ /// Gets or sets the sequence id.
+ /// </summary>
+ public int SequenceID { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs b/win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs
new file mode 100644
index 000000000..91ee98356
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/BitrateLimits.cs
@@ -0,0 +1,42 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="BitrateLimits.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>
+// Defines the BitrateLimits type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ /// <summary>
+ /// Represents bitrate limits as a range.
+ /// </summary>
+ public class BitrateLimits
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="BitrateLimits"/> class.
+ /// </summary>
+ /// <param name="low">
+ /// The low.
+ /// </param>
+ /// <param name="high">
+ /// The high.
+ /// </param>
+ public BitrateLimits(int low, int high)
+ {
+ this.Low = low;
+ this.High = high;
+ }
+
+ /// <summary>
+ /// Gets the inclusive lower limit for the bitrate.
+ /// </summary>
+ public int Low { get; private set; }
+
+ /// <summary>
+ /// Gets the inclusive upper limit for the bitrate.
+ /// </summary>
+ public int High { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Cropping.cs b/win/CS/HandBrake.Interop/Interop/Model/Cropping.cs
new file mode 100644
index 000000000..63a1b176a
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Cropping.cs
@@ -0,0 +1,99 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Cropping.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>
+// Defines the Cropping type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ /// <summary>
+ /// The Cropping Model
+ /// </summary>
+ public class Cropping
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Cropping"/> class.
+ /// </summary>
+ public Cropping()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Cropping"/> class.
+ /// Copy Constructor
+ /// </summary>
+ /// <param name="croping">
+ /// The croping.
+ /// </param>
+ public Cropping(Cropping croping)
+ {
+ this.Top = croping.Top;
+ this.Bottom = croping.Bottom;
+ this.Left = croping.Left;
+ this.Right = croping.Right;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Cropping"/> class.
+ /// </summary>
+ /// <param name="top">
+ /// The Top Value
+ /// </param>
+ /// <param name="bottom">
+ /// The Bottom Value
+ /// </param>
+ /// <param name="left">
+ /// The Left Value
+ /// </param>
+ /// <param name="right">
+ /// The Right Value
+ /// </param>
+ public Cropping(int top, int bottom, int left, int right)
+ {
+ this.Top = top;
+ this.Bottom = bottom;
+ this.Left = left;
+ this.Right = right;
+ }
+
+ /// <summary>
+ /// Gets or sets Top.
+ /// </summary>
+ public int Top { get; set; }
+
+ /// <summary>
+ /// Gets or sets Bottom.
+ /// </summary>
+ public int Bottom { get; set; }
+
+ /// <summary>
+ /// Gets or sets Left.
+ /// </summary>
+ public int Left { get; set; }
+
+ /// <summary>
+ /// Gets or sets Right.
+ /// </summary>
+ public int Right { get; set; }
+
+ /// <summary>
+ /// Clone this model
+ /// </summary>
+ /// <returns>
+ /// A Cloned copy
+ /// </returns>
+ public Cropping Clone()
+ {
+ return new Cropping
+ {
+ Top = this.Top,
+ Bottom = this.Bottom,
+ Left = this.Left,
+ Right = this.Right
+ };
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs
new file mode 100644
index 000000000..f98875a16
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Anamorphic.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Anamorphic.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>
+// Defines the Anamorphic type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The anamorphic.
+ /// </summary>
+ public enum Anamorphic
+ {
+ [DisplayName("None")]
+ [ShortName("none")]
+ None = 0,
+ [DisplayName("Automatic")]
+ [ShortName("auto")]
+ Automatic = 4,
+ [DisplayName("Loose")]
+ [ShortName("loose")]
+ Loose = 2,
+ [DisplayName("Custom")]
+ [ShortName("custom")]
+ Custom = 3
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs
new file mode 100644
index 000000000..922cdbc24
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/CombDetect.cs
@@ -0,0 +1,34 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="CombDetect.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>
+// Defines the CombDetect type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The CombDetect Type.
+ /// </summary>
+ public enum CombDetect
+ {
+ [ShortName("off")]
+ Off,
+
+ [ShortName("custom")]
+ Custom,
+
+ [ShortName("default")]
+ Default,
+
+ [ShortName("permissive")]
+ LessSensitive,
+
+ [ShortName("fast")]
+ Fast
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs
new file mode 100644
index 000000000..8950d2b92
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Container.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Container.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>
+// Defines the Container type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using System;
+
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The container.
+ /// </summary>
+ [Flags]
+ public enum Container
+ {
+ None = 0x0,
+
+ [DisplayName("MP4")]
+ MP4,
+ [DisplayName("MKV")]
+ MKV
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Decomb.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Decomb.cs
new file mode 100644
index 000000000..1fe70b421
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Decomb.cs
@@ -0,0 +1,34 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Decomb.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>
+// Defines the Decomb type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The decomb.
+ /// </summary>
+ public enum Decomb
+ {
+ [ShortName("default")]
+ Default,
+
+ [ShortName("bob")]
+ Bob,
+
+ [ShortName("custom")]
+ Custom,
+
+ [ShortName("eedi2")]
+ EEDI2,
+
+ [ShortName("eedi2bob")]
+ EEDI2Bob
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Deinterlace.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Deinterlace.cs
new file mode 100644
index 000000000..07c519a35
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Deinterlace.cs
@@ -0,0 +1,31 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Deinterlace.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>
+// Defines the Deinterlace type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The deinterlace.
+ /// </summary>
+ public enum Deinterlace
+ {
+ [ShortName("custom")]
+ Custom,
+
+ [ShortName("default")]
+ Default,
+
+ [ShortName("skip-spatial")]
+ SkipSpatialCheck,
+
+ [ShortName("bob")]
+ Bob
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs
new file mode 100644
index 000000000..1ebc03cc6
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/DeinterlaceFilter.cs
@@ -0,0 +1,28 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DeinterlaceFilter.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>
+// Defines the Deinterlace type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The deinterlace.
+ /// </summary>
+ public enum DeinterlaceFilter
+ {
+ [ShortName("off")]
+ Off = 0,
+
+ [ShortName("Yadif")]
+ Yadif = 1,
+
+ [ShortName("Decomb")]
+ Decomb = 2
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs
new file mode 100644
index 000000000..fb6440188
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Denoise.cs
@@ -0,0 +1,28 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Denoise.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>
+// Defines the Denoise type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The denoise.
+ /// </summary>
+ public enum Denoise
+ {
+ [ShortName("off")]
+ Off = 0,
+
+ [ShortName("hqdn3d")]
+ hqdn3d = 1,
+
+ [ShortName("nlmeans")]
+ NLMeans = 2,
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs
new file mode 100644
index 000000000..0aeebdd7c
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Detelecine.cs
@@ -0,0 +1,26 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Detelecine.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>
+// Defines the Detelecine type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The detelecine.
+ /// </summary>
+ public enum Detelecine
+ {
+ [ShortName("off")]
+ Off = 0,
+ [ShortName("default")]
+ Default = 2,
+ [ShortName("custom")]
+ Custom = 1
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs
new file mode 100644
index 000000000..4e4f241df
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBAudioEncoder.cs
@@ -0,0 +1,131 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBAudioEncoder.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>
+// The hb audio encoder.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Interop.HbLib;
+
+ /// <summary>
+ /// The hb audio encoder.
+ /// </summary>
+ public class HBAudioEncoder
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HBAudioEncoder"/> class.
+ /// </summary>
+ /// <param name="compatibleContainers">
+ /// The compatible containers.
+ /// </param>
+ /// <param name="compressionLimits">
+ /// The compression limits.
+ /// </param>
+ /// <param name="defaultCompression">
+ /// The default compression.
+ /// </param>
+ /// <param name="defaultQuality">
+ /// The default quality.
+ /// </param>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="id">
+ /// The id.
+ /// </param>
+ /// <param name="qualityLimits">
+ /// The quality limits.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public HBAudioEncoder(int compatibleContainers, RangeLimits compressionLimits, float defaultCompression, float defaultQuality, string displayName, int id, RangeLimits qualityLimits, string shortName)
+ {
+ this.CompatibleContainers = compatibleContainers;
+ this.CompressionLimits = compressionLimits;
+ this.DefaultCompression = defaultCompression;
+ this.DefaultQuality = defaultQuality;
+ this.DisplayName = displayName;
+ this.Id = id;
+ this.QualityLimits = qualityLimits;
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets the compatible containers.
+ /// </summary>
+ public int CompatibleContainers { get; private set; }
+
+ /// <summary>
+ /// Gets the compression limits.
+ /// </summary>
+ public RangeLimits CompressionLimits { get; private set; }
+
+ /// <summary>
+ /// Gets the default compression.
+ /// </summary>
+ public float DefaultCompression { get; private set; }
+
+ /// <summary>
+ /// Gets the default quality.
+ /// </summary>
+ public float DefaultQuality { get; private set; }
+
+ /// <summary>
+ /// Gets the display name.
+ /// </summary>
+ public string DisplayName { get; private set; }
+
+ /// <summary>
+ /// Gets the id.
+ /// </summary>
+ public int Id { get; private set; }
+
+ /// <summary>
+ /// Gets a value indicating whether the encoder is passthrough.
+ /// </summary>
+ public bool IsPassthrough
+ {
+ get
+ {
+ return (this.Id & NativeConstants.HB_ACODEC_PASS_FLAG) > 0;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the quality limits.
+ /// </summary>
+ public RangeLimits QualityLimits { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; set; }
+
+ /// <summary>
+ /// Gets a value indicating whether the encoder supports compression.
+ /// </summary>
+ public bool SupportsCompression
+ {
+ get
+ {
+ return this.CompressionLimits.High >= 0;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the encoder supports quality.
+ /// </summary>
+ public bool SupportsQuality
+ {
+ get
+ {
+ return this.QualityLimits.High >= 0;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs
new file mode 100644
index 000000000..487e90362
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBContainer.cs
@@ -0,0 +1,60 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBContainer.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>
+// The hb container.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The hb container.
+ /// </summary>
+ public class HBContainer
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HBContainer"/> class.
+ /// </summary>
+ /// <param name="defaultExtension">
+ /// The default extension.
+ /// </param>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="id">
+ /// The id.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public HBContainer(string defaultExtension, string displayName, int id, string shortName)
+ {
+ this.DefaultExtension = defaultExtension;
+ this.DisplayName = displayName;
+ this.Id = id;
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets the default extension.
+ /// </summary>
+ public string DefaultExtension { get; private set; }
+
+ /// <summary>
+ /// Gets the display name.
+ /// </summary>
+ public string DisplayName { get; private set; }
+
+ /// <summary>
+ /// Gets the id.
+ /// </summary>
+ public int Id { get; private set; }
+
+ /// <summary>
+ /// Gets the short name.
+ /// </summary>
+ public string ShortName { get; private set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs
new file mode 100644
index 000000000..a96724c31
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBMixdown.cs
@@ -0,0 +1,51 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBMixdown.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>
+// The hb mixdown.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The hb mixdown.
+ /// </summary>
+ public class HBMixdown
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HBMixdown"/> class.
+ /// </summary>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="id">
+ /// The id.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public HBMixdown(string displayName, int id, string shortName)
+ {
+ this.DisplayName = displayName;
+ this.Id = id;
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets the display name.
+ /// </summary>
+ public string DisplayName { get; private set; }
+
+ /// <summary>
+ /// Gets the id.
+ /// </summary>
+ public int Id { get; private set; }
+
+ /// <summary>
+ /// Gets the short name.
+ /// </summary>
+ public string ShortName { get; private set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs
new file mode 100644
index 000000000..2954128d7
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBPresetTune.cs
@@ -0,0 +1,42 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBPresetTune.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>
+// Defines the HBPresetTune type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The hb preset tune.
+ /// </summary>
+ public class HBPresetTune
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HBPresetTune"/> class.
+ /// </summary>
+ /// <param name="name">
+ /// The name.
+ /// </param>
+ /// <param name="shortName">
+ /// The short Name.
+ /// </param>
+ public HBPresetTune(string name, string shortName)
+ {
+ this.Name = name;
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets the name.
+ /// </summary>
+ public string Name { get; private set; }
+
+ /// <summary>
+ /// Gets the short name.
+ /// </summary>
+ public string ShortName { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs
new file mode 100644
index 000000000..ecebb0526
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBRate.cs
@@ -0,0 +1,42 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBRate.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>
+// Represents a rate in HandBrake: audio sample rate or video framerate.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ /// <summary>
+ /// Represents a rate in HandBrake: audio sample rate or video framerate.
+ /// </summary>
+ public class HBRate
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HBRate"/> class.
+ /// </summary>
+ /// <param name="name">
+ /// The name.
+ /// </param>
+ /// <param name="rate">
+ /// The rate.
+ /// </param>
+ public HBRate(string name, int rate)
+ {
+ this.Name = name;
+ this.Rate = rate;
+ }
+
+ /// <summary>
+ /// Gets the name to use for this rate.
+ /// </summary>
+ public string Name { get; private set; }
+
+ /// <summary>
+ /// Gets the raw rate.
+ /// </summary>
+ public int Rate { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs
new file mode 100644
index 000000000..2c064b2be
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/HBVideoEncoder.cs
@@ -0,0 +1,109 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HBVideoEncoder.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>
+// The hb video encoder.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using System.Collections.Generic;
+
+ using HandBrake.Interop.Interop.HbLib;
+ using HandBrake.Interop.Interop.Helpers;
+
+ /// <summary>
+ /// The hb video encoder.
+ /// </summary>
+ public class HBVideoEncoder
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="HBVideoEncoder"/> class.
+ /// </summary>
+ /// <param name="compatibleContainers">
+ /// The compatible containers.
+ /// </param>
+ /// <param name="displayName">
+ /// The display name.
+ /// </param>
+ /// <param name="id">
+ /// The id.
+ /// </param>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public HBVideoEncoder(int compatibleContainers, string displayName, int id, string shortName)
+ {
+ this.CompatibleContainers = compatibleContainers;
+ this.DisplayName = displayName;
+ this.Id = id;
+ this.ShortName = shortName;
+ }
+
+ /// <summary>
+ /// Gets the compatible containers.
+ /// </summary>
+ public int CompatibleContainers { get; private set; }
+
+ /// <summary>
+ /// Gets the display name.
+ /// </summary>
+ public string DisplayName { get; private set; }
+
+ /// <summary>
+ /// Gets the id.
+ /// </summary>
+ public int Id { get; private set; }
+
+ /// <summary>
+ /// Gets the short name.
+ /// </summary>
+ public string ShortName { get; private set; }
+
+ /// <summary>
+ /// Gets the list of presets this encoder supports. (null if the encoder doesn't support presets)
+ /// </summary>
+ public List<string> Presets
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_presets(this.Id));
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of tunes this encoder supports. (null if the encoder doesn't support tunes)
+ /// </summary>
+ public List<string> Tunes
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_tunes(this.Id));
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of profiles this encoder supports. (null if the encoder doesn't support profiles)
+ /// </summary>
+ public List<string> Profiles
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_profiles(this.Id));
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of levels this encoder supports. (null if the encoder doesn't support levels)
+ /// </summary>
+ public List<string> Levels
+ {
+ get
+ {
+ return InteropUtilities.ToStringListFromArrayPtr(HBFunctions.hb_video_encoder_get_levels(this.Id));
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs
new file mode 100644
index 000000000..2c0d85b9d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/PictureRotation.cs
@@ -0,0 +1,22 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PictureRotation.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>
+// Possible picture rotations.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ /// <summary>
+ /// Possible picture rotations.
+ /// </summary>
+ public enum PictureRotation
+ {
+ None = 0,
+ Clockwise90,
+ Clockwise180,
+ Clockwise270
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs
new file mode 100644
index 000000000..8f62f3f22
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/ScaleMethod.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ScaleMethod.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>
+// Scaling Method
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ /// <summary>
+ /// Enumeration of rescaling algorithms.
+ /// </summary>
+ public enum ScaleMethod
+ {
+ /// <summary>
+ /// Standard software scaling. Highest quality.
+ /// </summary>
+ Lanczos = 0,
+
+ /// <summary>
+ /// OpenCL-assisted bicubic scaling.
+ /// </summary>
+ Bicubic = 1
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs
new file mode 100644
index 000000000..5924604fe
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/Sharpen.cs
@@ -0,0 +1,28 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Sharpen.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>
+// Defines the Sharpen type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The Sharpen.
+ /// </summary>
+ public enum Sharpen
+ {
+ [ShortName("off")]
+ Off,
+
+ [ShortName("unsharp")]
+ UnSharp,
+
+ [ShortName("lapsharp")]
+ LapSharp
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs
new file mode 100644
index 000000000..461b3931d
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncodeRateType.cs
@@ -0,0 +1,21 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoEncodeRateType.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>
+// Defines the VideoEncodeRateType type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The video encode rate type.
+ /// </summary>
+ public enum VideoEncodeRateType
+ {
+ TargetSize = 0,
+ AverageBitrate = 1,
+ ConstantQuality = 2
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs
new file mode 100644
index 000000000..68c09d0d1
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Encoding/VideoEncoder.cs
@@ -0,0 +1,71 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoEncoder.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>
+// The video encoder.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Encoding
+{
+ using HandBrake.Interop.Attributes;
+
+ /// <summary>
+ /// The video encoder.
+ /// </summary>
+ public enum VideoEncoder
+ {
+ [DisplayName("H.264 (x264)")]
+ [ShortName("x264")]
+ X264 = 0,
+
+ [DisplayName("H.264 10-bit (x264)")]
+ [ShortName("x264_10bit")]
+ X264_10,
+
+ [DisplayName("H.264 (Intel QSV)")]
+ [ShortName("qsv_h264")]
+ QuickSync,
+
+ [DisplayName("MPEG-4")]
+ [ShortName("mpeg4")]
+ FFMpeg,
+
+ [DisplayName("MPEG-2")]
+ [ShortName("mpeg2")]
+ FFMpeg2,
+
+ [DisplayName("Theora")]
+ [ShortName("theora")]
+ Theora,
+
+ [DisplayName("H.265 (x265)")]
+ [ShortName("x265")]
+ X265,
+
+ [DisplayName("H.265 12-bit (x265)")]
+ [ShortName("x265_12bit")]
+ X265_12,
+
+ [DisplayName("H.265 10-bit (x265)")]
+ [ShortName("x265_10bit")]
+ X265_10,
+
+ [DisplayName("H.265 (Intel QSV)")]
+ [ShortName("qsv_h265")]
+ QuickSyncH265,
+
+ [DisplayName("H.265 10-bit (Intel QSV)")]
+ [ShortName("qsv_h265_10bit")]
+ QuickSyncH26510b,
+
+ [DisplayName("VP8")]
+ [ShortName("VP8")]
+ VP8,
+
+ [DisplayName("VP9")]
+ [ShortName("VP9")]
+ VP9
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Language.cs b/win/CS/HandBrake.Interop/Interop/Model/Language.cs
new file mode 100644
index 000000000..5564a434e
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Language.cs
@@ -0,0 +1,67 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Language.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>
+// Represents a language.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ /// <summary>
+ /// Represents a language.
+ /// </summary>
+ public class Language
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Language"/> class.
+ /// </summary>
+ /// <param name="englishName">
+ /// The english name.
+ /// </param>
+ /// <param name="nativeName">
+ /// The native name.
+ /// </param>
+ /// <param name="code">
+ /// The code.
+ /// </param>
+ public Language(string englishName, string nativeName, string code)
+ {
+ this.EnglishName = englishName;
+ this.NativeName = nativeName;
+ this.Code = code;
+ }
+
+ /// <summary>
+ /// Gets the english name of the language.
+ /// </summary>
+ public string EnglishName { get; private set; }
+
+ /// <summary>
+ /// Gets the native name of the language.
+ /// </summary>
+ public string NativeName { get; private set; }
+
+ /// <summary>
+ /// Gets the language code.
+ /// </summary>
+ public string Code { get; private set; }
+
+ /// <summary>
+ /// Gets the display string for the language.
+ /// </summary>
+ public string Display
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(this.NativeName) && this.NativeName != this.EnglishName)
+ {
+ return this.EnglishName + " (" + this.NativeName + ")";
+ }
+
+ return this.EnglishName;
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs b/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs
new file mode 100644
index 000000000..beebc12f5
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Preview/PreviewSettings.cs
@@ -0,0 +1,81 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="PreviewSettings.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>
+// The preview settings.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Preview
+{
+ using Encoding;
+
+ /// <summary>
+ /// The preview settings.
+ /// </summary>
+ public class PreviewSettings
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PreviewSettings"/> class.
+ /// </summary>
+ public PreviewSettings()
+ {
+ }
+
+ /// <summary>
+ /// Gets or sets the cropping.
+ /// </summary>
+ public Cropping Cropping { get; set; }
+
+ /// <summary>
+ /// Gets or sets the max width.
+ /// </summary>
+ public int MaxWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets the max height.
+ /// </summary>
+ public int MaxHeight { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether keep display aspect.
+ /// </summary>
+ public bool KeepDisplayAspect { get; set; }
+
+ /// <summary>
+ /// Gets or sets the title number.
+ /// </summary>
+ public int TitleNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the anamorphic.
+ /// </summary>
+ public Anamorphic Anamorphic { get; set; }
+
+ /// <summary>
+ /// Gets or sets the modulus.
+ /// </summary>
+ public int? Modulus { get; set; }
+
+ /// <summary>
+ /// Gets or sets the width.
+ /// </summary>
+ public int Width { get; set; }
+
+ /// <summary>
+ /// Gets or sets the height.
+ /// </summary>
+ public int Height { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pixel aspect x.
+ /// </summary>
+ public int PixelAspectX { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pixel aspect y.
+ /// </summary>
+ public int PixelAspectY { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs b/win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs
new file mode 100644
index 000000000..8768d0054
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Preview/RawPreviewData.cs
@@ -0,0 +1,26 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="RawPreviewData.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>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model.Preview
+{
+ public class RawPreviewData
+ {
+ public RawPreviewData(byte[] rawBitmapData, int strideWidth, int strideHeight, int width, int height)
+ {
+ this.RawBitmapData = rawBitmapData;
+ this.StrideWidth = strideWidth;
+ this.StrideHeight = strideHeight;
+ this.Width = width;
+ this.Height = height;
+ }
+
+ 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
new file mode 100644
index 000000000..3a05f8e38
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/RangeLimits.cs
@@ -0,0 +1,60 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="RangeLimits.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>
+// The range limits.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ /// <summary>
+ /// The range limits.
+ /// </summary>
+ public class RangeLimits
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="RangeLimits"/> class.
+ /// </summary>
+ /// <param name="ascending">
+ /// The ascending.
+ /// </param>
+ /// <param name="granularity">
+ /// The granularity.
+ /// </param>
+ /// <param name="high">
+ /// The high.
+ /// </param>
+ /// <param name="low">
+ /// The low.
+ /// </param>
+ public RangeLimits(bool @ascending, float granularity, float high, float low)
+ {
+ this.Ascending = @ascending;
+ this.Granularity = granularity;
+ this.High = high;
+ this.Low = low;
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether ascending.
+ /// </summary>
+ public bool Ascending { get; private set; }
+
+ /// <summary>
+ /// Gets the granularity.
+ /// </summary>
+ public float Granularity { get; private set; }
+
+ /// <summary>
+ /// Gets the high.
+ /// </summary>
+ public float High { get; private set; }
+
+ /// <summary>
+ /// Gets the low.
+ /// </summary>
+ public float Low { get; private set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/Size.cs b/win/CS/HandBrake.Interop/Interop/Model/Size.cs
new file mode 100644
index 000000000..6113b8bcf
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/Size.cs
@@ -0,0 +1,60 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Size.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>
+// Defines the Size type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ /// <summary>
+ /// The size.
+ /// </summary>
+ public class Size
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Size"/> class.
+ /// </summary>
+ /// <param name="width">
+ /// The width.
+ /// </param>
+ /// <param name="height">
+ /// The height.
+ /// </param>
+ public Size(int width, int height)
+ {
+ this.Width = width;
+ this.Height = height;
+ }
+
+ /// <summary>
+ /// Gets the height.
+ /// </summary>
+ public int Height { get; private set; }
+
+ /// <summary>
+ /// Gets the width.
+ /// </summary>
+ public int Width { get; private set; }
+
+ /// <summary>
+ /// Gets a value indicating whether is empty.
+ /// </summary>
+ public bool IsEmpty
+ {
+ get
+ {
+ if (this.Width <= 0 && this.Height <= 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs b/win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs
new file mode 100644
index 000000000..23b43df79
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/SourceVideoInfo.cs
@@ -0,0 +1,42 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceVideoInfo.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>
+// The source framerate info.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ /// <summary>
+ /// The source framerate info.
+ /// </summary>
+ public class SourceVideoInfo
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SourceVideoInfo"/> class.
+ /// </summary>
+ /// <param name="resolution">
+ /// The resolution.
+ /// </param>
+ /// <param name="parVal">
+ /// The par val.
+ /// </param>
+ public SourceVideoInfo(Size resolution, Size parVal)
+ {
+ this.Resolution = resolution;
+ this.ParVal = parVal;
+ }
+
+ /// <summary>
+ /// Gets the resolution (width/height) of this Title
+ /// </summary>
+ public Size Resolution { get; private set; }
+
+ /// <summary>
+ /// Gets the pixel aspect ratio.
+ /// </summary>
+ public Size ParVal { get; private set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs b/win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs
new file mode 100644
index 000000000..64fbd6f4f
--- /dev/null
+++ b/win/CS/HandBrake.Interop/Interop/Model/VideoQualityLimits.cs
@@ -0,0 +1,60 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoQualityLimits.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>
+// Defines the VideoQualityLimits type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interop.Model
+{
+ /// <summary>
+ /// Represents limits on video quality for a particular encoder.
+ /// </summary>
+ public class VideoQualityLimits
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="VideoQualityLimits"/> class.
+ /// </summary>
+ /// <param name="low">
+ /// The low.
+ /// </param>
+ /// <param name="high">
+ /// The high.
+ /// </param>
+ /// <param name="granularity">
+ /// The granularity.
+ /// </param>
+ /// <param name="ascending">
+ /// The ascending.
+ /// </param>
+ public VideoQualityLimits(float low, float high, float granularity, bool @ascending)
+ {
+ this.Low = low;
+ this.High = high;
+ this.Granularity = granularity;
+ this.Ascending = @ascending;
+ }
+
+ /// <summary>
+ /// Gets the inclusive lower limit for the quality.
+ /// </summary>
+ public float Low { get; private set; }
+
+ /// <summary>
+ /// Gets the inclusive upper limit for the quality.
+ /// </summary>
+ public float High { get; private set; }
+
+ /// <summary>
+ /// Gets the granularity for the quality.
+ /// </summary>
+ public float Granularity { get; private set; }
+
+ /// <summary>
+ /// Gets a value indicating whether the quality increases as the number increases.
+ /// </summary>
+ public bool Ascending { get; private set; }
+ }
+}