summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs189
1 files changed, 98 insertions, 91 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
+ };
+ }
+ }
+}