mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 03:00:35 +00:00
188 lines
5.2 KiB
C#
188 lines
5.2 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;
|
|
|
|
#region Autogenerated code
|
|
public partial class URIHandlerAdapter : GLib.GInterfaceAdapter, Gst.IURIHandler {
|
|
|
|
[StructLayout (LayoutKind.Sequential)]
|
|
struct GstURIHandlerInterface {
|
|
IntPtr GetProtocols;
|
|
public GetUriNativeDelegate GetUri;
|
|
public SetUriNativeDelegate SetUri;
|
|
}
|
|
|
|
static GstURIHandlerInterface iface;
|
|
|
|
static URIHandlerAdapter ()
|
|
{
|
|
GLib.GType.Register (_gtype, typeof (URIHandlerAdapter));
|
|
iface.GetUri = new GetUriNativeDelegate (GetUri_cb);
|
|
iface.SetUri = new SetUriNativeDelegate (SetUri_cb);
|
|
}
|
|
|
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
|
delegate IntPtr GetUriNativeDelegate (IntPtr inst);
|
|
|
|
static IntPtr GetUri_cb (IntPtr inst)
|
|
{
|
|
try {
|
|
IURIHandlerImplementor __obj = GLib.Object.GetObject (inst, false) as IURIHandlerImplementor;
|
|
string __result;
|
|
__result = __obj.Uri;
|
|
return GLib.Marshaller.StringToPtrGStrdup(__result);
|
|
} catch (Exception e) {
|
|
GLib.ExceptionManager.RaiseUnhandledException (e, true);
|
|
// NOTREACHED: above call does not return.
|
|
throw e;
|
|
}
|
|
}
|
|
|
|
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
|
|
delegate bool SetUriNativeDelegate (IntPtr inst, IntPtr uri, out IntPtr error);
|
|
|
|
static bool SetUri_cb (IntPtr inst, IntPtr uri, out IntPtr error)
|
|
{
|
|
error = IntPtr.Zero;
|
|
|
|
try {
|
|
IURIHandlerImplementor __obj = GLib.Object.GetObject (inst, false) as IURIHandlerImplementor;
|
|
bool __result;
|
|
__result = __obj.SetUri (GLib.Marshaller.Utf8PtrToString (uri));
|
|
return __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);
|
|
GstURIHandlerInterface native_iface = (GstURIHandlerInterface) Marshal.PtrToStructure (ifaceptr, typeof (GstURIHandlerInterface));
|
|
native_iface.GetUri = iface.GetUri;
|
|
native_iface.SetUri = iface.SetUri;
|
|
Marshal.StructureToPtr (native_iface, ifaceptr, false);
|
|
}
|
|
|
|
GLib.Object implementor;
|
|
|
|
public URIHandlerAdapter ()
|
|
{
|
|
InitHandler = new GLib.GInterfaceInitHandler (Initialize);
|
|
}
|
|
|
|
public URIHandlerAdapter (IURIHandlerImplementor implementor)
|
|
{
|
|
if (implementor == null)
|
|
throw new ArgumentNullException ("implementor");
|
|
else if (!(implementor is GLib.Object))
|
|
throw new ArgumentException ("implementor must be a subclass of GLib.Object");
|
|
this.implementor = implementor as 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 = GLib.Object.GetObject (handle);
|
|
}
|
|
|
|
[DllImport("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
static extern IntPtr gst_uri_handler_get_type();
|
|
|
|
private static GLib.GType _gtype = new GLib.GType (gst_uri_handler_get_type ());
|
|
|
|
public static GLib.GType GType {
|
|
get {
|
|
return _gtype;
|
|
}
|
|
}
|
|
|
|
public override GLib.GType GInterfaceGType {
|
|
get {
|
|
return _gtype;
|
|
}
|
|
}
|
|
|
|
public override IntPtr Handle {
|
|
get {
|
|
return implementor.Handle;
|
|
}
|
|
}
|
|
|
|
public IntPtr OwnedHandle {
|
|
get {
|
|
return implementor.OwnedHandle;
|
|
}
|
|
}
|
|
|
|
public static IURIHandler GetObject (IntPtr handle, bool owned)
|
|
{
|
|
GLib.Object obj = GLib.Object.GetObject (handle, owned);
|
|
return GetObject (obj);
|
|
}
|
|
|
|
public static IURIHandler GetObject (GLib.Object obj)
|
|
{
|
|
if (obj == null)
|
|
return null;
|
|
else if (obj is IURIHandlerImplementor)
|
|
return new URIHandlerAdapter (obj as IURIHandlerImplementor);
|
|
else if (obj as IURIHandler == null)
|
|
return new URIHandlerAdapter (obj.Handle);
|
|
else
|
|
return obj as IURIHandler;
|
|
}
|
|
|
|
public IURIHandlerImplementor Implementor {
|
|
get {
|
|
return implementor as IURIHandlerImplementor;
|
|
}
|
|
}
|
|
|
|
[DllImport("gstreamer-1.0-0.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 = GLib.Marshaller.PtrToStringGFree(raw_ret);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
[DllImport("gstreamer-1.0-0.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("gstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
|
static extern bool gst_uri_handler_set_uri(IntPtr raw, IntPtr uri, out IntPtr error);
|
|
|
|
public bool SetUri(string uri) {
|
|
IntPtr native_uri = GLib.Marshaller.StringToPtrGStrdup (uri);
|
|
IntPtr error = IntPtr.Zero;
|
|
bool raw_ret = gst_uri_handler_set_uri(Handle, native_uri, out error);
|
|
bool ret = raw_ret;
|
|
GLib.Marshaller.Free (native_uri);
|
|
if (error != IntPtr.Zero) throw new GLib.GException (error);
|
|
return ret;
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|