public static Gst.PbUtils.InstallPluginsReturn InstallPluginsAsync(string[] details, Gst.PbUtils.InstallPluginsContext ctx, Gst.PbUtils.InstallPluginsResultFunc func) { int cnt_details = details == null ? 0 : details.Length; IntPtr[] native_details = new IntPtr [cnt_details + 1]; for (int i = 0; i < cnt_details; i++) { native_details [i] = GLib.Marshaller.StringToPtrGStrdup(details[i]); } native_details [cnt_details] = IntPtr.Zero; IntPtr native_ctx = GLib.Marshaller.StructureToPtrAlloc(ctx); Gst.PbUtilsSharp.InstallPluginsResultFuncWrapper func_wrapper = new Gst.PbUtilsSharp.InstallPluginsResultFuncWrapper(func); func_wrapper.PersistUntilCalled(); int raw_ret = gst_install_plugins_async(native_details, native_ctx, func_wrapper.NativeDelegate, IntPtr.Zero); Gst.PbUtils.InstallPluginsReturn ret = (Gst.PbUtils.InstallPluginsReturn)raw_ret; for (int i = 0; i < native_details.Length - 1; i++) { details [i] = GLib.Marshaller.Utf8PtrToString(native_details[i]); GLib.Marshaller.Free(native_details[i]); } Marshal.FreeHGlobal(native_ctx); return(ret); }
public static Gst.PbUtils.InstallPluginsReturn InstallPluginsSync(string[] details, Gst.PbUtils.InstallPluginsContext ctx) { int cnt_details = details == null ? 0 : details.Length; IntPtr[] native_details = new IntPtr [cnt_details + 1]; for (int i = 0; i < cnt_details; i++) { native_details [i] = GLib.Marshaller.StringToPtrGStrdup(details[i]); } native_details [cnt_details] = IntPtr.Zero; IntPtr native_ctx = GLib.Marshaller.StructureToPtrAlloc(ctx); int raw_ret = gst_install_plugins_sync(native_details, native_ctx); Gst.PbUtils.InstallPluginsReturn ret = (Gst.PbUtils.InstallPluginsReturn)raw_ret; for (int i = 0; i < native_details.Length - 1; i++) { details [i] = GLib.Marshaller.Utf8PtrToString(native_details[i]); GLib.Marshaller.Free(native_details[i]); } Marshal.FreeHGlobal(native_ctx); return(ret); }
static void ReadNative(IntPtr native, ref Gst.PbUtils.InstallPluginsContext target) { target = New(native); }