Add bindings for class struct methods

This commit is contained in:
Stephan Sundermann 2014-08-06 00:55:58 +02:00
parent 62b75d93d3
commit 6d80e4208a
5 changed files with 258 additions and 1 deletions

View file

@ -0,0 +1,37 @@
//
// AudioFilter.cs
//
// Authors:
// Stephan Sundermann <stephansundermann@gmail.com>
//
// Copyright (C) 2014 Stephan Sundermann
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
namespace Gst.Audio {
using System;
using System.Runtime.InteropServices;
partial class AudioFilter
{
[DllImport("libgstaudio-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_audio_filter_class_add_pad_templates(IntPtr klass, IntPtr allowed_caps);
public void AddPadTemplates(Gst.Caps allowed_caps) {
gst_audio_filter_class_add_pad_templates(LookupGType().GetClassPtr (), allowed_caps == null ? IntPtr.Zero : allowed_caps.Handle);
}
}
}

View file

@ -0,0 +1,85 @@
//
// DeviceProvider.cs
//
// Authors:
// Stephan Sundermann <stephansundermann@gmail.com>
//
// Copyright (C) 2014 Stephan Sundermann
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301 USA
namespace Gst {
using System;
using System.Runtime.InteropServices;
partial class DeviceProvider
{
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_add_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddMetadata(string key, string value) {
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
gst_device_provider_class_add_metadata(LookupGType().GetClassPtr (), native_key, native_value);
GLib.Marshaller.Free (native_key);
GLib.Marshaller.Free (native_value);
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_add_static_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddStaticMetadata(string key, string value) {
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
gst_device_provider_class_add_static_metadata(LookupGType().GetClassPtr (), native_key, GLib.Marshaller.StringToPtrGStrdup(value));
GLib.Marshaller.Free (native_key);
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_device_provider_class_get_metadata(IntPtr klass, IntPtr key);
public string GetMetadata(string key) {
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
IntPtr raw_ret = gst_device_provider_class_get_metadata(LookupGType().GetClassPtr (), native_key);
string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
GLib.Marshaller.Free (native_key);
return ret;
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_set_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetMetadata(string longname, string classification, string description, string author) {
IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup (classification);
IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup (description);
IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
gst_device_provider_class_set_metadata(LookupGType().GetClassPtr (), native_longname, native_classification, native_description, native_author);
GLib.Marshaller.Free (native_longname);
GLib.Marshaller.Free (native_classification);
GLib.Marshaller.Free (native_description);
GLib.Marshaller.Free (native_author);
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_device_provider_class_set_static_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetStaticMetadata(string longname, string classification, string description, string author) {
gst_device_provider_class_set_static_metadata(LookupGType().GetClassPtr (), GLib.Marshaller.StringToPtrGStrdup(longname), GLib.Marshaller.StringToPtrGStrdup(classification), GLib.Marshaller.StringToPtrGStrdup(description), GLib.Marshaller.StringToPtrGStrdup(author));
}
}
}

View file

@ -45,5 +45,96 @@ namespace Gst {
elements[i].Unlink (elements[i+1]);
}
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_add_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddMetadata(string key, string value) {
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
gst_element_class_add_metadata(LookupGType().GetClassPtr (), native_key, native_value);
GLib.Marshaller.Free (native_key);
GLib.Marshaller.Free (native_value);
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_add_pad_template(IntPtr klass, IntPtr templ);
public void AddPadTemplate(Gst.PadTemplate templ) {
gst_element_class_add_pad_template(LookupGType().GetClassPtr (), templ == null ? IntPtr.Zero : templ.OwnedHandle);
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_add_static_metadata(IntPtr klass, IntPtr key, IntPtr value);
public void AddStaticMetadata(string key, string value) {
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
IntPtr native_value = GLib.Marshaller.StringToPtrGStrdup (value);
gst_element_class_add_static_metadata(LookupGType().GetClassPtr (), native_key, native_value);
GLib.Marshaller.Free (native_key);
GLib.Marshaller.Free (native_value);
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_element_class_get_metadata(IntPtr klass, IntPtr key);
public string GetMetadata(string key) {
IntPtr native_key = GLib.Marshaller.StringToPtrGStrdup (key);
IntPtr raw_ret = gst_element_class_get_metadata(LookupGType().GetClassPtr (), native_key);
string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
GLib.Marshaller.Free (native_key);
return ret;
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_element_class_get_pad_template(IntPtr element_class, IntPtr name);
public Gst.PadTemplate GetPadTemplate(string name) {
IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
IntPtr raw_ret = gst_element_class_get_pad_template(LookupGType().GetClassPtr (), native_name);
Gst.PadTemplate ret = GLib.Object.GetObject(raw_ret) as Gst.PadTemplate;
GLib.Marshaller.Free (native_name);
return ret;
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr gst_element_class_get_pad_template_list(IntPtr element_class);
public Gst.PadTemplate[] GetPadTemplateList() {
IntPtr raw_ret = gst_element_class_get_pad_template_list(LookupGType().GetClassPtr ());
Gst.PadTemplate[] ret = (Gst.PadTemplate[]) GLib.Marshaller.ListPtrToArray (raw_ret, typeof(GLib.List), false, false, typeof(Gst.PadTemplate));
return ret;
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_set_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetMetadata(string longname, string classification, string description, string author) {
IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup (classification);
IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup (description);
IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
gst_element_class_set_metadata(LookupGType().GetClassPtr (), native_longname, native_classification, native_description, native_author);
GLib.Marshaller.Free (native_longname);
GLib.Marshaller.Free (native_classification);
GLib.Marshaller.Free (native_description);
GLib.Marshaller.Free (native_author);
}
[DllImport("libgstreamer-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void gst_element_class_set_static_metadata(IntPtr klass, IntPtr longname, IntPtr classification, IntPtr description, IntPtr author);
public void SetStaticMetadata(string longname, string classification, string description, string author) {
IntPtr native_longname = GLib.Marshaller.StringToPtrGStrdup (longname);
IntPtr native_classification = GLib.Marshaller.StringToPtrGStrdup (classification);
IntPtr native_description = GLib.Marshaller.StringToPtrGStrdup (description);
IntPtr native_author = GLib.Marshaller.StringToPtrGStrdup (author);
gst_element_class_set_static_metadata(LookupGType().GetClassPtr (), native_longname, native_classification, native_description, native_author);
GLib.Marshaller.Free (native_longname);
GLib.Marshaller.Free (native_classification);
GLib.Marshaller.Free (native_description);
GLib.Marshaller.Free (native_author);
}
}
}

View file

@ -2478,6 +2478,9 @@
<method name="AddMetadata" cname="gst_device_provider_class_add_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstDeviceProviderClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="key" type="const-gchar*"/>
<parameter name="value" type="const-gchar*"/>
</parameters>
@ -2485,6 +2488,9 @@
<method name="AddStaticMetadata" cname="gst_device_provider_class_add_static_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstDeviceProviderClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="key" type="const-gchar*"/>
<parameter name="value" type="gchar*" owned="true"/>
</parameters>
@ -2492,12 +2498,18 @@
<method name="GetMetadata" cname="gst_device_provider_class_get_metadata" shared="true">
<return-type type="const-gchar*"/>
<parameters>
<parameter name="klass" type="GstDeviceProviderClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="key" type="const-gchar*"/>
</parameters>
</method>
<method name="SetMetadata" cname="gst_device_provider_class_set_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstDeviceProviderClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="longname" type="const-gchar*"/>
<parameter name="classification" type="const-gchar*"/>
<parameter name="description" type="const-gchar*"/>
@ -2507,6 +2519,9 @@
<method name="SetStaticMetadata" cname="gst_device_provider_class_set_static_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstDeviceProviderClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="longname" type="gchar*" owned="true"/>
<parameter name="classification" type="gchar*" owned="true"/>
<parameter name="description" type="gchar*" owned="true"/>
@ -2670,6 +2685,9 @@
<method name="AddMetadata" cname="gst_element_class_add_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="key" type="const-gchar*"/>
<parameter name="value" type="const-gchar*"/>
</parameters>
@ -2677,12 +2695,18 @@
<method name="AddPadTemplate" cname="gst_element_class_add_pad_template" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="templ" type="GstPadTemplate*" owned="true"/>
</parameters>
</method>
<method name="AddStaticMetadata" cname="gst_element_class_add_static_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="key" type="const-gchar*"/>
<parameter name="value" type="const-gchar*"/>
</parameters>
@ -2690,22 +2714,35 @@
<method name="GetMetadata" cname="gst_element_class_get_metadata" shared="true">
<return-type type="const-gchar*"/>
<parameters>
<parameter name="klass" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="key" type="const-gchar*"/>
</parameters>
</method>
<method name="GetPadTemplate" cname="gst_element_class_get_pad_template" shared="true">
<return-type type="GstPadTemplate*"/>
<parameters>
<parameter name="element_class" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="name" type="const-gchar*"/>
</parameters>
</method>
<method name="GetPadTemplateList" cname="gst_element_class_get_pad_template_list" shared="true">
<return-type type="GList*" element_type="GstPadTemplate*"/>
<parameters/>
<parameters>
<parameter name="element_class" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
</parameters>
</method>
<method name="SetMetadata" cname="gst_element_class_set_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="longname" type="const-gchar*"/>
<parameter name="classification" type="const-gchar*"/>
<parameter name="description" type="const-gchar*"/>
@ -2715,6 +2752,9 @@
<method name="SetStaticMetadata" cname="gst_element_class_set_static_metadata" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstElementClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="longname" type="const-gchar*"/>
<parameter name="classification" type="const-gchar*"/>
<parameter name="description" type="const-gchar*"/>
@ -11294,6 +11334,9 @@
<method name="AddPadTemplates" cname="gst_audio_filter_class_add_pad_templates" shared="true">
<return-type type="void"/>
<parameters>
<parameter name="klass" type="GstAudioFilterClass*">
<warning>missing glib:type-name</warning>
</parameter>
<parameter name="allowed_caps" type="GstCaps*"/>
</parameters>
</method>

View file

@ -206,6 +206,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
<attr path="//*[@type='const GSList*']" name="type">GSList*</attr>
<attr path="//object/field[@cname='object' and @type='GstObject*']" name="hidden">true</attr>
<attr path="//constant[@name='CLOCK_TIME_NONE']" name="ctype">guint64</attr>
<attr path="//method[parameters/parameter[contains(@type, 'Class*')]]" name="hidden">true</attr>
<!-- No way to correctly generate these without the element type -->
<attr path="//boxed[@cname='GstMpegtsDescriptor']//method[parameters/parameter[@type='GArray***']]" name="hidden">true</attr>