diff options
Diffstat (limited to 'win/CS')
10 files changed, 61 insertions, 12 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeCompletedEventArgs.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeCompletedEventArgs.cs index 2169c6e4d..46c2ba58b 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeCompletedEventArgs.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/EventArgs/EncodeCompletedEventArgs.cs @@ -17,7 +17,7 @@ namespace HandBrake.Interop.EventArgs public class EncodeCompletedEventArgs : EventArgs
{
/// <summary>
- /// Gets or sets a value indicating whether Error.
+ /// Gets or sets a value indicating whether an error occurred during the encode.
/// </summary>
public bool Error { get; set; }
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index 83f104368..fb3cf1f51 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -928,10 +928,10 @@ namespace HandBrake.Interop InteropUtilities.FreeMemory(this.encodeAllocatedMemory);
this.encodePollTimer.Stop();
- if (this.EncodeCompleted != null)
- {
- this.EncodeCompleted(this, new EncodeCompletedEventArgs { Error = state.param.workdone.error > 0 });
- }
+ if (this.EncodeCompleted != null)
+ {
+ this.EncodeCompleted(this, new EncodeCompletedEventArgs { Error = state.param.workdone.error != hb_error_code.HB_ERROR_NONE });
+ }
}
}
@@ -1516,9 +1516,16 @@ namespace HandBrake.Interop nativeJob.mux = HBFunctions.hb_container_get_from_name(profile.ContainerName);
}
- IntPtr outputPathPtr = InteropUtilities.CreateUtf8Ptr(job.OutputPath);
- allocatedMemory.Add(outputPathPtr);
- nativeJob.file = outputPathPtr;
+ if (job.OutputPath == null)
+ {
+ nativeJob.file = IntPtr.Zero;
+ }
+ else
+ {
+ IntPtr outputPathPtr = InteropUtilities.CreateUtf8Ptr(job.OutputPath);
+ allocatedMemory.Add(outputPathPtr);
+ nativeJob.file = outputPathPtr;
+ }
nativeJob.largeFileSize = profile.LargeFile ? 1 : 0;
nativeJob.mp4_optimize = profile.Optimize ? 1 : 0;
@@ -1704,6 +1711,11 @@ namespace HandBrake.Interop hb_audio_s nativeAudio = baseStruct;
HBAudioEncoder encoder = Encoders.GetAudioEncoder(encoding.Encoder);
+ if (encoder == null)
+ {
+ throw new InvalidOperationException("Could not find audio encoder " + encoding.Name);
+ }
+
nativeAudio.config.output.track = outputTrack;
nativeAudio.config.output.codec = (uint)encoder.Id;
nativeAudio.config.output.compression_level = -1;
@@ -1876,6 +1888,7 @@ namespace HandBrake.Interop {
TrackNumber = currentAudioTrack,
Codec = Converters.NativeToAudioCodec(audio.config.input.codec),
+ CodecParam = audio.config.input.codec_param,
CodecId = audio.config.input.codec,
Language = audio.config.lang.simple,
LanguageCode = audio.config.lang.iso639_2,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index 9dcbc8242..b195c54a0 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -136,6 +136,7 @@ <Compile Include="HbLib\hb_chapter_s.cs" />
<Compile Include="HbLib\hb_container_s.cs" />
<Compile Include="HbLib\hb_encoder_s.cs" />
+ <Compile Include="HbLib\hb_error_code.cs" />
<Compile Include="HbLib\hb_filter_ids.cs" />
<Compile Include="HbLib\hb_filter_object_s.cs" />
<Compile Include="HbLib\hb_mixdown_s.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs index 2167734b6..b065293ba 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs @@ -138,7 +138,7 @@ namespace HandBrake.Interop if (!string.IsNullOrEmpty(message))
{
// These errors happen in normal operations. Log them as messages.
- if (message == "dvd: ifoOpen failed" || message.Contains("avformat_seek_file failed"))
+ if (message == "dvd: ifoOpen failed" || message.Contains("avformat_seek_file failed") || message.Contains("nav_get_title_list"))
{
SendMessageEvent(message);
return;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs index 423afad1c..305283286 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs @@ -302,6 +302,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);
+
[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/HbLib/hb_error_code.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_error_code.cs new file mode 100644 index 000000000..86d8f3f08 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_error_code.cs @@ -0,0 +1,16 @@ +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HandBrake.Interop.HbLib
+{
+ public enum hb_error_code
+ {
+ HB_ERROR_NONE = 0,
+ HB_ERROR_CANCELED,
+ HB_ERROR_WRONG_INPUT,
+ HB_ERROR_INIT,
+ HB_ERROR_UNKNOWN
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_state_s.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_state_s.cs index bb82aad2b..d687a2810 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_state_s.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_state_s.cs @@ -84,7 +84,7 @@ namespace HandBrake.Interop.HbLib public struct hb_state_workdone_anon
{
/// int
- public int error;
+ public hb_error_code error;
}
[StructLayout(LayoutKind.Sequential)]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs index cb70f21d0..ba6a1ebd6 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs @@ -252,6 +252,17 @@ namespace HandBrake.Interop.Model }
/// <summary>
+ /// Determines if DRC can be applied to the given track with the given encoder.
+ /// </summary>
+ /// <param name="track">The track to apply DRC to.</param>
+ /// <param name="encoder">The encoder to use for DRC.</param>
+ /// <returns>True if DRC can be applied to the track with the given encoder.</returns>
+ public static bool CanApplyDrc(AudioTrack track, HBAudioEncoder encoder)
+ {
+ return HBFunctions.hb_audio_can_apply_drc(track.CodecId, track.CodecParam, encoder.Id) > 0;
+ }
+
+ /// <summary>
/// Sanitizes a mixdown given the output codec and input channel layout.
/// </summary>
/// <param name="mixdown">The desired mixdown.</param>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs index 50ecffdda..29dedafbb 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.51.0.0")]
-[assembly: AssemblyFileVersion("1.51.0.0")]
+[assembly: AssemblyVersion("1.52.0.0")]
+[assembly: AssemblyFileVersion("1.52.0.0")]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs index e20ff3003..4c4e64fd7 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/SourceData/AudioTrack.cs @@ -30,6 +30,11 @@ namespace HandBrake.Interop.SourceData 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; }
|