Пример #1
0
		public void Invoke (ClosureInvokedArgs args)
		{
			if (Invoked == null)
				return;
			Invoked (this, args);
		}
Пример #2
0
		static void MarshalCallback (IntPtr raw_closure, IntPtr return_val, uint n_param_vals, IntPtr param_values, IntPtr invocation_hint, IntPtr marshal_data)
		{
			string message = String.Empty;

			try {
				SignalClosure closure = closures [raw_closure] as SignalClosure;
				message = "Marshaling " + closure.name + " signal";
				Value objval = (Value) Marshal.PtrToStructure (param_values, typeof (Value));
				Gst.GLib.Object __obj = objval.Val as Gst.GLib.Object;
				if (__obj == null)
					return;

				if (closure.args_type == typeof (EventArgs)) {
					closure.Invoke (new ClosureInvokedArgs (__obj, EventArgs.Empty));
					return;
				}

				SignalArgs args = Activator.CreateInstance (closure.args_type, new object [0]) as SignalArgs;
				args.Args = new object [n_param_vals - 1];
				Gst.GLib.Value[] vals = new Gst.GLib.Value [n_param_vals - 1];
				for (int i = 1; i < n_param_vals; i++) {
					IntPtr ptr = new IntPtr (param_values.ToInt64 () + i * Marshal.SizeOf (typeof (Value)));
					vals [i - 1] = (Value) Marshal.PtrToStructure (ptr, typeof (Value));
					args.Args [i - 1] = vals [i - 1].Val;
				}
				ClosureInvokedArgs ci_args = new ClosureInvokedArgs (__obj, args);
				closure.Invoke (ci_args);
				for (int i = 1; i < n_param_vals; i++) {
					vals [i - 1].Update (args.Args [i - 1]);
					IntPtr ptr = new IntPtr (param_values.ToInt64 () + i * Marshal.SizeOf (typeof (Value)));
					Marshal.StructureToPtr (vals [i - 1], ptr, false);
				}
				if (return_val == IntPtr.Zero || args.RetVal == null)
					return;

				Value ret = (Value) Marshal.PtrToStructure (return_val, typeof (Value));
				ret.Val = args.RetVal;
				Marshal.StructureToPtr (ret, return_val, false);
			} catch (Exception e) {
				Console.WriteLine (message);
				ExceptionManager.RaiseUnhandledException (e, false);
			}
		}
Пример #3
0
		void ClosureInvokedCB (object o, ClosureInvokedArgs args)
		{
			Delegate handler;
			if (o == before_closure)
				handler = args.Target.BeforeSignals [name] as Delegate;
			else
				handler = args.Target.AfterSignals [name] as Delegate;

			if (handler != null)
				handler.DynamicInvoke (new object[] {args.Target, args.Args});
		}