diff options
author | sr55 <[email protected]> | 2015-01-10 18:14:11 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-01-10 18:14:11 +0000 |
commit | 2d7ab4d15eb9ea450787831445cbf79d5192d18c (patch) | |
tree | dbc3547f778aecfd0ee35cd065d54971260f92a5 /win/CS/HandBrake.Interop | |
parent | 0c5b67ec4b331028bac27c6761ae371dc75391b2 (diff) |
WinGui:
- Fix the DRC call
- Adding a HandBrake instance manager for scanning to make calls into the libhb helper methods easier.
- Remove codecparam from the audio models
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6724 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.Interop')
8 files changed, 98 insertions, 15 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs index c42203566..b2fbf75d6 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs @@ -9,6 +9,7 @@ namespace HandBrake.Interop
{
+ using System;
using System.Collections.Generic;
using System.Linq;
@@ -59,7 +60,7 @@ namespace HandBrake.Interop private static List<HBRate> audioSampleRates;
/// <summary>
- /// Initializes static members of the EncoderHelpers class.
+ /// Initializes static members of the HandBrakeEncoderHelpers class.
/// </summary>
static HandBrakeEncoderHelpers()
{
@@ -322,12 +323,15 @@ namespace HandBrake.Interop /// <param name="encoder">
/// The encoder to use for DRC.
/// </param>
+ /// <param name="title">
+ /// The title.
+ /// </param>
/// <returns>
/// True if DRC can be applied to the track with the given encoder.
/// </returns>
- public static bool CanApplyDrc(AudioTrack track, HBAudioEncoder encoder)
+ public static bool CanApplyDrc(AudioTrack track, HBAudioEncoder encoder, int title)
{
- return HBFunctions.hb_audio_can_apply_drc(track.CodecId, track.CodecParam, encoder.Id) > 0;
+ return HBFunctions.hb_audio_can_apply_drc2(HandBrakeInstanceManager.LastScanHandle, title, track.TrackNumber, encoder.Id) > 0;
}
/// <summary>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index 9962eca4d..a77f36ddb 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -111,6 +111,17 @@ namespace HandBrake.Interop public event EventHandler<EncodeCompletedEventArgs> EncodeCompleted;
/// <summary>
+ /// Gets the handle.
+ /// </summary>
+ internal IntPtr Handle
+ {
+ get
+ {
+ return this.Handle;
+ }
+ }
+
+ /// <summary>
/// Gets the list of titles on this instance.
/// </summary>
public List<Title> Titles
@@ -360,8 +371,6 @@ namespace HandBrake.Interop }
}
-
-
/// <summary>
/// Starts an encode with the given job.
/// </summary>
@@ -591,6 +600,5 @@ namespace HandBrake.Interop }
}
}
-
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstanceManager.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstanceManager.cs new file mode 100644 index 000000000..1ef749bd8 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstanceManager.cs @@ -0,0 +1,70 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="HandBrakeInstanceManager.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 hand brake instance manager.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop
+{
+ using System;
+
+ using HandBrake.Interop.Interfaces;
+
+ /// <summary>
+ /// The HandBrake Instance manager.
+ /// Only supports scanning right now.
+ /// </summary>
+ public static class HandBrakeInstanceManager
+ {
+ private static HandBrakeInstance scanInstance;
+
+ /// <summary>
+ /// Gets the scanInstance.
+ /// </summary>
+ /// <param name="verbosity">
+ /// The verbosity.
+ /// </param>
+ /// <returns>
+ /// The <see cref="IHandBrakeInstance"/>.
+ /// </returns>
+ public static IHandBrakeInstance GetScanInstance(int verbosity)
+ {
+ if (scanInstance != null)
+ {
+ scanInstance.Dispose();
+ scanInstance = null;
+ }
+
+ HandBrakeInstance newInstance = new HandBrakeInstance();
+ newInstance.Initialize(verbosity);
+ scanInstance = newInstance;
+
+ return scanInstance;
+ }
+
+ /// <summary>
+ /// Gets the last scan scan instance.
+ /// </summary>
+ public static IHandBrakeInstance LastScanScanInstance
+ {
+ get
+ {
+ return scanInstance;
+ }
+ }
+
+ /// <summary>
+ /// Gets the handle.
+ /// </summary>
+ internal static IntPtr LastScanHandle
+ {
+ get
+ {
+ return scanInstance.Handle;
+ }
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index 6df1d6a36..f153d2dca 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -152,6 +152,7 @@ </ItemGroup>
<ItemGroup>
<Compile Include="Attributes\ShortName.cs" />
+ <Compile Include="HandBrakeInstanceManager.cs" />
<Compile Include="HandBrakeUnitConversionHelpers.cs" />
<Compile Include="EventArgs\EncodeCompletedEventArgs.cs" />
<Compile Include="EventArgs\EncodeProgressEventArgs.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs index d3bbb19f8..2b1e4a770 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs @@ -277,8 +277,9 @@ namespace HandBrake.Interop.HbLib //const char* hb_audio_dither_get_description(int method);
//const hb_dither_t* hb_audio_dither_get_next(const hb_dither_t *last);
- [DllImport("hb.dll", EntryPoint = "hb_audio_can_apply_drc", CallingConvention = CallingConvention.Cdecl)]
- public static extern int hb_audio_can_apply_drc(uint codec, uint codec_param, int encoder);
+ // hb_audio_can_apply_drc2(hb_handle_t *h, int title_idx, int audio_idx, int encoder)
+ [DllImport("hb.dll", EntryPoint = "hb_audio_can_apply_drc2", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_audio_can_apply_drc2(IntPtr handle, int title_index, int audio_index, int encoder);
[DllImport("hb.dll", EntryPoint = "hb_mixdown_is_supported", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_mixdown_is_supported(int mixdown, uint codec, ulong layout);
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs index 61ffa892e..df2e4918c 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/ScanFactory.cs @@ -172,8 +172,7 @@ namespace HandBrake.Interop.Json.Factories AudioTrack newAudio = new AudioTrack
{
TrackNumber = currentAudioTrack,
- // CodecParam = audio.config.input.codec_param,
- // CodecId = audio.config.input.codec,
+ CodecId = Convert.ToUInt32(track.Codec),
Language = track.Language,
LanguageCode = track.LanguageCode,
Description = track.Description,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs index b91511cfc..aaacee197 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Scan/AudioList.cs @@ -43,5 +43,10 @@ namespace HandBrake.Interop.Json.Scan /// Gets or sets the sample rate.
/// </summary>
public int SampleRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the codec.
+ /// </summary>
+ public int Codec { get; set; }
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs index db1ef5549..61438ee67 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Scan/AudioTrack.cs @@ -25,11 +25,6 @@ namespace HandBrake.Interop.Model.Scan public uint CodecId { get; set; }
/// <summary>
- /// Gets or sets the codec parameters for this track.
- /// </summary>
- public uint CodecParam { get; set; }
-
- /// <summary>
/// Gets or sets the language (if detected) of this Audio Track
/// </summary>
public string Language { get; set; }
|