summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs29
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs2
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs13
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoding.cs5
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs6
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs2
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs18
7 files changed, 55 insertions, 20 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index bfd0c44de..521f5912a 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -11,6 +11,7 @@ namespace HandBrake.Interop
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
@@ -1284,6 +1285,8 @@ namespace HandBrake.Interop
nativeJob.maxWidth = profile.MaxWidth;
nativeJob.maxHeight = profile.MaxHeight;
+ nativeJob.modulus = 2;
+
break;
case Anamorphic.Strict:
nativeJob.anamorphic.mode = 1;
@@ -1421,7 +1424,10 @@ namespace HandBrake.Interop
foreach (Tuple<AudioEncoding, int> outputTrack in outputTrackList)
{
- audioList.Add(this.ConvertAudioBack(outputTrack.Item1, titleAudio[outputTrack.Item2 - 1], numTracks++, allocatedMemory));
+ AudioEncoding encoding = outputTrack.Item1;
+ int trackNumber = outputTrack.Item2;
+
+ audioList.Add(this.ConvertAudioBack(encoding, titleAudio[trackNumber - 1], numTracks++, allocatedMemory));
}
NativeList nativeAudioList = InteropUtilities.ToHandBrakeListFromList<hb_audio_s>(audioList);
@@ -1483,6 +1489,7 @@ namespace HandBrake.Interop
{
var subtitleConfig = new hb_subtitle_config_s();
+ subtitleConfig.dest = srtSubtitle.BurnedIn ? hb_subtitle_config_s_subdest.RENDERSUB : hb_subtitle_config_s_subdest.PASSTHRUSUB;
subtitleConfig.src_codeset = srtSubtitle.CharacterCode;
subtitleConfig.src_filename = srtSubtitle.FileName;
subtitleConfig.offset = srtSubtitle.Offset;
@@ -1766,13 +1773,24 @@ namespace HandBrake.Interop
throw new InvalidOperationException("Could not find audio encoder " + encoding.Name);
}
+ bool isPassthrough = encoder.IsPassthrough;
+
+ uint outputCodec = (uint)encoder.Id;
+ if (encoding.PassthroughIfPossible &&
+ encoder.Id == baseStruct.config.input.codec &&
+ (encoder.Id & NativeConstants.HB_ACODEC_PASS_MASK) > 0)
+ {
+ outputCodec |= NativeConstants.HB_ACODEC_PASS_FLAG;
+ isPassthrough = true;
+ }
+
nativeAudio.config.output.track = outputTrack;
- nativeAudio.config.output.codec = (uint)encoder.Id;
+ nativeAudio.config.output.codec = outputCodec;
nativeAudio.config.output.compression_level = -1;
nativeAudio.config.output.samplerate = nativeAudio.config.input.samplerate;
nativeAudio.config.output.dither_method = -1;
- if (!encoder.IsPassthrough)
+ if (!isPassthrough)
{
if (encoding.SampleRateRaw != 0)
{
@@ -1824,7 +1842,10 @@ namespace HandBrake.Interop
allocatedMemory.Add(encodingNamePtr);
}
- nativeAudio.padding = new byte[MarshalingConstants.AudioPaddingBytes];
+ if (nativeAudio.padding == null)
+ {
+ nativeAudio.padding = new byte[MarshalingConstants.AudioPaddingBytes];
+ }
return nativeAudio;
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs
index 45637e9a4..7e17a199b 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs
@@ -29,7 +29,7 @@ namespace HandBrake.Interop.HbLib
public const uint HB_ACODEC_FFFLAC24 = 0x00200000;
public const uint HB_ACODEC_FDK_AAC = 0x00400000;
public const uint HB_ACODEC_FDK_HAAC = 0x00800000;
- public const uint HB_ACODEC_FF_MASK = 0x00FF2000;
+ public const uint HB_ACODEC_FF_MASK = 0x00FF2800;
public const uint HB_ACODEC_PASS_FLAG = 0x40000000;
public const uint HB_ACODEC_PASS_MASK = (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA);
public const uint HB_ACODEC_AUTO_PASS = (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG);
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs
index ecf1b775a..f27fad285 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs
@@ -177,7 +177,18 @@ namespace HandBrake.Interop.Model
return containers;
}
- }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether SRT subtitles can be burnt in.
+ /// </summary>
+ public static bool CanBurnSrt
+ {
+ get
+ {
+ return HBFunctions.hb_subtitle_can_burn((int)hb_subtitle_s_subsource.SRTSUB) > 0;
+ }
+ }
/// <summary>
/// Gets the audio encoder with the specified short name.
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoding.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoding.cs
index c6ac28ea5..7aa211c8d 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoding.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncoding.cs
@@ -37,6 +37,11 @@ namespace HandBrake.Interop.Model.Encoding
public string Encoder { get; set; }
/// <summary>
+ /// Will pass through the track if it maches the codec type.
+ /// </summary>
+ public bool PassthroughIfPossible { get; set; }
+
+ /// <summary>
/// Gets or sets the encode rate type (bitrate or quality).
/// </summary>
public AudioEncodeRateType EncodeRateType { get; set; }
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs
index 478e309a6..6bcd8e0d7 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs
@@ -49,7 +49,7 @@ namespace HandBrake.Interop.Model.Encoding
public int Id { get; set; }
/// <summary>
- /// Gets a value indicating whether is passthrough.
+ /// Gets a value indicating whether the encoder is passthrough.
/// </summary>
public bool IsPassthrough
{
@@ -70,7 +70,7 @@ namespace HandBrake.Interop.Model.Encoding
public string ShortName { get; set; }
/// <summary>
- /// Gets a value indicating whether supports compression.
+ /// Gets a value indicating whether the encoder supports compression.
/// </summary>
public bool SupportsCompression
{
@@ -81,7 +81,7 @@ namespace HandBrake.Interop.Model.Encoding
}
/// <summary>
- /// Gets a value indicating whether supports quality.
+ /// Gets a value indicating whether the encoder supports quality.
/// </summary>
public bool SupportsQuality
{
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs
index 2912dec1e..e4bb3c39e 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs
@@ -17,7 +17,7 @@ namespace HandBrake.Interop.Model
#region Properties
/// <summary>
- /// Gets or sets a value indicating whether burned in.
+ /// Gets or sets a value indicating whether the subtitle track should be burned in.
/// </summary>
public bool BurnedIn { get; set; }
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs
index 46cc45f57..9a60c8ab3 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs
@@ -14,18 +14,21 @@ namespace HandBrake.Interop.Model
/// </summary>
public class SrtSubtitle
{
- #region Properties
-
/// <summary>
/// Gets or sets the character code.
/// </summary>
public string CharacterCode { get; set; }
/// <summary>
- /// Gets or sets a value indicating whether default.
+ /// Gets or sets a value indicating whether the subtitle track should be marked as default.
/// </summary>
public bool Default { get; set; }
+ /// <summary>
+ /// Gets or sets a value indicating the subtitle track should be burned in.
+ /// </summary>
+ public bool BurnedIn { get; set; }
+
/// <summary>
/// Gets or sets the file name.
/// </summary>
@@ -41,10 +44,6 @@ namespace HandBrake.Interop.Model
/// </summary>
public int Offset { get; set; }
- #endregion
-
- #region Public Methods
-
/// <summary>
/// The clone.
/// </summary>
@@ -55,14 +54,13 @@ namespace HandBrake.Interop.Model
{
return new SrtSubtitle
{
- Default = this.Default,
+ Default = this.Default,
+ BurnedIn = this.BurnedIn,
FileName = this.FileName,
LanguageCode = this.LanguageCode,
CharacterCode = this.CharacterCode,
Offset = this.Offset
};
}
-
- #endregion
}
} \ No newline at end of file