summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Validate.cs39
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicGeometry.cs27
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicResult.cs32
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/DestSettings.cs64
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/Geometry.cs33
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/PAR.cs27
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/SourceGeometry.cs37
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Audio.cs34
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/AudioList.cs72
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/ChapterList.cs22
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Destination.cs44
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Filter.cs29
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/FilterList.cs27
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/JsonEncodeObject.cs64
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/MetaData.cs62
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Mp4Options.cs27
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Range.cs52
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/SRT.cs32
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Search.cs37
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Source.cs32
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Subtitle.cs29
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/SubtitleList.cs52
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs72
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs517
24 files changed, 1463 insertions, 0 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Validate.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Validate.cs
new file mode 100644
index 000000000..d3c7d8136
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Helpers/Validate.cs
@@ -0,0 +1,39 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Validate.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 validate.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Helpers
+{
+ using System;
+
+ /// <summary>
+ /// The validate.
+ /// </summary>
+ public class Validate
+ {
+ /// <summary>
+ /// The not null.
+ /// </summary>
+ /// <param name="item">
+ /// The item.
+ /// </param>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// Thrown when the input object is null
+ /// </exception>
+ public static void NotNull(object item, string message)
+ {
+ if (item == null)
+ {
+ throw new ArgumentException(message);
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicGeometry.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicGeometry.cs
new file mode 100644
index 000000000..684eac686
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicGeometry.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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.Json.Anamorphic
+{
+ /// <summary>
+ /// The geometry.
+ /// </summary>
+ internal class AnamorphicGeometry
+ {
+ /// <summary>
+ /// Gets or sets the dest geometry.
+ /// </summary>
+ public DestSettings DestGeometry { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source geometry.
+ /// </summary>
+ public SourceGeometry SourceGeometry { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicResult.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicResult.cs
new file mode 100644
index 000000000..42e955443
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/AnamorphicResult.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AnamorphicResult.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 result.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Anamorphic
+{
+ /// <summary>
+ /// The anamorphic result.
+ /// </summary>
+ internal class AnamorphicResult
+ {
+ /// <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/HandBrakeInterop/Json/Anamorphic/DestSettings.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/DestSettings.cs
new file mode 100644
index 000000000..1f4f95542
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/DestSettings.cs
@@ -0,0 +1,64 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="DestGeometry.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.Json.Anamorphic
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The dest geometry.
+ /// </summary>
+ internal class DestSettings
+ {
+ 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 bool 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/HandBrakeInterop/Json/Anamorphic/Geometry.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/Geometry.cs
new file mode 100644
index 000000000..add6bc562
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/Geometry.cs
@@ -0,0 +1,33 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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.Json.Anamorphic
+{
+
+ /// <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/HandBrakeInterop/Json/Anamorphic/PAR.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/PAR.cs
new file mode 100644
index 000000000..84680dee6
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/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.Json.Anamorphic
+{
+ /// <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/HandBrakeInterop/Json/Anamorphic/SourceGeometry.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/SourceGeometry.cs
new file mode 100644
index 000000000..983e9f5f8
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Anamorphic/SourceGeometry.cs
@@ -0,0 +1,37 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceGeometry.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 geometry.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Anamorphic
+{
+ /// <summary>
+ /// The source geometry.
+ /// </summary>
+ internal class SourceGeometry
+ {
+ public SourceGeometry()
+ {
+ this.PAR = new PAR();
+ }
+
+ /// <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/HandBrakeInterop/Json/Encode/Audio.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Audio.cs
new file mode 100644
index 000000000..1f683785f
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The audio.
+ /// </summary>
+ public class Audio
+ {
+ /// <summary>
+ /// Gets or sets the audio list.
+ /// </summary>
+ public List<AudioList> AudioList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the copy mask.
+ /// </summary>
+ public int 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/HandBrakeInterop/Json/Encode/AudioList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/AudioList.cs
new file mode 100644
index 000000000..8227c2777
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/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.Json.Encode
+{
+ /// <summary>
+ /// The audio list.
+ /// </summary>
+ public class AudioList
+ {
+ /// <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; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/ChapterList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/ChapterList.cs
new file mode 100644
index 000000000..abdb570e0
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/ChapterList.cs
@@ -0,0 +1,22 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ChapterList.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 chapter list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Encode
+{
+ /// <summary>
+ /// The chapter list.
+ /// </summary>
+ public class ChapterList
+ {
+ /// <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/HandBrakeInterop/Json/Encode/Destination.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Destination.cs
new file mode 100644
index 000000000..6eb9e0a90
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Destination.cs
@@ -0,0 +1,44 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The destination.
+ /// </summary>
+ public class Destination
+ {
+ /// <summary>
+ /// Gets or sets the chapter list.
+ /// </summary>
+ public List<ChapterList> ChapterList { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether chapter markers.
+ /// </summary>
+ public bool ChapterMarkers { 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/HandBrakeInterop/Json/Encode/Filter.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Filter.cs
new file mode 100644
index 000000000..a5097f477
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The filter.
+ /// </summary>
+ public class Filter
+ {
+ /// <summary>
+ /// Gets or sets the filter list.
+ /// </summary>
+ public List<FilterList> FilterList { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether grayscale.
+ /// </summary>
+ public bool Grayscale { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/FilterList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/FilterList.cs
new file mode 100644
index 000000000..4a9bc97f4
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/FilterList.cs
@@ -0,0 +1,27 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="FilterList.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.Json.Encode
+{
+ /// <summary>
+ /// The filter list.
+ /// </summary>
+ public class FilterList
+ {
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int ID { get; set; }
+
+ /// <summary>
+ /// Gets or sets the settings.
+ /// </summary>
+ public string Settings { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/JsonEncodeObject.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/JsonEncodeObject.cs
new file mode 100644
index 000000000..c5e6c6aa1
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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.Json.Encode
+{
+ using HandBrake.Interop.Json.Anamorphic;
+
+ /// <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 Filter Filter { 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 Subtitle 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/HandBrakeInterop/Json/Encode/MetaData.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/MetaData.cs
new file mode 100644
index 000000000..0343c9128
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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.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/HandBrakeInterop/Json/Encode/Mp4Options.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Mp4Options.cs
new file mode 100644
index 000000000..e8b10c4c7
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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.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/HandBrakeInterop/Json/Encode/Range.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Range.cs
new file mode 100644
index 000000000..2d9a45ee1
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Range.cs
@@ -0,0 +1,52 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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.Json.Encode
+{
+ /// <summary>
+ /// The range.
+ /// </summary>
+ public class Range
+ {
+ /// <summary>
+ /// Gets or sets the chapter end.
+ /// </summary>
+ public int ChapterEnd { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter start.
+ /// </summary>
+ public int ChapterStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frame to start.
+ /// </summary>
+ public int FrameToStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frame to stop.
+ /// </summary>
+ public int FrameToStop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pts to start.
+ /// </summary>
+ public int PtsToStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pts to stop.
+ /// </summary>
+ public int PtsToStop { get; set; }
+
+ /// <summary>
+ /// Gets or sets the start at preview.
+ /// </summary>
+ public int StartAtPreview { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/SRT.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/SRT.cs
new file mode 100644
index 000000000..b7c8f17b2
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/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.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/HandBrakeInterop/Json/Encode/Search.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Search.cs
new file mode 100644
index 000000000..413b8677a
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Search.cs
@@ -0,0 +1,37 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Search.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.Json.Encode
+{
+ /// <summary>
+ /// The search.
+ /// </summary>
+ public class Search
+ {
+ /// <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/HandBrakeInterop/Json/Encode/Source.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Source.cs
new file mode 100644
index 000000000..f006d2ba0
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Source.cs
@@ -0,0 +1,32 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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.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; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Subtitle.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Subtitle.cs
new file mode 100644
index 000000000..c20ab8fb2
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Subtitle.cs
@@ -0,0 +1,29 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="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>
+// <summary>
+// The subtitle.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Encode
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The subtitle.
+ /// </summary>
+ public class Subtitle
+ {
+ /// <summary>
+ /// Gets or sets the search.
+ /// </summary>
+ public Search Search { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle list.
+ /// </summary>
+ public List<SubtitleList> SubtitleList { get; set; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/SubtitleList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/SubtitleList.cs
new file mode 100644
index 000000000..54ce5e902
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/SubtitleList.cs
@@ -0,0 +1,52 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleList.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.Json.Encode
+{
+ /// <summary>
+ /// The subtitle list.
+ /// </summary>
+ public class SubtitleList
+ {
+ /// <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 Force { 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/HandBrakeInterop/Json/Encode/Video.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs
new file mode 100644
index 000000000..a92253d7b
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Encode/Video.cs
@@ -0,0 +1,72 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <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.Json.Encode
+{
+ /// <summary>
+ /// The video.
+ /// </summary>
+ public class Video
+ {
+ /// <summary>
+ /// Gets or sets the codec.
+ /// </summary>
+ public int Codec { 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 the number of passes
+ /// </summary>
+ public int pass { get; set; }
+
+ /// <summary>
+ /// Gets or sets 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; }
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs
new file mode 100644
index 000000000..17013ae5b
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs
@@ -0,0 +1,517 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="EncodeFactory.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 encode factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Json.Factories
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.Interop.HbLib;
+ using HandBrake.Interop.Helpers;
+ using HandBrake.Interop.Json.Anamorphic;
+ using HandBrake.Interop.Json.Encode;
+ using HandBrake.Interop.Json.Scan;
+ using HandBrake.Interop.Model;
+ using HandBrake.Interop.Model.Encoding;
+
+ using Newtonsoft.Json;
+
+ using AudioList = HandBrake.Interop.Json.Encode.AudioList;
+ using ChapterList = HandBrake.Interop.Json.Encode.ChapterList;
+ using MetaData = HandBrake.Interop.Json.Encode.MetaData;
+ using PAR = HandBrake.Interop.Json.Anamorphic.PAR;
+ using SubtitleList = HandBrake.Interop.Json.Encode.SubtitleList;
+
+ /// <summary>
+ /// This factory takes the internal EncodeJob object and turns it into a set of JSON models
+ /// that can be deserialized by libhb.
+ /// </summary>
+ internal class EncodeFactory
+ {
+
+ /*
+ * <j45> maxWidth and maxHeight are frontend issues. You pass those into hb_set_anamorphic_size when calculating geometry settings. width and height are given to the CROP_SCALE filter. No need for the frontend to set it in the job. The job will get the final dimensions from the filter settings anyway.
+ * <j45> for example, both crop_scale and rotate filters modify job width and height settings
+ *
+ */
+
+ /// <summary>
+ /// The create.
+ /// </summary>
+ /// <param name="job">
+ /// The encode job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="JsonEncodeObject"/>.
+ /// </returns>
+ internal static JsonEncodeObject Create(EncodeJob job, JsonScanObject scannedSource)
+ {
+ JsonEncodeObject encode = new JsonEncodeObject
+ {
+ SequenceID = 0,
+ Audio = CreateAudio(job),
+ Destination = CreateDestination(job),
+ Filter = CreateFilter(job),
+ PAR = CreatePAR(job),
+ MetaData = CreateMetaData(job),
+ Source = CreateSource(job),
+ Subtitle = CreateSubtitle(job),
+ Video = CreateVideo(job)
+ };
+
+ return encode;
+ }
+
+ /// <summary>
+ /// The create source.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Source"/>.
+ /// </returns>
+ private static Source CreateSource(EncodeJob job)
+ {
+ Source source = new Source
+ {
+ Title = job.Title,
+ Range =
+ new Range
+ {
+ ChapterEnd = job.ChapterEnd,
+ ChapterStart = job.ChapterStart,
+ FrameToStart = job.FramesStart,
+ FrameToStop = job.FramesEnd,
+ PtsToStart = (int)(job.SecondsStart * 90000),
+ PtsToStop = (int)((job.SecondsEnd - job.SecondsStart) * 90000),
+ },
+ Angle = job.Angle
+ };
+ return source;
+ }
+
+ /// <summary>
+ /// The create destination.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Destination"/>.
+ /// </returns>
+ private static Destination CreateDestination(EncodeJob job)
+ {
+ Destination destination = new Destination
+ {
+ File = job.OutputPath,
+ Mp4Options =
+ new Mp4Options
+ {
+ IpodAtom = job.EncodingProfile.IPod5GSupport,
+ // LargeFileSize = job.EncodingProfile.LargeFile,
+ Mp4Optimize = job.EncodingProfile.Optimize
+ },
+ ChapterMarkers = job.EncodingProfile.IncludeChapterMarkers,
+ Mux = HBFunctions.hb_container_get_from_name(job.EncodingProfile.ContainerName),
+ ChapterList = new List<ChapterList>()
+ };
+
+ foreach (string item in job.CustomChapterNames)
+ {
+ ChapterList chapter = new ChapterList { Name = item };
+ destination.ChapterList.Add(chapter);
+ }
+
+ return destination;
+ }
+
+ /// <summary>
+ /// Create the PAR object
+ /// </summary>
+ /// <param name="job">The Job</param>
+ /// <returns>The produced PAR object.</returns>
+ private static PAR CreatePAR(EncodeJob job)
+ {
+ return new PAR {Num = job.EncodingProfile.PixelAspectX, Den = job.EncodingProfile.PixelAspectY} ;
+ }
+
+ /// <summary>
+ /// The create subtitle.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Subtitle"/>.
+ /// </returns>
+ private static Subtitle CreateSubtitle(EncodeJob job)
+ {
+ Subtitle subtitle = new Subtitle
+ {
+ Search =
+ new Search
+ {
+ Enable = false,
+ Default = false,
+ Burn = false,
+ Forced = false
+ },
+ SubtitleList = new List<SubtitleList>()
+ };
+
+ foreach (SourceSubtitle item in job.Subtitles.SourceSubtitles)
+ {
+ SubtitleList track = new SubtitleList
+ {
+ Burn = item.BurnedIn,
+ Default = item.Default,
+ Force = item.Forced,
+ ID = item.TrackNumber,
+ Track = item.TrackNumber
+ };
+
+ subtitle.SubtitleList.Add(track);
+ }
+
+ foreach (SrtSubtitle item in job.Subtitles.SrtSubtitles)
+ {
+ SubtitleList track = new SubtitleList
+ {
+ Default = item.Default,
+ Offset = item.Offset,
+ SRT =
+ new SRT
+ {
+ Filename = item.FileName,
+ Codeset = item.CharacterCode,
+ Language = item.LanguageCode
+ }
+ };
+
+ subtitle.SubtitleList.Add(track);
+ }
+
+ return subtitle;
+ }
+
+ /// <summary>
+ /// The create video.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Video"/>.
+ /// </returns>
+ private static Video CreateVideo(EncodeJob job)
+ {
+ Video video = new Video();
+
+ HBVideoEncoder videoEncoder = Encoders.VideoEncoders.FirstOrDefault(e => e.ShortName == job.EncodingProfile.VideoEncoder);
+ Validate.NotNull(videoEncoder, "Video encoder " + job.EncodingProfile.VideoEncoder + " not recognized.");
+ if (videoEncoder != null)
+ {
+ video.Codec = videoEncoder.Id;
+ }
+
+ video.Level = job.EncodingProfile.VideoLevel;
+ video.Options = job.EncodingProfile.VideoOptions;
+ video.Preset = job.EncodingProfile.VideoPreset;
+ video.Profile = job.EncodingProfile.VideoProfile;
+ video.Quality = job.EncodingProfile.Quality;
+ if (job.EncodingProfile.VideoTunes != null && job.EncodingProfile.VideoTunes.Count > 0)
+ {
+ video.Tune = string.Join(",", job.EncodingProfile.VideoTunes);
+ }
+
+ return video;
+ }
+
+ /// <summary>
+ /// The create audio.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Audio"/>.
+ /// </returns>
+ private static Audio CreateAudio(EncodeJob job)
+ {
+ Audio audio = new Audio();
+
+ if (!string.IsNullOrEmpty(job.EncodingProfile.AudioEncoderFallback))
+ {
+ HBAudioEncoder audioEncoder = Encoders.GetAudioEncoder(job.EncodingProfile.AudioEncoderFallback);
+ Validate.NotNull(audioEncoder, "Unrecognized fallback audio encoder: " + job.EncodingProfile.AudioEncoderFallback);
+ audio.FallbackEncoder = audioEncoder.Id;
+ }
+
+ audio.CopyMask = (int)NativeConstants.HB_ACODEC_ANY;
+
+ audio.AudioList = new List<AudioList>();
+ int numTracks = 0;
+ foreach (AudioEncoding item in job.EncodingProfile.AudioEncodings)
+ {
+ HBAudioEncoder encoder = Encoders.GetAudioEncoder(item.Encoder);
+ Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder);
+
+ HBMixdown mixdown = Encoders.GetMixdown(item.Mixdown);
+ Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + item.Mixdown);
+
+ AudioList audioTrack = new AudioList
+ {
+ Track = numTracks++,
+ Bitrate = item.Bitrate,
+ CompressionLevel = item.Compression,
+ DRC = item.Drc,
+ Encoder = encoder.Id,
+ Gain = item.Gain,
+ Mixdown = mixdown.Id,
+ NormalizeMixLevel = false,
+ Quality = item.Quality,
+ Samplerate = item.SampleRateRaw
+ };
+
+ audio.AudioList.Add(audioTrack);
+ }
+
+ return audio;
+ }
+
+ /// <summary>
+ /// The create filter. TODO
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Filter"/>.
+ /// </returns>
+ private static Filter CreateFilter(EncodeJob job)
+ {
+ Filter filter = new Filter
+ {
+ FilterList = new List<FilterList>(),
+ Grayscale = job.EncodingProfile.Grayscale
+ };
+
+ // Detelecine
+ if (job.EncodingProfile.Detelecine != Detelecine.Off)
+ {
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DETELECINE, Settings = job.EncodingProfile.CustomDetelecine };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // Decomb
+ if (job.EncodingProfile.Decomb != Decomb.Off)
+ {
+ string options = "";
+ if (job.EncodingProfile.Decomb == Decomb.Fast)
+ {
+ options = "7:2:6:9:1:80";
+ }
+ else if (job.EncodingProfile.Decomb == Decomb.Bob)
+ {
+ options = "455";
+ }
+ else
+ {
+ options = job.EncodingProfile.CustomDecomb;
+ }
+
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DECOMB, Settings = options };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // Deinterlace
+ if (job.EncodingProfile.Deinterlace != Deinterlace.Off)
+ {
+ string options = string.Empty;
+ if (job.EncodingProfile.Deinterlace == Deinterlace.Fast)
+ {
+ options = "0";
+ }
+ else if (job.EncodingProfile.Deinterlace == Deinterlace.Slow)
+ {
+ options = "1";
+ }
+ else if (job.EncodingProfile.Deinterlace == Deinterlace.Slower)
+ {
+ options = "3";
+ }
+ else if (job.EncodingProfile.Deinterlace == Deinterlace.Bob)
+ {
+ options = "15";
+ }
+ else
+ {
+ options = job.EncodingProfile.CustomDeinterlace;
+ }
+
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEINTERLACE, Settings = options };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // VFR / CFR TODO
+ FilterList framerateShaper = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_VFR, Settings = string.Empty };
+ filter.FilterList.Add(framerateShaper);
+
+ // Deblock
+ if (job.EncodingProfile.Deblock < 5)
+ {
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEBLOCK, Settings = job.EncodingProfile.Deblock.ToString() };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // Denoise
+ if (job.EncodingProfile.Denoise != Denoise.Off)
+ {
+ hb_filter_ids id = job.EncodingProfile.Denoise == Denoise.hqdn3d
+ ? hb_filter_ids.HB_FILTER_HQDN3D
+ : hb_filter_ids.HB_FILTER_NLMEANS;
+
+ string settings;
+ if (job.EncodingProfile.Denoise == Denoise.hqdn3d
+ && !string.IsNullOrEmpty(job.EncodingProfile.CustomDenoise))
+ {
+ settings = job.EncodingProfile.CustomDenoise;
+ }
+ else
+ {
+ IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings((int)id, job.EncodingProfile.DenoisePreset, job.EncodingProfile.DenoiseTune);
+ settings = Marshal.PtrToStringAnsi(settingsPtr);
+ }
+
+ FilterList filterItem = new FilterList { ID = (int)id, Settings = settings };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // CropScale Filter
+ FilterList cropScale = new FilterList
+ {
+ ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE,
+ Settings =
+ string.Format(
+ "{0}:{1}:{2}:{3}:{4}:{5}",
+ job.EncodingProfile.Width,
+ job.EncodingProfile.Height,
+ job.EncodingProfile.Cropping.Top,
+ job.EncodingProfile.Cropping.Bottom,
+ job.EncodingProfile.Cropping.Left,
+ job.EncodingProfile.Cropping.Right)
+ };
+ filter.FilterList.Add(cropScale);
+
+ // Rotate
+ /* TODO NOT SUPPORTED YET. */
+
+ return filter;
+ }
+
+ /// <summary>
+ /// The create geometry.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Geometry"/>.
+ /// </returns>
+ private static Json.Anamorphic.Geometry CreateGeometry(EncodeJob job, JsonScanObject scannedSource)
+ {
+ TitleList title = scannedSource.TitleList.FirstOrDefault(c => c.Index == job.Title);
+
+ // Sanatise the Geometry First.
+ AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry
+ {
+ DestGeometry = new DestSettings(),
+ SourceGeometry =
+ new SourceGeometry
+ {
+ Width = title.Geometry.Width,
+ Height = title.Geometry.Height,
+ PAR = new Json.Anamorphic.PAR { Num = title.Geometry.PAR.Num, Den = title.Geometry.PAR.Den }
+ }
+ };
+
+ anamorphicGeometry.DestGeometry.AnamorphicMode = (int)job.EncodingProfile.Anamorphic;
+ anamorphicGeometry.DestGeometry.Geometry.Width = job.EncodingProfile.Width;
+ anamorphicGeometry.DestGeometry.Geometry.Height = job.EncodingProfile.Height;
+ anamorphicGeometry.DestGeometry.Keep = job.EncodingProfile.KeepDisplayAspect;
+ anamorphicGeometry.DestGeometry.Geometry.PAR = new Json.Anamorphic.PAR { Num = job.EncodingProfile.PixelAspectX, Den = job.EncodingProfile.PixelAspectY };
+ anamorphicGeometry.DestGeometry.Crop = new List<int> { job.EncodingProfile.Cropping.Top, job.EncodingProfile.Cropping.Bottom, job.EncodingProfile.Cropping.Left, job.EncodingProfile.Cropping.Right };
+
+ string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
+ IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode));
+ string statusJson = Marshal.PtrToStringAnsi(json);
+ AnamorphicResult sanatisedGeometry = JsonConvert.DeserializeObject<AnamorphicResult>(statusJson);
+
+ // Setup the Destination Gemotry.
+ Json.Anamorphic.Geometry geometry = new Json.Anamorphic.Geometry();
+ geometry.Width = sanatisedGeometry.Width;
+ geometry.Height = sanatisedGeometry.Height;
+ geometry.PAR = sanatisedGeometry.PAR;
+ return geometry;
+ }
+
+ /// <summary>
+ /// The create meta data.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="MetaData"/>.
+ /// </returns>
+ private static MetaData CreateMetaData(EncodeJob job)
+ {
+ MetaData metaData = new MetaData();
+ return metaData;
+ }
+
+
+ /// <summary>
+ /// Adds a filter to the given filter list.
+ /// </summary>
+ /// <param name="filterList">The list to add the filter to.</param>
+ /// <param name="filterType">The type of filter.</param>
+ /// <param name="settings">Settings for the filter.</param>
+ /// <param name="allocatedMemory">The list of allocated memory.</param>
+ private void AddFilter(List<hb_filter_object_s> filterList, int filterType, string settings, List<IntPtr> allocatedMemory)
+ {
+ IntPtr settingsNativeString = Marshal.StringToHGlobalAnsi(settings);
+ hb_filter_object_s filter = InteropUtilities.ToStructureFromPtr<hb_filter_object_s>(HBFunctions.hb_filter_init(filterType));
+ filter.settings = settingsNativeString;
+
+ allocatedMemory.Add(settingsNativeString);
+ filterList.Add(filter);
+ }
+
+ /// <summary>
+ /// Adds a filter to the given filter list with the provided preset and tune.
+ /// </summary>
+ /// <param name="filterList">The list to add the filter to.</param>
+ /// <param name="filterType">The type of filter.</param>
+ /// <param name="preset">The preset name.</param>
+ /// <param name="tune">The tune name.</param>
+ private void AddFilterFromPreset(List<hb_filter_object_s> filterList, int filterType, string preset, string tune)
+ {
+ IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings(filterType, preset, tune);
+
+ hb_filter_object_s filter = InteropUtilities.ToStructureFromPtr<hb_filter_object_s>(HBFunctions.hb_filter_init(filterType));
+ filter.settings = settingsPtr;
+
+ filterList.Add(filter);
+ }
+ }
+}