summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
diff options
context:
space:
mode:
authorrandomengy <[email protected]>2012-11-22 18:36:29 +0000
committerrandomengy <[email protected]>2012-11-22 18:36:29 +0000
commita020ee671a4baa3cfc03aa408776707a79e184b9 (patch)
tree3014304229d4880a0ed75e44f10ff0ef1455c9a0 /win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
parent29b2060a937a748c76302d9b687a46bca8634ccc (diff)
Interop: Updated to work with hb_chapter_set_title for chapter markers.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5078 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs')
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
index db72feac5..de73dd607 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs
@@ -37,7 +37,7 @@ namespace HandBrake.Interop
/// <typeparam name="T">The type of structure in the list.</typeparam>
/// <param name="listPtr">The pointer to the native list.</param>
/// <returns>The converted managed list.</returns>
- public static List<T> ConvertList<T>(IntPtr listPtr)
+ public static List<T> ToList<T>(this IntPtr listPtr)
{
List<T> returnList = new List<T>();
hb_list_s itemList = ReadStructure<hb_list_s>(listPtr);
@@ -52,6 +52,25 @@ namespace HandBrake.Interop
}
/// <summary>
+ /// Converts the HB list to a managed list of pointers.
+ /// </summary>
+ /// <param name="listPtr">The list to convert.</param>
+ /// <returns>The managed list of pointers.</returns>
+ public static List<IntPtr> ToIntPtrList(this IntPtr listPtr)
+ {
+ var returnList = new List<IntPtr>();
+ hb_list_s itemList = ReadStructure<hb_list_s>(listPtr);
+
+ for (int i = 0; i < itemList.items_count; i++)
+ {
+ IntPtr itemPtr = Marshal.ReadIntPtr(itemList.items, i * Marshal.SizeOf(typeof(IntPtr)));
+ returnList.Add(itemPtr);
+ }
+
+ return returnList;
+ }
+
+ /// <summary>
/// Converts the given native array to a managed collection.
/// </summary>
/// <typeparam name="T">The type of item in the list.</typeparam>