gstreamer/gstreamer-sharp/override/URIHandlerAdapter.cs

268 lines
8.1 KiB
C#
Raw Normal View History

// This file was generated by the Gtk# code generator.
2009-09-11 08:08:06 +00:00
// Any changes made will be lost if regenerated.
namespace Gst {
using System;
using System.Runtime.InteropServices;
using System.Collections;
2009-09-11 08:08:06 +00:00
using System.Reflection;
#region Autogenerated code
2009-09-11 08:08:06 +00:00
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 ()
{
2009-09-11 08:08:06 +00:00
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);
}
2009-09-11 08:08:06 +00:00
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate int GetTypeFullNativeDelegate (IntPtr gtype);
static int GetTypeFull_cb (IntPtr gtype)
{
try {
2009-09-11 08:08:06 +00:00
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) {
2009-09-11 08:08:06 +00:00
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
2009-09-11 08:08:06 +00:00
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr GetProtocolsFullNativeDelegate (IntPtr gtype);
static Hashtable protocols_cache = new Hashtable ();
static IntPtr GetProtocolsFull_cb (IntPtr gtype)
{
try {
2009-09-11 08:08:06 +00:00
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) {
2009-09-11 08:08:06 +00:00
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
2009-09-11 08:08:06 +00:00
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate IntPtr GetUriNativeDelegate (IntPtr inst);
static IntPtr GetUri_cb (IntPtr inst)
{
try {
2009-09-11 08:08:06 +00:00
URIHandlerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as URIHandlerImplementor;
string __result = __obj.Uri;
2009-09-11 08:08:06 +00:00
return Gst.GLib.Marshaller.StringToPtrGStrdup (__result);
} catch (Exception e) {
2009-09-11 08:08:06 +00:00
Gst.GLib.ExceptionManager.RaiseUnhandledException (e, true);
// NOTREACHED: above call does not return.
throw e;
}
}
2009-09-11 08:08:06 +00:00
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
delegate bool SetUriNativeDelegate (IntPtr inst, IntPtr uri);
static bool SetUri_cb (IntPtr inst, IntPtr uri)
{
try {
2009-09-11 08:08:06 +00:00
URIHandlerImplementor __obj = Gst.GLib.Object.GetObject (inst, false) as URIHandlerImplementor;
bool __result = __obj.SetUri (Gst.GLib.Marshaller.Utf8PtrToString (uri));
return __result;
} catch (Exception e) {
2009-09-11 08:08:06 +00:00
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 ();
}
2009-09-11 08:08:06 +00:00
Gst.GLib.Object implementor;
public URIHandlerAdapter ()
{
2009-09-11 08:08:06 +00:00
InitHandler = new Gst.GLib.GInterfaceInitHandler (Initialize);
}
public URIHandlerAdapter (URIHandlerImplementor implementor)
{
if (implementor == null)
throw new ArgumentNullException ("implementor");
2009-09-11 08:08:06 +00:00
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");
2009-09-11 08:08:06 +00:00
implementor = Gst.GLib.Object.GetObject (handle);
}
2009-09-11 08:08:06 +00:00
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_uri_handler_get_type();
2009-09-11 08:08:06 +00:00
private static Gst.GLib.GType _gtype = new Gst.GLib.GType (gst_uri_handler_get_type ());
2009-09-11 08:08:06 +00:00
public override Gst.GLib.GType GType {
get {
return _gtype;
}
}
public override IntPtr Handle {
get {
2009-09-11 08:08:06 +00:00
return implementor.Handle;
}
}
public IntPtr OwnedHandle {
get {
return implementor.OwnedHandle;
}
}
public static URIHandler GetObject (IntPtr handle, bool owned)
{
2009-09-11 08:08:06 +00:00
Gst.GLib.Object obj = Gst.GLib.Object.GetObject (handle, owned);
return GetObject (obj);
}
2009-09-11 08:08:06 +00:00
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 {
2009-09-11 08:08:06 +00:00
return implementor as URIHandlerImplementor;
}
}
2009-09-11 08:08:06 +00:00
[Gst.GLib.Signal("new-uri")]
public event Gst.NewUriHandler NewUri {
add {
2009-09-11 08:08:06 +00:00
Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs));
sig.AddDelegate (value);
}
remove {
2009-09-11 08:08:06 +00:00
Gst.GLib.Signal sig = Gst.GLib.Signal.Lookup (Gst.GLib.Object.GetObject (Handle), "new-uri", typeof (Gst.NewUriArgs));
sig.RemoveDelegate (value);
}
}
2009-09-11 08:08:06 +00:00
[DllImport("libgstreamer-0.10.dll", CallingConvention = CallingConvention.Cdecl)]
static extern int gst_uri_handler_get_uri_type(IntPtr raw);
public Gst.URIType UriType {
get {
2009-09-11 08:08:06 +00:00
int raw_ret = gst_uri_handler_get_uri_type(Handle);
Gst.URIType ret = (Gst.URIType) raw_ret;
return ret;
}
}
2009-09-11 08:08:06 +00:00
[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) {
2009-09-11 08:08:06 +00:00
IntPtr native_uri = Gst.GLib.Marshaller.StringToPtrGStrdup (uri);
bool raw_ret = gst_uri_handler_set_uri(Handle, native_uri);
bool ret = raw_ret;
2009-09-11 08:08:06 +00:00
Gst.GLib.Marshaller.Free (native_uri);
return ret;
}
2009-09-11 08:08:06 +00:00
[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);
2009-09-11 08:08:06 +00:00
string[] ret = Gst.Marshaller.NullTermPtrToStringArray (raw_ret, false);
return ret;
}
}
2009-09-11 08:08:06 +00:00
[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);
2009-09-11 08:08:06 +00:00
string ret = Gst.GLib.Marshaller.Utf8PtrToString (raw_ret);
return ret;
}
}
#endregion
}
}