summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-04-30 15:16:51 (GMT)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-04-30 15:16:51 (GMT)
commit54a34ed67c39943b93893ded0d7a9b6610825455 (patch)
tree93e62aad3b925512f61097b7428e4be8999c9161
parent7938de9740ca6c2ba3f9937fb1b1e579e8738334 (diff)
Add initial support for setting/getting element class fields
-rw-r--r--gstreamer-sharp/Element.custom48
1 files changed, 48 insertions, 0 deletions
diff --git a/gstreamer-sharp/Element.custom b/gstreamer-sharp/Element.custom
index 9ab37ec..31e56b3 100644
--- a/gstreamer-sharp/Element.custom
+++ b/gstreamer-sharp/Element.custom
@@ -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);
+}