diff options
author | sr55 <[email protected]> | 2015-02-28 20:10:51 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-02-28 20:10:51 +0000 |
commit | 649ff74c60c7d04d53e70bb2826327d1aae96be3 (patch) | |
tree | 51e3df9be5962cb52a6398751074e07f8b8d4a46 /win/CS | |
parent | 45f6af479741991c494808514c12752cec34c6ce (diff) |
WinGui: Moving the Interop Code into the services library. This will allow some modelling simplifications.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6949 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
147 files changed, 8360 insertions, 82 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index a14112886..32aeae5e6 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -106,6 +106,115 @@ <Compile Include="EventArgs\SettingChangedEventArgs.cs" />
<Compile Include="Exceptions\GeneralApplicationException.cs" />
<Compile Include="EventArgs\QueueProgressEventArgs.cs" />
+ <Compile Include="Interop\Attributes\ShortName.cs" />
+ <Compile Include="Interop\EventArgs\EncodeCompletedEventArgs.cs" />
+ <Compile Include="Interop\EventArgs\EncodeProgressEventArgs.cs" />
+ <Compile Include="Interop\EventArgs\MessageLoggedEventArgs.cs" />
+ <Compile Include="Interop\EventArgs\ScanProgressEventArgs.cs" />
+ <Compile Include="Interop\HandBrakeEncoderHelpers.cs" />
+ <Compile Include="Interop\HandBrakeInstance.cs" />
+ <Compile Include="Interop\HandBrakeInstanceManager.cs" />
+ <Compile Include="Interop\HandBrakeLanguagesHelper.cs" />
+ <Compile Include="Interop\HandBrakeUnitConversionHelpers.cs" />
+ <Compile Include="Interop\HandBrakeUtils.cs" />
+ <Compile Include="Interop\HbLib\HBDelegates.cs" />
+ <Compile Include="Interop\HbLib\HbFunctions.cs" />
+ <Compile Include="Interop\HbLib\hb_anamorphic_mode_t.cs" />
+ <Compile Include="Interop\HbLib\hb_container_s.cs" />
+ <Compile Include="Interop\HbLib\hb_encoder_s.cs" />
+ <Compile Include="Interop\HbLib\hb_error_code.cs" />
+ <Compile Include="Interop\HbLib\hb_filter_ids.cs" />
+ <Compile Include="Interop\HbLib\hb_geometry.cs" />
+ <Compile Include="Interop\HbLib\hb_image_s.cs" />
+ <Compile Include="Interop\HbLib\hb_mixdown_s.cs" />
+ <Compile Include="Interop\HbLib\hb_rate_s.cs" />
+ <Compile Include="Interop\HbLib\hb_subtitle.cs" />
+ <Compile Include="Interop\HbLib\iso639_lang_t.cs" />
+ <Compile Include="Interop\HbLib\NativeConstants.cs" />
+ <Compile Include="Interop\Helpers\InteropUtilities.cs" />
+ <Compile Include="Interop\Helpers\NativeList.cs" />
+ <Compile Include="Interop\Helpers\Utilities.cs" />
+ <Compile Include="Interop\Helpers\Validate.cs" />
+ <Compile Include="Interop\Interfaces\IHandBrakeInstance.cs" />
+ <Compile Include="Interop\Json\Anamorphic\AnamorphicGeometry.cs" />
+ <Compile Include="Interop\Json\Anamorphic\AnamorphicResult.cs" />
+ <Compile Include="Interop\Json\Anamorphic\DestSettings.cs" />
+ <Compile Include="Interop\Json\Anamorphic\Geometry.cs" />
+ <Compile Include="Interop\Json\Anamorphic\PAR.cs" />
+ <Compile Include="Interop\Json\Anamorphic\SourceGeometry.cs" />
+ <Compile Include="Interop\Json\Encode\Audio.cs" />
+ <Compile Include="Interop\Json\Encode\AudioList.cs" />
+ <Compile Include="Interop\Json\Encode\ChapterList.cs" />
+ <Compile Include="Interop\Json\Encode\Destination.cs" />
+ <Compile Include="Interop\Json\Encode\Filter.cs" />
+ <Compile Include="Interop\Json\Encode\FilterList.cs" />
+ <Compile Include="Interop\Json\Encode\JsonEncodeObject.cs" />
+ <Compile Include="Interop\Json\Encode\MetaData.cs" />
+ <Compile Include="Interop\Json\Encode\Mp4Options.cs" />
+ <Compile Include="Interop\Json\Encode\Range.cs" />
+ <Compile Include="Interop\Json\Encode\Search.cs" />
+ <Compile Include="Interop\Json\Encode\Source.cs" />
+ <Compile Include="Interop\Json\Encode\SRT.cs" />
+ <Compile Include="Interop\Json\Encode\Subtitle.cs" />
+ <Compile Include="Interop\Json\Encode\SubtitleList.cs" />
+ <Compile Include="Interop\Json\Encode\Video.cs" />
+ <Compile Include="Interop\Json\Factories\AnamorphicFactory.cs" />
+ <Compile Include="Interop\Json\Factories\EncodeFactory.cs" />
+ <Compile Include="Interop\Json\Factories\ScanFactory.cs" />
+ <Compile Include="Interop\Json\Scan\AudioList.cs" />
+ <Compile Include="Interop\Json\Scan\ChapterList.cs" />
+ <Compile Include="Interop\Json\Scan\Color.cs" />
+ <Compile Include="Interop\Json\Scan\Duration.cs" />
+ <Compile Include="Interop\Json\Scan\Duration2.cs" />
+ <Compile Include="Interop\Json\Scan\FrameRate.cs" />
+ <Compile Include="Interop\Json\Scan\Geometry.cs" />
+ <Compile Include="Interop\Json\Scan\JsonScanObject.cs" />
+ <Compile Include="Interop\Json\Scan\MetaData.cs" />
+ <Compile Include="Interop\Json\Scan\PAR.cs" />
+ <Compile Include="Interop\Json\Scan\SubtitleList.cs" />
+ <Compile Include="Interop\Json\Scan\TitleList.cs" />
+ <Compile Include="Interop\Json\State\JsonState.cs" />
+ <Compile Include="Interop\Json\State\Scanning.cs" />
+ <Compile Include="Interop\Json\State\WorkDone.cs" />
+ <Compile Include="Interop\Json\State\Working.cs" />
+ <Compile Include="Interop\Model\BitrateLimits.cs" />
+ <Compile Include="Interop\Model\Cropping.cs" />
+ <Compile Include="Interop\Model\EncodeJob.cs" />
+ <Compile Include="Interop\Model\Encoding\Anamorphic.cs" />
+ <Compile Include="Interop\Model\Encoding\AudioEncoder.cs" />
+ <Compile Include="Interop\Model\Encoding\AudioEncodeRateType.cs" />
+ <Compile Include="Interop\Model\Encoding\AudioEncoding.cs" />
+ <Compile Include="Interop\Model\Encoding\Container.cs" />
+ <Compile Include="Interop\Model\Encoding\Decomb.cs" />
+ <Compile Include="Interop\Model\Encoding\Deinterlace.cs" />
+ <Compile Include="Interop\Model\Encoding\Denoise.cs" />
+ <Compile Include="Interop\Model\Encoding\Detelecine.cs" />
+ <Compile Include="Interop\Model\Encoding\HBAudioEncoder.cs" />
+ <Compile Include="Interop\Model\Encoding\HBContainer.cs" />
+ <Compile Include="Interop\Model\Encoding\HBMixdown.cs" />
+ <Compile Include="Interop\Model\Encoding\HBRate.cs" />
+ <Compile Include="Interop\Model\Encoding\HBVideoEncoder.cs" />
+ <Compile Include="Interop\Model\Encoding\Mixdown.cs" />
+ <Compile Include="Interop\Model\Encoding\OutputExtension.cs" />
+ <Compile Include="Interop\Model\Encoding\PictureRotation.cs" />
+ <Compile Include="Interop\Model\Encoding\ScaleMethod.cs" />
+ <Compile Include="Interop\Model\Encoding\VideoEncoder.cs" />
+ <Compile Include="Interop\Model\Encoding\VideoEncodeRateType.cs" />
+ <Compile Include="Interop\Model\Language.cs" />
+ <Compile Include="Interop\Model\RangeLimits.cs" />
+ <Compile Include="Interop\Model\Scan\AudioTrack.cs" />
+ <Compile Include="Interop\Model\Scan\Chapter.cs" />
+ <Compile Include="Interop\Model\Scan\InputType.cs" />
+ <Compile Include="Interop\Model\Scan\Subtitle.cs" />
+ <Compile Include="Interop\Model\Scan\SubtitleSource.cs" />
+ <Compile Include="Interop\Model\Scan\Title.cs" />
+ <Compile Include="Interop\Model\Size.cs" />
+ <Compile Include="Interop\Model\SourceSubtitle.cs" />
+ <Compile Include="Interop\Model\SourceType.cs" />
+ <Compile Include="Interop\Model\SrtSubtitle.cs" />
+ <Compile Include="Interop\Model\Subtitles.cs" />
+ <Compile Include="Interop\Model\VideoQualityLimits.cs" />
+ <Compile Include="Interop\Model\VideoRangeType.cs" />
<Compile Include="Isolation\BackgroundServiceConnector.cs" />
<Compile Include="Isolation\IsolatedEncodeService.cs" />
<Compile Include="Services\Encode\Factories\VideoProfileFactory.cs" />
@@ -183,12 +292,6 @@ <SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\HandBrake.Interop\HandBrakeInterop\HandBrake.Interop.csproj">
- <Project>{F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}</Project>
- <Name>HandBrake.Interop</Name>
- </ProjectReference>
- </ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(ProgramFiles)\MSBuild\StyleCop\v4.*\StyleCop.targets" />
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Attributes/ShortName.cs b/win/CS/HandBrake.ApplicationServices/Interop/Attributes/ShortName.cs new file mode 100644 index 000000000..55df6136e --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Attributes/ShortName.cs @@ -0,0 +1,35 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ShortName.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 Short Name for an enum value
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Attributes
+{
+ using System;
+
+ /// <summary>
+ /// A Short Name for an enum value
+ /// </summary>
+ public class ShortName : Attribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ShortName"/> class.
+ /// </summary>
+ /// <param name="shortName">
+ /// The short name.
+ /// </param>
+ public ShortName(string shortName)
+ {
+ this.Name = shortName;
+ }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string Name { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeCompletedEventArgs.cs b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeCompletedEventArgs.cs new file mode 100644 index 000000000..26d9b4f67 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeCompletedEventArgs.cs @@ -0,0 +1,24 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>
+ /// Encode Completed Event Args
+ /// </summary>
+ public class EncodeCompletedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether an error occurred during the encode.
+ /// </summary>
+ public bool Error { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs new file mode 100644 index 000000000..245132016 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/EncodeProgressEventArgs.cs @@ -0,0 +1,44 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>s
+ /// Encode Progress Event Args
+ /// </summary>
+ public class EncodeProgressEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Gets or sets FractionComplete.
+ /// </summary>
+ public double FractionComplete { get; set; }
+
+ /// <summary>
+ /// Gets or sets CurrentFrameRate.
+ /// </summary>
+ public double CurrentFrameRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets AverageFrameRate.
+ /// </summary>
+ public double AverageFrameRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets EstimatedTimeLeft.
+ /// </summary>
+ public TimeSpan EstimatedTimeLeft { get; set; }
+
+ /// <summary>
+ /// Gets or sets the current encoding pass. (-1: subtitle scan, 1: first pass, 2: second pass)
+ /// </summary>
+ public int Pass { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/MessageLoggedEventArgs.cs b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/MessageLoggedEventArgs.cs new file mode 100644 index 000000000..432b1da59 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/MessageLoggedEventArgs.cs @@ -0,0 +1,24 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>
+ /// The Message Logged Event Args
+ /// </summary>
+ public class MessageLoggedEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Gets or sets Message.
+ /// </summary>
+ public string Message { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/ScanProgressEventArgs.cs b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/ScanProgressEventArgs.cs new file mode 100644 index 000000000..f58a04c0b --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/EventArgs/ScanProgressEventArgs.cs @@ -0,0 +1,44 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.EventArgs
+{
+ using System;
+
+ /// <summary>
+ /// The Scan Progress Event Args
+ /// </summary>
+ public class ScanProgressEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Gets or sets the total progress fraction for the scan.
+ /// </summary>
+ public double Progress { get; set; }
+
+ /// <summary>
+ /// Gets or sets the current preview being processed on the scan.
+ /// </summary>
+ public int CurrentPreview { get; set; }
+
+ /// <summary>
+ /// Gets or sets the total number of previews to process.
+ /// </summary>
+ public int Previews { get; set; }
+
+ /// <summary>
+ /// Gets or sets the current title being processed on the scan.
+ /// </summary>
+ public int CurrentTitle { get; set; }
+
+ /// <summary>
+ /// Gets or sets the total number of titles to process.
+ /// </summary>
+ public int Titles { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs new file mode 100644 index 000000000..c0a4195f9 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -0,0 +1,533 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Encoders.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.ApplicationServices.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
+
+ /// <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 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>
+ /// Determines if the given encoder is compatible with the given track.
+ /// </summary>
+ /// <param name="track">
+ /// The audio track to examine.
+ /// </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(AudioTrack track, HBAudioEncoder encoder)
+ {
+ return (track.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 DRC can be applied to the given track with the given encoder.
+ /// </summary>
+ /// <param name="track">
+ /// The track to apply DRC to.
+ /// </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(AudioTrack track, HBAudioEncoder encoder, int title)
+ {
+ return HBFunctions.hb_audio_can_apply_drc2(HandBrakeInstanceManager.LastScanHandle, title, track.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)
+ {
+ int sanitizedMixdown = HBFunctions.hb_mixdown_get_best((uint)encoder.Id, layout, mixdown.Id);
+ return Mixdowns.Single(m => m.Id == sanitizedMixdown);
+ }
+
+ /// <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>
+ /// 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 = low, High = 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 = low,
+ High = high,
+ Granularity = granularity,
+ Ascending = 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>
+ internal 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
+ {
+ Low = low,
+ High = high,
+ Granularity = granularity,
+ Ascending = direction == 0
+ };
+ }
+
+ /// <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>
+ internal 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
+ {
+ Low = low,
+ High = high,
+ Granularity = granularity,
+ Ascending = direction == 0
+ };
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs new file mode 100644 index 000000000..82e44c04a --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstance.cs @@ -0,0 +1,551 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Drawing;
+ using System.Drawing.Imaging;
+ using System.IO;
+ using System.Linq;
+ using System.Runtime.ExceptionServices;
+ using System.Runtime.InteropServices;
+ using System.Timers;
+ using System.Windows.Media.Imaging;
+
+ using HandBrake.ApplicationServices.Interop.EventArgs;
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
+ using HandBrake.ApplicationServices.Interop.Interfaces;
+ using HandBrake.ApplicationServices.Interop.Json.Encode;
+ using HandBrake.ApplicationServices.Interop.Json.Factories;
+ using HandBrake.ApplicationServices.Interop.Json.Scan;
+ using HandBrake.ApplicationServices.Interop.Json.State;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
+
+ using Newtonsoft.Json;
+
+ using Geometry = HandBrake.ApplicationServices.Interop.Json.Anamorphic.Geometry;
+
+ /// <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 = 200;
+
+ /// <summary>
+ /// The number of MS between status polls when encoding.
+ /// </summary>
+ private const double EncodePollIntervalMs = 200;
+
+ /// <summary>
+ /// The native handle to the HandBrake instance.
+ /// </summary>
+ private IntPtr hbHandle;
+
+ /// <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 List<Title> titles;
+
+ /// <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.Handle;
+ }
+ }
+
+ /// <summary>
+ /// Gets the list of titles on this instance.
+ /// </summary>
+ public List<Title> Titles
+ {
+ get
+ {
+ return this.titles;
+ }
+ }
+
+ /// <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)
+ {
+ 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);
+ }
+ };
+ 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="job">
+ /// The encode job to preview.
+ /// </param>
+ /// <param name="previewNumber">
+ /// The index of the preview to get (0-based).
+ /// </param>
+ /// <returns>
+ /// An image with the requested preview.
+ /// </returns>
+ [HandleProcessCorruptedStateExceptions]
+ public BitmapImage GetPreview(EncodeJob job, int previewNumber)
+ {
+ Title title = this.Titles.FirstOrDefault(t => t.TitleNumber == job.Title);
+ Validate.NotNull(title, "GetPreview: Title should not have been null. This is probably a bug.");
+
+ // Creat the Expected Output Geometry details for libhb.
+ hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s
+ {
+ crop = new[] { job.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right },
+ itu_par = 0,
+ keep = (int)AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH + (job.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width?
+ maxWidth = job.MaxWidth,
+ maxHeight = job.MaxHeight,
+ mode = (int)(hb_anamorphic_mode_t)job.Anamorphic,
+ modulus = job.Modulus,
+ geometry = new hb_geometry_s
+ {
+ height = job.Height,
+ width = job.Width,
+ par = job.Anamorphic != Anamorphic.Custom
+ ? new hb_rational_t { den = title.ParVal.Height, num = title.ParVal.Width }
+ : new hb_rational_t { den = job.PixelAspectY, num = job.PixelAspectX }
+ }
+ };
+
+ // Sanatise the input.
+ Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, title, AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH); // TODO this keep isn't right.
+ int width = resultGeometry.Width * resultGeometry.PAR.Num / resultGeometry.PAR.Den;
+ int height = resultGeometry.Height;
+ uiGeometry.geometry.height = resultGeometry.Height; // Prased the height now.
+ int outputWidth = width;
+ int outputHeight = height;
+
+ // Fetch the image data from LibHb
+ IntPtr resultingImageStuct = HBFunctions.hb_get_preview2(this.hbHandle, job.Title, previewNumber, ref uiGeometry, 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);
+
+ var bitmap = new Bitmap(outputWidth, outputHeight);
+ BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, outputWidth, outputHeight), ImageLockMode.WriteOnly, PixelFormat.Format32bppRgb);
+
+ IntPtr ptr = bitmapData.Scan0; // Pointer to the first pixel.
+ for (int i = 0; i < image.height; i++)
+ {
+ try
+ {
+ Marshal.Copy(managedBuffer, i * stride_width, ptr, stride_width);
+ ptr = IntPtr.Add(ptr, outputWidth * 4);
+ }
+ catch (Exception exc)
+ {
+ Debug.WriteLine(exc); // In theory, this will allow a partial image display if this happens. TODO add better logging of this.
+ }
+ }
+
+ bitmap.UnlockBits(bitmapData);
+
+ // 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);
+
+ // Create a Bitmap Image for display.
+ using (var memoryStream = new MemoryStream())
+ {
+ try
+ {
+ bitmap.Save(memoryStream, ImageFormat.Bmp);
+ }
+ finally
+ {
+ bitmap.Dispose();
+ }
+
+ var wpfBitmap = new BitmapImage();
+ wpfBitmap.BeginInit();
+ wpfBitmap.CacheOption = BitmapCacheOption.OnLoad;
+ wpfBitmap.StreamSource = memoryStream;
+ wpfBitmap.EndInit();
+ wpfBitmap.Freeze();
+
+ return wpfBitmap;
+ }
+ }
+
+ /// <summary>
+ /// Starts an encode with the given job.
+ /// </summary>
+ /// <param name="job">
+ /// The job to start.
+ /// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ [HandleProcessCorruptedStateExceptions]
+ public void StartEncode(EncodeJob job, Title title)
+ {
+ JsonEncodeObject encodeObject = EncodeFactory.Create(job, title);
+
+ JsonSerializerSettings settings = new JsonSerializerSettings
+ {
+ NullValueHandling = NullValueHandling.Ignore,
+ };
+
+ string encode = JsonConvert.SerializeObject(encodeObject, Formatting.Indented, settings);
+ HBFunctions.hb_add_json(this.hbHandle, InteropUtilities.ToUtf8PtrFromString(encode));
+ 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>
+ /// 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 = JsonConvert.DeserializeObject<JsonState>(statusJson);
+
+ if (state != null && state.State == NativeConstants.HB_STATE_SCANNING)
+ {
+ if (this.ScanProgress != null)
+ {
+ this.ScanProgress(this, new ScanProgressEventArgs
+ {
+ Progress = state.Scanning.Progress,
+ CurrentPreview = state.Scanning.Preview,
+ Previews = state.Scanning.PreviewCount,
+ CurrentTitle = state.Scanning.Title,
+ Titles = state.Scanning.TitleCount
+ });
+ }
+ }
+ else if (state != null && state.State == NativeConstants.HB_STATE_SCANDONE)
+ {
+ this.titles = new List<Title>();
+
+ var jsonMsg = HBFunctions.hb_get_title_set_json(this.hbHandle);
+
+ string scanJson = InteropUtilities.ToStringFromUtf8Ptr(jsonMsg);
+
+ JsonScanObject scanObject = JsonConvert.DeserializeObject<JsonScanObject>(scanJson);
+
+ foreach (Title title in ScanFactory.CreateTitleSet(scanObject))
+ {
+ // Set the Main Title.
+ this.featureTitle = title.IsMainFeature ? title.TitleNumber : 0;
+
+ this.titles.Add(title);
+ }
+
+ this.scanPollTimer.Stop();
+
+ if (this.ScanCompleted != null)
+ {
+ this.ScanCompleted(this, new System.EventArgs());
+ }
+ }
+ }
+
+ /// <summary>
+ /// Checks the status of the ongoing encode.
+ /// </summary>
+ /// <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);
+
+ if (state != null && state.State == NativeConstants.HB_STATE_WORKING)
+ {
+ if (this.EncodeProgress != null)
+ {
+ var progressEventArgs = new EncodeProgressEventArgs
+ {
+ FractionComplete = state.Working.Progress,
+ CurrentFrameRate = state.Working.Rate,
+ AverageFrameRate = state.Working.RateAvg,
+ EstimatedTimeLeft = new TimeSpan(state.Working.Hours, state.Working.Minutes, state.Working.Seconds),
+ Pass = 1, // TODO
+ };
+
+ this.EncodeProgress(this, progressEventArgs);
+ }
+ }
+ else if (state != null && state.State == NativeConstants.HB_STATE_WORKDONE)
+ {
+ this.encodePollTimer.Stop();
+
+ if (this.EncodeCompleted != null)
+ {
+ this.EncodeCompleted(this, new EncodeCompletedEventArgs
+ {
+ Error = state.WorkDone.Error != (int)hb_error_code.HB_ERROR_NONE
+ });
+ }
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstanceManager.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstanceManager.cs new file mode 100644 index 000000000..9dc3c1d79 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeInstanceManager.cs @@ -0,0 +1,117 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop
+{
+ using System;
+
+ using HandBrake.ApplicationServices.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;
+
+ /// <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>
+ /// Gets the last scan scan instance.
+ /// </summary>
+ public 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>
+ public 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.ApplicationServices/Interop/HandBrakeLanguagesHelper.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeLanguagesHelper.cs new file mode 100644 index 000000000..7d059f047 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop
+{
+ using System.Collections.Generic;
+
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
+ using HandBrake.ApplicationServices.Interop.Model;
+
+ /// <summary>
+ /// Contains utilities for converting language codes.
+ /// </summary>
+ public static class Languages
+ {
+ /// <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.ApplicationServices/Interop/HandBrakeUnitConversionHelpers.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUnitConversionHelpers.cs new file mode 100644 index 000000000..ab66617fc --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUnitConversionHelpers.cs @@ -0,0 +1,220 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.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>
+ public static HBVideoEncoder NativeToVideoEncoder(hb_encoder_s encoder)
+ {
+ return new HBVideoEncoder
+ {
+ Id = encoder.codec,
+ ShortName = encoder.short_name,
+ DisplayName = encoder.name,
+ CompatibleContainers = encoder.muxers
+ };
+ }
+
+ /// <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>
+ public static HBAudioEncoder NativeToAudioEncoder(hb_encoder_s encoder)
+ {
+ var result = new HBAudioEncoder
+ {
+ Id = encoder.codec,
+ ShortName = encoder.short_name,
+ DisplayName = encoder.name,
+ CompatibleContainers = encoder.muxers,
+ QualityLimits = HandBrakeEncoderHelpers.GetAudioQualityLimits(encoder.codec),
+ DefaultQuality = HBFunctions.hb_audio_quality_get_default((uint)encoder.codec),
+ CompressionLimits = HandBrakeEncoderHelpers.GetAudioCompressionLimits(encoder.codec),
+ DefaultCompression =
+ HBFunctions.hb_audio_compression_get_default((uint)encoder.codec)
+ };
+
+ 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>
+ public static HBRate NativeToRate(hb_rate_s rate)
+ {
+ return new HBRate
+ {
+ Name = rate.name,
+ Rate = 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>
+ public static HBMixdown NativeToMixdown(hb_mixdown_s mixdown)
+ {
+ return new HBMixdown
+ {
+ Id = mixdown.amixdown,
+ ShortName = mixdown.short_name,
+ DisplayName = mixdown.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>
+ public static HBContainer NativeToContainer(hb_container_s container)
+ {
+ return new HBContainer
+ {
+ DisplayName = container.name,
+ ShortName = container.short_name,
+ DefaultExtension = container.default_extension,
+ Id = container.format
+ };
+ }
+
+ /// <summary>
+ /// Converts a native language structure to a Language object.
+ /// </summary>
+ /// <param name="language">
+ /// The structure to convert.
+ /// </param>
+ /// <returns>
+ /// The converted structure.
+ /// </returns>
+ public static Language NativeToLanguage(iso639_lang_t language)
+ {
+ string englishName = InteropUtilities.ToStringFromUtf8Ptr(language.eng_name);
+ string nativeName = InteropUtilities.ToStringFromUtf8Ptr(language.native_name);
+ return new Language
+ {
+ Code = language.iso639_2,
+ EnglishName = englishName,
+ NativeName = nativeName
+ };
+ }
+
+ /// <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.ApplicationServices/Interop/HandBrakeUtils.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs new file mode 100644 index 000000000..2ad727a9e --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeUtils.cs @@ -0,0 +1,329 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.ApplicationServices.Interop.EventArgs;
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
+
+ /// <summary>
+ /// HandBrake Interop Utilities
+ /// </summary>
+ public static class HandBrakeUtils
+ {
+ /// <summary>
+ /// Estimated overhead in bytes for each frame in output container.
+ /// </summary>
+ internal const int ContainerOverheadPerFrame = 6;
+
+ /// <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)
+ {
+ if (!string.IsNullOrEmpty(message))
+ {
+ string[] messageParts = message.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
+
+ if (messageParts.Length > 0)
+ {
+ message = messageParts[0];
+ 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(
+ preset,
+ string.Join(",", tunes),
+ extraOptions,
+ profile,
+ level,
+ width,
+ height);
+
+ string x264Settings = Marshal.PtrToStringAnsi(ptr);
+
+ return x264Settings;
+ }
+
+ /// <summary>
+ /// Sends the message logged event to any registered listeners.
+ /// </summary>
+ /// <param name="message">
+ /// The message to send.
+ /// </param>
+ private static void SendMessageEvent(string message)
+ {
+ if (MessageLogged != null)
+ {
+ MessageLogged(null, new MessageLoggedEventArgs { Message = message });
+ }
+
+ Debug.WriteLine(message);
+ }
+
+ /// <summary>
+ /// Sends the error logged event to any registered listeners.
+ /// </summary>
+ /// <param name="message">
+ /// The message to send
+ /// </param>
+ private static void SendErrorEvent(string message)
+ {
+ if (ErrorLogged != null)
+ {
+ ErrorLogged(null, new MessageLoggedEventArgs { Message = message });
+ }
+
+ Debug.WriteLine("ERROR: " + message);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HBDelegates.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HBDelegates.cs new file mode 100644 index 000000000..283beb88e --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ public delegate void LoggingCallback(string message);
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs new file mode 100644 index 000000000..23f0df750 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/HbFunctions.cs @@ -0,0 +1,442 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.HbLib
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ /// <summary>
+ /// Contains p-invoke function declarations to hblib.
+ /// </summary>
+ public static class HBFunctions
+ {
+ [DllImport("hb.dll", EntryPoint = "hb_register_logger", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_register_logger(LoggingCallback callback);
+
+ [DllImport("hb.dll", EntryPoint = "hb_register_error_handler", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_register_error_handler(LoggingCallback callback);
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_dvd_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_dvd_name(IntPtr path);
+
+
+ /// Return Type: void
+ ///enable: int
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_get_titles", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_get_titles(IntPtr hbHandle);
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_start", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_start(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ [DllImport("hb.dll", EntryPoint = "hb_pause", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_pause(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ [DllImport("hb.dll", EntryPoint = "hb_resume", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_resume(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t*
+ [DllImport("hb.dll", EntryPoint = "hb_stop", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_stop(IntPtr hbHandle);
+
+
+ /// Return Type: int
+ ///param0: hb_handle_t*
+ [DllImport("hb.dll", EntryPoint = "hb_get_scancount", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_get_scancount(IntPtr hbHandle);
+
+
+ /// Return Type: void
+ ///param0: hb_handle_t**
+ [DllImport("hb.dll", EntryPoint = "hb_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_close(IntPtr hbHandle);
+
+ [DllImport("hb.dll", EntryPoint = "hb_global_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_global_close();
+
+ //hb_list_t * hb_list_init();
+ [DllImport("hb.dll", EntryPoint = "hb_list_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_list_init();
+
+ //int hb_list_count( const hb_list_t * );
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_list_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_close(IntPtr listPtrPtr);
+
+ [DllImport("hb.dll", EntryPoint = "hb_subtitle_can_force", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_subtitle_can_force(int source);
+
+ [DllImport("hb.dll", EntryPoint = "hb_subtitle_can_burn", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_subtitle_can_burn(int source);
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_audio_samplerate_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_audio_samplerate_get_next(IntPtr last);
+
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_audio_bitrate_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_audio_bitrate_get_next(IntPtr last);
+
+ [DllImport("hb.dll", 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.dll", EntryPoint = "hb_video_quality_get_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_quality_get_name(uint codec);
+
+ [DllImport("hb.dll", 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.dll", EntryPoint = "hb_audio_quality_get_default", CallingConvention = CallingConvention.Cdecl)]
+ public static extern float hb_audio_quality_get_default(uint codec);
+
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_mixdown_is_supported", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout);
+
+ [DllImport("hb.dll", EntryPoint = "hb_mixdown_has_codec_support", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_has_codec_support(int mixdown, uint codec);
+
+ [DllImport("hb.dll", 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.dll", EntryPoint = "hb_mixdown_get_best", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_mixdown_get_best(uint codec, ulong layout, int mixdown);
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_container_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_container_get_next(IntPtr last);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_presets", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_presets(int encoder);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_tunes", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_tunes(int encoder);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_profiles", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_profiles(int encoder);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_encoder_get_levels", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_encoder_get_levels(int encoder);
+
+
+ [DllImport("hb.dll", EntryPoint = "lang_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr lang_get_next(IntPtr last);
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", EntryPoint = "hb_filter_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_filter_init(int filter_id);
+
+ [DllImport("hb.dll", EntryPoint = "hb_generate_filter_settings", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_generate_filter_settings(
+ int filter_id,
+ [In] [MarshalAs(UnmanagedType.LPStr)] string preset,
+ [In] [MarshalAs(UnmanagedType.LPStr)] string tune);
+
+ [DllImport("hb.dll", EntryPoint = "hb_x264_encopt_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_x264_encopt_name(IntPtr name);
+
+ [DllImport("hb.dll", 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.dll", EntryPoint = "hb_x264_param_unparse", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_x264_param_unparse(
+ [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.dll", EntryPoint = "hb_get_opencl_env", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_get_opencl_env();
+
+ [DllImport("hb.dll", EntryPoint = "hb_qsv_available", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_qsv_available();
+
+ [DllImport("hb.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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.dll", 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);
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs new file mode 100644 index 000000000..e4500c864 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/NativeConstants.cs @@ -0,0 +1,52 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.HbLib
+{
+ public class NativeConstants
+ {
+ // Audio encoders
+ public const uint HB_ACODEC_MASK = 0x00FFFF00;
+ 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_FF_MASK = 0x00FF2800;
+ public const uint HB_ACODEC_PASS_FLAG = 0x40000000;
+ public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA);
+ 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_ANY = (HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG);
+
+ // 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;
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_anamorphic_mode_t.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_anamorphic_mode_t.cs new file mode 100644 index 000000000..6940e73a8 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_anamorphic_mode_t.cs @@ -0,0 +1,20 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.HbLib
+{
+ public enum hb_anamorphic_mode_t
+ {
+ HB_ANAMORPHIC_NONE,
+ HB_ANAMORPHIC_STRICT,
+ HB_ANAMORPHIC_LOOSE,
+ HB_ANAMORPHIC_CUSTOM
+ } ;
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_container_s.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_container_s.cs new file mode 100644 index 000000000..b332f25eb --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public 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.ApplicationServices/Interop/HbLib/hb_encoder_s.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_encoder_s.cs new file mode 100644 index 000000000..a4ac0f8e9 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public 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.ApplicationServices/Interop/HbLib/hb_error_code.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_error_code.cs new file mode 100644 index 000000000..ac8a91592 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_error_code.cs @@ -0,0 +1,23 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.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
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_filter_ids.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_filter_ids.cs new file mode 100644 index 000000000..67803b5b2 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_filter_ids.cs @@ -0,0 +1,30 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.HbLib
+{
+ internal enum hb_filter_ids
+ {
+ HB_FILTER_QSV_PRE = 1, // for QSV - important to have before other filters
+ // First, filters that may change the framerate (drop or dup frames)
+ HB_FILTER_DETELECINE,
+ 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_HQDN3D,
+ HB_FILTER_NLMEANS,
+ HB_FILTER_RENDER_SUB,
+ HB_FILTER_CROP_SCALE,
+ // Finally filters that don't care what order they are in,
+ // except that they must be after the above filters
+ HB_FILTER_ROTATE,
+ HB_FILTER_QSV_POST, // for QSV - important to have as a last one
+ HB_FILTER_QSV, // default MSDK VPP filter
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_geometry.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_geometry.cs new file mode 100644 index 000000000..8a6cfa3e6 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/HbLib/hb_image_s.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_image_s.cs new file mode 100644 index 000000000..764a3ea43 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/HbLib/hb_mixdown_s.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_mixdown_s.cs new file mode 100644 index 000000000..3d6654daf --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public 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.ApplicationServices/Interop/HbLib/hb_rate_s.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_rate_s.cs new file mode 100644 index 000000000..9c365eac9 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.HbLib
+{
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct hb_rate_s
+ {
+ /// char*
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string name;
+
+ /// int
+ public int rate;
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_subtitle.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/hb_subtitle.cs new file mode 100644 index 000000000..ac2a7e80b --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.HbLib
+{
+ public enum hb_subtitle_s_subsource
+ {
+ VOBSUB,
+
+ SRTSUB,
+
+ CC608SUB,
+
+ CC708SUB,
+
+ UTF8SUB,
+
+ TX3GSUB,
+
+ SSASUB,
+
+ PGSSUB
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HbLib/iso639_lang_t.cs b/win/CS/HandBrake.ApplicationServices/Interop/HbLib/iso639_lang_t.cs new file mode 100644 index 000000000..e99b79c9a --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.HbLib
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ [StructLayout(LayoutKind.Sequential)]
+ public 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.ApplicationServices/Interop/Helpers/InteropUtilities.cs b/win/CS/HandBrake.ApplicationServices/Interop/Helpers/InteropUtilities.cs new file mode 100644 index 000000000..ad8f35762 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.Helpers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Runtime.InteropServices;
+ using System.Text;
+
+ using HandBrake.ApplicationServices.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 interator 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.ApplicationServices/Interop/Helpers/NativeList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Helpers/NativeList.cs new file mode 100644 index 000000000..0731bd331 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.Helpers
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.ApplicationServices.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.ApplicationServices/Interop/Helpers/Utilities.cs b/win/CS/HandBrake.ApplicationServices/Interop/Helpers/Utilities.cs new file mode 100644 index 000000000..cd44e12d8 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Helpers/Validate.cs b/win/CS/HandBrake.ApplicationServices/Interop/Helpers/Validate.cs new file mode 100644 index 000000000..4533ac21d --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.Interop.Helpers
+{
+ using System;
+
+ /// <summary>
+ /// The validate.
+ /// </summary>
+ internal 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.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs new file mode 100644 index 000000000..e416a7673 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Interfaces/IHandBrakeInstance.cs @@ -0,0 +1,143 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Interfaces
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Windows.Media.Imaging;
+
+ using HandBrake.ApplicationServices.Interop.EventArgs;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
+
+ /// <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>
+ List<Title> Titles { 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>
+ /// <returns>
+ /// An image with the requested preview.
+ /// </returns>
+ BitmapImage GetPreview(EncodeJob job, int previewNumber);
+
+ /// <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>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ void StartEncode(EncodeJob jobToStart, Title title);
+
+ /// <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>
+ /// <param name="titleIndex">
+ /// The title index to scan (1-based, 0 for all titles).
+ /// </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.ApplicationServices/Interop/Json/Anamorphic/AnamorphicGeometry.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Anamorphic/AnamorphicGeometry.cs new file mode 100644 index 000000000..993d54657 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.Interop.Json.Anamorphic
+{
+ /// <summary>
+ /// The geometry.
+ /// </summary>
+ internal class AnamorphicGeometry
+ {
+ /// <summary>
+ /// Gets or sets the dest geometry.
+ /// </summary>
+ public DestSettings DestSettings { 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.ApplicationServices/Interop/Json/Anamorphic/AnamorphicResult.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Anamorphic/AnamorphicResult.cs new file mode 100644 index 000000000..ab28a8c32 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Anamorphic/DestSettings.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Anamorphic/DestSettings.cs new file mode 100644 index 000000000..f377892e9 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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 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.ApplicationServices/Interop/Json/Anamorphic/Geometry.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Anamorphic/Geometry.cs new file mode 100644 index 000000000..b70b58f6b --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Anamorphic/PAR.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Anamorphic/PAR.cs new file mode 100644 index 000000000..895666633 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Anamorphic/SourceGeometry.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Anamorphic/SourceGeometry.cs new file mode 100644 index 000000000..2496093e9 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Audio.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Audio.cs new file mode 100644 index 000000000..5a2c97066 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/AudioList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/AudioList.cs new file mode 100644 index 000000000..9e1af92df --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/ChapterList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/ChapterList.cs new file mode 100644 index 000000000..d58146510 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Destination.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Destination.cs new file mode 100644 index 000000000..42b3eaa40 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Filter.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Filter.cs new file mode 100644 index 000000000..9082ff8a2 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/FilterList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/FilterList.cs new file mode 100644 index 000000000..e08a76ba8 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs new file mode 100644 index 000000000..7b9a1f953 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.Json.Encode
+{
+ using HandBrake.ApplicationServices.Interop.Json.Anamorphic;
+
+ /// <summary>
+ /// The root object.
+ /// </summary>
+ internal 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.ApplicationServices/Interop/Json/Encode/MetaData.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/MetaData.cs new file mode 100644 index 000000000..86f06b8cb --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Mp4Options.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Mp4Options.cs new file mode 100644 index 000000000..ad12e4e69 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Range.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Range.cs new file mode 100644 index 000000000..50b874501 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Range.cs @@ -0,0 +1,57 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.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; }
+
+ /// <summary>
+ /// Gets or sets the seek points.
+ /// </summary>
+ public int? SeekPoints { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SRT.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SRT.cs new file mode 100644 index 000000000..94229c97b --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Search.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Search.cs new file mode 100644 index 000000000..8e5625f00 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Source.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Source.cs new file mode 100644 index 000000000..7adc228a9 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Subtitle.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Subtitle.cs new file mode 100644 index 000000000..c5e8d56f7 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/SubtitleList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleList.cs new file mode 100644 index 000000000..99781bf29 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/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.ApplicationServices.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.ApplicationServices/Interop/Json/Encode/Video.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Video.cs new file mode 100644 index 000000000..957f3dfb8 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Video.cs @@ -0,0 +1,74 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Encode
+{
+ using System;
+
+ /// <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 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; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/AnamorphicFactory.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/AnamorphicFactory.cs new file mode 100644 index 000000000..9aa335a52 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/AnamorphicFactory.cs @@ -0,0 +1,111 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Factories
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Json.Anamorphic;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
+
+ using Newtonsoft.Json;
+
+ /// <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>
+ /// The create geometry.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <param name="title">
+ /// The current title.
+ /// </param>
+ /// <param name="keepWidthOrHeight">
+ /// Keep Width or Height. (Not Display Aspect)
+ /// </param>
+ /// <returns>
+ /// The <see cref="Scan.Geometry"/>.
+ /// </returns>
+ public static Geometry CreateGeometry(EncodeJob job, Title title, KeepSetting keepWidthOrHeight) // Todo remove the need for these objects. Should use simpler objects.
+ {
+ int settingMode = (int)keepWidthOrHeight + (job.KeepDisplayAspect ? 0x04 : 0);
+
+ // Sanatise the Geometry First.
+ AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry
+ {
+ SourceGeometry = new SourceGeometry
+ {
+ Width = title.Resolution.Width,
+ Height = title.Resolution.Height,
+ PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height }
+ },
+ DestSettings = new DestSettings
+ {
+ AnamorphicMode = (int)job.Anamorphic,
+ Geometry = {
+ Width = job.Width, Height = job.Height,
+ PAR = new PAR
+ {
+ Num = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : job.PixelAspectX,
+ Den = job.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : job.PixelAspectY,
+ }
+ },
+ Keep = settingMode,
+ Crop = new List<int> { job.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right },
+ Modulus = job.Modulus,
+ MaxWidth = job.MaxWidth,
+ MaxHeight = job.MaxHeight,
+ ItuPAR = false
+ }
+ };
+
+ if (job.Anamorphic == Anamorphic.Custom)
+ {
+ anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = job.PixelAspectX, Den = job.PixelAspectY };
+ }
+ else
+ {
+ anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height };
+ }
+
+ 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);
+ AnamorphicResult resultGeometry = JsonConvert.DeserializeObject<AnamorphicResult>(result);
+
+ // Setup the Destination Gemotry.
+ Geometry geometry = new Geometry
+ {
+ Width = resultGeometry.Width,
+ Height = resultGeometry.Height,
+ PAR = resultGeometry.PAR
+ };
+ return geometry;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/EncodeFactory.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/EncodeFactory.cs new file mode 100644 index 000000000..083e60884 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/EncodeFactory.cs @@ -0,0 +1,516 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Factories
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Globalization;
+ using System.Linq;
+ using System.Runtime.InteropServices;
+ using System.Windows.Media.Animation;
+
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
+ using HandBrake.ApplicationServices.Interop.Json.Anamorphic;
+ using HandBrake.ApplicationServices.Interop.Json.Encode;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
+
+ using Subtitle = HandBrake.ApplicationServices.Interop.Json.Encode.Subtitle;
+
+ /// <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
+ {
+ /*
+ * TODO:
+ * 1. OpenCL and HWD Support
+ * 2. Rotate Support
+ */
+
+ /// <summary>
+ /// The create.
+ /// </summary>
+ /// <param name="job">
+ /// The encode job.
+ /// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <returns>
+ /// The <see cref="JsonEncodeObject"/>.
+ /// </returns>
+ internal static JsonEncodeObject Create(EncodeJob job, Title title)
+ {
+ JsonEncodeObject encode = new JsonEncodeObject
+ {
+ SequenceID = 0,
+ Audio = CreateAudio(job),
+ Destination = CreateDestination(job),
+ Filter = CreateFilter(job, title),
+ PAR = CreatePAR(job, title),
+ 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)
+ {
+ Range range = new Range();
+ switch (job.RangeType)
+ {
+ case VideoRangeType.Chapters:
+ range.ChapterEnd = job.ChapterEnd;
+ range.ChapterStart = job.ChapterStart;
+ break;
+ case VideoRangeType.Seconds:
+ range.PtsToStart = (int)(job.SecondsStart * 90000);
+ range.PtsToStop = (int)((job.SecondsEnd - job.SecondsStart) * 90000);
+ break;
+ case VideoRangeType.Frames:
+ range.FrameToStart = job.FramesStart;
+ range.FrameToStop = job.FramesEnd;
+ break;
+ case VideoRangeType.Preview:
+ range.StartAtPreview = job.StartAtPreview;
+ range.SeekPoints = job.SeekPoints;
+ range.PtsToStop = job.SecondsEnd * 90000;
+ break;
+ }
+
+ Source source = new Source
+ {
+ Title = job.Title,
+ Range = range,
+ 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.IPod5GSupport,
+ Mp4Optimize = job.Optimize
+ },
+ ChapterMarkers = job.IncludeChapterMarkers,
+ Mux = HBFunctions.hb_container_get_from_name(job.ContainerName),
+ ChapterList = new List<ChapterList>()
+ };
+
+ if (job.UseDefaultChapterNames)
+ {
+ 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>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <returns>
+ /// The produced PAR object.
+ /// </returns>
+ private static PAR CreatePAR(EncodeJob job, Title title)
+ {
+ Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, title, AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH);
+ return new PAR { Num = resultGeometry.PAR.Num, Den = resultGeometry.PAR.Den };
+ }
+
+ /// <summary>
+ /// The create subtitle.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Encode.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)
+ {
+ // Handle Foreign Audio Search
+ if (item.TrackNumber == 0)
+ {
+ subtitle.Search.Enable = true;
+ subtitle.Search.Burn = item.BurnedIn;
+ subtitle.Search.Default = item.Default;
+ subtitle.Search.Forced = item.Forced;
+ }
+ else
+ {
+ SubtitleList track = new SubtitleList { Burn = item.BurnedIn, Default = item.Default, Force = item.Forced, ID = item.TrackNumber, Track = (item.TrackNumber - 1) };
+ subtitle.SubtitleList.Add(track);
+ }
+ }
+
+ foreach (SrtSubtitle item in job.Subtitles.SrtSubtitles)
+ {
+ SubtitleList track = new SubtitleList
+ {
+ Track = -1, // Indicates SRT
+ Default = item.Default,
+ Offset = item.Offset,
+ Burn = item.BurnedIn,
+ 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 = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(e => e.ShortName == job.VideoEncoder);
+ Validate.NotNull(videoEncoder, "Video encoder " + job.VideoEncoder + " not recognized.");
+ if (videoEncoder != null)
+ {
+ video.Codec = videoEncoder.Id;
+ }
+
+ if (!string.IsNullOrEmpty(job.AdvancedOptions))
+ {
+ video.Options = job.AdvancedOptions;
+ }
+ else
+ {
+ video.Level = job.VideoLevel;
+ video.Options = job.VideoOptions;
+ video.Preset = job.VideoPreset;
+ video.Profile = job.VideoProfile;
+ }
+
+ if (job.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality) video.Quality = job.Quality;
+ if (job.VideoEncodeRateType == VideoEncodeRateType.AverageBitrate)
+ {
+ video.Bitrate = job.VideoBitrate;
+ video.TwoPass = job.TwoPass;
+ video.Turbo = job.TurboFirstPass;
+ }
+
+ if (job.VideoTunes != null && job.VideoTunes.Count > 0)
+ {
+ video.Tune = string.Join(",", job.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.AudioEncoderFallback))
+ {
+ HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(job.AudioEncoderFallback);
+ Validate.NotNull(audioEncoder, "Unrecognized fallback audio encoder: " + job.AudioEncoderFallback);
+ audio.FallbackEncoder = audioEncoder.Id;
+ }
+
+ audio.CopyMask = (int)NativeConstants.HB_ACODEC_ANY;
+
+ audio.AudioList = new List<AudioList>();
+ foreach (AudioEncoding item in job.AudioEncodings)
+ {
+ HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(item.Encoder);
+ Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder);
+
+ HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(item.Mixdown);
+ Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + item.Mixdown);
+
+ AudioList audioTrack = new AudioList
+ {
+ Track = item.InputNumber - 1,
+ DRC = item.Drc,
+ Encoder = encoder.Id,
+ Gain = item.Gain,
+ Mixdown = mixdown.Id,
+ NormalizeMixLevel = false,
+ Samplerate = item.SampleRateRaw,
+ Name = item.Name,
+ };
+
+ if (!item.IsPassthru)
+ {
+ if (item.EncodeRateType == AudioEncodeRateType.Quality)
+ {
+ audioTrack.Quality = item.Quality;
+ }
+
+ if (item.EncodeRateType == AudioEncodeRateType.Compression)
+ {
+ audioTrack.CompressionLevel = item.Compression;
+ }
+
+ if (item.EncodeRateType == AudioEncodeRateType.Bitrate)
+ {
+ audioTrack.Bitrate = item.Bitrate;
+ }
+ }
+
+ audio.AudioList.Add(audioTrack);
+ }
+
+ return audio;
+ }
+
+ /// <summary>
+ /// The create filter.
+ /// </summary>
+ /// <param name="job">
+ /// The job.
+ /// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Filter"/>.
+ /// </returns>
+ private static Filter CreateFilter(EncodeJob job, Title title)
+ {
+ Filter filter = new Filter
+ {
+ FilterList = new List<FilterList>(),
+ Grayscale = job.Grayscale
+ };
+
+ // Detelecine
+ if (job.Detelecine != Detelecine.Off)
+ {
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DETELECINE, Settings = job.CustomDetelecine };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // Decomb
+ if (job.Decomb != Decomb.Off)
+ {
+ string options;
+ if (job.Decomb == Decomb.Fast)
+ {
+ options = "7:2:6:9:1:80";
+ }
+ else if (job.Decomb == Decomb.Bob)
+ {
+ options = "455";
+ }
+ else
+ {
+ options = job.CustomDecomb;
+ }
+
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DECOMB, Settings = options };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // Deinterlace
+ if (job.Deinterlace != Deinterlace.Off)
+ {
+ string options;
+ if (job.Deinterlace == Deinterlace.Fast)
+ {
+ options = "0";
+ }
+ else if (job.Deinterlace == Deinterlace.Slow)
+ {
+ options = "1";
+ }
+ else if (job.Deinterlace == Deinterlace.Slower)
+ {
+ options = "3";
+ }
+ else if (job.Deinterlace == Deinterlace.Bob)
+ {
+ options = "15";
+ }
+ else
+ {
+ options = job.CustomDeinterlace;
+ }
+
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEINTERLACE, Settings = options };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // VFR / CFR
+ int fm = job.ConstantFramerate ? 1 : job.PeakFramerate ? 2 : 0;
+ IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(job.Framerate.ToString(CultureInfo.InvariantCulture));
+ int vrate = HBFunctions.hb_video_framerate_get_from_name(frameratePrt);
+
+ int num;
+ int den;
+ if (vrate > 0)
+ {
+ num = 27000000;
+ den = vrate;
+ }
+ else
+ {
+ // cfr or pfr flag with no rate specified implies use the title rate.
+ num = title.FramerateNumerator;
+ den = title.FramerateDenominator;
+ }
+
+ string framerateString = string.Format("{0}:{1}:{2}", fm, num, den); // filter_cfr, filter_vrate.num, filter_vrate.den
+
+ FilterList framerateShaper = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_VFR, Settings = framerateString };
+ filter.FilterList.Add(framerateShaper);
+
+ // Deblock
+ if (job.Deblock >= 5)
+ {
+ FilterList filterItem = new FilterList { ID = (int)hb_filter_ids.HB_FILTER_DEBLOCK, Settings = job.Deblock.ToString() };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // Denoise
+ if (job.Denoise != Denoise.Off)
+ {
+ hb_filter_ids id = job.Denoise == Denoise.hqdn3d
+ ? hb_filter_ids.HB_FILTER_HQDN3D
+ : hb_filter_ids.HB_FILTER_NLMEANS;
+
+ string settings;
+ if (!string.IsNullOrEmpty(job.CustomDenoise))
+ {
+ settings = job.CustomDenoise;
+ }
+ else
+ {
+ IntPtr settingsPtr = HBFunctions.hb_generate_filter_settings((int)id, job.DenoisePreset, job.DenoiseTune);
+ settings = Marshal.PtrToStringAnsi(settingsPtr);
+ }
+
+ FilterList filterItem = new FilterList { ID = (int)id, Settings = settings };
+ filter.FilterList.Add(filterItem);
+ }
+
+ // CropScale Filter
+ Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, title, AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH);
+ FilterList cropScale = new FilterList
+ {
+ ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE,
+ Settings =
+ string.Format(
+ "{0}:{1}:{2}:{3}:{4}:{5}",
+ resultGeometry.Width,
+ resultGeometry.Height,
+ job.Cropping.Top,
+ job.Cropping.Bottom,
+ job.Cropping.Left,
+ job.Cropping.Right)
+ };
+ filter.FilterList.Add(cropScale);
+
+ // Rotate
+ /* TODO NOT SUPPORTED YET. */
+
+ return filter;
+ }
+
+ /// <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();
+
+ /* TODO NOT SUPPORTED YET. */
+ return metaData;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/ScanFactory.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/ScanFactory.cs new file mode 100644 index 000000000..3cb0cc6c4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Factories/ScanFactory.cs @@ -0,0 +1,221 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="ScanFactory.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 scan factory.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Factories
+{
+ using System;
+ using System.Collections.Generic;
+
+ using HandBrake.ApplicationServices.Interop.Json.Scan;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
+
+ /// <summary>
+ /// This factory takes the JSON objects deserialized from libhb for the scan information
+ /// and converts them into the internal Title objects.
+ /// </summary>
+ internal class ScanFactory
+ {
+ /// <summary>
+ /// The create title set.
+ /// </summary>
+ /// <param name="scan">
+ /// The scan.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ internal static IEnumerable<Title> CreateTitleSet(JsonScanObject scan)
+ {
+ List<Title> titles = new List<Title>();
+
+ if (scan != null)
+ {
+ foreach (TitleList item in scan.TitleList)
+ {
+ Title title = CreateTitle(item);
+
+ if (title.TitleNumber == scan.MainFeature)
+ {
+ title.IsMainFeature = true;
+ }
+
+ titles.Add(title);
+ }
+ }
+
+ return titles;
+ }
+
+ /// <summary>
+ /// The create title.
+ /// </summary>
+ /// <param name="title">
+ /// The title.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Title"/>.
+ /// </returns>
+ private static Title CreateTitle(TitleList title)
+ {
+ Title newTitle = new Title
+ {
+ TitleNumber = title.Index,
+ Playlist = title.Playlist,
+ Resolution = new Size(title.Geometry.Width, title.Geometry.Height),
+ ParVal = new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den),
+ Duration = new TimeSpan(title.Duration.Hours, title.Duration.Minutes, title.Duration.Seconds),
+ AutoCropDimensions = new Cropping
+ {
+ Top = title.Crop[0],
+ Bottom = title.Crop[1],
+ Left = title.Crop[2],
+ Right = title.Crop[3]
+ },
+ AngleCount = title.AngleCount,
+ VideoCodecName = title.VideoCodec,
+ Framerate = ((double)title.FrameRate.Num) / title.FrameRate.Den,
+ FramerateNumerator = title.FrameRate.Num,
+ FramerateDenominator = title.FrameRate.Den,
+ Path = title.Path
+ };
+
+ switch (title.Type)
+ {
+ case 2:
+ newTitle.InputType = InputType.Stream;
+ break;
+ case 0:
+ newTitle.InputType = InputType.Dvd;
+ break;
+ case 1:
+ newTitle.InputType = InputType.Bluray;
+ break;
+ case 3:
+ newTitle.InputType = InputType.FFStream;
+ break;
+ }
+
+ foreach (Subtitle subtitleTrack in CreateSubtitleTracks(title.SubtitleList))
+ {
+ newTitle.Subtitles.Add(subtitleTrack);
+ }
+
+ foreach (AudioTrack audioTrack in CreateAudioTracks(title.AudioList))
+ {
+ newTitle.AudioTracks.Add(audioTrack);
+ }
+
+ foreach (Chapter chapter in CreateChapters(title.ChapterList))
+ {
+ newTitle.Chapters.Add(chapter);
+ }
+
+ return newTitle;
+ }
+
+ /// <summary>
+ /// The create subtitle tracks.
+ /// </summary>
+ /// <param name="subtitles">
+ /// The subtitles.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ private static IEnumerable<Subtitle> CreateSubtitleTracks(IEnumerable<SubtitleList> subtitles)
+ {
+ List<Subtitle> subtiles = new List<Subtitle>();
+
+ int currentSubtitleTrack = 1;
+ foreach (SubtitleList subtitle in subtitles)
+ {
+ Subtitle newSubtitle = new Subtitle
+ {
+ TrackNumber = currentSubtitleTrack,
+ Language = subtitle.Language,
+ LanguageCode = subtitle.LanguageCode,
+ SubtitleSourceInt = subtitle.Source,
+ SubtitleSource = (SubtitleSource)subtitle.Source // TODO Check correct
+ };
+
+ subtiles.Add(newSubtitle);
+
+ currentSubtitleTrack++;
+ }
+
+ return subtiles;
+ }
+
+ /// <summary>
+ /// The create audio tracks.
+ /// </summary>
+ /// <param name="audioTracks">
+ /// The audio tracks.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ private static IEnumerable<AudioTrack> CreateAudioTracks(IEnumerable<AudioList> audioTracks)
+ {
+ List<AudioTrack> tracks = new List<AudioTrack>();
+
+ int currentAudioTrack = 1;
+ foreach (AudioList track in audioTracks)
+ {
+ AudioTrack newAudio = new AudioTrack
+ {
+ TrackNumber = currentAudioTrack,
+ CodecId = Convert.ToUInt32(track.Codec),
+ Language = track.Language,
+ LanguageCode = track.LanguageCode,
+ Description = track.Description,
+ ChannelLayout = (ulong)track.ChannelLayout,
+ SampleRate = track.SampleRate,
+ Bitrate = track.BitRate
+ };
+
+ tracks.Add(newAudio);
+
+ currentAudioTrack++;
+ }
+ return tracks;
+ }
+
+ /// <summary>
+ /// The create chapters.
+ /// </summary>
+ /// <param name="chapters">
+ /// The chapters.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IEnumerable"/>.
+ /// </returns>
+ private static IEnumerable<Chapter> CreateChapters(IEnumerable<ChapterList> chapters)
+ {
+ List<Chapter> tracks = new List<Chapter>();
+
+ int currentTrack = 1;
+ foreach (ChapterList chapter in chapters)
+ {
+ Chapter newChapter = new Chapter
+ {
+ Name = chapter.Name,
+ ChapterNumber = currentTrack,
+ Duration = new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds)
+ };
+
+ tracks.Add(newChapter);
+ currentTrack++;
+ }
+
+ return tracks;
+ }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs new file mode 100644 index 000000000..18ad084f3 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/AudioList.cs @@ -0,0 +1,52 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The audio list.
+ /// </summary>
+ internal class AudioList
+ {
+ /// <summary>
+ /// Gets or sets the bit rate.
+ /// </summary>
+ public int BitRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the channel layout.
+ /// </summary>
+ public int 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; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs new file mode 100644 index 000000000..c4da099e5 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/ChapterList.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The chapter list.
+ /// </summary>
+ internal class ChapterList
+ {
+ /// <summary>
+ /// Gets or sets the duration.
+ /// </summary>
+ public Duration2 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.ApplicationServices/Interop/Json/Scan/Color.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Color.cs new file mode 100644 index 000000000..8709dcbdd --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The color.
+ /// </summary>
+ internal 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.ApplicationServices/Interop/Json/Scan/Duration.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration.cs new file mode 100644 index 000000000..7785fff05 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The duration.
+ /// </summary>
+ internal 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 int Ticks { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs new file mode 100644 index 000000000..444ea3e2f --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Duration2.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Duration2.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 2.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The duration 2.
+ /// </summary>
+ internal class Duration2
+ {
+ /// <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 int Ticks { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs new file mode 100644 index 000000000..937738076 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/FrameRate.cs @@ -0,0 +1,28 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The frame rate.
+ /// </summary>
+ internal 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.ApplicationServices/Interop/Json/Scan/Geometry.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/Geometry.cs new file mode 100644 index 000000000..9f7bc95d4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The geometry.
+ /// </summary>
+ internal 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.ApplicationServices/Interop/Json/Scan/JsonScanObject.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/JsonScanObject.cs new file mode 100644 index 000000000..397e5ce9e --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.Json.Scan
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The root object.
+ /// </summary>
+ internal 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<TitleList> TitleList { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs new file mode 100644 index 000000000..46b312a5a --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/MetaData.cs @@ -0,0 +1,18 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The meta data.
+ /// </summary>
+ internal class MetaData
+ {
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/PAR.cs new file mode 100644 index 000000000..bfe647ab8 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The par.
+ /// </summary>
+ internal class PAR
+ {
+ /// <summary>
+ /// Gets or sets the height.
+ /// </summary>
+ public int Num { get; set; }
+
+ /// <summary>
+ /// Gets or sets the width.
+ /// </summary>
+ public int Den { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs new file mode 100644 index 000000000..f727fd15e --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/SubtitleList.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The subtitle list.
+ /// </summary>
+ internal class SubtitleList
+ {
+ /// <summary>
+ /// Gets or sets the format.
+ /// </summary>
+ public int 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; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs new file mode 100644 index 000000000..b31dd4e05 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Scan/TitleList.cs @@ -0,0 +1,105 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="TitleList.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.ApplicationServices.Interop.Json.Scan
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The title list.
+ /// </summary>
+ internal class TitleList
+ {
+ /// <summary>
+ /// Gets or sets the angle count.
+ /// </summary>
+ public int AngleCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio list.
+ /// </summary>
+ public List<AudioList> AudioList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter list.
+ /// </summary>
+ public List<ChapterList> ChapterList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the color.
+ /// </summary>
+ public Color Color { 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 MetaData 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<SubtitleList> SubtitleList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type.
+ /// HB_DVD_TYPE, 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.ApplicationServices/Interop/Json/State/JsonState.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/State/JsonState.cs new file mode 100644 index 000000000..b0817a7d2 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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 int State { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/State/Scanning.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/State/Scanning.cs new file mode 100644 index 000000000..033bef017 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Json/State/WorkDone.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/State/WorkDone.cs new file mode 100644 index 000000000..76f85ba90 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Json/State/Working.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/State/Working.cs new file mode 100644 index 000000000..9aaebf690 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/State/Working.cs @@ -0,0 +1,62 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.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 job.
+ /// </summary>
+ public int Job { get; set; }
+
+ /// <summary>
+ /// Gets or sets the job count.
+ /// </summary>
+ public int JobCount { 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.ApplicationServices/Interop/Model/BitrateLimits.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/BitrateLimits.cs new file mode 100644 index 000000000..0cc7257a0 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/BitrateLimits.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model
+{
+ /// <summary>
+ /// Represents bitrate limits as a range.
+ /// </summary>
+ public class BitrateLimits
+ {
+ /// <summary>
+ /// The inclusive lower limit for the bitrate.
+ /// </summary>
+ public int Low { get; set; }
+
+ /// <summary>
+ /// The inclusive upper limit for the bitrate.
+ /// </summary>
+ public int High { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Cropping.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Cropping.cs new file mode 100644 index 000000000..0c3201155 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Model/EncodeJob.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/EncodeJob.cs new file mode 100644 index 000000000..73eb17ad4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/EncodeJob.cs @@ -0,0 +1,505 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="EncodeJob.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 EncodeJob type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model
+{
+ using System.Collections.Generic;
+
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The encode job.
+ /// </summary>
+ public class EncodeJob
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="EncodeJob"/> class.
+ /// </summary>
+ public EncodeJob()
+ {
+ this.Cropping = new Cropping();
+ }
+
+ #region Source
+
+ /// <summary>
+ /// Gets or sets the source path.
+ /// </summary>
+ public string SourcePath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the 1-based index of the title to encode.
+ /// </summary>
+ public int Title { get; set; }
+
+ /// <summary>
+ /// Gets or sets the range type.
+ /// </summary>
+ public VideoRangeType RangeType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seek points.
+ /// This is the number of preview points.
+ /// </summary>
+ public int SeekPoints { get; set; }
+
+ /// <summary>
+ /// Gets or sets the start at preview.
+ /// </summary>
+ public int StartAtPreview { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds end.
+ /// </summary>
+ public int SecondsEnd { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds start.
+ /// </summary>
+ public double SecondsStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the angle to encode. 0 for default, 1+ for specified angle.
+ /// </summary>
+ public int Angle { get; set; }
+
+ /// <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 frames end.
+ /// </summary>
+ public int FramesEnd { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frames start.
+ /// </summary>
+ public int FramesStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source type.
+ /// </summary>
+ public SourceType SourceType { get; set; }
+
+ #endregion
+
+ #region Destination and Output Settings
+
+ /// <summary>
+ /// Gets or sets the output path.
+ /// </summary>
+ public string OutputPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the container name.
+ /// </summary>
+ public string ContainerName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the preferred extension.
+ /// </summary>
+ public OutputExtension PreferredExtension { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether include chapter markers.
+ /// </summary>
+ public bool IncludeChapterMarkers { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether optimize.
+ /// </summary>
+ public bool Optimize { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether i pod 5 g support.
+ /// </summary>
+ public bool IPod5GSupport { get; set; }
+ #endregion
+
+ #region Picture Settings
+
+ /// <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 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 the scale method.
+ /// </summary>
+ public ScaleMethod ScaleMethod { get; set; }
+
+ /// <summary>
+ /// Gets or sets the cropping.
+ /// </summary>
+ public Cropping Cropping { get; set; }
+
+ /// <summary>
+ /// Gets or sets the anamorphic.
+ /// </summary>
+ public Anamorphic Anamorphic { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether use display width.
+ /// </summary>
+ public bool UseDisplayWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets the display width.
+ /// </summary>
+ public int DisplayWidth { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether keep display aspect.
+ /// </summary>
+ public bool KeepDisplayAspect { 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; }
+
+ /// <summary>
+ /// Gets or sets the modulus.
+ /// </summary>
+ public int Modulus { get; set; }
+
+ /// <summary>
+ /// Gets or sets the rotation.
+ /// </summary>
+ public PictureRotation Rotation { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the picture should be flipped horizontally.
+ /// </summary>
+ public bool FlipHorizontal { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the picture should be flipped vertically.
+ /// </summary>
+ public bool FlipVertical { get; set; }
+ #endregion
+
+ #region Filters
+
+ /// <summary>
+ /// Gets or sets the deinterlace.
+ /// </summary>
+ public Deinterlace Deinterlace { get; set; }
+
+ /// <summary>
+ /// Gets or sets the custom deinterlace.
+ /// </summary>
+ public string CustomDeinterlace { get; set; }
+
+ /// <summary>
+ /// Gets or sets the decomb.
+ /// </summary>
+ public Decomb Decomb { get; set; }
+
+ /// <summary>
+ /// Gets or sets the custom decomb.
+ /// </summary>
+ public string CustomDecomb { get; set; }
+
+ /// <summary>
+ /// Gets or sets the detelecine.
+ /// </summary>
+ public Detelecine Detelecine { get; set; }
+
+ /// <summary>
+ /// Gets or sets the custom detelecine.
+ /// </summary>
+ public string CustomDetelecine { get; set; }
+
+ /// <summary>
+ /// Gets or sets the denoise.
+ /// </summary>
+ public Denoise Denoise { get; set; }
+
+ /// <summary>
+ /// Gets or sets the denoise preset name.
+ /// </summary>
+ public string DenoisePreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the denoise tune name.
+ /// </summary>
+ public string DenoiseTune { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether we should use the provided
+ /// custom denoise string or we should use the preset and tune.
+ /// </summary>
+ public bool UseCustomDenoise { get; set; }
+
+ /// <summary>
+ /// Gets or sets the custom denoise.
+ /// </summary>
+ public string CustomDenoise { get; set; }
+
+ /// <summary>
+ /// Gets or sets the deblock.
+ /// </summary>
+ public int Deblock { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the grayscale filter will be applied.
+ /// </summary>
+ public bool Grayscale { get; set; }
+ #endregion
+
+ #region Video
+
+ /// <summary>
+ /// Gets or sets the video encoder.
+ /// </summary>
+ public string VideoEncoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video encoder options.
+ /// </summary>
+ public string VideoOptions { get; set; }
+
+ /// <summary>
+ /// Gets or sets the advanced options.
+ /// This overrides the VideoOptions, VideoPreset, VideoTunes and VideoLevel
+ /// </summary>
+ public string AdvancedOptions { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video encoder profile name.
+ /// </summary>
+ public string VideoProfile { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video encoder preset name.
+ /// </summary>
+ public string VideoPreset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video encoder tunes.
+ /// </summary>
+ public List<string> VideoTunes { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video encoder level.
+ /// </summary>
+ public string VideoLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to use QSV decoding.
+ /// </summary>
+ public bool QsvDecode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video encode rate type.
+ /// </summary>
+ public VideoEncodeRateType VideoEncodeRateType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the quality.
+ /// </summary>
+ public double Quality { get; set; }
+
+ /// <summary>
+ /// Gets or sets the target size.
+ /// </summary>
+ public int TargetSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video bitrate.
+ /// </summary>
+ public int VideoBitrate { 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.
+ /// </summary>
+ public bool TurboFirstPass { get; set; }
+
+ /// <summary>
+ /// Gets or sets the framerate.
+ /// </summary>
+ public double Framerate { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether constant framerate.
+ /// </summary>
+ public bool ConstantFramerate { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether peak framerate.
+ /// </summary>
+ public bool PeakFramerate { get; set; }
+ #endregion
+
+ #region Audio
+
+ /// <summary>
+ /// Gets or sets the audio encodings.
+ /// </summary>
+ public List<AudioEncoding> AudioEncodings { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio encoder fallback.
+ /// </summary>
+ public string AudioEncoderFallback { get; set; }
+ #endregion
+
+ #region Chapter Markers
+
+ /// <summary>
+ /// Gets or sets a value indicating whether use default chapter names.
+ /// </summary>
+ public bool UseDefaultChapterNames { get; set; }
+
+ /// <summary>
+ /// Gets or sets the custom chapter names.
+ /// </summary>
+ public List<string> CustomChapterNames { get; set; }
+ #endregion
+
+ #region Subtitles
+
+ /// <summary>
+ /// Gets or sets the subtitles.
+ /// </summary>
+ public Subtitles Subtitles { get; set; }
+ #endregion
+
+ #region Additional Args
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to use DXVA hardware decoding.
+ /// </summary>
+ public bool DxvaDecoding { get; set; }
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="EncodeJob"/>.
+ /// </returns>
+ public EncodeJob Clone()
+ {
+ var clone = new EncodeJob
+ {
+ SourceType = this.SourceType,
+ SourcePath = this.SourcePath,
+ Title = this.Title,
+ Angle = this.Angle,
+ RangeType = this.RangeType,
+ ChapterStart = this.ChapterStart,
+ ChapterEnd = this.ChapterEnd,
+ SecondsStart = this.SecondsStart,
+ SecondsEnd = this.SecondsEnd,
+ FramesStart = this.FramesStart,
+ FramesEnd = this.FramesEnd,
+ Subtitles = this.Subtitles,
+ UseDefaultChapterNames = this.UseDefaultChapterNames,
+ DxvaDecoding = this.DxvaDecoding,
+ OutputPath = this.OutputPath,
+
+ ContainerName = this.ContainerName,
+ PreferredExtension = this.PreferredExtension,
+ IncludeChapterMarkers = this.IncludeChapterMarkers,
+ Optimize = this.Optimize,
+ IPod5GSupport = this.IPod5GSupport,
+
+ Width = this.Width,
+ Height = this.Height,
+ MaxWidth = this.MaxWidth,
+ MaxHeight = this.MaxHeight,
+ ScaleMethod = this.ScaleMethod,
+ Cropping = this.Cropping.Clone(),
+ Anamorphic = this.Anamorphic,
+ UseDisplayWidth = this.UseDisplayWidth,
+ DisplayWidth = this.DisplayWidth,
+ KeepDisplayAspect = this.KeepDisplayAspect,
+ PixelAspectX = this.PixelAspectX,
+ PixelAspectY = this.PixelAspectY,
+ Modulus = this.Modulus,
+ Rotation = this.Rotation,
+ FlipHorizontal = this.FlipHorizontal,
+ FlipVertical = this.FlipVertical,
+
+ Deinterlace = this.Deinterlace,
+ CustomDeinterlace = this.CustomDeinterlace,
+ Decomb = this.Decomb,
+ CustomDecomb = this.CustomDecomb,
+ Detelecine = this.Detelecine,
+ CustomDetelecine = this.CustomDetelecine,
+ Denoise = this.Denoise,
+ DenoisePreset = this.DenoisePreset,
+ DenoiseTune = this.DenoiseTune,
+ UseCustomDenoise = this.UseCustomDenoise,
+ CustomDenoise = this.CustomDenoise,
+ Deblock = this.Deblock,
+ Grayscale = this.Grayscale,
+
+ VideoEncoder = this.VideoEncoder,
+ VideoOptions = this.VideoOptions,
+ VideoProfile = this.VideoProfile,
+ VideoPreset = this.VideoPreset,
+ VideoTunes = this.VideoTunes,
+ VideoLevel = this.VideoLevel,
+ QsvDecode = this.QsvDecode,
+ VideoEncodeRateType = this.VideoEncodeRateType,
+ Quality = this.Quality,
+ TargetSize = this.TargetSize,
+ VideoBitrate = this.VideoBitrate,
+ TwoPass = this.TwoPass,
+ TurboFirstPass = this.TurboFirstPass,
+ Framerate = this.Framerate,
+ ConstantFramerate = this.ConstantFramerate,
+
+ AudioEncodings = new List<AudioEncoding>(this.AudioEncodings),
+ AudioEncoderFallback = this.AudioEncoderFallback
+ };
+
+ return clone;
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Anamorphic.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Anamorphic.cs new file mode 100644 index 000000000..1b77203f4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Anamorphic.cs @@ -0,0 +1,28 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The anamorphic.
+ /// </summary>
+ public enum Anamorphic
+ {
+ [Display(Name = "None")]
+ None = 0,
+ [Display(Name = "Strict")]
+ Strict = 1,
+ [Display(Name = "Loose")]
+ Loose = 2,
+ [Display(Name = "Custom")]
+ Custom = 3
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncodeRateType.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncodeRateType.cs new file mode 100644 index 000000000..031c89b11 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncodeRateType.cs @@ -0,0 +1,21 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioEncodeRateType.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 encode rate type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The audio encode rate type.
+ /// </summary>
+ public enum AudioEncodeRateType
+ {
+ Bitrate,
+ Quality,
+ Compression
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoder.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoder.cs new file mode 100644 index 000000000..e8f0a484a --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoder.cs @@ -0,0 +1,77 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioEncoder.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 encoder enumeration
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Encoding
+{
+ using System.ComponentModel.DataAnnotations;
+
+ using HandBrake.ApplicationServices.Interop.Attributes;
+
+ /// <summary>
+ /// The audio encoder.
+ /// </summary>
+ public enum AudioEncoder
+ {
+ [Display(Name = "AAC (avcodec)")]
+ [ShortName("av_aac")]
+ ffaac,
+
+ [Display(Name = "AAC (FDK)")]
+ [ShortName("fdk_aac")]
+ fdkaac,
+
+ [Display(Name = "HE-AAC (FDK)")]
+ [ShortName("fdk_haac")]
+ fdkheaac,
+
+ [Display(Name = "MP3")]
+ [ShortName("mp3")]
+ Lame,
+
+ [Display(Name = "AC3")]
+ [ShortName("ac3")]
+ Ac3,
+
+ [Display(Name = "Auto Passthru")]
+ [ShortName("copy")]
+ Passthrough,
+
+ [Display(Name = "AC3 Passthru")]
+ [ShortName("copy:ac3")]
+ Ac3Passthrough,
+
+ [Display(Name = "DTS Passthru")]
+ [ShortName("copy:dts")]
+ DtsPassthrough,
+
+ [Display(Name = "DTS-HD Passthru")]
+ [ShortName("copy:dtshd")]
+ DtsHDPassthrough,
+
+ [Display(Name = "AAC Passthru")]
+ [ShortName("copy:aac")]
+ AacPassthru,
+
+ [Display(Name = "MP3 Passthru")]
+ [ShortName("copy:mp3")]
+ Mp3Passthru,
+
+ [Display(Name = "Vorbis")]
+ [ShortName("vorbis")]
+ Vorbis,
+
+ [Display(Name = "FLAC 16-bit")]
+ [ShortName("flac16")]
+ ffflac,
+
+ [Display(Name = "FLAC 24-bit")]
+ [ShortName("flac24")]
+ ffflac24,
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoding.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoding.cs new file mode 100644 index 000000000..381e9d2c0 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/AudioEncoding.cs @@ -0,0 +1,89 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="AudioEncoding.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 AudioEncoding type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Encoding
+{
+ using System;
+
+ /// <summary>
+ /// The Audio Encoding Model
+ /// </summary>
+ public class AudioEncoding
+ {
+ /// <summary>
+ /// Initializes a new instance of the AudioEncoding class.
+ /// </summary>
+ public AudioEncoding()
+ {
+ // Initialize to -1 to differentiate a compression of 0 from uninitialized.
+ this.Compression = -1;
+ }
+
+ /// <summary>
+ /// Gets or sets the chosen track to apply the encoding to.
+ /// </summary>
+ /// <remarks>1-based index. 0 means apply to all tracks.</remarks>
+ public int InputNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the encoder to use.
+ /// </summary>
+ public string Encoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets the encode rate type (bitrate or quality).
+ /// </summary>
+ public AudioEncodeRateType EncodeRateType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the bitrate (in kbps) of this track.
+ /// </summary>
+ public int Bitrate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the target audio quality for this track.
+ /// </summary>
+ public float Quality { get; set; }
+
+ /// <summary>
+ /// Gets or sets the target audio compression for this track.
+ /// </summary>
+ public float Compression { get; set; }
+
+ /// <summary>
+ /// Gets or sets the mixdown.
+ /// </summary>
+ public string Mixdown { get; set; }
+
+ /// <summary>
+ /// Gets or sets the sample rate in Hz.
+ /// </summary>
+ public int SampleRateRaw { get; set; }
+
+ /// <summary>
+ /// Gets or sets Gain.
+ /// </summary>
+ public int Gain { get; set; }
+
+ /// <summary>
+ /// Gets or sets Drc.
+ /// </summary>
+ public double Drc { get; set; }
+
+ /// <summary>
+ /// Gets or sets Name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether is passthru.
+ /// </summary>
+ public bool IsPassthru { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Container.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Container.cs new file mode 100644 index 000000000..ec59a6dbf --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Container.cs @@ -0,0 +1,28 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ using System;
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The container.
+ /// </summary>
+ [Flags]
+ public enum Container
+ {
+ None = 0x0,
+
+ [Display(Name = "MP4")]
+ MP4,
+ [Display(Name = "MKV")]
+ MKV
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Decomb.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Decomb.cs new file mode 100644 index 000000000..a63375143 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Decomb.cs @@ -0,0 +1,23 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The decomb.
+ /// </summary>
+ public enum Decomb
+ {
+ Off = 0,
+ Default = 2,
+ Fast = 3,
+ Bob = 4,
+ Custom = 1
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Deinterlace.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Deinterlace.cs new file mode 100644 index 000000000..1ed41419f --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Deinterlace.cs @@ -0,0 +1,24 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The deinterlace.
+ /// </summary>
+ public enum Deinterlace
+ {
+ Off = 0,
+ Fast = 2,
+ Slow = 3,
+ Slower = 4,
+ Bob = 5,
+ Custom = 1
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Denoise.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Denoise.cs new file mode 100644 index 000000000..2f24251ef --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Denoise.cs @@ -0,0 +1,21 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The denoise.
+ /// </summary>
+ public enum Denoise
+ {
+ Off = 0,
+ hqdn3d = 1,
+ NLMeans = 2,
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Detelecine.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Detelecine.cs new file mode 100644 index 000000000..d16075af4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Detelecine.cs @@ -0,0 +1,21 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The detelecine.
+ /// </summary>
+ public enum Detelecine
+ {
+ Off = 0,
+ Default = 2,
+ Custom = 1
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBAudioEncoder.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBAudioEncoder.cs new file mode 100644 index 000000000..5bef508f8 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBAudioEncoder.cs @@ -0,0 +1,92 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ using HandBrake.ApplicationServices.Interop.HbLib;
+
+ /// <summary>
+ /// The hb audio encoder.
+ /// </summary>
+ public class HBAudioEncoder
+ {
+ /// <summary>
+ /// Gets or sets the compatible containers.
+ /// </summary>
+ public int CompatibleContainers { get; set; }
+
+ /// <summary>
+ /// Gets or sets the compression limits.
+ /// </summary>
+ public RangeLimits CompressionLimits { get; set; }
+
+ /// <summary>
+ /// Gets or sets the default compression.
+ /// </summary>
+ public float DefaultCompression { get; set; }
+
+ /// <summary>
+ /// Gets or sets the default quality.
+ /// </summary>
+ public float DefaultQuality { get; set; }
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int Id { get; 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.ApplicationServices/Interop/Model/Encoding/HBContainer.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBContainer.cs new file mode 100644 index 000000000..2a91c4e70 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBContainer.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The hb container.
+ /// </summary>
+ public class HBContainer
+ {
+ /// <summary>
+ /// Gets or sets the default extension.
+ /// </summary>
+ public string DefaultExtension { get; set; }
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int Id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBMixdown.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBMixdown.cs new file mode 100644 index 000000000..18e7288e7 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBMixdown.cs @@ -0,0 +1,36 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The hb mixdown.
+ /// </summary>
+ public class HBMixdown
+ {
+ #region Public Properties
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int Id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; set; }
+
+ #endregion
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBRate.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBRate.cs new file mode 100644 index 000000000..edae8f29a --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBRate.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// Represents a rate in HandBrake: audio sample rate or video framerate.
+ /// </summary>
+ public class HBRate
+ {
+ /// <summary>
+ /// Gets or sets the name to use for this rate.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the raw rate.
+ /// </summary>
+ public int Rate { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBVideoEncoder.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBVideoEncoder.cs new file mode 100644 index 000000000..dd09452a1 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/HBVideoEncoder.cs @@ -0,0 +1,86 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ using System.Collections.Generic;
+
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
+
+ /// <summary>
+ /// The hb video encoder.
+ /// </summary>
+ public class HBVideoEncoder
+ {
+ /// <summary>
+ /// Gets or sets the compatible containers.
+ /// </summary>
+ public int CompatibleContainers { get; set; }
+
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public string DisplayName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int Id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the short name.
+ /// </summary>
+ public string ShortName { get; 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.ApplicationServices/Interop/Model/Encoding/Mixdown.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs new file mode 100644 index 000000000..4ca750adb --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/Mixdown.cs @@ -0,0 +1,55 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Mixdown.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 Mixdown type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Encoding
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The Audio Mixdown Enumeration
+ /// </summary>
+ public enum Mixdown
+ {
+ [Display(Name = "Dolby Pro Logic II")]
+ DolbyProLogicII = 0,
+
+ [Display(Name = "None")]
+ None,
+
+ [Display(Name = "Automatic")]
+ Auto,
+
+ [Display(Name = "Mono")]
+ Mono,
+
+ [Display(Name = "Mono (Left Only)")]
+ LeftOnly,
+
+ [Display(Name = "Mono (Right Only)")]
+ RightOnly,
+
+ [Display(Name = "Stereo")]
+ Stereo,
+
+ [Display(Name = "Dolby Surround")]
+ DolbySurround,
+
+ [Display(Name = "5.1 Channels")]
+ FivePoint1Channels,
+
+ [Display(Name = "6.1 Channels")]
+ SixPoint1Channels,
+
+ [Display(Name = "7.1 Channels")]
+ SevenPoint1Channels,
+
+ [Display(Name = "7.1 (5F/2R/LFE)")]
+ Five_2_LFE,
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/OutputExtension.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/OutputExtension.cs new file mode 100644 index 000000000..08534fd19 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/OutputExtension.cs @@ -0,0 +1,20 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="OutputExtension.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 OutputExtension type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// The output extension.
+ /// </summary>
+ public enum OutputExtension
+ {
+ Mp4,
+ M4v
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/PictureRotation.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/PictureRotation.cs new file mode 100644 index 000000000..38fc68980 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.Interop.Model.Encoding
+{
+ /// <summary>
+ /// Possible picture rotations.
+ /// </summary>
+ public enum PictureRotation
+ {
+ None = 0,
+ Clockwise90,
+ Clockwise180,
+ Clockwise270
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/ScaleMethod.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/ScaleMethod.cs new file mode 100644 index 000000000..203b5a583 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Model/Encoding/VideoEncodeRateType.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncodeRateType.cs new file mode 100644 index 000000000..3fca0466a --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/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.ApplicationServices.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.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs new file mode 100644 index 000000000..ce88223bb --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Encoding/VideoEncoder.cs @@ -0,0 +1,49 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model.Encoding
+{
+ using System.ComponentModel.DataAnnotations;
+
+ using HandBrake.ApplicationServices.Interop.Attributes;
+
+ /// <summary>
+ /// The video encoder.
+ /// </summary>
+ public enum VideoEncoder
+ {
+ [Display(Name = "H.264 (x264)")]
+ [ShortName("x264")]
+ X264 = 0,
+
+ [Display(Name = "H.264 (Intel QSV)")]
+ [ShortName("qsv_h264")]
+ QuickSync,
+
+ [Display(Name = "MPEG-4")]
+ [ShortName("mpeg4")]
+ FFMpeg,
+
+ [Display(Name = "MPEG-2")]
+ [ShortName("mpeg2")]
+ FFMpeg2,
+
+ [Display(Name = "Theora")]
+ [ShortName("theora")]
+ Theora,
+
+ [Display(Name = "H.265 (x265)")]
+ [ShortName("x265")]
+ X265,
+
+ [Display(Name = "VP8")]
+ [ShortName("vp8")]
+ VP8
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Language.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Language.cs new file mode 100644 index 000000000..b6a0d61b4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Language.cs @@ -0,0 +1,48 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model
+{
+ /// <summary>
+ /// Represents a language.
+ /// </summary>
+ public class Language
+ {
+ /// <summary>
+ /// Gets or sets the english name of the language.
+ /// </summary>
+ public string EnglishName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the native name of the language.
+ /// </summary>
+ public string NativeName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code.
+ /// </summary>
+ public string Code { get; 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.ApplicationServices/Interop/Model/RangeLimits.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/RangeLimits.cs new file mode 100644 index 000000000..e10e16a71 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/RangeLimits.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model
+{
+ /// <summary>
+ /// The range limits.
+ /// </summary>
+ public class RangeLimits
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether ascending.
+ /// </summary>
+ public bool Ascending { get; set; }
+
+ /// <summary>
+ /// Gets or sets the granularity.
+ /// </summary>
+ public float Granularity { get; set; }
+
+ /// <summary>
+ /// Gets or sets the high.
+ /// </summary>
+ public float High { get; set; }
+
+ /// <summary>
+ /// Gets or sets the low.
+ /// </summary>
+ public float Low { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/AudioTrack.cs new file mode 100644 index 000000000..4a7fe21a4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/AudioTrack.cs @@ -0,0 +1,107 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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>
+// An object represending an AudioTrack associated with a Title, in a DVD
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Scan
+{
+ /// <summary>
+ /// An object represending an AudioTrack associated with a Title, in a DVD
+ /// </summary>
+ public class AudioTrack
+ {
+ /// <summary>
+ /// Gets or sets the track number of this Audio Track
+ /// </summary>
+ public int TrackNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the audio codec ID for this track.
+ /// </summary>
+ public uint CodecId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language (if detected) of this Audio Track
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code for this audio track.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the description for this audio track.
+ /// </summary>
+ public string Description { get; set; }
+
+ /// <summary>
+ /// Gets or sets the channel layout of this Audio Track.
+ /// </summary>
+ public ulong ChannelLayout { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frequency (in Hz) of this Audio Track
+ /// </summary>
+ public int SampleRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the bitrate (in bits/sec) of this Audio Track.
+ /// </summary>
+ public int Bitrate { get; set; }
+
+ /// <summary>
+ /// Gets the display string for this audio track.
+ /// </summary>
+ public string Display
+ {
+ get
+ {
+ return this.GetDisplayString(true);
+ }
+ }
+
+ /// <summary>
+ /// Gets the display string for this audio track (not including track number)
+ /// </summary>
+ public string NoTrackDisplay
+ {
+ get
+ {
+ return this.GetDisplayString(false);
+ }
+ }
+
+ /// <summary>
+ /// Override of the ToString method to make this object easier to use in the UI
+ /// </summary>
+ /// <returns>A string formatted as: {track #} {language} ({format}) ({sub-format})</returns>
+ public override string ToString()
+ {
+ return this.GetDisplayString(true);
+ }
+
+ /// <summary>
+ /// The get display string.
+ /// </summary>
+ /// <param name="includeTrackNumber">
+ /// The include track number.
+ /// </param>
+ /// <returns>
+ /// The <see cref="string"/>.
+ /// </returns>
+ private string GetDisplayString(bool includeTrackNumber)
+ {
+ if (includeTrackNumber)
+ {
+ return this.TrackNumber + " " + this.Description;
+ }
+
+ return this.Description;
+ }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Chapter.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Chapter.cs new file mode 100644 index 000000000..f0e63ba3e --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Chapter.cs @@ -0,0 +1,44 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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>
+// An object representing a Chapter aosciated with a Title, in a DVD
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Scan
+{
+ using System;
+ using System.Globalization;
+
+ /// <summary>
+ /// An object representing a Chapter aosciated with a Title, in a DVD
+ /// </summary>
+ public class Chapter
+ {
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of this Chapter, in regards to its parent Title
+ /// </summary>
+ public int ChapterNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the duration of this chapter.
+ /// </summary>
+ public TimeSpan Duration { get; set; }
+
+ /// <summary>
+ /// Override of the ToString method to make this object easier to use in the UI
+ /// </summary>
+ /// <returns>A string formatted as: {chapter #}</returns>
+ public override string ToString()
+ {
+ return this.ChapterNumber.ToString(CultureInfo.InvariantCulture);
+ }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/InputType.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/InputType.cs new file mode 100644 index 000000000..892d68116 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/InputType.cs @@ -0,0 +1,31 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="InputType.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 InputType type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Scan
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The input type.
+ /// </summary>
+ public enum InputType
+ {
+ [Display(Name = "File")]
+ Stream,
+
+ [Display(Name = "DVD")]
+ Dvd,
+
+ [Display(Name = "Blu-ray")]
+ Bluray,
+
+ [Display(Name = "File")]
+ FFStream
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Subtitle.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Subtitle.cs new file mode 100644 index 000000000..7e09d21c5 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Subtitle.cs @@ -0,0 +1,96 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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>
+// An object that represents a subtitle associated with a Title, in a DVD
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Scan
+{
+ using HandBrake.ApplicationServices.Interop.HbLib;
+
+ /// <summary>
+ /// An object that represents a subtitle associated with a Title, in a DVD
+ /// </summary>
+ public class Subtitle
+ {
+ /// <summary>
+ /// Gets or sets the track number of this Subtitle
+ /// </summary>
+ public int TrackNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language (if detected) of this Subtitle
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Langauage Code.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle source.
+ /// </summary>
+ public SubtitleSource SubtitleSource { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitle source raw integer.
+ /// </summary>
+ public int SubtitleSourceInt { get; set; }
+
+ /// <summary>
+ /// Gets a value indicating whether the "forced only" flag can be set on this subtitle.
+ /// </summary>
+ public bool CanSetForcedOnly
+ {
+ get
+ {
+ return HBFunctions.hb_subtitle_can_force(this.SubtitleSourceInt) > 0;
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether this subtitle can be burned into the picture.
+ /// </summary>
+ public bool CanBurn
+ {
+ get
+ {
+ return HBFunctions.hb_subtitle_can_burn(this.SubtitleSourceInt) > 0;
+ }
+ }
+
+ /// <summary>
+ /// Returns true if the subtitle can be passed through using the given muxer.
+ /// </summary>
+ /// <param name="muxer">The muxer ID.</param>
+ /// <returns>True if the subtitle can be passed through.</returns>
+ public bool CanPass(int muxer)
+ {
+ return HBFunctions.hb_subtitle_can_pass(this.SubtitleSourceInt, muxer) > 0;
+ }
+
+ /// <summary>
+ /// Override of the ToString method to make this object easier to use in the UI
+ /// </summary>
+ /// <returns>A string formatted as: {track #} {language}</returns>
+ public override string ToString()
+ {
+ return string.Format("{0} {1} ({2})", this.TrackNumber, this.Language, this.SubtitleSource);
+ }
+
+ /// <summary>
+ /// Gets the display.
+ /// </summary>
+ public string Display
+ {
+ get
+ {
+ return this.ToString();
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/SubtitleSource.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/SubtitleSource.cs new file mode 100644 index 000000000..e29a1a413 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/SubtitleSource.cs @@ -0,0 +1,26 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleSource.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 SubtitleSource type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Scan
+{
+ /// <summary>
+ /// The subtitle source.
+ /// </summary>
+ public enum SubtitleSource
+ {
+ VobSub,
+ SRT,
+ CC608,
+ CC708,
+ UTF8,
+ TX3G,
+ SSA,
+ PGS
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Title.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Title.cs new file mode 100644 index 000000000..fc8f6ea07 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Scan/Title.cs @@ -0,0 +1,184 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Title.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 object that represents a single Title of a DVD
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model.Scan
+{
+ using System;
+ using System.Collections.Generic;
+
+ using HandBrake.ApplicationServices.Interop.Model;
+
+ /// <summary>
+ /// An object that represents a single Title of a DVD
+ /// </summary>
+ public class Title
+ {
+ /// <summary>
+ /// The audio tracks.
+ /// </summary>
+ private readonly List<AudioTrack> audioTracks;
+
+ /// <summary>
+ /// The chapters.
+ /// </summary>
+ private readonly List<Chapter> chapters;
+
+ /// <summary>
+ /// The subtitles.
+ /// </summary>
+ private readonly List<Subtitle> subtitles;
+
+ /// <summary>
+ /// Initializes a new instance of the Title class.
+ /// </summary>
+ public Title()
+ {
+ this.audioTracks = new List<AudioTrack>();
+ this.chapters = new List<Chapter>();
+ this.subtitles = new List<Subtitle>();
+ }
+
+ /// <summary>
+ /// Gets or sets the input type of this title.
+ /// </summary>
+ public InputType InputType { get; set; }
+
+ /// <summary>
+ /// Gets a collection of chapters in this Title
+ /// </summary>
+ public List<Chapter> Chapters
+ {
+ get { return this.chapters; }
+ }
+
+ /// <summary>
+ /// Gets a collection of audio tracks associated with this Title
+ /// </summary>
+ public List<AudioTrack> AudioTracks
+ {
+ get { return this.audioTracks; }
+ }
+
+ /// <summary>
+ /// Gets a collection of subtitles associated with this Title
+ /// </summary>
+ public List<Subtitle> Subtitles
+ {
+ get { return this.subtitles; }
+ }
+
+ /// <summary>
+ /// Gets or sets the track number of this Title (1-based).
+ /// </summary>
+ public int TitleNumber { get; set; }
+
+ /// <summary>
+ /// Gets or sets the playlist number this title came from.
+ /// </summary>
+ public int Playlist { get; set; }
+
+ /// <summary>
+ /// Gets or sets the duration of this title.
+ /// </summary>
+ public TimeSpan Duration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the resolution (width/height) of this Title
+ /// </summary>
+ public Size Resolution { get; set; }
+
+ /// <summary>
+ /// Gets or sets the number of angles on the title.
+ /// </summary>
+ public int AngleCount { get; set; }
+
+ /// <summary>
+ /// Gets or sets the pixel aspect ratio.
+ /// </summary>
+ public Size ParVal { get; set; }
+
+ /// <summary>
+ /// Gets or sets the automatically detected crop region for this Title.
+ /// </summary>
+ public Cropping AutoCropDimensions { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name of the video codec for this title.
+ /// </summary>
+ public string VideoCodecName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video frame rate for this title.
+ /// </summary>
+ public double Framerate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video frame rate numerator.
+ /// </summary>
+ public int FramerateNumerator { get; set; }
+
+ /// <summary>
+ /// Gets or sets the video frame rate denominator.
+ /// </summary>
+ public int FramerateDenominator { get; set; }
+
+ /// <summary>
+ /// Gets the total number of frames in this title.
+ /// </summary>
+ public int Frames
+ {
+ get
+ {
+ return (int)Math.Ceiling(this.Duration.TotalSeconds * this.Framerate);
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ public string Path { get; set; }
+
+ /// <summary>
+ /// Override of the ToString method to provide an easy way to use this object in the UI
+ /// </summary>
+ /// <returns>A string representing this track in the format: {title #}[ {playlist source}] (00:00:00)</returns>
+ public override string ToString()
+ {
+ string playlistPortion = string.Empty;
+ if (this.InputType == InputType.Bluray)
+ {
+ playlistPortion = string.Format(" {0:d5}.MPLS", this.Playlist);
+ }
+
+ return string.Format(
+ "{0}{1} ({2:00}:{3:00}:{4:00})",
+ this.TitleNumber,
+ playlistPortion,
+ this.Duration.Hours,
+ this.Duration.Minutes,
+ this.Duration.Seconds);
+ }
+
+ /// <summary>
+ /// Gets the display string for this title.
+ /// </summary>
+ public string Display
+ {
+ get
+ {
+ return this.ToString();
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether is main feature.
+ /// </summary>
+ public bool IsMainFeature { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Size.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Size.cs new file mode 100644 index 000000000..c41482e88 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/Size.cs @@ -0,0 +1,42 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.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 or sets the height.
+ /// </summary>
+ public int Height { 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.ApplicationServices/Interop/Model/SourceSubtitle.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceSubtitle.cs new file mode 100644 index 000000000..eca99ece4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceSubtitle.cs @@ -0,0 +1,54 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceSubtitle.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 SourceSubtitle type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model
+{
+ /// <summary>
+ /// The source subtitle.
+ /// </summary>
+ public class SourceSubtitle
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether the subtitle track should be burned in.
+ /// </summary>
+ public bool BurnedIn { 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 forced.
+ /// </summary>
+ public bool Forced { get; set; }
+
+ /// <summary>
+ /// Gets or sets the 1-based subtitle track number. 0 means foreign audio search.
+ /// </summary>
+ public int TrackNumber { get; set; }
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="SourceSubtitle"/>.
+ /// </returns>
+ public SourceSubtitle Clone()
+ {
+ return new SourceSubtitle
+ {
+ TrackNumber = this.TrackNumber,
+ Default = this.Default,
+ Forced = this.Forced,
+ BurnedIn = this.BurnedIn
+ };
+ }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceType.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceType.cs new file mode 100644 index 000000000..7d44a10bc --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/SourceType.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceType.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 SourceType type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model
+{
+ /// <summary>
+ /// The source type.
+ /// </summary>
+ public enum SourceType
+ {
+ /// <summary>
+ /// The none.
+ /// </summary>
+ None = 0,
+
+ /// <summary>
+ /// The file.
+ /// </summary>
+ File,
+
+ /// <summary>
+ /// The video folder.
+ /// </summary>
+ VideoFolder,
+
+ /// <summary>
+ /// The dvd.
+ /// </summary>
+ Dvd
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/SrtSubtitle.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/SrtSubtitle.cs new file mode 100644 index 000000000..98c9e8d08 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/SrtSubtitle.cs @@ -0,0 +1,66 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SrtSubtitle.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 SrtSubtitle type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model
+{
+ /// <summary>
+ /// The srt subtitle.
+ /// </summary>
+ public class SrtSubtitle
+ {
+ /// <summary>
+ /// Gets or sets the character code.
+ /// </summary>
+ public string CharacterCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the subtitle track should be marked as default.
+ /// </summary>
+ public bool Default { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the subtitle track should be burned in.
+ /// </summary>
+ public bool BurnedIn { get; set; }
+
+ /// <summary>
+ /// Gets or sets the file name.
+ /// </summary>
+ public string FileName { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the offset.
+ /// </summary>
+ public int Offset { get; set; }
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="SrtSubtitle"/>.
+ /// </returns>
+ public SrtSubtitle Clone()
+ {
+ return new SrtSubtitle
+ {
+ Default = this.Default,
+ BurnedIn = this.BurnedIn,
+ FileName = this.FileName,
+ LanguageCode = this.LanguageCode,
+ CharacterCode = this.CharacterCode,
+ Offset = this.Offset
+ };
+ }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/Subtitles.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/Subtitles.cs new file mode 100644 index 000000000..c455ee6a6 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/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>
+// Defines the Subtitles type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model
+{
+ using System.Collections.Generic;
+
+ /// <summary>
+ /// The subtitles.
+ /// </summary>
+ public class Subtitles
+ {
+ /// <summary>
+ /// Gets or sets the source subtitles.
+ /// </summary>
+ public List<SourceSubtitle> SourceSubtitles { get; set; }
+
+ /// <summary>
+ /// Gets or sets the srt subtitles.
+ /// </summary>
+ public List<SrtSubtitle> SrtSubtitles { get; set; }
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/VideoQualityLimits.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/VideoQualityLimits.cs new file mode 100644 index 000000000..821d58e9a --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/VideoQualityLimits.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <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.ApplicationServices.Interop.Model
+{
+ /// <summary>
+ /// Represents limits on video quality for a particular encoder.
+ /// </summary>
+ public class VideoQualityLimits
+ {
+ /// <summary>
+ /// Gets or sets the inclusive lower limit for the quality.
+ /// </summary>
+ public float Low { get; set; }
+
+ /// <summary>
+ /// Gets or sets the inclusive upper limit for the quality.
+ /// </summary>
+ public float High { get; set; }
+
+ /// <summary>
+ /// Gets or sets the granularity for the quality.
+ /// </summary>
+ public float Granularity { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the quality increases as the number increases.
+ /// </summary>
+ public bool Ascending { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Model/VideoRangeType.cs b/win/CS/HandBrake.ApplicationServices/Interop/Model/VideoRangeType.cs new file mode 100644 index 000000000..89e0f3af4 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Model/VideoRangeType.cs @@ -0,0 +1,43 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoRangeType.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 VideoRangeType type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Model
+{
+ using System.ComponentModel.DataAnnotations;
+
+ /// <summary>
+ /// The video range type.
+ /// </summary>
+ public enum VideoRangeType
+ {
+ /// <summary>
+ /// The entire title.
+ /// </summary>
+ [Display(Name = "Preview")]
+ Preview,
+
+ /// <summary>
+ /// A chapter range.
+ /// </summary>
+ [Display(Name = "Chapters")]
+ Chapters,
+
+ /// <summary>
+ /// A timespan range in seconds.
+ /// </summary>
+ [Display(Name = "Seconds")]
+ Seconds,
+
+ /// <summary>
+ /// A frame range.
+ /// </summary>
+ [Display(Name = "Frames")]
+ Frames
+ }
+}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs index 744f435ae..3dee11f37 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/LibEncode.cs @@ -18,10 +18,10 @@ namespace HandBrake.ApplicationServices.Services.Encode using HandBrake.ApplicationServices.Services.Scan;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop;
- using HandBrake.Interop.EventArgs;
- using HandBrake.Interop.Interfaces;
- using HandBrake.Interop.Model;
+ using HandBrake.ApplicationServices.Interop;
+ using HandBrake.ApplicationServices.Interop.EventArgs;
+ using HandBrake.ApplicationServices.Interop.Interfaces;
+ using HandBrake.ApplicationServices.Interop.Model;
/// <summary>
/// LibHB Implementation of IEncode
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs index 42210363a..67d81facf 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/EncodeTask.cs @@ -17,8 +17,8 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
- using HandBrake.Interop.Model;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// An Encode Task
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs index 7c973328c..9a6f61810 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AllowedPassthru.cs @@ -9,7 +9,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models
{
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// Allowed Passthru Options
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs index 91c9c3564..9887275bb 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Model/Models/AudioTrack.cs @@ -17,7 +17,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Model.Models using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using Newtonsoft.Json;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs index d17de41b1..08ee84b9d 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/LibScan.cs @@ -22,14 +22,14 @@ namespace HandBrake.ApplicationServices.Services.Scan using HandBrake.ApplicationServices.Services.Scan.Interfaces;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop;
- using HandBrake.Interop.EventArgs;
- using HandBrake.Interop.Interfaces;
- using HandBrake.Interop.Model;
- using HandBrake.Interop.Model.Scan;
+ using HandBrake.ApplicationServices.Interop;
+ using HandBrake.ApplicationServices.Interop.EventArgs;
+ using HandBrake.ApplicationServices.Interop.Interfaces;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Scan;
using Chapter = HandBrake.ApplicationServices.Services.Scan.Model.Chapter;
- using ScanProgressEventArgs = HandBrake.Interop.EventArgs.ScanProgressEventArgs;
+ using ScanProgressEventArgs = HandBrake.ApplicationServices.Interop.EventArgs.ScanProgressEventArgs;
using Size = System.Drawing.Size;
using Subtitle = HandBrake.ApplicationServices.Services.Scan.Model.Subtitle;
using SubtitleType = HandBrake.ApplicationServices.Services.Encode.Model.Models.SubtitleType;
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs b/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs index cde8fece8..25fb66769 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Scan/Model/Title.cs @@ -13,7 +13,7 @@ namespace HandBrake.ApplicationServices.Services.Scan.Model using System.Collections.Generic;
using System.Linq;
- using HandBrake.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model;
using Size = System.Drawing.Size;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs index 3bb040052..5b39a23d6 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/Converters.cs @@ -13,7 +13,7 @@ namespace HandBrake.ApplicationServices.Utilities using System.Text.RegularExpressions;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// A class to convert various things to native C# objects
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs b/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs index 45988ba60..48df48f8b 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/EnumHelper.cs @@ -18,7 +18,7 @@ namespace HandBrake.ApplicationServices.Utilities using System.Linq;
using System.Reflection;
- using HandBrake.Interop.Attributes;
+ using HandBrake.ApplicationServices.Interop.Attributes;
/// <summary>
/// Enum Helpers
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs index 141af6b55..a16274694 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/InteropModelCreator.cs @@ -16,8 +16,8 @@ namespace HandBrake.ApplicationServices.Utilities using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
- using HandBrake.Interop.Model;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// A Utility Class to Convert a
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs index 7ec730330..fc05244a4 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs @@ -14,7 +14,7 @@ namespace HandBrake.ApplicationServices.Utilities using System.Management;
using System.Windows.Forms;
- using HandBrake.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.HbLib;
using Microsoft.Win32;
diff --git a/win/CS/HandBrake10.sln b/win/CS/HandBrake10.sln index 59cc0e38c..9f8fb0d59 100644 --- a/win/CS/HandBrake10.sln +++ b/win/CS/HandBrake10.sln @@ -7,8 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandBrake.ApplicationServic EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandBrakeWPF", "HandBrakeWPF\HandBrakeWPF.csproj", "{DADE66CB-0E12-4959-ADE5-0ACD31D27C59}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HandBrake.Interop", "HandBrake.Interop\HandBrakeInterop\HandBrake.Interop.csproj", "{F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5CB7BC74-449C-4E95-98AB-E1E4387E514B}"
ProjectSection(SolutionItems) = preProject
build.xml = build.xml
@@ -72,27 +70,6 @@ Global {DADE66CB-0E12-4959-ADE5-0ACD31D27C59}.Release|x64.Build.0 = Release|x64
{DADE66CB-0E12-4959-ADE5-0ACD31D27C59}.Release|x86.ActiveCfg = Release|x86
{DADE66CB-0E12-4959-ADE5-0ACD31D27C59}.Release|x86.Build.0 = Release|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug|Any CPU.ActiveCfg = Debug|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug|Mixed Platforms.Build.0 = Debug|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug|x64.ActiveCfg = Debug|x64
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug|x64.Build.0 = Debug|x64
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug|x86.ActiveCfg = Debug|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug|x86.Build.0 = Debug|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug32|Any CPU.ActiveCfg = Debug32|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug32|Mixed Platforms.ActiveCfg = Debug32|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug32|Mixed Platforms.Build.0 = Debug32|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug32|x64.ActiveCfg = Debug32|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug32|x64.Build.0 = Debug32|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug32|x86.ActiveCfg = Debug32|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Debug32|x86.Build.0 = Debug32|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Release|Any CPU.ActiveCfg = Release|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Release|Mixed Platforms.ActiveCfg = Release|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Release|Mixed Platforms.Build.0 = Release|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Release|x64.ActiveCfg = Release|x64
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Release|x64.Build.0 = Release|x64
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Release|x86.ActiveCfg = Release|x86
- {F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs index 6048a3026..89fcd58a9 100644 --- a/win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioBitrateConverter.cs @@ -16,7 +16,7 @@ namespace HandBrakeWPF.Converters.Audio using System.Linq;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// A Converter to provide the available audio bitrate options.
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs index 25515bfdb..3ced1e9c2 100644 --- a/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioEncoderConverter.cs @@ -19,7 +19,7 @@ namespace HandBrakeWPF.Converters.Audio using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// Audio Encoder Converter
diff --git a/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs b/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs index ed9ab9b9f..1cc6af360 100644 --- a/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Audio/AudioQueueDisplayConverter.cs @@ -18,7 +18,7 @@ namespace HandBrakeWPF.Converters.Audio using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// Audio Queue Display Converter
diff --git a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs index a0f2c78ed..10fb8fd3c 100644 --- a/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/EnumComboConverter.cs @@ -17,7 +17,7 @@ namespace HandBrakeWPF.Converters using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using PresetPictureSettingsMode = HandBrakeWPF.Model.Picture.PresetPictureSettingsMode;
diff --git a/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs b/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs index 14c0dfc93..e3110f688 100644 --- a/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Filters/DenoisePresetConverter.cs @@ -16,7 +16,7 @@ namespace HandBrakeWPF.Converters.Filters using System.Windows.Data;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// The denoise preset converter.
diff --git a/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs index 8c60cb998..900d70236 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/EncoderOptionsTooltipConverter.cs @@ -16,7 +16,7 @@ namespace HandBrakeWPF.Converters.Video using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// The x 264 queue tooltip converter.
diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs index b30d525fb..ffe11ffef 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoEncoderConverter.cs @@ -19,7 +19,7 @@ namespace HandBrakeWPF.Converters.Video using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// Video Encoder Converter
diff --git a/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs b/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs index a4ec4e9e5..278d9e960 100644 --- a/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs +++ b/win/CS/HandBrakeWPF/Converters/Video/VideoOptionsTooltipConverter.cs @@ -15,7 +15,7 @@ namespace HandBrakeWPF.Converters.Video using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// The x 264 queue tooltip converter.
diff --git a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj index 0e5efa7fd..74cdd73f5 100644 --- a/win/CS/HandBrakeWPF/HandBrakeWPF.csproj +++ b/win/CS/HandBrakeWPF/HandBrakeWPF.csproj @@ -531,10 +531,6 @@ <Project>{087A2BA8-BAC2-4577-A46F-07FF9D420016}</Project>
<Name>HandBrake.ApplicationServices</Name>
</ProjectReference>
- <ProjectReference Include="..\HandBrake.Interop\HandBrakeInterop\HandBrake.Interop.csproj">
- <Project>{F0A61F62-2C3B-4A87-AFF4-0C4256253DA1}</Project>
- <Name>HandBrake.Interop</Name>
- </ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="Views\Images\Advanced.png" />
diff --git a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs index 6ea4ca28d..febb442ec 100644 --- a/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs +++ b/win/CS/HandBrakeWPF/Helpers/AutoNameHelper.cs @@ -18,7 +18,7 @@ namespace HandBrakeWPF.Helpers using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Extensions;
using HandBrakeWPF.Services.Interfaces;
diff --git a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs index 6961ae64f..b14695922 100644 --- a/win/CS/HandBrakeWPF/Helpers/PictureSize.cs +++ b/win/CS/HandBrakeWPF/Helpers/PictureSize.cs @@ -11,9 +11,9 @@ namespace HandBrakeWPF.Helpers {
using System.Diagnostics;
- using HandBrake.Interop.HbLib;
- using HandBrake.Interop.Model;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// The picture size Helpers
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs index 5892978cd..804f77b19 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistFactory.cs @@ -16,7 +16,7 @@ namespace HandBrakeWPF.Services.Presets.Factories using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Services.Presets.Model;
diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs index a98e63e6d..a8b0f43a3 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/PlistPresetFactory.cs @@ -19,7 +19,7 @@ namespace HandBrakeWPF.Services.Presets.Factories using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Model.Audio;
using HandBrakeWPF.Model.Subtitles;
diff --git a/win/CS/HandBrakeWPF/Services/UpdateService.cs b/win/CS/HandBrakeWPF/Services/UpdateService.cs index ed093baf9..d31d3b60f 100644 --- a/win/CS/HandBrakeWPF/Services/UpdateService.cs +++ b/win/CS/HandBrakeWPF/Services/UpdateService.cs @@ -15,7 +15,7 @@ namespace HandBrakeWPF.Services using System.Threading;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop;
+ using HandBrake.ApplicationServices.Interop;
using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Interfaces;
diff --git a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs index 719b873f8..65464f3f9 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AddPresetViewModel.cs @@ -18,7 +18,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Model.Audio;
using HandBrakeWPF.Model.Subtitles;
diff --git a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs index 18606bfa0..da068d193 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AdvancedViewModel.cs @@ -11,7 +11,7 @@ namespace HandBrakeWPF.ViewModels {
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Scan.Model;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Services.Presets.Model;
using HandBrakeWPF.ViewModels.Interfaces;
diff --git a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs index 22a7094e7..699137169 100644 --- a/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/AudioViewModel.cs @@ -21,7 +21,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Model.Audio;
using HandBrakeWPF.Services.Interfaces;
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index 8e5c9f6d5..a555142fe 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -18,7 +18,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Encode.Model.Models;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Services.Presets.Model;
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs index a84a79f6a..acbcb7d02 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IAdvancedViewModel.cs @@ -9,7 +9,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// The Advanced View Model Interface
diff --git a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs index 70b72affe..a9907bdba 100644 --- a/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/Interfaces/IX264ViewModel.cs @@ -9,7 +9,7 @@ namespace HandBrakeWPF.ViewModels.Interfaces
{
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
/// <summary>
/// The Advanced View Model Interface
diff --git a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs index cb174f3bf..d3fd9900c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/MainViewModel.cs @@ -31,7 +31,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Scan.Interfaces;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop;
+ using HandBrake.ApplicationServices.Interop;
using HandBrakeWPF.Commands;
using HandBrakeWPF.Factories;
diff --git a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs index 56ceacf71..4d133606c 100644 --- a/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/PictureSettingsViewModel.cs @@ -16,8 +16,8 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Scan.Model;
- using HandBrake.Interop.Model;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Helpers;
using HandBrakeWPF.Services.Presets.Model;
diff --git a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs index a00a3dcca..5099a2d9a 100644 --- a/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/StaticPreviewViewModel.cs @@ -27,7 +27,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Interfaces;
using HandBrake.ApplicationServices.Services.Scan.Interfaces;
using HandBrake.ApplicationServices.Services.Scan.Model;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Factories;
using HandBrakeWPF.Properties;
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 423dbd42b..a975a8bcd 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -23,8 +23,8 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Services.Encode.Model.Models.Video;
using HandBrake.ApplicationServices.Services.Scan.Model;
using HandBrake.ApplicationServices.Utilities;
- using HandBrake.Interop;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Properties;
diff --git a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs index 2647e2ae8..474e43d7e 100644 --- a/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/X264ViewModel.cs @@ -17,7 +17,7 @@ namespace HandBrakeWPF.ViewModels using HandBrake.ApplicationServices.Model;
using HandBrake.ApplicationServices.Services.Encode.Model;
using HandBrake.ApplicationServices.Services.Scan.Model;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Commands.Interfaces;
using HandBrakeWPF.Helpers;
diff --git a/win/CS/build.xml b/win/CS/build.xml index 595e24866..9852f893c 100644 --- a/win/CS/build.xml +++ b/win/CS/build.xml @@ -20,7 +20,6 @@ <!-- Build all the main cproj files.-->
<ItemGroup>
- <ProjectsToBuild Include="HandBrake.Interop\HandBrakeInterop\*proj" Exclude="$(MSBuildProjectFile)"/>
<ProjectsToBuild Include="HandBrake.ApplicationServices\*proj" Exclude="$(MSBuildProjectFile)"/>
<ProjectsToBuild Include="HandBrakeWPF\HandBrakeWPF.*proj" Exclude="$(MSBuildProjectFile)"/>
</ItemGroup>
|