Finishing c# marshmalling.

This commit is contained in:
Zoe Roux
2019-09-16 01:13:50 +02:00
parent 1ced45a763
commit 5459e3cde6
5 changed files with 16 additions and 17 deletions
+2 -2
View File
@@ -12,13 +12,13 @@ namespace Kyoo.InternalAPI.TranscoderLink
public extern static int Init();
[DllImport(TranscoderPath, CallingConvention = CallingConvention.Cdecl)]
private extern static int ExtractSubtitles(string path, string outPath, out IntPtr streams);
private extern static IntPtr ExtractSubtitles(string path, string outPath, out int streams);
public static void ExtractSubtitles(string path, string outPath, out Stream[] streams)
{
int size = Marshal.SizeOf<Stream>();
int length = ExtractSubtitles(path, outPath, out IntPtr streamsPtr); //The streamsPtr is always nullptr
IntPtr streamsPtr = ExtractSubtitles(path, outPath, out int length);
if (length > 0)
{
streams = new Stream[length];