private static void FullInit(string progname, ref string [] args, bool check) { string [] progargs = new string[args.Length + 1]; progargs[0] = progname; args.CopyTo(progargs, 1); GLib.Argv argv = new GLib.Argv(progargs); IntPtr argv_ptr = argv.Handle; int argc = progargs.Length; if(check) { IntPtr error_ptr; bool result = gst_init_check(ref argc, ref argv_ptr, out error_ptr); if(error_ptr != IntPtr.Zero) { throw new ApplicationException("gst_init_check set error"); } else if(!result) { throw new ApplicationException("gst_init_check failed, error not set"); } } else { gst_init(ref argc, ref argv_ptr); } if(argv_ptr != argv.Handle) { string init_call = check ? "gst_init_check" : "gst_init"; throw new ApplicationException(init_call + " returned a new argv handle"); } if(argc <= 1) { args = new string[0]; } else { progargs = argv.GetArgs(argc); args = new string[argc - 1]; Array.Copy(progargs, 1, args, 0, argc - 1); } }
private static void FullInit(string progname, ref string [] args, bool check) { string [] progargs = new string[args.Length + 1]; progargs[0] = progname; args.CopyTo (progargs, 1); GLib.Argv argv = new GLib.Argv (progargs); IntPtr argv_ptr = argv.Handle; int argc = progargs.Length; if (check) { IntPtr error_ptr; bool result = gst_init_check (ref argc, ref argv_ptr, out error_ptr); if (error_ptr != IntPtr.Zero) { throw new GLib.GException (error_ptr); } else if (!result) { throw new ApplicationException ("gst_init_check() failed: Reason unknown"); } } else { gst_init (ref argc, ref argv_ptr); } if (argv_ptr != argv.Handle) { string init_call = check ? "gst_init_check()" : "gst_init()"; throw new ApplicationException (init_call + " returned a new argv handle"); } gst_controller_init (ref argc, ref argv_ptr); gst_pb_utils_init (); if (argc <= 1) { args = new string[0]; } else { progargs = argv.GetArgs (argc); args = new string[argc - 1]; System.Array.Copy (progargs, 1, args, 0, argc - 1); } RegisterManagedTypes (); }