1 // This file was generated by the Gtk# code generator.
2 // Any changes made will be lost if regenerated.
7 using System.Collections;
8 using System.Collections.Generic;
9 using System.Runtime.InteropServices;
11 #region Autogenerated code
12 [StructLayout(LayoutKind.Sequential)]
13 public partial struct NetTimePacket : IEquatable<NetTimePacket> {
15 public ulong LocalTime;
16 public ulong RemoteTime;
18 public static Gst.Net.NetTimePacket Zero = new Gst.Net.NetTimePacket ();
20 public static Gst.Net.NetTimePacket New(IntPtr raw) {
21 if (raw == IntPtr.Zero)
22 return Gst.Net.NetTimePacket.Zero;
23 return (Gst.Net.NetTimePacket) Marshal.PtrToStructure (raw, typeof (Gst.Net.NetTimePacket));
26 [DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
27 static extern IntPtr gst_net_time_packet_new(byte[] buffer);
29 public static NetTimePacket New(byte[] buffer)
31 NetTimePacket result = NetTimePacket.New (gst_net_time_packet_new(buffer));
35 [DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
36 static extern IntPtr gst_net_time_packet_get_type();
38 public static GLib.GType GType {
40 IntPtr raw_ret = gst_net_time_packet_get_type();
41 GLib.GType ret = new GLib.GType(raw_ret);
46 [DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
47 static extern unsafe bool gst_net_time_packet_send(IntPtr raw, IntPtr socket, IntPtr dest_address, out IntPtr error);
49 public unsafe bool Send(GLib.Socket socket, GLib.SocketAddress dest_address) {
50 IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
51 System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
52 IntPtr error = IntPtr.Zero;
53 bool raw_ret = gst_net_time_packet_send(this_as_native, socket == null ? IntPtr.Zero : socket.Handle, dest_address == null ? IntPtr.Zero : dest_address.Handle, out error);
55 ReadNative (this_as_native, ref this);
56 System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
57 if (error != IntPtr.Zero) throw new GLib.GException (error);
61 [DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
62 static extern byte gst_net_time_packet_serialize(IntPtr raw);
64 public byte Serialize() {
65 IntPtr this_as_native = System.Runtime.InteropServices.Marshal.AllocHGlobal (System.Runtime.InteropServices.Marshal.SizeOf (this));
66 System.Runtime.InteropServices.Marshal.StructureToPtr (this, this_as_native, false);
67 byte raw_ret = gst_net_time_packet_serialize(this_as_native);
69 ReadNative (this_as_native, ref this);
70 System.Runtime.InteropServices.Marshal.FreeHGlobal (this_as_native);
74 [DllImport("gstnet-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
75 static extern unsafe IntPtr gst_net_time_packet_receive(IntPtr socket, out IntPtr src_address, out IntPtr error);
77 public static unsafe Gst.Net.NetTimePacket Receive(GLib.Socket socket, out GLib.SocketAddress src_address) {
78 IntPtr native_src_address;
79 IntPtr error = IntPtr.Zero;
80 IntPtr raw_ret = gst_net_time_packet_receive(socket == null ? IntPtr.Zero : socket.Handle, out native_src_address, out error);
81 Gst.Net.NetTimePacket ret = Gst.Net.NetTimePacket.New (raw_ret);
82 src_address = GLib.Object.GetObject(native_src_address, true) as GLib.SocketAddress;
83 if (error != IntPtr.Zero) throw new GLib.GException (error);
87 static void ReadNative (IntPtr native, ref Gst.Net.NetTimePacket target)
89 target = New (native);
92 public bool Equals (NetTimePacket other)
94 return true && LocalTime.Equals (other.LocalTime) && RemoteTime.Equals (other.RemoteTime);
97 public override bool Equals (object other)
99 return other is NetTimePacket && Equals ((NetTimePacket) other);
102 public override int GetHashCode ()
104 return this.GetType ().FullName.GetHashCode () ^ LocalTime.GetHashCode () ^ RemoteTime.GetHashCode ();
107 public static explicit operator GLib.Value (Gst.Net.NetTimePacket boxed)
109 GLib.Value val = GLib.Value.Empty;
110 val.Init (Gst.Net.NetTimePacket.GType);
115 public static explicit operator Gst.Net.NetTimePacket (GLib.Value val)
117 return (Gst.Net.NetTimePacket) val.Val;