Fix indention and use new Gst.Value stuff for dynamic signals

This commit is contained in:
Sebastian Dröge 2009-04-11 17:57:11 +02:00
parent d45b43983e
commit e03a50aa84
3 changed files with 102 additions and 106 deletions

View file

@ -136,17 +136,12 @@ namespace Gst {
static void OnMarshal (IntPtr closure, ref GLib.Value retval, uint argc, IntPtr argsPtr,
IntPtr ihint, IntPtr data) {
object [] args = new object[argc - 1];
object o = ( (GLib.Value) Marshal.PtrToStructure (argsPtr, typeof (GLib.Value))).Val;
object o = Gst.Value.GetValue ( (GLib.Value) Marshal.PtrToStructure (argsPtr, typeof (GLib.Value)));
for (int i = 1; i < argc; i++) {
IntPtr struct_ptr = (IntPtr) ( (long) argsPtr + (i * gvalue_struct_size));
Type detectedType = GLib.GType.LookupType (Marshal.ReadIntPtr (struct_ptr));
if (detectedType.IsSubclassOf (typeof (Opaque))) {
args[i - 1] = (Opaque) Opaque.GetOpaque (g_value_peek_pointer (struct_ptr), detectedType, false);
} else {
GLib.Value argument = (GLib.Value) Marshal.PtrToStructure (struct_ptr, typeof (GLib.Value));
args[i - 1] = argument.Val;
}
args[i - 1] = Gst.Value.GetValue (argument);
}
if (data == IntPtr.Zero) {
@ -264,7 +259,7 @@ namespace Gst {
query = (SignalQuery) SignalEmitInfo[key];
GLib.Value[] signal_parameters = new GLib.Value[query.n_params + 1];
signal_parameters[0] = new GLib.Value (o);
signal_parameters[0] = Gst.Value.CreateValue (o);
if (parameters.Length != query.n_params)
throw new ApplicationException (String.Format ("Invalid number of parameters: expected {0}, got {1}", query.n_params, parameters.Length));
@ -276,7 +271,7 @@ namespace Gst {
if (expected_type != given_type && ! given_type.IsSubclassOf (given_type))
throw new ApplicationException (String.Format ("Invalid parameter type: expected {0}, got {1}", expected_type, given_type));
signal_parameters[i + 1] = new GLib.Value (parameters[i]);
signal_parameters[i + 1] = Gst.Value.CreateValue (parameters[i]);
}
GLib.Value return_value = new GLib.Value ();
@ -288,7 +283,7 @@ namespace Gst {
g_signal_emitv (signal_parameters, query.signal_id, signal_detail_quark, ref return_value);
return (query.return_type != GType.Invalid && query.return_type != GType.None) ? return_value.Val : null;
return (query.return_type != GType.Invalid && query.return_type != GType.None) ? Gst.Value.GetValue (return_value) : null;
}
[DllImport ("gstreamersharpglue-0.10") ]

View file

@ -373,7 +373,8 @@ namespace Gst {
return new char[] { (char) ( (fourcc.Val >> 24) & 0xff),
(char) ( (fourcc.Val >> 16) & 0xff),
(char) ( (fourcc.Val >> 8) & 0xff),
(char) ((fourcc.Val >> 0) & 0xff)};
(char) ( (fourcc.Val >> 0) & 0xff)
};
}
public static explicit operator string (Fourcc fourcc) {