summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
diff options
context:
space:
mode:
authorrandomengy <[email protected]>2013-09-14 18:13:52 +0000
committerrandomengy <[email protected]>2013-09-14 18:13:52 +0000
commitdf38b4e3b51cd16e1ef7c559717a578852877456 (patch)
tree826193d6858fbbc2eec6f70009083b98c7d14098 /win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
parent1e73f743a8463ef70126d7b6b094f6ccc74c971e (diff)
Interop: Various fixes/improvements
* Exposed container list and changing compatible containers from an enum to an int to allow pulling the container list dynamically. * Removed a few unused and out-of-date functions and structs. * Updated a few structs to better track with the QSV changes. * Added a method to create a pointer to a UTF-8 encoded string. * Dither now is chosen automatically rather than turned off, which helps with FDK AAC. * Fixed unicode custom chapter names. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5782 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs44
1 files changed, 19 insertions, 25 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
index 1369b32c1..21fb68425 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
@@ -148,25 +148,13 @@ namespace HandBrake.Interop
/// <returns>The converted model.</returns>
public static HBVideoEncoder NativeToVideoEncoder(hb_encoder_s encoder)
{
- var result = new HBVideoEncoder
+ return new HBVideoEncoder
{
Id = encoder.codec,
ShortName = encoder.short_name,
DisplayName = encoder.name,
- CompatibleContainers = Container.None
+ CompatibleContainers = encoder.muxers
};
-
- 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>
@@ -181,19 +169,9 @@ namespace HandBrake.Interop
Id = encoder.codec,
ShortName = encoder.short_name,
DisplayName = encoder.name,
- CompatibleContainers = Container.None
+ CompatibleContainers = encoder.muxers
};
- 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.codec);
result.DefaultQuality = HBFunctions.hb_audio_quality_get_default((uint)encoder.codec);
result.CompressionLimits = Encoders.GetAudioCompressionLimits(encoder.codec);
@@ -232,6 +210,22 @@ namespace HandBrake.Interop
}
/// <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>