summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.Interop')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs189
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs3
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj64
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Interfaces/IHandBrakeInstance.cs220
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs72
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/InteropWindsorInstaller.cs38
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/MarshalingConstants.cs36
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Settings.StyleCop62
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs4
9 files changed, 502 insertions, 186 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
index 9a4b175e5..cc12aa514 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
@@ -4,21 +4,20 @@
// </copyright>
// <summary>
// Defines the Converters type.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-using HandBrake.Interop.Model;
-
-namespace HandBrake.Interop
-{
- using System;
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop
+{
+ using System;
using System.Collections.Generic;
using HandBrake.Interop.HbLib;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.SourceData;
+ using HandBrake.Interop.Model;
- public static class Converters
+ public static class Converters
{
/// <summary>
/// Video Frame Rates
@@ -32,7 +31,11 @@ namespace HandBrake.Interop
{23.976, 1126125},
{24, 1125000},
{25, 1080000},
- {29.97, 900900}
+ {29.97, 900900},
+ {30, 900000},
+ {50, 540000},
+ {59.94, 450450},
+ {60, 450000}
};
/// <summary>
@@ -159,6 +162,8 @@ namespace HandBrake.Interop
return NativeConstants.HB_ACODEC_DCA_HD_PASS;
case AudioEncoder.Vorbis:
return NativeConstants.HB_ACODEC_VORBIS;
+ case AudioEncoder.ffflac:
+ return NativeConstants.HB_ACODEC_FFFLAC;
}
return 0;
@@ -191,85 +196,87 @@ namespace HandBrake.Interop
case NativeConstants.HB_ACODEC_CA_AAC:
case NativeConstants.HB_ACODEC_CA_HAAC:
return AudioCodec.Aac;
+ case NativeConstants.HB_ACODEC_FFFLAC:
+ return AudioCodec.Flac;
default:
- return AudioCodec.Other;
- }
- }
-
- /// <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)
- {
- var result = new HBVideoEncoder
- {
- Id = encoder.encoder,
- ShortName = encoder.short_name,
- DisplayName = encoder.human_readable_name,
- CompatibleContainers = Container.None
- };
-
- if ((encoder.muxers & NativeConstants.HB_MUX_MKV) > 0)
- {
- result.CompatibleContainers = result.CompatibleContainers | Container.Mkv;
- }
-
- if ((encoder.muxers & NativeConstants.HB_MUX_MP4) > 0)
- {
- result.CompatibleContainers = result.CompatibleContainers | Container.Mp4;
- }
-
- return result;
- }
-
- /// <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.encoder,
- ShortName = encoder.short_name,
- DisplayName = encoder.human_readable_name,
- CompatibleContainers = Container.None
- };
-
- if ((encoder.muxers & NativeConstants.HB_MUX_MKV) > 0)
- {
- result.CompatibleContainers = result.CompatibleContainers | Container.Mkv;
- }
-
- if ((encoder.muxers & NativeConstants.HB_MUX_MP4) > 0)
- {
- result.CompatibleContainers = result.CompatibleContainers | Container.Mp4;
- }
-
- result.QualityLimits = Encoders.GetAudioQualityLimits(encoder.encoder);
- result.DefaultQuality = HBFunctions.hb_get_default_audio_quality((uint)encoder.encoder);
- result.CompressionLimits = Encoders.GetAudioCompressionLimits(encoder.encoder);
- result.DefaultCompression = HBFunctions.hb_get_default_audio_compression((uint) encoder.encoder);
-
- return result;
- }
-
- /// <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.human_readable_name
- };
- }
- }
-}
+ return AudioCodec.Other;
+ }
+ }
+
+ /// <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)
+ {
+ var result = new HBVideoEncoder
+ {
+ Id = encoder.encoder,
+ ShortName = encoder.short_name,
+ DisplayName = encoder.human_readable_name,
+ CompatibleContainers = Container.None
+ };
+
+ if ((encoder.muxers & NativeConstants.HB_MUX_MKV) > 0)
+ {
+ result.CompatibleContainers = result.CompatibleContainers | Container.Mkv;
+ }
+
+ if ((encoder.muxers & NativeConstants.HB_MUX_MP4) > 0)
+ {
+ result.CompatibleContainers = result.CompatibleContainers | Container.Mp4;
+ }
+
+ return result;
+ }
+
+ /// <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.encoder,
+ ShortName = encoder.short_name,
+ DisplayName = encoder.human_readable_name,
+ CompatibleContainers = Container.None
+ };
+
+ if ((encoder.muxers & NativeConstants.HB_MUX_MKV) > 0)
+ {
+ result.CompatibleContainers = result.CompatibleContainers | Container.Mkv;
+ }
+
+ if ((encoder.muxers & NativeConstants.HB_MUX_MP4) > 0)
+ {
+ result.CompatibleContainers = result.CompatibleContainers | Container.Mp4;
+ }
+
+ result.QualityLimits = Encoders.GetAudioQualityLimits(encoder.encoder);
+ result.DefaultQuality = HBFunctions.hb_get_default_audio_quality((uint)encoder.encoder);
+ result.CompressionLimits = Encoders.GetAudioCompressionLimits(encoder.encoder);
+ result.DefaultCompression = HBFunctions.hb_get_default_audio_compression((uint) encoder.encoder);
+
+ return result;
+ }
+
+ /// <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.human_readable_name
+ };
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index d5bae2e97..efcd257e1 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -17,6 +17,7 @@ namespace HandBrake.Interop
using System.Windows.Media.Imaging;
using HandBrake.Interop.HbLib;
+ using HandBrake.Interop.Interfaces;
using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.SourceData;
@@ -24,7 +25,7 @@ namespace HandBrake.Interop
/// <summary>
/// A wrapper for a HandBrake instance.
/// </summary>
- public class HandBrakeInstance : IDisposable
+ public class HandBrakeInstance : IHandBrakeInstance, IDisposable
{
/// <summary>
/// The modulus for picture size when auto-sizing dimensions.
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
index 62b901df8..8155e16f1 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
@@ -101,6 +101,12 @@
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
+ <Reference Include="Castle.Core">
+ <HintPath>..\..\libraries\caliburn\Castle.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="Castle.Windsor">
+ <HintPath>..\..\libraries\caliburn\Castle.Windsor.dll</HintPath>
+ </Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
@@ -138,39 +144,41 @@
<Compile Include="HbLib\hb_job_s.cs" />
<Compile Include="HbLib\hb_title_s.cs" />
<Compile Include="HbLib\NativeConstants.cs" />
+ <Compile Include="Interfaces\IHandBrakeInstance.cs" />
<Compile Include="InteropUtilities.cs" />
+ <Compile Include="InteropWindsorInstaller.cs" />
<Compile Include="Language.cs" />
<Compile Include="LanguageCodes.cs" />
<Compile Include="MarshalingConstants.cs" />
- <Compile Include="MessageLoggedEventArgs.cs" />
- <Compile Include="Model\Cropping.cs" />
- <Compile Include="Model\EncodeJob.cs" />
- <Compile Include="Model\Encoders.cs" />
- <Compile Include="Model\Encoding\Anamorphic.cs" />
- <Compile Include="Model\Encoding\AudioEncodeRateType.cs" />
- <Compile Include="Model\Encoding\HBAudioEncoder.cs" />
- <Compile Include="Model\Encoding\AudioEncoder.cs" />
- <Compile Include="Model\Encoding\AudioEncoding.cs" />
- <Compile Include="Model\Encoding\Decomb.cs" />
+ <Compile Include="MessageLoggedEventArgs.cs" />
+ <Compile Include="Model\Cropping.cs" />
+ <Compile Include="Model\EncodeJob.cs" />
+ <Compile Include="Model\Encoders.cs" />
+ <Compile Include="Model\Encoding\Anamorphic.cs" />
+ <Compile Include="Model\Encoding\AudioEncodeRateType.cs" />
+ <Compile Include="Model\Encoding\HBAudioEncoder.cs" />
+ <Compile Include="Model\Encoding\AudioEncoder.cs" />
+ <Compile Include="Model\Encoding\AudioEncoding.cs" />
+ <Compile Include="Model\Encoding\Decomb.cs" />
<Compile Include="Model\Encoding\Deinterlace.cs" />
- <Compile Include="Model\Encoding\Denoise.cs" />
- <Compile Include="Model\Encoding\Detelecine.cs" />
- <Compile Include="Model\Encoding\EncodingProfile.cs" />
- <Compile Include="Model\Encoding\HBMixdown.cs" />
- <Compile Include="Model\Encoding\HBVideoEncoder.cs" />
- <Compile Include="Model\Encoding\Mixdown.cs" />
- <Compile Include="Model\Encoding\OutputExtension.cs" />
- <Compile Include="Model\Encoding\Container.cs" />
- <Compile Include="Model\Encoding\VideoEncoder.cs" />
- <Compile Include="Model\Encoding\VideoEncodeRateType.cs" />
- <Compile Include="Model\Encoding\x264\x264Preset.cs" />
- <Compile Include="Model\Encoding\x264\x264Profile.cs" />
- <Compile Include="Model\Encoding\x264\x264Tune.cs" />
- <Compile Include="Model\BitrateLimits.cs" />
- <Compile Include="Model\RangeLimits.cs" />
- <Compile Include="Model\Size.cs" />
- <Compile Include="Model\SourceSubtitle.cs" />
- <Compile Include="Model\SourceType.cs" />
+ <Compile Include="Model\Encoding\Denoise.cs" />
+ <Compile Include="Model\Encoding\Detelecine.cs" />
+ <Compile Include="Model\Encoding\EncodingProfile.cs" />
+ <Compile Include="Model\Encoding\HBMixdown.cs" />
+ <Compile Include="Model\Encoding\HBVideoEncoder.cs" />
+ <Compile Include="Model\Encoding\Mixdown.cs" />
+ <Compile Include="Model\Encoding\OutputExtension.cs" />
+ <Compile Include="Model\Encoding\Container.cs" />
+ <Compile Include="Model\Encoding\VideoEncoder.cs" />
+ <Compile Include="Model\Encoding\VideoEncodeRateType.cs" />
+ <Compile Include="Model\Encoding\x264\x264Preset.cs" />
+ <Compile Include="Model\Encoding\x264\x264Profile.cs" />
+ <Compile Include="Model\Encoding\x264\x264Tune.cs" />
+ <Compile Include="Model\BitrateLimits.cs" />
+ <Compile Include="Model\RangeLimits.cs" />
+ <Compile Include="Model\Size.cs" />
+ <Compile Include="Model\SourceSubtitle.cs" />
+ <Compile Include="Model\SourceType.cs" />
<Compile Include="Model\SrtSubtitle.cs" />
<Compile Include="Model\Subtitles.cs" />
<Compile Include="Model\VideoRangeType.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Interfaces/IHandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Interfaces/IHandBrakeInstance.cs
new file mode 100644
index 000000000..9225acfc5
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Interfaces/IHandBrakeInstance.cs
@@ -0,0 +1,220 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="IHandBrakeInstance.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// The Interface for HandBrakeInstance
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Interfaces
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Windows.Media.Imaging;
+
+ using HandBrake.Interop.Model;
+ using HandBrake.Interop.SourceData;
+
+ /// <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 number of previews created during scan.
+ /// </summary>
+ int PreviewCount { get; }
+
+ /// <summary>
+ /// Gets the list of titles on this instance.
+ /// </summary>
+ List<Title> Titles { get; }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// Calculates the video bitrate for the given job and target size.
+ /// </summary>
+ /// <param name="job">
+ /// The encode job.
+ /// </param>
+ /// <param name="sizeMB">
+ /// The target size in MB.
+ /// </param>
+ /// <param name="overallSelectedLengthSeconds">
+ /// The currently selected encode length. Used in preview
+ /// for calculating bitrate when the target size would be wrong.
+ /// </param>
+ /// <returns>
+ /// The video bitrate in kbps.
+ /// </returns>
+ int CalculateBitrate(EncodeJob job, int sizeMB, double overallSelectedLengthSeconds = 0);
+
+ /// <summary>
+ /// Gives estimated file size (in MB) of the given job and video bitrate.
+ /// </summary>
+ /// <param name="job">
+ /// The encode job.
+ /// </param>
+ /// <param name="videoBitrate">
+ /// The video bitrate to be used (kbps).
+ /// </param>
+ /// <returns>
+ /// The estimated file size (in MB) of the given job and video bitrate.
+ /// </returns>
+ double CalculateFileSize(EncodeJob job, int videoBitrate);
+
+ /// <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>
+ /// Gets the final size for a given encode job.
+ /// </summary>
+ /// <param name="job">
+ /// The encode job to use.
+ /// </param>
+ /// <param name="width">
+ /// The storage width.
+ /// </param>
+ /// <param name="height">
+ /// The storage height.
+ /// </param>
+ /// <param name="parWidth">
+ /// The pixel aspect X number.
+ /// </param>
+ /// <param name="parHeight">
+ /// The pixel aspect Y number.
+ /// </param>
+ void GetSize(EncodeJob job, out int width, out int height, out int parWidth, out int parHeight);
+
+ /// <summary>
+ /// Pauses the current encode.
+ /// </summary>
+ void PauseEncode();
+
+ /// <summary>
+ /// Resumes a paused encode.
+ /// </summary>
+ void ResumeEncode();
+
+ /// <summary>
+ /// Starts an encode with the given job.
+ /// </summary>
+ /// <param name="jobToStart">
+ /// The job to start.
+ /// </param>
+ void StartEncode(EncodeJob jobToStart);
+
+ /// <summary>
+ /// Starts an encode with the given job.
+ /// </summary>
+ /// <param name="job">
+ /// The job to start.
+ /// </param>
+ /// <param name="preview">
+ /// True if this is a preview encode.
+ /// </param>
+ /// <param name="previewNumber">
+ /// The preview number to start the encode at (0-based).
+ /// </param>
+ /// <param name="previewSeconds">
+ /// The number of seconds in the preview.
+ /// </param>
+ /// <param name="overallSelectedLengthSeconds">
+ /// The currently selected encode length. Used in preview
+ /// for calculating bitrate when the target size would be wrong.
+ /// </param>
+ void StartEncode(
+ EncodeJob job, bool preview, int previewNumber, int previewSeconds, double overallSelectedLengthSeconds);
+
+ /// <summary>
+ /// Starts scanning the given path.
+ /// </summary>
+ /// <param name="path">
+ /// The path to the video to scan.
+ /// </param>
+ /// <param name="previewCount">
+ /// The number of preview images to make.
+ /// </param>
+ void StartScan(string path, int previewCount);
+
+ /// <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="titleIndex">
+ /// The title index to scan (1-based, 0 for all titles).
+ /// </param>
+ void StartScan(string path, int previewCount, int titleIndex);
+
+ /// <summary>
+ /// Stops the current encode.
+ /// </summary>
+ void StopEncode();
+
+ /// <summary>
+ /// Stop any running scans
+ /// </summary>
+ void StopScan();
+
+ #endregion
+ }
+} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
index 3a36ddfc9..3a7f1c01e 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
@@ -12,13 +12,13 @@ namespace HandBrake.Interop
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
-
- using HandBrake.Interop.HbLib;
-
- /// <summary>
- /// Helper utilities for native interop.
- /// </summary>
- public static class InteropUtilities
+
+ using HandBrake.Interop.HbLib;
+
+ /// <summary>
+ /// Helper utilities for native interop.
+ /// </summary>
+ public static class InteropUtilities
{
/// <summary>
/// Reads the given native structure pointer.
@@ -49,35 +49,35 @@ namespace HandBrake.Interop
}
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 IEnumerable<T> ConvertArray<T>(IntPtr arrayPtr, int count)
- {
- IntPtr currentItem = arrayPtr;
-
- var result = new List<T>();
- for (int i = 0; i < count; i++)
- {
- T nativeEncoder = ReadStructure<T>(currentItem);
- result.Add(nativeEncoder);
-
- currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(typeof(T)));
- }
-
- return result;
- }
-
- /// <summary>
- /// Creats a new, empty native HandBrake list.
- /// </summary>
- /// <param name="capacity">The capacity of the new list.</param>
+ }
+
+ /// <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 IEnumerable<T> ConvertArray<T>(IntPtr arrayPtr, int count)
+ {
+ IntPtr currentItem = arrayPtr;
+
+ var result = new List<T>();
+ for (int i = 0; i < count; i++)
+ {
+ T nativeEncoder = ReadStructure<T>(currentItem);
+ result.Add(nativeEncoder);
+
+ currentItem = IntPtr.Add(currentItem, Marshal.SizeOf(typeof(T)));
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Creats a new, empty native HandBrake list.
+ /// </summary>
+ /// <param name="capacity">The capacity of the new list.</param>
/// <returns>The new native list.</returns>
public static NativeList CreateNativeList(int capacity)
{
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropWindsorInstaller.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropWindsorInstaller.cs
new file mode 100644
index 000000000..91383f8b5
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropWindsorInstaller.cs
@@ -0,0 +1,38 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="InteropWindsorInstaller.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 Implimentation of IWindsorInstaller for this library.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop
+{
+ using Castle.Core;
+ using Castle.MicroKernel.Registration;
+ using Castle.MicroKernel.SubSystems.Configuration;
+ using Castle.Windsor;
+
+ using HandBrake.Interop.Interfaces;
+
+ /// <summary>
+ /// An Implimentation of IWindsorInstaller for this library.
+ /// </summary>
+ public class InteropWindsorInstaller : IWindsorInstaller
+ {
+ /// <summary>
+ /// An Implimentation of IWindsorInstaller for this library.
+ /// </summary>
+ /// <param name="container">
+ /// The container.
+ /// </param>
+ /// <param name="store">
+ /// The store.
+ /// </param>
+ public void Install(IWindsorContainer container, IConfigurationStore store)
+ {
+ container.Register(Component.For<IHandBrakeInstance>().ImplementedBy<HandBrakeInstance>().LifeStyle.Is(LifestyleType.Singleton));
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/MarshalingConstants.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/MarshalingConstants.cs
index 07ebc0810..82948f05a 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/MarshalingConstants.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/MarshalingConstants.cs
@@ -9,21 +9,21 @@
namespace HandBrake.Interop
{
- public static class MarshalingConstants
- {
-#if X64
- public const int JobPaddingBytes = 49264;
- public const int AudioPaddingBytes = 49208;
-#else
- /// <summary>
- /// Job Padding Bytes
- /// </summary>
- public const int JobPaddingBytes = 49216;
-
- /// <summary>
- /// Audio Padding Bytes
- /// </summary>
- public const int AudioPaddingBytes = 49180;
-#endif
- }
-}
+ public static class MarshalingConstants
+ {
+#if X64
+ public const int JobPaddingBytes = 49264;
+ public const int AudioPaddingBytes = 49208;
+#else
+ /// <summary>
+ /// Job Padding Bytes
+ /// </summary>
+ public const int JobPaddingBytes = 49216;
+
+ /// <summary>
+ /// Audio Padding Bytes
+ /// </summary>
+ public const int AudioPaddingBytes = 49180;
+#endif
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Settings.StyleCop b/win/CS/HandBrake.Interop/HandBrakeInterop/Settings.StyleCop
index 39d8ff868..c4e827f20 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Settings.StyleCop
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Settings.StyleCop
@@ -1,14 +1,54 @@
-<StyleCopSettings Version="4.3">
- <Analyzers>
- <Analyzer AnalyzerId="Microsoft.StyleCop.CSharp.SpacingRules">
- <Rules>
- <Rule Name="TabsMustNotBeUsed">
- <RuleSettings>
+<StyleCopSettings Version="105">
+ <Analyzers>
+ <Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
+ <Rules>
+ <Rule Name="TabsMustNotBeUsed">
+ <RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
- </Rules>
- <AnalyzerSettings />
- </Analyzer>
- </Analyzers>
-</StyleCopSettings>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
+ <Rules>
+ <Rule Name="FileMustHaveHeader">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">True</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderMustShowCopyright">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">True</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderMustHaveCopyrightText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">True</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderMustContainFileName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">True</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">True</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderMustHaveSummary">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">True</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ <Rule Name="FileHeaderMustHaveValidCompanyText">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">True</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
+ </Analyzers>
+</StyleCopSettings> \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs
index 62bfecf79..ad797c53d 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs
@@ -22,6 +22,8 @@ namespace HandBrake.Interop.SourceData
Aac,
- Other
+ Other,
+
+ Flac
}
}