Add initial support for setting/getting element class fields

This commit is contained in:
Sebastian Dröge 2009-04-30 17:16:51 +02:00
parent 7938de9740
commit 54a34ed67c

View file

@ -191,3 +191,51 @@ public Gst.QueryType[] GetQueryTypes () {
return ret; return ret;
} }
[DllImport("gstreamer-0.10.dll")]
static extern void gst_element_class_add_pad_template (IntPtr klass, IntPtr templ);
protected static void AddPadTemplate (GLib.GType gtype, Gst.PadTemplate templ) {
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
gst_element_class_add_pad_template (class_ptr, templ.Handle);
}
[DllImport("gstreamer-0.10.dll")]
static extern IntPtr gst_element_class_get_pad_template (IntPtr klass, IntPtr name);
public Gst.PadTemplate GetPadTemplate (string name) {
GLib.GType gtype = this.LookupGType ().ThresholdType;
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr raw_ret = gst_element_class_get_pad_template (class_ptr, native_name);
GLib.Marshaller.Free (native_name);
return GLib.Object.GetObject (raw_ret, false) as Gst.PadTemplate;
}
[DllImport("gstreamer-0.10.dll")]
static extern IntPtr gst_element_class_get_pad_template_list (IntPtr klass);
public Gst.PadTemplate[] GetPadTemplates () {
GLib.GType gtype = this.LookupGType ().ThresholdType;
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
IntPtr raw_ret = gst_element_class_get_pad_template_list (class_ptr);
return (Gst.PadTemplate[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), false, false, typeof(Gst.PadTemplate));
}
[DllImport("gstreamer-0.10.dll")]
static extern void gst_element_class_set_details_simple (IntPtr klass, IntPtr longname, IntPtr classification, IntPtr desc, IntPtr author);
protected static void SetDetails (GLib.GType gtype, string longname, string klass, string description, string author) {
IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
IntPtr native_klass = GLib.Marshaller.StringToPtrGStrdup (klass);
IntPtr native_desc = GLib.Marshaller.StringToPtrGStrdup (description);
IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
gst_element_class_set_details_simple (class_ptr, native_longname, native_klass, native_desc, native_author);
GLib.Marshaller.Free (native_longname);
GLib.Marshaller.Free (native_klass);
GLib.Marshaller.Free (native_desc);
GLib.Marshaller.Free (native_author);
}