diff options
author | sr55 <[email protected]> | 2013-08-24 17:17:06 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2013-08-24 17:17:06 +0000 |
commit | bb5043c58b3a74fe87db12f1aaa7cbc6e2504824 (patch) | |
tree | 78a535b868dd7d8280a31752e32522fef3e53c7f | |
parent | f8e7adc789a0a426907bad279c0c6741da32aba5 (diff) |
Interop: Few minor updates for QuickSync.
WinGui: Create a new instances of HandBrakeInstance for every new encode.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5746 b64f7644-9d1e-0410-96f1-a4d463321fa5
5 files changed, 28 insertions, 35 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs index d6f312e24..83e4fe5ca 100644 --- a/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs +++ b/win/CS/HandBrake.ApplicationServices/Services/LibScan.cs @@ -36,7 +36,7 @@ namespace HandBrake.ApplicationServices.Services /*
* TODO
* 1. Expose the Previews code.
- * 2. Expose the Logging.
+ * 2. Cleanup old instances.
*
*/
@@ -48,11 +48,6 @@ namespace HandBrake.ApplicationServices.Services static readonly object LogLock = new object();
/// <summary>
- /// LibHB Instance
- /// </summary>
- private readonly IHandBrakeInstance instance;
-
- /// <summary>
/// The user setting service.
/// </summary>
private readonly IUserSettingService userSettingService;
@@ -87,28 +82,25 @@ namespace HandBrake.ApplicationServices.Services /// </summary>
private StreamWriter scanLog;
+ /// <summary>
+ /// LibHB Instance
+ /// </summary>
+ private IHandBrakeInstance instance;
+
#endregion
/// <summary>
/// Initializes a new instance of the <see cref="LibScan"/> class.
/// </summary>
- /// <param name="handBrakeInstance">
- /// The hand Brake Instance.
- /// </param>
/// <param name="userSettingService">
/// The user Setting Service.
/// </param>
- public LibScan(IHandBrakeInstance handBrakeInstance, IUserSettingService userSettingService)
+ public LibScan(IUserSettingService userSettingService)
{
logging = new StringBuilder();
header = GeneralUtilities.CreateCliLogHeader();
-
- instance = handBrakeInstance;
this.userSettingService = userSettingService;
- instance.Initialize(1);
- instance.ScanProgress += this.InstanceScanProgress;
- instance.ScanCompleted += this.InstanceScanCompleted;
HandBrakeUtils.MessageLogged += this.HandBrakeInstanceMessageLogged;
HandBrakeUtils.ErrorLogged += this.HandBrakeInstanceErrorLogged;
@@ -182,7 +174,6 @@ namespace HandBrake.ApplicationServices.Services // Clear down the logging
this.logging.Clear();
-
try
{
// Make we don't pick up a stale last_scan_log_xyz.txt (and that we have rights to the file)
@@ -201,10 +192,17 @@ namespace HandBrake.ApplicationServices.Services Directory.CreateDirectory(Path.GetDirectoryName(dvdInfoPath));
}
+ // Create a new scan log.
scanLog = new StreamWriter(dvdInfoPath);
- Thread t = new Thread(unused => this.ScanSource(sourcePath, title, previewCount));
- t.Start();
+ // Create a new HandBrake Instance.
+ instance = new HandBrakeInstance();
+ instance.Initialize(1);
+ instance.ScanProgress += this.InstanceScanProgress;
+ instance.ScanCompleted += this.InstanceScanCompleted;
+
+ // Start the scan on a back
+ this.ScanSource(sourcePath, title, previewCount);
}
/// <summary>
@@ -212,6 +210,8 @@ namespace HandBrake.ApplicationServices.Services /// </summary>
public void Stop()
{
+ instance.StopScan();
+
try
{
if (this.scanLog != null)
@@ -224,16 +224,6 @@ namespace HandBrake.ApplicationServices.Services {
// Do Nothing.
}
-
- instance.StopScan();
- }
-
- /// <summary>
- /// Shutdown the service.
- /// </summary>
- public void Shutdown()
- {
- // Nothing to do for this implementation.
}
#endregion
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs index ae7fcd704..23c5dd28b 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/NativeConstants.cs @@ -48,13 +48,16 @@ namespace HandBrake.Interop.HbLib public const int HB_SUBSTREAM_BD_DTS = 0x71;
// Video Encoders
- public const int HB_VCODEC_MASK = 0x0000FF;
+ public const int HB_VCODEC_MASK = 0x0000FFF;
public const int HB_VCODEC_X264 = 0x000001;
public const int HB_VCODEC_THEORA = 0x000002;
public const int HB_VCODEC_FFMPEG_MPEG4 = 0x000010;
public const int HB_VCODEC_FFMPEG = HB_VCODEC_FFMPEG_MPEG4;
public const int HB_VCODEC_FFMPEG_MPEG2 = 0x000020;
public const int HB_VCODEC_FFMPEG_MASK = 0x0000F0;
+ public const int HB_VCODEC_QSV_H264 = 0x0000100;
+ public const int HB_VCODEC_QSV_MASK = 0x0000F00;
+ public const int HB_VCODEC_H264_MASK = (HB_VCODEC_X264 | HB_VCODEC_QSV_H264);
// Muxers
public const int HB_MUX_MASK = 0xFF0000;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_filter.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_filter.cs index 068564c91..8dbe88d20 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_filter.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_filter.cs @@ -36,8 +36,9 @@ namespace HandBrake.Interop.HbLib public enum hb_filter_ids
{
+ HB_FILTER_QSV_PRE = 1, // for QSV - important to have before other filters
// First, filters that may change the framerate (drop or dup frames)
- HB_FILTER_DETELECINE = 1,
+ HB_FILTER_DETELECINE,
HB_FILTER_DECOMB,
HB_FILTER_DEINTERLACE,
HB_FILTER_VFR,
@@ -49,5 +50,7 @@ namespace HandBrake.Interop.HbLib // Finally filters that don't care what order they are in,
// except that they must be after the above filters
HB_FILTER_ROTATE,
+ HB_FILTER_QSV_POST, // for QSV - important to have as a last one
+ HB_FILTER_QSV, // default MSDK VPP filter
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs index c270860d0..25eb96274 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs @@ -15,9 +15,8 @@ namespace HandBrake.Interop using System.Runtime.InteropServices;
using System.Text;
using HandBrake.Interop.HbLib;
- using Model.Encoding;
- /// <summary>
+ /// <summary>
/// Helper utilities for native interop.
/// </summary>
public static class InteropUtilities
diff --git a/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs b/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs index 073105694..8180ac070 100644 --- a/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs +++ b/win/CS/HandBrakeWPF/Services/ScanServiceWrapper.cs @@ -16,7 +16,6 @@ namespace HandBrakeWPF.Services using HandBrake.ApplicationServices.Parsing;
using HandBrake.ApplicationServices.Services;
using HandBrake.ApplicationServices.Services.Interfaces;
- using HandBrake.Interop;
using HandBrake.Interop.Interfaces;
/// <summary>
@@ -50,8 +49,7 @@ namespace HandBrakeWPF.Services /// </param>
public ScanServiceWrapper(IUserSettingService userSettingService)
{
- HandbrakeInstance = new HandBrakeInstance();
- this.scanService = new LibScan(HandbrakeInstance, userSettingService);
+ this.scanService = new LibScan(userSettingService);
this.scanService.ScanCompleted += this.ScanServiceScanCompleted;
this.scanService.ScanStared += this.ScanServiceScanStared;
this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged;
|