context: // This file was generated by the Gtk# code generator.
  // Any changes made will be lost if regenerated.
  
  namespace Gst.Rtsp {
  
  	using System;
  	using System.Runtime.InteropServices;
  
  #region Autogenerated code
  	public partial class RTSPExtensionAdapter : GLib.GInterfaceAdapter, Gst.Rtsp.IRTSPExtension {
  
  		[StructLayout (LayoutKind.Sequential)]
  		struct GstRTSPExtensionInterface {
  			public DetectServerNativeDelegate DetectServer;
  			public BeforeSendNativeDelegate BeforeSend;
  			public AfterSendNativeDelegate AfterSend;
  			public ParseSdpNativeDelegate ParseSdp;
  			public SetupMediaNativeDelegate SetupMedia;
  			public ConfigureStreamNativeDelegate ConfigureStream;
  			public GetTransportsNativeDelegate GetTransports;
  			public StreamSelectNativeDelegate StreamSelect;
  			IntPtr SendEvent;
  			public ReceiveRequestNativeDelegate ReceiveRequest;
  			[MarshalAs (UnmanagedType.ByValArray, SizeConst=4)]
  			private IntPtr[] _gstGstReserved;
  		}
  
  		static GstRTSPExtensionInterface iface;
  
  		static RTSPExtensionAdapter ()
  		{
  			GLib.GType.Register (_gtype, typeof (RTSPExtensionAdapter));
  			iface.DetectServer = new DetectServerNativeDelegate (DetectServer_cb);
  			iface.BeforeSend = new BeforeSendNativeDelegate (BeforeSend_cb);
  			iface.AfterSend = new AfterSendNativeDelegate (AfterSend_cb);
  			iface.ParseSdp = new ParseSdpNativeDelegate (ParseSdp_cb);
  			iface.SetupMedia = new SetupMediaNativeDelegate (SetupMedia_cb);
  			iface.ConfigureStream = new ConfigureStreamNativeDelegate (ConfigureStream_cb);
  			iface.GetTransports = new GetTransportsNativeDelegate (GetTransports_cb);
  			iface.StreamSelect = new StreamSelectNativeDelegate (StreamSelect_cb);
  			iface.ReceiveRequest = new ReceiveRequestNativeDelegate (ReceiveRequest_cb);
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate bool DetectServerNativeDelegate (IntPtr inst, IntPtr resp);
  
  		static bool DetectServer_cb (IntPtr inst, IntPtr resp)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				bool __result;
  				__result = __obj.DetectServer (Gst.Rtsp.RTSPMessage.New (resp));
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int BeforeSendNativeDelegate (IntPtr inst, IntPtr req);
  
  		static int BeforeSend_cb (IntPtr inst, IntPtr req)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				Gst.Rtsp.RTSPResult __result;
  				__result = __obj.BeforeSend (Gst.Rtsp.RTSPMessage.New (req));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int AfterSendNativeDelegate (IntPtr inst, IntPtr req, IntPtr resp);
  
  		static int AfterSend_cb (IntPtr inst, IntPtr req, IntPtr resp)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				Gst.Rtsp.RTSPResult __result;
  				__result = __obj.AfterSend (Gst.Rtsp.RTSPMessage.New (req), Gst.Rtsp.RTSPMessage.New (resp));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int ParseSdpNativeDelegate (IntPtr inst, IntPtr sdp, IntPtr s);
  
  		static int ParseSdp_cb (IntPtr inst, IntPtr sdp, IntPtr s)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				Gst.Rtsp.RTSPResult __result;
  				__result = __obj.ParseSdp (sdp == IntPtr.Zero ? null : (Gst.Sdp.SDPMessage) GLib.Opaque.GetOpaque (sdp, typeof (Gst.Sdp.SDPMessage), false), s == IntPtr.Zero ? null : (Gst.Structure) GLib.Opaque.GetOpaque (s, typeof (Gst.Structure), false));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int SetupMediaNativeDelegate (IntPtr inst, IntPtr media);
  
  		static int SetupMedia_cb (IntPtr inst, IntPtr media)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				Gst.Rtsp.RTSPResult __result;
  				__result = __obj.SetupMedia (Gst.Sdp.SDPMedia.New (media));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate bool ConfigureStreamNativeDelegate (IntPtr inst, IntPtr caps);
  
  		static bool ConfigureStream_cb (IntPtr inst, IntPtr caps)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				bool __result;
  				__result = __obj.ConfigureStream (caps == IntPtr.Zero ? null : (Gst.Caps) GLib.Opaque.GetOpaque (caps, typeof (Gst.Caps), false));
  				return __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int GetTransportsNativeDelegate (IntPtr inst, int protocols, IntPtr transport);
  
  		static int GetTransports_cb (IntPtr inst, int protocols, IntPtr transport)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				Gst.Rtsp.RTSPResult __result;
  				__result = __obj.GetTransports ((Gst.Rtsp.RTSPLowerTrans) protocols, GLib.Marshaller.Utf8PtrToString (transport));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int StreamSelectNativeDelegate (IntPtr inst, IntPtr url);
  
  		static int StreamSelect_cb (IntPtr inst, IntPtr url)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				Gst.Rtsp.RTSPResult __result;
  				__result = __obj.StreamSelect (Gst.Rtsp.RTSPUrl.New (url));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
  		delegate int ReceiveRequestNativeDelegate (IntPtr inst, IntPtr req);
  
  		static int ReceiveRequest_cb (IntPtr inst, IntPtr req)
  		{
  			try {
  				IRTSPExtensionImplementor __obj = GLib.Object.GetObject (inst, false) as IRTSPExtensionImplementor;
  				Gst.Rtsp.RTSPResult __result;
  				__result = __obj.ReceiveRequest (Gst.Rtsp.RTSPMessage.New (req));
  				return (int) __result;
  			} catch (Exception e) {
  				GLib.ExceptionManager.RaiseUnhandledException (e, true);
  				// NOTREACHED: above call does not return.
  				throw e;
  			}
  		}
  
  		static int class_offset = 2 * IntPtr.Size;
  
  		static void Initialize (IntPtr ptr, IntPtr data)
  		{
  			IntPtr ifaceptr = new IntPtr (ptr.ToInt64 () + class_offset);
  			GstRTSPExtensionInterface native_iface = (GstRTSPExtensionInterface) Marshal.PtrToStructure (ifaceptr, typeof (GstRTSPExtensionInterface));
  			native_iface.DetectServer = iface.DetectServer;
  			native_iface.BeforeSend = iface.BeforeSend;
  			native_iface.AfterSend = iface.AfterSend;
  			native_iface.ParseSdp = iface.ParseSdp;
  			native_iface.SetupMedia = iface.SetupMedia;
  			native_iface.ConfigureStream = iface.ConfigureStream;
  			native_iface.GetTransports = iface.GetTransports;
  			native_iface.StreamSelect = iface.StreamSelect;
  			native_iface.ReceiveRequest = iface.ReceiveRequest;
  			Marshal.StructureToPtr (native_iface, ifaceptr, false);
  		}
  
  		GLib.Object implementor;
  
  		public RTSPExtensionAdapter ()
  		{
  			InitHandler = new GLib.GInterfaceInitHandler (Initialize);
  		}
  
  		public RTSPExtensionAdapter (IRTSPExtensionImplementor implementor)
  		{
  
gt: 			if (implementor == null)