diff options
author | sr55 <[email protected]> | 2015-04-05 13:40:13 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-04-05 13:40:13 +0000 |
commit | 752c3f30c5db812af2e69aa8815fd41605536461 (patch) | |
tree | 91e8fe147ad01b8b144d7f9b8cab4c36b88fa189 /win/CS | |
parent | 343ffe36398605c25349cc5d49a043706d42f6b5 (diff) |
WinGui: Updates to the latest JSON API. This enables hardware decode / encode options once again.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7053 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS')
12 files changed, 102 insertions, 82 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj index e0bf5cd97..91b8dfea8 100644 --- a/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj +++ b/win/CS/HandBrake.ApplicationServices/HandBrake.ApplicationServices.csproj @@ -109,6 +109,7 @@ <Compile Include="Interop\Interfaces\IHandBrakeInstance.cs" />
<Compile Include="Interop\Json\Anamorphic\AnamorphicGeometry.cs" />
<Compile Include="Interop\Json\Anamorphic\DestSettings.cs" />
+ <Compile Include="Interop\Json\Encode\QSV.cs" />
<Compile Include="Interop\Json\Shared\PAR.cs" />
<Compile Include="Interop\Json\Encode\Audio.cs" />
<Compile Include="Interop\Json\Encode\AudioList.cs" />
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Audio.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Audio.cs index 5a2c97066..ce1c69c9c 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Audio.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Audio.cs @@ -24,7 +24,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode /// <summary>
/// Gets or sets the copy mask.
/// </summary>
- public int CopyMask { get; set; }
+ public string[] CopyMask { get; set; }
/// <summary>
/// Gets or sets the fallback encoder.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/AudioList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/AudioList.cs index 9e1af92df..2f79ec7e6 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/AudioList.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/AudioList.cs @@ -68,5 +68,10 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode /// Gets or sets the track.
/// </summary>
public int Track { get; set; }
+
+ /// <summary>
+ /// Gets or sets the dither method.
+ /// </summary>
+ public int DitherMethod { get; set; }
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs index b6b12a7eb..9de1b8341 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/JsonEncodeObject.cs @@ -29,7 +29,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode /// <summary>
/// Gets or sets the filter.
/// </summary>
- public Filters Filter { get; set; }
+ public Filters Filters { get; set; }
/// <summary>
/// Gets or sets the PAR
@@ -39,7 +39,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode /// <summary>
/// Gets or sets the meta data.
/// </summary>
- public MetaData MetaData { get; set; }
+ public MetaData Metadata { get; set; }
/// <summary>
/// Gets or sets the sequence id.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/QSV.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/QSV.cs new file mode 100644 index 000000000..0ca120643 --- /dev/null +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/QSV.cs @@ -0,0 +1,27 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="QSV.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 qsv.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Encode
+{
+ /// <summary>
+ /// The qsv.
+ /// </summary>
+ public class QSV
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether decode.
+ /// </summary>
+ public bool Decode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the async depth.
+ /// </summary>
+ public int AsyncDepth { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Range.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Range.cs index 50b874501..1fb42f1db 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Range.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Range.cs @@ -16,38 +16,19 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode {
/// <summary>
/// Gets or sets the chapter end.
+ /// Type is "chapter", "time", "frame", or "preview".
/// </summary>
- public int? ChapterEnd { get; set; }
+ public string Type { get; set; }
/// <summary>
/// Gets or sets the chapter start.
/// </summary>
- public int? ChapterStart { get; set; }
+ public int? Start { get; set; }
/// <summary>
/// Gets or sets the frame to start.
/// </summary>
- public int? FrameToStart { get; set; }
-
- /// <summary>
- /// Gets or sets the frame to stop.
- /// </summary>
- public int? FrameToStop { get; set; }
-
- /// <summary>
- /// Gets or sets the pts to start.
- /// </summary>
- public int? PtsToStart { get; set; }
-
- /// <summary>
- /// Gets or sets the pts to stop.
- /// </summary>
- public int? PtsToStop { get; set; }
-
- /// <summary>
- /// Gets or sets the start at preview.
- /// </summary>
- public int? StartAtPreview { get; set; }
+ public int? End { get; set; }
/// <summary>
/// Gets or sets the seek points.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleList.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleList.cs index 99781bf29..71814c9e1 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleList.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/SubtitleList.cs @@ -27,7 +27,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode /// <summary>
/// Gets or sets a value indicating whether force.
/// </summary>
- public bool Force { get; set; }
+ public bool Forced { get; set; }
/// <summary>
/// Gets or sets the id.
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Video.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Video.cs index 957f3dfb8..6844eaf0d 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Video.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Encode/Video.cs @@ -9,17 +9,23 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode
{
- using System;
-
/// <summary>
/// The video.
/// </summary>
public class Video
{
/// <summary>
+ /// Initializes a new instance of the <see cref="Video"/> class.
+ /// </summary>
+ public Video()
+ {
+ this.QSV = new QSV();
+ }
+
+ /// <summary>
/// Gets or sets the codec.
/// </summary>
- public int Codec { get; set; }
+ public int Encoder { get; set; }
/// <summary>
/// Gets or sets the level.
@@ -70,5 +76,20 @@ namespace HandBrake.ApplicationServices.Interop.Json.Encode /// Gets or sets the tune.
/// </summary>
public string Tune { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether open cl.
+ /// </summary>
+ public bool OpenCL { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether hw decode.
+ /// </summary>
+ public bool HWDecode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the qsv.
+ /// </summary>
+ public QSV QSV { get; set; }
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs index 2ec14a1e2..52fc9636a 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/Encode/Factories/EncodeFactory.cs @@ -57,12 +57,12 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories SequenceID = 0,
Audio = CreateAudio(job),
Destination = CreateDestination(job),
- Filter = CreateFilter(job),
+ Filters = CreateFilter(job),
PAR = CreatePAR(job),
- MetaData = CreateMetaData(job),
+ Metadata = CreateMetaData(job),
Source = CreateSource(job, configuration),
- Subtitle = CreateSubtitle(job),
- Video = CreateVideo(job)
+ Subtitle = CreateSubtitle(job),
+ Video = CreateVideo(job, configuration)
};
return encode;
@@ -86,21 +86,25 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories switch (job.PointToPointMode)
{
case PointToPointMode.Chapters:
- range.ChapterEnd = job.EndPoint;
- range.ChapterStart = job.StartPoint;
+ range.Type = "chapter";
+ range.End = job.EndPoint;
+ range.Start = job.StartPoint;
break;
case PointToPointMode.Seconds:
- range.PtsToStart = job.StartPoint * 90000;
- range.PtsToStop = (job.EndPoint - job.StartPoint) * 90000;
+ range.Type = "time";
+ range.Start = job.StartPoint * 90000;
+ range.End = (job.EndPoint - job.StartPoint) * 90000;
break;
case PointToPointMode.Frames:
- range.FrameToStart = job.StartPoint;
- range.FrameToStop = job.EndPoint;
+ range.Type = "frame";
+ range.Start = job.StartPoint;
+ range.End = job.EndPoint;
break;
case PointToPointMode.Preview:
- range.StartAtPreview = job.PreviewEncodeStartAt;
+ range.Type = "preview";
+ range.Start = job.PreviewEncodeStartAt;
range.SeekPoints = configuration.PreviewScanCount;
- range.PtsToStop = job.PreviewEncodeDuration * 90000;
+ range.End = job.PreviewEncodeDuration * 90000;
break;
}
@@ -202,7 +206,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories }
else
{
- SubtitleList track = new SubtitleList { Burn = item.Burned, Default = item.Default, Force = item.Forced, ID = item.SourceTrack.TrackNumber, Track = (item.SourceTrack.TrackNumber - 1) };
+ SubtitleList track = new SubtitleList { Burn = item.Burned, Default = item.Default, Forced = item.Forced, ID = item.SourceTrack.TrackNumber, Track = (item.SourceTrack.TrackNumber - 1) };
subtitle.SubtitleList.Add(track);
}
}
@@ -236,10 +240,13 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories /// <param name="job">
/// The job.
/// </param>
+ /// <param name="configuration">
+ /// The configuration.
+ /// </param>
/// <returns>
/// The <see cref="Video"/>.
/// </returns>
- private static Video CreateVideo(EncodeTask job)
+ private static Video CreateVideo(EncodeTask job, HBConfiguration configuration)
{
Video video = new Video();
@@ -247,7 +254,7 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories Validate.NotNull(videoEncoder, "Video encoder " + job.VideoEncoder + " not recognized.");
if (videoEncoder != null)
{
- video.Codec = videoEncoder.Id;
+ video.Encoder = videoEncoder.Id;
}
string advancedOptions = job.ShowAdvancedTab ? job.AdvancedEncoderOptions : string.Empty;
@@ -279,6 +286,10 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories }
}
+ video.OpenCL = configuration.ScalingMode == VideoScaler.BicubicCl;
+ video.HWDecode = configuration.EnableDxva;
+ video.QSV.Decode = !configuration.DisableQuickSyncDecoding;
+
return video;
}
@@ -295,17 +306,17 @@ namespace HandBrake.ApplicationServices.Services.Encode.Factories {
Audio audio = new Audio();
- int copyMask = 0;
- if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMask = (int)NativeConstants.HB_ACODEC_AAC_PASS;
- if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_AC3_PASS;
- if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMask |= (int)NativeConstants.HB_ACODEC_DCA_HD_PASS;
- if (job.AllowedPassthruOptions.AudioAllowDTSPass) copyMask |= (int)NativeConstants.HB_ACODEC_DCA_PASS;
- if (job.AllowedPassthruOptions.AudioAllowEAC3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_EAC3_PASS;
- if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMask |= (int)NativeConstants.HB_ACODEC_FLAC_PASS;
- if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMask |= (int)NativeConstants.HB_ACODEC_MP3_PASS;
- if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMask |= (int)NativeConstants.HB_ACODEC_TRUEHD_PASS;
-
- audio.CopyMask = copyMask;
+ List<string> copyMaskList = new List<string>();
+ if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMaskList.Add("copy:aac");
+ if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMaskList.Add("copy:ac3");
+ if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMaskList.Add("copy:dtshd");
+ if (job.AllowedPassthruOptions.AudioAllowDTSPass) copyMaskList.Add("copy:dts");
+ if (job.AllowedPassthruOptions.AudioAllowEAC3Pass) copyMaskList.Add("copy:eac3");
+ if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMaskList.Add("copy:flac");
+ if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMaskList.Add("copy:mp3");
+ if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMaskList.Add("copy:truehd");
+ audio.CopyMask = copyMaskList.ToArray();
+
HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback));
audio.FallbackEncoder = audioEncoder.Id;
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs index d74a8f72a..2e8e3f05f 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/GeneralUtilities.cs @@ -49,22 +49,6 @@ namespace HandBrake.ApplicationServices.Utilities }
}
- /// <summary>
- /// Gets a value indicating whether is lib hb present.
- /// </summary>
- public static bool IsLibHbPresent
- {
- get
- {
- if (isLibHbPresent == null)
- {
- isLibHbPresent = File.Exists(Path.Combine(Application.StartupPath, "hb.dll"));
- }
-
- return isLibHbPresent.Value;
- }
- }
-
#endregion
#region Public Methods
diff --git a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs index fc05244a4..ffe00d679 100644 --- a/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs +++ b/win/CS/HandBrake.ApplicationServices/Utilities/SystemInfo.cs @@ -71,11 +71,6 @@ namespace HandBrake.ApplicationServices.Utilities {
try
{
- if (!GeneralUtilities.IsLibHbPresent)
- {
- return false; // Feature is disabled.
- }
-
return HBFunctions.hb_qsv_available() == 1;
}
catch (Exception)
diff --git a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs index 5f1193cc7..14ff6cd70 100644 --- a/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/VideoViewModel.cs @@ -1033,11 +1033,6 @@ namespace HandBrakeWPF.ViewModels /// </returns>
private string GetActualx264Query()
{
- if (!GeneralUtilities.IsLibHbPresent)
- {
- return string.Empty; // Feature is disabled.
- }
-
string preset = this.VideoPreset != null ? this.VideoPreset.ShortName : string.Empty;
string profile = this.VideoProfile != null ? this.VideoProfile.ShortName : string.Empty;
|