gstreamer/gstreamer-sharp/override/URIHandlerAdapter.cs
2009-09-11 10:14:43 +02:00

267 lines
8.1 KiB
C#

// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Gst {
using System;
using System.Runtime.InteropServices;
using System.Collections;
using System.Reflection;
#region Autogenerated code
public partial class URIHandlerAdapter : Gst.GLib.GInterfaceAdapter, Gst.URIHandler {
[StructLayout (LayoutKind.Sequential)]
struct GstURIHandlerInterface {
IntPtr NewUri;
IntPtr GetType;
IntPtr GetProtocols;
public GetUriNativeDelegate GetUri;
public SetUriNativeDelegate SetUri;
public GetTypeFullNativeDelegate GetTypeFull;
public GetProtocolsFullNativeDelegate GetProtocolsFull;
[MarshalAs (UnmanagedType.ByValArray, SizeConst=2)]
public IntPtr[] GstReserved;
}
static GstURIHandlerInterface iface;
static URIHandlerAdapter ()
{
Gst.GLib.GType.Register (_gtype, typeof(URIHandlerAdapter));
iface.GetTypeFull = new GetTypeFullNativeDelegate (GetTypeFull_cb);
iface.GetProtocolsFull = new GetProtocolsFullNativeDelegate (GetProtocolsFull_cb);
iface.GetUri = new GetUriNativeDelegate (GetUri_cb);
iface.SetUri = new SetUriNativeDelegate (SetUri_cb);
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate int GetTypeFullNativeDelegate (IntPtr gtype);
static int GetTypeFull_cb (IntPtr gtype)
{
try {
Gst.GLib.GType gt = new Gst.GLib.GType (gtype);
System.Type t = (System.Type) gt;
System.Reflection.PropertyInfo pi = t.GetProperty ("Type", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
Gst.URIType __result = Gst.URIType.Unknown;
if (pi != null && pi.PropertyType == typeof (Gst.URIType))
__result = (Gst.URIType) pi.GetValue (null, null);
return (int) __result;
} catch (Exception e) {
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr GetProtocolsFullNativeDelegate (IntPtr gtype);
static Hashtable protocols_cache = new Hashtable ();
static IntPtr GetProtocolsFull_cb (IntPtr gtype)
{
try {
Gst.GLib.GType gt = new Gst.GLib.GType (gtype);
System.Type t = (System.Type) gt;
if (protocols_cache.Contains (gtype)) {
return (IntPtr) protocols_cache[gtype];
}
System.Reflection.PropertyInfo pi = t.GetProperty ("Protocols", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.FlattenHierarchy);
string[] __result;
if (pi != null && pi.PropertyType == typeof (string[]))
__result = (string[]) pi.GetValue (null, null);
else
__result = new string[] {};
IntPtr ret = Gst.Marshaller.StringArrayToNullTermPointer (__result);
protocols_cache.Add (gtype, ret);
return ret;
} catch (Exception e) {
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr GetUriNativeDelegate (IntPtr inst);
static IntPtr GetUri_cb (IntPtr inst)
{
try {
URIHandlerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as URIHandlerImplementor;
string __result = __obj.Uri;
return Gst.GLib.Marshaller.StringToPtrGStrdup (__result);
} catch (Exception e) {
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate bool SetUriNativeDelegate (IntPtr inst, IntPtr uri);
static bool SetUri_cb (IntPtr inst, IntPtr uri)
{
try {
URIHandlerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as URIHandlerImplementor;
bool __result = __obj.SetUri (Gst.GLib.Marshaller.Utf8PtrToString (uri));
return __result;
} catch (Exception e) {
Gst.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);
GstURIHandlerInterface native_iface = (GstURIHandlerInterface) Marshal.PtrToStructure (ifaceptr, typeof (GstURIHandlerInterface));
native_iface.GetTypeFull = iface.GetTypeFull;
native_iface.GetProtocolsFull = iface.GetProtocolsFull;
native_iface.GetUri = iface.GetUri;
native_iface.SetUri = iface.SetUri;
Marshal.StructureToPtr (native_iface, ifaceptr, false);
GCHandle gch = (GCHandle) data;
gch.Free ();
}
Gst.GLib.Object implementor;
public URIHandlerAdapter ()
{
InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize);
}
public URIHandlerAdapter (URIHandlerImplementor implementor)
{
if (implementor == null)
throw new ArgumentNullException ("implementor");
else if (!(implementor is Gst.GLib.Object))
throw new ArgumentException ("implementor must be a subclass of Gst.GLib.Object");
this.implementor = implementor as Gst.GLib.Object;
}
public URIHandlerAdapter (IntPtr handle)
{
if (!_gtype.IsInstance (handle))
throw new ArgumentException ("The gobject doesn't implement the GInterface of this adapter", "handle");
implementor = Gst.GLib.Object.GetObject (handle);
}
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_uri_handler_get_type();
private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_uri_handler_get_type ());
public override Gst.GLib.GType GType {
get {
return _gtype;
}
}
public override IntPtr Handle {
get {
return implementor.Handle;
}
}
public IntPtr OwnedHandle {
get {
return implementor.OwnedHandle;
}
}
public static URIHandler GetObject (IntPtr handle, bool owned)
{
Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned);
return GetObject (obj);
}
public static URIHandler GetObject (Gst.GLib.Object obj)
{
if (obj == null)
return null;
else if (obj is URIHandlerImplementor)
return new URIHandlerAdapter (obj as URIHandlerImplementor);
else if (obj as URIHandler == null)
return new URIHandlerAdapter (obj.Handle);
else
return obj as URIHandler;
}
public URIHandlerImplementor Implementor {
get {
return implementor as URIHandlerImplementor;
}
}
[Gst.GLib.Signal("new-uri")]
public event Gst.NewUriHandler NewUri {
add {
Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs));
sig.AddDelegate (value);
}
remove {
Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs));
sig.RemoveDelegate (value);
}
}
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int gst_uri_handler_get_uri_type(IntPtr raw);
public Gst.URIType UriType {
get {
int raw_ret = gst_uri_handler_get_uri_type(Handle);
Gst.URIType ret = (Gst.URIType) raw_ret;
return ret;
}
}
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool gst_uri_handler_set_uri(IntPtr raw, IntPtr uri);
public bool SetUri(string uri) {
IntPtr native_uri = Gst.GLib.Marshaller.StringToPtrGStrdup (uri);
bool raw_ret = gst_uri_handler_set_uri(Handle, native_uri);
bool ret = raw_ret;
Gst.GLib.Marshaller.Free (native_uri);
return ret;
}
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_uri_handler_get_protocols(IntPtr raw);
public string[] Protocols {
get {
IntPtr raw_ret = gst_uri_handler_get_protocols(Handle);
string[] ret = Gst.Marshaller.NullTermPtrToStringArray (raw_ret, false);
return ret;
}
}
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_uri_handler_get_uri(IntPtr raw);
public string Uri {
get {
IntPtr raw_ret = gst_uri_handler_get_uri(Handle);
string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret);
return ret;
}
}
#endregion
}
}