summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
diff options
context:
space:
mode:
authorrandomengy <[email protected]>2011-10-08 02:12:46 +0000
committerrandomengy <[email protected]>2011-10-08 02:12:46 +0000
commit54e0ebd757caf1fb4912a866b5bf61a6a86767e6 (patch)
tree686b93fa82ef4d320df2b735f541327712657ecc /win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
parent8aefcb07be2554610fd196f8190b5c44245be428 (diff)
Interop: Updating structs to keep up with libhb. Adding support for x264 profile/preset/tune and updating to use built in auto-passthrough.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4270 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs138
1 files changed, 72 insertions, 66 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
index b0e81fcd3..aeea2a142 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
@@ -18,10 +18,10 @@ namespace HandBrake.Interop
public static class Converters
{
- /// <summary>
- /// Video Frame Rates
- /// </summary>
- private static Dictionary<double, int> vrates = new Dictionary<double, int>
+ /// <summary>
+ /// Video Frame Rates
+ /// </summary>
+ private static Dictionary<double, int> vrates = new Dictionary<double, int>
{
{5, 5400000},
{10, 2700000},
@@ -33,19 +33,19 @@ namespace HandBrake.Interop
{29.97, 900900}
};
- /// <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)
+ /// <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 (!vrates.ContainsKey(framerate))
{
@@ -55,19 +55,19 @@ namespace HandBrake.Interop
return vrates[framerate];
}
- /// <summary>
- /// Convert a Mixdown object to HandBrakes native mixdown constant.
- /// </summary>
- /// <param name="mixdown">
- /// The mixdown.
- /// </param>
- /// <returns>
- /// NativeContstant that represents the mixdown.
- /// </returns>
- /// <exception cref="ArgumentException">
- /// Thrown for an invalid mixodown.
- /// </exception>
- public static int MixdownToNative(Mixdown mixdown)
+ /// <summary>
+ /// Convert a Mixdown object to HandBrakes native mixdown constant.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The mixdown.
+ /// </param>
+ /// <returns>
+ /// NativeContstant that represents the mixdown.
+ /// </returns>
+ /// <exception cref="ArgumentException">
+ /// Thrown for an invalid mixodown.
+ /// </exception>
+ public static int MixdownToNative(Mixdown mixdown)
{
if (mixdown == Mixdown.Auto)
{
@@ -76,6 +76,8 @@ namespace HandBrake.Interop
switch (mixdown)
{
+ case Mixdown.None:
+ return NativeConstants.HB_AMIXDOWN_NONE;
case Mixdown.DolbyProLogicII:
return NativeConstants.HB_AMIXDOWN_DOLBYPLII;
case Mixdown.DolbySurround:
@@ -91,22 +93,24 @@ namespace HandBrake.Interop
return 0;
}
- /// <summary>
- /// Convert an native internal handbrake mixdown to a local mixdown enum.
- /// </summary>
- /// <param name="mixdown">
- /// The mixdown.
- /// </param>
- /// <returns>
- /// A mixdown object.
- /// </returns>
- /// <exception cref="ArgumentException">
- /// thrown when mixdown is invalid.
- /// </exception>
- public static Mixdown NativeToMixdown(int mixdown)
+ /// <summary>
+ /// Convert an native internal handbrake mixdown to a local mixdown enum.
+ /// </summary>
+ /// <param name="mixdown">
+ /// The mixdown.
+ /// </param>
+ /// <returns>
+ /// A mixdown object.
+ /// </returns>
+ /// <exception cref="ArgumentException">
+ /// thrown when mixdown is invalid.
+ /// </exception>
+ public static Mixdown NativeToMixdown(int mixdown)
{
switch (mixdown)
{
+ case NativeConstants.HB_AMIXDOWN_NONE:
+ return Mixdown.None;
case NativeConstants.HB_AMIXDOWN_MONO:
return Mixdown.Mono;
case NativeConstants.HB_AMIXDOWN_STEREO:
@@ -125,30 +129,32 @@ namespace HandBrake.Interop
/// <summary>
/// Gets the native code for the given encoder.
/// </summary>
- /// <param name="encoder">The audio encoder to convert. Cannot be AudioEncoder.Passthrough.</param>
+ /// <param name="encoder">The audio encoder to convert.</param>
/// <returns>The native code for the encoder.</returns>
public static uint AudioEncoderToNative(AudioEncoder encoder)
{
switch (encoder)
{
+ case AudioEncoder.Passthrough:
+ return NativeConstants.HB_ACODEC_AUTO_PASS;
case AudioEncoder.Ac3Passthrough:
return NativeConstants.HB_ACODEC_AC3_PASS;
- case AudioEncoder.Ac3:
- return NativeConstants.HB_ACODEC_AC3;
+ case AudioEncoder.Ac3:
+ return NativeConstants.HB_ACODEC_AC3;
case AudioEncoder.Faac:
return NativeConstants.HB_ACODEC_FAAC;
- case AudioEncoder.ffaac:
- return NativeConstants.HB_ACODEC_FFAAC;
- case AudioEncoder.AacPassthru:
- return NativeConstants.HB_ACODEC_AAC_PASS;
+ case AudioEncoder.ffaac:
+ return NativeConstants.HB_ACODEC_FFAAC;
+ case AudioEncoder.AacPassthru:
+ return NativeConstants.HB_ACODEC_AAC_PASS;
case AudioEncoder.Lame:
return NativeConstants.HB_ACODEC_LAME;
- case AudioEncoder.Mp3Passthru:
- return NativeConstants.HB_ACODEC_MP3_PASS;
- case AudioEncoder.DtsPassthrough:
- return NativeConstants.HB_ACODEC_DCA_PASS;
- case AudioEncoder.DtsHDPassthrough:
- return NativeConstants.HB_ACODEC_DCA_HD_PASS;
+ case AudioEncoder.Mp3Passthru:
+ return NativeConstants.HB_ACODEC_MP3_PASS;
+ case AudioEncoder.DtsPassthrough:
+ return NativeConstants.HB_ACODEC_DCA_PASS;
+ case AudioEncoder.DtsHDPassthrough:
+ return NativeConstants.HB_ACODEC_DCA_HD_PASS;
case AudioEncoder.Vorbis:
return NativeConstants.HB_ACODEC_VORBIS;
}
@@ -156,16 +162,16 @@ namespace HandBrake.Interop
return 0;
}
- /// <summary>
- /// Convert Native HB Internal Audio int to a AudioCodec model.
- /// </summary>
- /// <param name="codec">
- /// The codec.
- /// </param>
- /// <returns>
- /// An AudioCodec object.
- /// </returns>
- public static AudioCodec NativeToAudioCodec(uint codec)
+ /// <summary>
+ /// Convert Native HB Internal Audio int to a AudioCodec model.
+ /// </summary>
+ /// <param name="codec">
+ /// The codec.
+ /// </param>
+ /// <returns>
+ /// An AudioCodec object.
+ /// </returns>
+ public static AudioCodec NativeToAudioCodec(uint codec)
{
switch (codec)
{