mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 06:31:08 +00:00
Add initial support for setting/getting element class fields
This commit is contained in:
parent
7938de9740
commit
54a34ed67c
1 changed files with 48 additions and 0 deletions
|
@ -191,3 +191,51 @@ public Gst.QueryType[] GetQueryTypes () {
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue