diff --git a/ExtLibs/Utilities/GStreamer.cs b/ExtLibs/Utilities/GStreamer.cs index 1dc887eec4..cbae46288e 100644 --- a/ExtLibs/Utilities/GStreamer.cs +++ b/ExtLibs/Utilities/GStreamer.cs @@ -53,20 +53,37 @@ public static BackendEnum Backend { get { - if (Environment.OSVersion.Platform == PlatformID.Win32NT) + if (Environment.OSVersion.Platform == PlatformID.Win32NT) return BackendEnum.Windows; - if (Environment.OSVersion.Platform == PlatformID.Unix) + if (Environment.OSVersion.Platform == PlatformID.Unix) { var doc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (doc.StartsWith("/data/user/")) return BackendEnum.Android; - return BackendEnum.Linux; + return BackendEnum.Linux; } return BackendEnum.Windows; } } + public static void gst_init(IntPtr argc, IntPtr argv) + { + switch (Backend) + { + default: + case BackendEnum.Windows: + WinNativeMethods.gst_init(argc, argv); + break; + case BackendEnum.Linux: + LinuxNativeMethods.gst_init(argc, argv); + break; + case BackendEnum.Android: + AndroidNativeMethods.gst_init(argc, argv); + break; + } + } + public static void gst_init(ref int argc, string[] argv) { switch (Backend) @@ -918,7 +935,7 @@ public static class WinNativeMethods [DllImport(lib, CallingConvention = CallingConvention.Cdecl)] public static extern void gst_init(IntPtr argc, IntPtr argv); - [DllImport(lib, CallingConvention = CallingConvention.Cdecl)] + [DllImport(lib, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)] public static extern void gst_init(ref int argc, string[] argv); [DllImport(lib, CallingConvention = CallingConvention.Cdecl)] @@ -1244,17 +1261,15 @@ public static Thread StartA(string stringpipeline) static void ThreadStart(object datao) { string stringpipeline = (string)datao; - int argc = 1; - string[] argv = new string[] { "-vvv" }; Environment.SetEnvironmentVariable("GST_DEBUG", "*:4"); try { - + //https://github.com/GStreamer/gstreamer/blob/master/tools/gst-launch.c#L1125 - NativeMethods.gst_init(ref argc, argv); + NativeMethods.gst_init(IntPtr.Zero, IntPtr.Zero); } catch (DllNotFoundException ex) {