summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrandomengy <[email protected]>2011-07-24 19:04:13 +0000
committerrandomengy <[email protected]>2011-07-24 19:04:13 +0000
commitd03140dd43594dafbf6f7f474ee06b45afc1b903 (patch)
tree700ad66da60f01e9d1b399dbead00f91f1d8c039
parent2f8559933d48333e463a548152197db4cb926971 (diff)
Add DTS-HD and DRC to HandBrakeInterop. Update libhb audio structures. Fix test project build failures.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4138 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop.Test/EncodeJobsPersist.cs1
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop.Test/TestEncodes.cs2
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs11
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs4
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs7
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs6
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs35
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs3
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs10
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs3
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Mixdown.cs4
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs2
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs2
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Utilities.cs14
14 files changed, 64 insertions, 40 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop.Test/EncodeJobsPersist.cs b/win/CS/HandBrake.Interop/HandBrakeInterop.Test/EncodeJobsPersist.cs
index 5ede69963..37ca233c4 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop.Test/EncodeJobsPersist.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop.Test/EncodeJobsPersist.cs
@@ -7,6 +7,7 @@ using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
using HandBrake.Interop;
+using HandBrake.Interop.Model;
namespace HandBrakeInterop.Test
{
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop.Test/TestEncodes.cs b/win/CS/HandBrake.Interop/HandBrakeInterop.Test/TestEncodes.cs
index cb5a848eb..47498ef76 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop.Test/TestEncodes.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop.Test/TestEncodes.cs
@@ -5,6 +5,8 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using HandBrake.Interop;
+using HandBrake.Interop.Model;
+using HandBrake.Interop.Model.Encoding;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace HandBrakeInterop.Test
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
index cbe3cce9f..ee49c5802 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs
@@ -16,7 +16,7 @@ namespace HandBrake.Interop
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.SourceData;
- public static class Converters
+ public static class Converters
{
private static Dictionary<double, int> vrates = new Dictionary<double, int>
{
@@ -83,14 +83,17 @@ namespace HandBrake.Interop
throw new ArgumentException("Unrecognized mixdown: " + mixdown, "mixdown");
}
+ /// <summary>
+ /// Gets the native code for the given encoder.
+ /// </summary>
+ /// <param name="encoder">The audio encoder to convert. Cannot be AudioEncoder.Passthrough.</param>
+ /// <returns>The native code for the encoder.</returns>
public static uint AudioEncoderToNative(AudioEncoder encoder)
{
switch (encoder)
{
case AudioEncoder.Ac3Passthrough:
return NativeConstants.HB_ACODEC_AC3_PASS;
- case AudioEncoder.DtsPassthrough:
- return NativeConstants.HB_ACODEC_DCA_PASS;
case AudioEncoder.Faac:
return NativeConstants.HB_ACODEC_FAAC;
case AudioEncoder.Lame:
@@ -112,6 +115,8 @@ namespace HandBrake.Interop
return AudioCodec.Ac3;
case NativeConstants.HB_ACODEC_DCA:
return AudioCodec.Dts;
+ case NativeConstants.HB_ACODEC_DCA_HD:
+ return AudioCodec.DtsHD;
default:
return AudioCodec.Other;
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index baa159c2f..28afc8462 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -1345,10 +1345,10 @@ namespace HandBrake.Interop
nativeAudio.config.output.codec = Converters.AudioEncoderToNative(encoding.Encoder);
}
- if (encoding.Encoder != AudioEncoder.Passthrough && encoding.Encoder != AudioEncoder.Ac3Passthrough && encoding.Encoder != AudioEncoder.DtsPassthrough)
+ if (!Utilities.IsPassthrough(encoding.Encoder))
{
nativeAudio.config.output.bitrate = encoding.Bitrate;
- nativeAudio.config.output.dynamic_range_compression = 0.0;
+ nativeAudio.config.output.dynamic_range_compression = encoding.Drc;
nativeAudio.config.output.gain = encoding.Gain;
if (encoding.Mixdown == Mixdown.Auto)
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs
index e76d41e82..5b4735ff8 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs
@@ -17,7 +17,7 @@ namespace HandBrake.Interop
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.SourceData;
- public static class HandBrakeUtils
+ public static class HandBrakeUtils
{
/// <summary>
/// Estimated overhead in bytes for each frame in output container.
@@ -212,7 +212,6 @@ namespace HandBrake.Interop
case AudioEncoder.Ac3:
case AudioEncoder.Passthrough:
case AudioEncoder.Ac3Passthrough:
- case AudioEncoder.DtsPassthrough:
return 1536;
}
@@ -240,9 +239,7 @@ namespace HandBrake.Interop
int samplesPerFrame = HandBrakeUtils.GetAudioSamplesPerFrame(encoding.Encoder);
int audioBitrate;
- if (encoding.Encoder == AudioEncoder.Passthrough ||
- encoding.Encoder == AudioEncoder.Ac3Passthrough ||
- encoding.Encoder == AudioEncoder.DtsPassthrough)
+ if (Utilities.IsPassthrough(encoding.Encoder))
{
// Input bitrate is in bits/second.
audioBitrate = track.Bitrate / 8;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs
index 40af719c5..4b2b7b123 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs
@@ -10,10 +10,10 @@
namespace HandBrake.Interop.HbLib
{
- using System;
- using System.Runtime.InteropServices;
+ using System;
+ using System.Runtime.InteropServices;
- [StructLayout(LayoutKind.Sequential)]
+ [StructLayout(LayoutKind.Sequential)]
public struct hb_anamorphic_substruct
{
/// int
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs
index 601f65526..df79262b3 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs
@@ -12,21 +12,26 @@ namespace HandBrake.Interop.HbLib
{
public partial class NativeConstants
{
- public const int HB_ACODEC_MASK = 0x0000FF00;
- public const int HB_ACODEC_FAAC = 0x00000100;
- public const int HB_ACODEC_LAME = 0x00000200;
- public const int HB_ACODEC_VORBIS = 0x00000400;
- public const int HB_ACODEC_AC3 = 0x00000800;
- public const int HB_ACODEC_MPGA = 0x00001000;
- public const int HB_ACODEC_LPCM = 0x00002000;
- public const int HB_ACODEC_DCA = 0x00004000;
- public const int HB_ACODEC_FFMPEG = 0x00008000;
- public const int HB_ACODEC_CA_AAC = 0x00010000;
- public const int HB_ACODEC_PASS_FLAG = 0x40000000;
- public const int HB_ACODEC_PASS_MASK = HB_ACODEC_AC3 | HB_ACODEC_DCA;
- public const int HB_ACODEC_AC3_PASS = HB_ACODEC_AC3 | HB_ACODEC_PASS_FLAG;
- public const int HB_ACODEC_DCA_PASS = HB_ACODEC_DCA | HB_ACODEC_PASS_FLAG;
- public const int HB_ACODEC_ANY = HB_ACODEC_MASK | HB_ACODEC_PASS_FLAG;
+ public const uint HB_ACODEC_MASK = 0x0000FF00;
+ public const uint HB_ACODEC_FAAC = 0x00000100;
+ 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_FF_MASK = 0x00060000;
+ public const uint HB_ACODEC_FF_I_FLAG = 0x80000000;
+ public const uint HB_ACODEC_PASS_FLAG = 0x40000000;
+ public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA);
+ 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);
public const int HB_SUBSTREAM_BD_TRUEHD = 0x72;
public const int HB_SUBSTREAM_BD_AC3 = 0x76;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs
index 377a52137..7938712c2 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs
@@ -104,6 +104,9 @@ namespace HandBrake.Interop.HbLib
/// int
public int channel_layout;
+
+ // hb_chan_map_t *
+ public IntPtr channel_map;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs
index 11310f96e..80c28c383 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs
@@ -9,13 +9,13 @@
namespace HandBrake.Interop.Model
{
- using System;
- using System.Collections.Generic;
- using System.Xml.Serialization;
+ using System;
+ using System.Collections.Generic;
+ using System.Xml.Serialization;
- using HandBrake.Interop.Model.Encoding;
+ using HandBrake.Interop.Model.Encoding;
- public class EncodeJob
+ public class EncodeJob
{
public SourceType SourceType { get; set; }
public string SourcePath { get; set; }
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs
index 16de0fefa..591037ad3 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoder.cs
@@ -28,9 +28,6 @@ namespace HandBrake.Interop.Model.Encoding
[Display(Name = "Passthrough (AC3)")]
Ac3Passthrough,
- [Display(Name = "Passthrough (DTS)")]
- DtsPassthrough,
-
[Display(Name = "Vorbis (vorbis)")]
Vorbis
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Mixdown.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Mixdown.cs
index 5ff1cc26f..89923c7c3 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Mixdown.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Mixdown.cs
@@ -9,9 +9,9 @@
namespace HandBrake.Interop.Model.Encoding
{
- using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations;
- public enum Mixdown
+ public enum Mixdown
{
[Display(Name = "Dolby Pro Logic II")]
DolbyProLogicII = 0,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs
index 91058e2b8..b9cb8ed2e 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioCodec.cs
@@ -16,6 +16,8 @@ namespace HandBrake.Interop.SourceData
Dts,
+ DtsHD,
+
Other
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs
index 29857d1e0..38d9b344a 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs
@@ -9,7 +9,7 @@
namespace HandBrake.Interop.SourceData
{
- /// <summary>
+ /// <summary>
/// An object represending an AudioTrack associated with a Title, in a DVD
/// </summary>
public class AudioTrack
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Utilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Utilities.cs
index e08d3f17c..fa5142e19 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Utilities.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Utilities.cs
@@ -7,9 +7,11 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------
+using HandBrake.Interop.Model.Encoding;
+
namespace HandBrake.Interop
{
- public static class Utilities
+ public static class Utilities
{
public static int GreatestCommonFactor(int a, int b)
{
@@ -32,5 +34,15 @@ namespace HandBrake.Interop
return GreatestCommonFactor(a, b % a);
}
}
+
+ /// <summary>
+ /// Determines if the given audio encoder is a passthrough encoder choice.
+ /// </summary>
+ /// <param name="encoder">The audio encoder to examine.</param>
+ /// <returns>True if the encoder is passthrough.</returns>
+ public static bool IsPassthrough(AudioEncoder encoder)
+ {
+ return encoder == AudioEncoder.Ac3Passthrough || encoder == AudioEncoder.Passthrough;
+ }
}
}