summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-04-30 17:16:51 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-04-30 17:16:51 +0200
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 () {
191 return ret; 191 return ret;
192 } 192 }
193 193
194[DllImport("gstreamer-0.10.dll")]
195static extern void gst_element_class_add_pad_template (IntPtr klass, IntPtr templ);
196
197protected static void AddPadTemplate (GLib.GType gtype, Gst.PadTemplate templ) {
198 IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
199 gst_element_class_add_pad_template (class_ptr, templ.Handle);
200}
201
202[DllImport("gstreamer-0.10.dll")]
203static extern IntPtr gst_element_class_get_pad_template (IntPtr klass, IntPtr name);
204
205public Gst.PadTemplate GetPadTemplate (string name) {
206 GLib.GType gtype = this.LookupGType ().ThresholdType;
207 IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
208 IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
209 IntPtr raw_ret = gst_element_class_get_pad_template (class_ptr, native_name);
210 GLib.Marshaller.Free (native_name);
211
212 return GLib.Object.GetObject (raw_ret, false) as Gst.PadTemplate;
213}
214
215[DllImport("gstreamer-0.10.dll")]
216static extern IntPtr gst_element_class_get_pad_template_list (IntPtr klass);
217
218public Gst.PadTemplate[] GetPadTemplates () {
219 GLib.GType gtype = this.LookupGType ().ThresholdType;
220 IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
221 IntPtr raw_ret = gst_element_class_get_pad_template_list (class_ptr);
222
223 return (Gst.PadTemplate[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), false, false, typeof(Gst.PadTemplate));
224}
225
226[DllImport("gstreamer-0.10.dll")]
227static extern void gst_element_class_set_details_simple (IntPtr klass, IntPtr longname, IntPtr classification, IntPtr desc, IntPtr author);
228
229protected static void SetDetails (GLib.GType gtype, string longname, string klass, string description, string author) {
230 IntPtr class_ptr = new IntPtr (gtype.ClassPtr.ToInt64 ());
231 IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
232 IntPtr native_klass = GLib.Marshaller.StringToPtrGStrdup (klass);
233 IntPtr native_desc = GLib.Marshaller.StringToPtrGStrdup (description);
234 IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
235 gst_element_class_set_details_simple (class_ptr, native_longname, native_klass, native_desc, native_author);
236
237 GLib.Marshaller.Free (native_longname);
238 GLib.Marshaller.Free (native_klass);
239 GLib.Marshaller.Free (native_desc);
240 GLib.Marshaller.Free (native_author);
241}