summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs58
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj2
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs35
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs12
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_list_s.cs25
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs4
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs77
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs322
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs6
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/ScaleMethod.cs24
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/NativeList.cs88
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs4
12 files changed, 377 insertions, 280 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index e1e602e7a..59d45029f 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -244,7 +244,9 @@ namespace HandBrake.Interop
{
this.previewCount = previewCount;
- HBFunctions.hb_scan(this.hbHandle, path, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000));
+ IntPtr pathPtr = InteropUtilities.CreateUtf8Ptr(path);
+ HBFunctions.hb_scan(this.hbHandle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000));
+ Marshal.FreeHGlobal(pathPtr);
this.scanPollTimer = new System.Timers.Timer();
this.scanPollTimer.Interval = ScanPollIntervalMs;
@@ -1038,7 +1040,17 @@ namespace HandBrake.Interop
{
if (i < nativeChapters.Count && i < job.CustomChapterNames.Count)
{
- IntPtr chapterNamePtr = InteropUtilities.CreateUtf8Ptr(job.CustomChapterNames[i]);
+ IntPtr chapterNamePtr;
+
+ if (string.IsNullOrWhiteSpace(job.CustomChapterNames[i]))
+ {
+ chapterNamePtr = InteropUtilities.CreateUtf8Ptr("Chapter " + (i + 1));
+ }
+ else
+ {
+ chapterNamePtr = InteropUtilities.CreateUtf8Ptr(job.CustomChapterNames[i]);
+ }
+
HBFunctions.hb_chapter_set_title__ptr(nativeChapters[i], chapterNamePtr);
Marshal.FreeHGlobal(chapterNamePtr);
}
@@ -1302,7 +1314,7 @@ namespace HandBrake.Interop
{
nativeJob.anamorphic.dar_width = profile.DisplayWidth;
nativeJob.anamorphic.dar_height = height;
- nativeJob.anamorphic.keep_display_aspect = profile.KeepDisplayAspect ? 1 : 0;
+ nativeJob.anamorphic.keep_display_aspect = 0;
}
}
else
@@ -1388,28 +1400,9 @@ namespace HandBrake.Interop
}
NativeList nativeAudioList = InteropUtilities.ConvertListBack<hb_audio_s>(audioList);
- nativeJob.list_audio = nativeAudioList.ListPtr;
+ nativeJob.list_audio = nativeAudioList.Ptr;
allocatedMemory.AddRange(nativeAudioList.AllocatedMemory);
- // Create a new empty list
- int totalSubtitles = 0;
- if (job.Subtitles != null)
- {
- if (job.Subtitles.SourceSubtitles != null)
- {
- totalSubtitles += job.Subtitles.SourceSubtitles.Count;
- }
-
- if (job.Subtitles.SrtSubtitles != null)
- {
- totalSubtitles += job.Subtitles.SrtSubtitles.Count;
- }
- }
-
- NativeList nativeSubtitleList = InteropUtilities.CreateNativeList(totalSubtitles + 2);
- nativeJob.list_subtitle = nativeSubtitleList.ListPtr;
- allocatedMemory.AddRange(nativeSubtitleList.AllocatedMemory);
-
if (job.Subtitles != null)
{
if (job.Subtitles.SourceSubtitles != null && job.Subtitles.SourceSubtitles.Count > 0)
@@ -1486,7 +1479,20 @@ namespace HandBrake.Interop
}
// Construct final filter list
- nativeJob.list_filter = this.ConvertFilterListToNative(filterList, allocatedMemory).ListPtr;
+ nativeJob.list_filter = this.ConvertFilterListToNative(filterList, allocatedMemory).Ptr;
+
+ if (profile.ScaleMethod == ScaleMethod.Bicubic)
+ {
+ HBFunctions.hb_get_opencl_env();
+ nativeJob.use_opencl = 1;
+ }
+ else
+ {
+ nativeJob.use_opencl = 0;
+ }
+
+ nativeJob.qsv.decode = profile.QsvDecode ? 1 : 0;
+ nativeJob.use_hwd = job.DxvaDecoding ? 1 : 0;
#pragma warning disable 612, 618
if (profile.OutputFormat == Container.Mp4)
@@ -1504,7 +1510,9 @@ namespace HandBrake.Interop
nativeJob.mux = HBFunctions.hb_container_get_from_name(profile.ContainerName);
}
- nativeJob.file = job.OutputPath;
+ 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;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
index fa97f477f..9dcbc8242 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj
@@ -138,7 +138,6 @@
<Compile Include="HbLib\hb_encoder_s.cs" />
<Compile Include="HbLib\hb_filter_ids.cs" />
<Compile Include="HbLib\hb_filter_object_s.cs" />
- <Compile Include="HbLib\hb_list_s.cs" />
<Compile Include="HbLib\hb_mixdown_s.cs" />
<Compile Include="HbLib\hb_rate_s.cs" />
<Compile Include="HbLib\hb_state_s.cs" />
@@ -177,6 +176,7 @@
<Compile Include="Model\Encoding\OutputExtension.cs" />
<Compile Include="Model\Encoding\Container.cs" />
<Compile Include="Model\Encoding\QsvPreset.cs" />
+ <Compile Include="Model\Encoding\ScaleMethod.cs" />
<Compile Include="Model\Encoding\VideoEncoder.cs" />
<Compile Include="Model\Encoding\VideoEncodeRateType.cs" />
<Compile Include="Model\Encoding\x264\x264Preset.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
index 6c3f70357..9fc20ede6 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs
@@ -79,7 +79,7 @@ namespace HandBrake.Interop.HbLib
///preview_count: int
///store_previews: int
[DllImport("hb.dll", EntryPoint = "hb_scan", CallingConvention = CallingConvention.Cdecl)]
- public static extern void hb_scan(IntPtr hbHandle, [In] [MarshalAs(UnmanagedType.LPStr)] string path, int title_index, int preview_count, int store_previews, ulong min_duration);
+ public static extern void hb_scan(IntPtr hbHandle, IntPtr path, int title_index, int preview_count, int store_previews, ulong min_duration);
[DllImport("hb.dll", EntryPoint = "hb_scan_stop", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_scan_stop(IntPtr hbHandle);
@@ -195,6 +195,35 @@ namespace HandBrake.Interop.HbLib
[DllImport("hb.dll", EntryPoint = "hb_global_close", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_global_close();
+ //hb_list_t * hb_list_init();
+ [DllImport("hb.dll", EntryPoint = "hb_list_init", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_list_init();
+
+ //int hb_list_count( const hb_list_t * );
+ [DllImport("hb.dll", EntryPoint = "hb_list_count", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_list_count(IntPtr listPtr);
+
+ //void hb_list_add( hb_list_t *, void * );
+ [DllImport("hb.dll", EntryPoint = "hb_list_add", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_add(IntPtr listPtr, IntPtr item);
+
+ //void hb_list_insert( hb_list_t * l, int pos, void * p );
+ [DllImport("hb.dll", EntryPoint = "hb_list_insert", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_insert(IntPtr listPtr, int pos, IntPtr item);
+
+ //void hb_list_rem( hb_list_t *, void * );
+ [DllImport("hb.dll", EntryPoint = "hb_list_rem", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_rem(IntPtr listPtr, IntPtr item);
+
+ //void * hb_list_item( const hb_list_t *, int );
+ [DllImport("hb.dll", EntryPoint = "hb_list_item", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_list_item(IntPtr listPtr, int itemIndex);
+
+ //void hb_list_close( hb_list_t ** );
+ [DllImport("hb.dll", EntryPoint = "hb_list_close", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_list_close(IntPtr listPtrPtr);
+
+
[DllImport("hb.dll", EntryPoint = "hb_subtitle_add", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_subtitle_add(ref hb_job_s job, ref hb_subtitle_config_s subtitleConfig, int track);
@@ -203,6 +232,7 @@ namespace HandBrake.Interop.HbLib
+
//int hb_video_framerate_get_from_name(const char *name);
//const char* hb_video_framerate_get_name(int framerate);
//const char* hb_video_framerate_sanitize_name(const char *name);
@@ -404,6 +434,9 @@ namespace HandBrake.Interop.HbLib
int height);
+ [DllImport("hb.dll", EntryPoint = "hb_get_opencl_env", CallingConvention = CallingConvention.Cdecl)]
+ public static extern int hb_get_opencl_env();
+
[DllImport("hb.dll", EntryPoint = "hb_qsv_available", CallingConvention = CallingConvention.Cdecl)]
public static extern int hb_qsv_available();
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs
index 7d0a76c68..78433c06f 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_job_s.cs
@@ -129,8 +129,8 @@ namespace HandBrake.Interop.HbLib
public int mux;
/// char*
- [MarshalAs(UnmanagedType.LPStr)]
- public string file;
+ /// UTF-8 encoded
+ public IntPtr file;
/// int
public int largeFileSize;
@@ -169,6 +169,14 @@ namespace HandBrake.Interop.HbLib
/// uint32_t->unsigned int
public uint frames_to_skip;
+ public int use_opencl;
+
+ public int use_hwd;
+
+ public int use_decomb;
+
+ public int use_detelecine;
+
public qsv_s qsv;
// Padding for the part of the struct we don't care about marshaling.
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_list_s.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_list_s.cs
deleted file mode 100644
index c7eb2d4ea..000000000
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_list_s.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="hb_list_s.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>
-// <auto-generated>Disable Stylecop Warnings for this file</auto-generated>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop.HbLib
-{
- using System;
- using System.Runtime.InteropServices;
-
- [StructLayout(LayoutKind.Sequential)]
- public struct hb_list_s
- {
- /// void**
- public IntPtr items;
-
- /// int
- public int items_alloc;
-
- /// int
- public int items_count;
- }
-}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs
index c20107aa5..d9a845081 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_title_s.cs
@@ -158,6 +158,10 @@ namespace HandBrake.Interop.HbLib
/// uint32_t->unsigned int
public uint flags;
+
+ public int opencl_support;
+
+ public int hwd_support;
}
public enum hb_title_type_anon
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
index 86a42295c..0dac9be4a 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
@@ -84,11 +84,11 @@ namespace HandBrake.Interop
public static List<T> ToList<T>(this IntPtr listPtr)
{
List<T> returnList = new List<T>();
- hb_list_s itemList = ReadStructure<hb_list_s>(listPtr);
+ NativeList nativeList = new NativeList(listPtr);
- for (int i = 0; i < itemList.items_count; i++)
+ for (int i = 0; i < nativeList.Count; i++)
{
- IntPtr itemPtr = Marshal.ReadIntPtr(itemList.items, i * Marshal.SizeOf(typeof(IntPtr)));
+ IntPtr itemPtr = nativeList[i];
returnList.Add(ReadStructure<T>(itemPtr));
}
@@ -103,11 +103,11 @@ namespace HandBrake.Interop
public static List<IntPtr> ToIntPtrList(this IntPtr listPtr)
{
var returnList = new List<IntPtr>();
- hb_list_s itemList = ReadStructure<hb_list_s>(listPtr);
+ NativeList nativeList = new NativeList(listPtr);
- for (int i = 0; i < itemList.items_count; i++)
+ for (int i = 0; i < nativeList.Count; i++)
{
- IntPtr itemPtr = Marshal.ReadIntPtr(itemList.items, i * Marshal.SizeOf(typeof(IntPtr)));
+ IntPtr itemPtr = nativeList[i];
returnList.Add(itemPtr);
}
@@ -138,55 +138,19 @@ namespace HandBrake.Interop
}
/// <summary>
- /// Creats a new, empty native HandBrake list.
- /// </summary>
- /// <param name="capacity">The capacity of the new list.</param>
- /// <returns>The new native list.</returns>
- public static NativeList CreateNativeList(int capacity)
- {
- NativeList returnList = new NativeList();
- int intSize = Marshal.SizeOf(typeof(IntPtr));
-
- IntPtr nativeListInternal = Marshal.AllocHGlobal(capacity * intSize);
- returnList.AllocatedMemory.Add(nativeListInternal);
-
- hb_list_s nativeListStruct = new hb_list_s { items = nativeListInternal, items_alloc = capacity, items_count = 0 };
-
- IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));
- Marshal.StructureToPtr(nativeListStruct, nativeListStructPtr, false);
-
- returnList.ListPtr = nativeListStructPtr;
- return returnList;
- }
-
- /// <summary>
/// Creates a native HandBrake list from the given managed list of pointers.
/// </summary>
/// <param name="list">The managed list to convert.</param>
/// <returns>The converted native list.</returns>
public static NativeList CreateIntPtrList(List<IntPtr> list)
{
- NativeList returnList = new NativeList();
- int intSize = Marshal.SizeOf(typeof(IntPtr));
+ NativeList returnList = NativeList.CreateList();
- IntPtr nativeListInternal = Marshal.AllocHGlobal(list.Count * intSize);
- returnList.AllocatedMemory.Add(nativeListInternal);
- for (int i = 0; i < list.Count; i++)
+ foreach (IntPtr ptr in list)
{
- Marshal.WriteIntPtr(nativeListInternal, i * intSize, list[i]);
+ returnList.Add(ptr);
}
- hb_list_s nativeListStruct = new hb_list_s
- {
- items = nativeListInternal,
- items_alloc = list.Count,
- items_count = list.Count
- };
-
- IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));
- Marshal.StructureToPtr(nativeListStruct, nativeListStructPtr, false);
-
- returnList.ListPtr = nativeListStructPtr;
return returnList;
}
@@ -198,31 +162,16 @@ namespace HandBrake.Interop
/// <returns>The converted native list.</returns>
public static NativeList ConvertListBack<T>(List<T> list)
{
- NativeList returnList = new NativeList();
- int intSize = Marshal.SizeOf(typeof(IntPtr));
-
- IntPtr nativeListInternal = Marshal.AllocHGlobal(list.Count * intSize);
- returnList.AllocatedMemory.Add(nativeListInternal);
- for (int i = 0; i < list.Count; i++)
+ NativeList returnList = NativeList.CreateList();
+ foreach (T item in list)
{
IntPtr itemPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(T)));
returnList.AllocatedMemory.Add(itemPtr);
- Marshal.StructureToPtr(list[i], itemPtr, false);
+ Marshal.StructureToPtr(item, itemPtr, false);
- Marshal.WriteIntPtr(nativeListInternal, i * intSize, itemPtr);
+ returnList.Add(itemPtr);
}
- hb_list_s nativeListStruct = new hb_list_s
- {
- items = nativeListInternal,
- items_alloc = list.Count,
- items_count = list.Count
- };
-
- IntPtr nativeListStructPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(hb_list_s)));
- Marshal.StructureToPtr(nativeListStruct, nativeListStructPtr, false);
-
- returnList.ListPtr = nativeListStructPtr;
return returnList;
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs
index 9b6ed825e..1f857a94f 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/EncodeJob.cs
@@ -9,162 +9,168 @@
namespace HandBrake.Interop.Model
{
- using System;
- using System.Collections.Generic;
- using System.Xml.Serialization;
-
- using HandBrake.Interop.Model.Encoding;
-
- /// <summary>
- /// The encode job.
- /// </summary>
- public class EncodeJob
- {
- #region Properties
-
- /// <summary>
- /// Gets or sets the angle to encode. 0 for default, 1+ for specified angle.
- /// </summary>
- public int Angle { get; set; }
-
- /// <summary>
- /// Gets or sets the chapter end.
- /// </summary>
- public int ChapterEnd { get; set; }
-
- /// <summary>
- /// Gets or sets the chapter start.
- /// </summary>
- public int ChapterStart { get; set; }
-
- /// <summary>
- /// Gets or sets the list of chosen audio tracks (1-based)
- /// </summary>
- public List<int> ChosenAudioTracks { get; set; }
-
- /// <summary>
- /// Gets or sets the custom chapter names.
- /// </summary>
- public List<string> CustomChapterNames { get; set; }
-
- /// <summary>
- /// Gets or sets the encoding profile.
- /// </summary>
- public EncodingProfile EncodingProfile { get; set; }
-
- /// <summary>
- /// Gets or sets the frames end.
- /// </summary>
- public int FramesEnd { get; set; }
-
- /// <summary>
- /// Gets or sets the frames start.
- /// </summary>
- public int FramesStart { get; set; }
-
- /// <summary>
- /// Gets or sets the length. The length of video to encode.
- /// </summary>
- [XmlIgnore]
- public TimeSpan Length { get; set; }
-
- /// <summary>
- /// Gets or sets the output path.
- /// </summary>
- public string OutputPath { get; set; }
-
- /// <summary>
- /// Gets or sets the range type.
- /// </summary>
- public VideoRangeType RangeType { get; set; }
-
- /// <summary>
- /// Gets or sets the seconds end.
- /// </summary>
- public double SecondsEnd { get; set; }
-
- /// <summary>
- /// Gets or sets the seconds start.
- /// </summary>
- public double SecondsStart { get; set; }
-
- /// <summary>
- /// Gets or sets the source path.
- /// </summary>
- public string SourcePath { get; set; }
-
- /// <summary>
- /// Gets or sets the source type.
- /// </summary>
- public SourceType SourceType { get; set; }
-
- /// <summary>
- /// Gets or sets the subtitles.
- /// </summary>
- public Subtitles Subtitles { get; set; }
-
- /// <summary>
- /// Gets or sets the 1-based index of the title to encode.
- /// </summary>
- public int Title { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether use default chapter names.
- /// </summary>
- public bool UseDefaultChapterNames { get; set; }
-
- /// <summary>
- /// Gets or sets the xml length.
- /// </summary>
- [XmlElement("Length")]
- public string XmlLength
- {
- get
- {
- return this.Length.ToString();
- }
- set
- {
- this.Length = TimeSpan.Parse(value);
- }
- }
-
- #endregion
-
- #region Public Methods
-
- /// <summary>
- /// The clone.
- /// </summary>
- /// <returns>
- /// The <see cref="EncodeJob"/>.
- /// </returns>
- public EncodeJob Clone()
- {
- var clone = new EncodeJob
- {
- SourceType = this.SourceType,
- SourcePath = this.SourcePath,
- Title = this.Title,
- Angle = this.Angle,
- RangeType = this.RangeType,
- ChapterStart = this.ChapterStart,
- ChapterEnd = this.ChapterEnd,
- SecondsStart = this.SecondsStart,
- SecondsEnd = this.SecondsEnd,
- FramesStart = this.FramesStart,
- FramesEnd = this.FramesEnd,
- ChosenAudioTracks = new List<int>(this.ChosenAudioTracks),
- Subtitles = this.Subtitles,
- UseDefaultChapterNames = this.UseDefaultChapterNames,
- OutputPath = this.OutputPath,
- EncodingProfile = this.EncodingProfile,
- Length = this.Length
- };
-
- return clone;
- }
-
- #endregion
- }
+ using System;
+ using System.Collections.Generic;
+ using System.Xml.Serialization;
+
+ using HandBrake.Interop.Model.Encoding;
+
+ /// <summary>
+ /// The encode job.
+ /// </summary>
+ public class EncodeJob
+ {
+ #region Properties
+
+ /// <summary>
+ /// Gets or sets the angle to encode. 0 for default, 1+ for specified angle.
+ /// </summary>
+ public int Angle { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter end.
+ /// </summary>
+ public int ChapterEnd { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter start.
+ /// </summary>
+ public int ChapterStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the list of chosen audio tracks (1-based)
+ /// </summary>
+ public List<int> ChosenAudioTracks { get; set; }
+
+ /// <summary>
+ /// Gets or sets the custom chapter names.
+ /// </summary>
+ public List<string> CustomChapterNames { get; set; }
+
+ /// <summary>
+ /// Gets or sets the encoding profile.
+ /// </summary>
+ public EncodingProfile EncodingProfile { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frames end.
+ /// </summary>
+ public int FramesEnd { get; set; }
+
+ /// <summary>
+ /// Gets or sets the frames start.
+ /// </summary>
+ public int FramesStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the length. The length of video to encode.
+ /// </summary>
+ [XmlIgnore]
+ public TimeSpan Length { get; set; }
+
+ /// <summary>
+ /// Gets or sets the output path.
+ /// </summary>
+ public string OutputPath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the range type.
+ /// </summary>
+ public VideoRangeType RangeType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds end.
+ /// </summary>
+ public double SecondsEnd { get; set; }
+
+ /// <summary>
+ /// Gets or sets the seconds start.
+ /// </summary>
+ public double SecondsStart { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source path.
+ /// </summary>
+ public string SourcePath { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source type.
+ /// </summary>
+ public SourceType SourceType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the subtitles.
+ /// </summary>
+ public Subtitles Subtitles { get; set; }
+
+ /// <summary>
+ /// Gets or sets the 1-based index of the title to encode.
+ /// </summary>
+ public int Title { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether use default chapter names.
+ /// </summary>
+ public bool UseDefaultChapterNames { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to use DXVA hardware decoding.
+ /// </summary>
+ public bool DxvaDecoding { get; set; }
+
+ /// <summary>
+ /// Gets or sets the xml length.
+ /// </summary>
+ [XmlElement("Length")]
+ public string XmlLength
+ {
+ get
+ {
+ return this.Length.ToString();
+ }
+ set
+ {
+ this.Length = TimeSpan.Parse(value);
+ }
+ }
+
+ #endregion
+
+ #region Public Methods
+
+ /// <summary>
+ /// The clone.
+ /// </summary>
+ /// <returns>
+ /// The <see cref="EncodeJob"/>.
+ /// </returns>
+ public EncodeJob Clone()
+ {
+ var clone = new EncodeJob
+ {
+ SourceType = this.SourceType,
+ SourcePath = this.SourcePath,
+ Title = this.Title,
+ Angle = this.Angle,
+ RangeType = this.RangeType,
+ ChapterStart = this.ChapterStart,
+ ChapterEnd = this.ChapterEnd,
+ SecondsStart = this.SecondsStart,
+ SecondsEnd = this.SecondsEnd,
+ FramesStart = this.FramesStart,
+ FramesEnd = this.FramesEnd,
+ ChosenAudioTracks = new List<int>(this.ChosenAudioTracks),
+ Subtitles = this.Subtitles,
+ UseDefaultChapterNames = this.UseDefaultChapterNames,
+ DxvaDecoding = this.DxvaDecoding,
+ OutputPath = this.OutputPath,
+ EncodingProfile = this.EncodingProfile,
+ Length = this.Length
+ };
+
+ return clone;
+ }
+
+ #endregion
+ }
} \ No newline at end of file
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
index 41751a946..81a1b8afd 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs
@@ -35,6 +35,7 @@ namespace HandBrake.Interop.Model.Encoding
public int Height { get; set; }
public int MaxWidth { get; set; }
public int MaxHeight { get; set; }
+ public ScaleMethod ScaleMethod { get; set; }
public CroppingType CroppingType { get; set; }
public Cropping Cropping { get; set; }
public Anamorphic Anamorphic { get; set; }
@@ -62,6 +63,8 @@ namespace HandBrake.Interop.Model.Encoding
public string X264Preset { get; set; }
public List<string> X264Tunes { get; set; }
+ public string QsvPreset { get; set; }
+ public bool QsvDecode { get; set; }
public string H264Level { get; set; }
public VideoEncodeRateType VideoEncodeRateType { get; set; }
public double Quality { get; set; }
@@ -93,6 +96,7 @@ namespace HandBrake.Interop.Model.Encoding
Height = this.Height,
MaxWidth = this.MaxWidth,
MaxHeight = this.MaxHeight,
+ ScaleMethod = this.ScaleMethod,
CroppingType = this.CroppingType,
Cropping = this.Cropping.Clone(),
Anamorphic = this.Anamorphic,
@@ -119,6 +123,8 @@ namespace HandBrake.Interop.Model.Encoding
X264Profile = this.X264Profile,
X264Preset = this.X264Preset,
X264Tunes = this.X264Tunes,
+ QsvPreset = this.QsvPreset,
+ QsvDecode = this.QsvDecode,
H264Level = this.H264Level,
VideoEncodeRateType = this.VideoEncodeRateType,
Quality = this.Quality,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/ScaleMethod.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/ScaleMethod.cs
new file mode 100644
index 000000000..31c624893
--- /dev/null
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/ScaleMethod.cs
@@ -0,0 +1,24 @@
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Deinterlace.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>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model.Encoding
+{
+ /// <summary>
+ /// Enumeration of rescaling algorithms.
+ /// </summary>
+ public enum ScaleMethod
+ {
+ /// <summary>
+ /// Standard software scaling. Highest quality.
+ /// </summary>
+ Lanczos = 0,
+
+ /// <summary>
+ /// OpenCL-assisted bicubic scaling.
+ /// </summary>
+ Bicubic = 1
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/NativeList.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/NativeList.cs
index adc74c456..1e24f9ce4 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/NativeList.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/NativeList.cs
@@ -11,13 +11,25 @@ namespace HandBrake.Interop
{
using System;
using System.Collections.Generic;
+ using System.Runtime.InteropServices;
+
+ using HandBrake.Interop.HbLib;
/// <summary>
/// Represents a HandBrake style native list.
/// </summary>
- public class NativeList
+ public class NativeList : IDisposable
{
/// <summary>
+ /// Initializes a new instance of the NativeList class.
+ /// </summary>
+ /// <param name="listPtr">The pointer to use for the list.</param>
+ public NativeList(IntPtr listPtr)
+ {
+ this.Ptr = listPtr;
+ }
+
+ /// <summary>
/// The list of native memory locations allocated for this list.
/// </summary>
private List<IntPtr> allocatedMemory = new List<IntPtr>();
@@ -25,7 +37,18 @@ namespace HandBrake.Interop
/// <summary>
/// Gets or sets the pointer to the native list.
/// </summary>
- public IntPtr ListPtr { get; set; }
+ public IntPtr Ptr { get; private set; }
+
+ /// <summary>
+ /// Gets the number of items in the list.
+ /// </summary>
+ public int Count
+ {
+ get
+ {
+ return HBFunctions.hb_list_count(this.Ptr);
+ }
+ }
/// <summary>
/// Gets the list of native memory locations allocated for this list.
@@ -37,5 +60,66 @@ namespace HandBrake.Interop
return allocatedMemory;
}
}
+
+ /// <summary>
+ /// Adds an item to the end of the list.
+ /// </summary>
+ /// <param name="item">The item to add.</param>
+ public void Add(IntPtr item)
+ {
+ HBFunctions.hb_list_add(this.Ptr, item);
+ }
+
+ /// <summary>
+ /// Inserts an item into the list.
+ /// </summary>
+ /// <param name="position">The index to insert the item at.</param>
+ /// <param name="item">The item to insert.</param>
+ public void Insert(int position, IntPtr item)
+ {
+ HBFunctions.hb_list_insert(this.Ptr, position, item);
+ }
+
+ /// <summary>
+ /// Removes an item from the list.
+ /// </summary>
+ /// <param name="item">The item to remove.</param>
+ public void Remove(IntPtr item)
+ {
+ HBFunctions.hb_list_rem(this.Ptr, item);
+ }
+
+ /// <summary>
+ /// Gets an item out of the list.
+ /// </summary>
+ /// <param name="i">Index in the list.</param>
+ /// <returns>The item at that index in the list.</returns>
+ public IntPtr this[int i]
+ {
+ get
+ {
+ return HBFunctions.hb_list_item(this.Ptr, i);
+ }
+ }
+
+ /// <summary>
+ /// Disposes resources associated with this object.
+ /// </summary>
+ public void Dispose()
+ {
+ IntPtr listPtrPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr)));
+ Marshal.WriteIntPtr(listPtrPtr, this.Ptr);
+ HBFunctions.hb_list_close(listPtrPtr);
+ Marshal.FreeHGlobal(listPtrPtr);
+ }
+
+ /// <summary>
+ /// Creates a new list in unmanaged memory.
+ /// </summary>
+ /// <returns>The created list.</returns>
+ public static NativeList CreateList()
+ {
+ return new NativeList(HBFunctions.hb_list_init());
+ }
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs
index 571a69b1a..1914e758f 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.49.0.0")]
-[assembly: AssemblyFileVersion("1.49.0.0")]
+[assembly: AssemblyVersion("1.50.0.0")]
+[assembly: AssemblyFileVersion("1.50.0.0")]