From 79931bf601c1537bb1612d0b6543cf62373a34fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 14 Apr 2009 17:55:19 +0200 Subject: [PATCH] Fix and complete Static{PadTemplate,Caps} bindings --- doc/en/Gst/StaticCaps.xml | 34 +++-------------- doc/en/Gst/StaticPadTemplate.xml | 47 +++-------------------- doc/en/index.xml | 4 +- gstreamer-sharp/Gstreamer.metadata | 10 +++++ gstreamer-sharp/Makefile.am | 2 + gstreamer-sharp/StaticCaps.custom | 48 ++++++++++++++++++++++++ gstreamer-sharp/StaticPadTemplate.custom | 37 ++++++++++++++++++ gstreamer-sharp/glue/Makefile.am | 2 + gstreamer-sharp/glue/staticcaps.c | 15 ++++++++ gstreamer-sharp/glue/staticpadtemplate.c | 27 +++++++++++++ 10 files changed, 154 insertions(+), 72 deletions(-) create mode 100644 gstreamer-sharp/StaticCaps.custom create mode 100644 gstreamer-sharp/StaticPadTemplate.custom create mode 100644 gstreamer-sharp/glue/staticcaps.c create mode 100644 gstreamer-sharp/glue/staticpadtemplate.c diff --git a/doc/en/Gst/StaticCaps.xml b/doc/en/Gst/StaticCaps.xml index 0b7f6b1abb..5c27683483 100644 --- a/doc/en/Gst/StaticCaps.xml +++ b/doc/en/Gst/StaticCaps.xml @@ -1,11 +1,11 @@ - + gstreamer-sharp 0.9.5.99 - System.ValueType + GLib.Opaque @@ -14,39 +14,17 @@ - - + Constructor0.9.5.99To be added.To be added.To be added.Constructor0.9.5.99To be added.To be added.To be added.Constructor0.9.5.99To be added.To be added.To be added.Property0.9.5.99Gst.StaticCapsTo be added.To be added.To be added. + Property Gst.Caps To be added.To be added.To be added. - 0.9.5.99 - - Method - Gst.Caps - - To be added.To be added.To be added. - 0.9.5.99 + 0.9.5.99Property0.9.5.99Gst.StaticCapsTo be added.To be added.To be added. Property GLib.GType To be added.To be added.To be added. - 0.9.5.99 - - Method - Gst.StaticCaps - - To be added.To be added.To be added.To be added. - 0.9.5.99 - - Field - System.String - To be added.To be added. - 0.9.5.99 - - Field - Gst.StaticCaps - To be added.To be added. - 0.9.5.99 + 0.9.5.99Property0.9.5.99System.StringTo be added.To be added.To be added. diff --git a/doc/en/Gst/StaticPadTemplate.xml b/doc/en/Gst/StaticPadTemplate.xml index 5ada4a69b4..676f374f37 100644 --- a/doc/en/Gst/StaticPadTemplate.xml +++ b/doc/en/Gst/StaticPadTemplate.xml @@ -1,11 +1,11 @@ - + gstreamer-sharp 0.9.5.99 - System.ValueType + GLib.Opaque @@ -17,54 +17,17 @@ - + Constructor0.9.5.99To be added.To be added.To be added.Constructor0.9.5.99To be added.To be added.To be added.To be added.To be added.To be added. Property Gst.Caps To be added.To be added.To be added. - 0.9.5.99 - - Field - Gst.PadDirection - To be added.To be added. - 0.9.5.99 - - Method - Gst.PadTemplate - - To be added.To be added.To be added. - 0.9.5.99 + 0.9.5.99Property0.9.5.99Gst.PadDirectionTo be added.To be added.To be added. Property GLib.GType To be added.To be added.To be added. - 0.9.5.99 - - Field - System.String - To be added.To be added. - 0.9.5.99 - - Method - Gst.StaticPadTemplate - - To be added.To be added.To be added.To be added. - 0.9.5.99 - - Field - Gst.PadPresence - To be added.To be added. - 0.9.5.99 - - Field - Gst.StaticCaps - To be added.To be added. - 0.9.5.99 - - Field - Gst.StaticPadTemplate - To be added.To be added. - 0.9.5.99 + 0.9.5.99Property0.9.5.99System.StringTo be added.To be added.To be added.Property0.9.5.99Gst.PadTemplateTo be added.To be added.To be added.Property0.9.5.99Gst.PadPresenceTo be added.To be added.To be added. diff --git a/doc/en/index.xml b/doc/en/index.xml index e0ec1cf0be..0179f400b9 100644 --- a/doc/en/index.xml +++ b/doc/en/index.xml @@ -167,8 +167,8 @@ - - + + diff --git a/gstreamer-sharp/Gstreamer.metadata b/gstreamer-sharp/Gstreamer.metadata index 4eb766a8ad..9f00f1b922 100644 --- a/gstreamer-sharp/Gstreamer.metadata +++ b/gstreamer-sharp/Gstreamer.metadata @@ -356,6 +356,16 @@ (State.Paused << 3) | State.Ready (State.Ready << 3) | State.Null + boxed + true + GetCaps + true + + boxed + true + GetPadTemplate + true + true 1 1 diff --git a/gstreamer-sharp/Makefile.am b/gstreamer-sharp/Makefile.am index 5c7db40f36..c3bff2d9b8 100644 --- a/gstreamer-sharp/Makefile.am +++ b/gstreamer-sharp/Makefile.am @@ -65,6 +65,8 @@ customs = \ Object.custom \ MiniObject.custom \ Registry.custom \ + StaticCaps.custom \ + StaticPadTemplate.custom \ Structure.custom diff --git a/gstreamer-sharp/StaticCaps.custom b/gstreamer-sharp/StaticCaps.custom new file mode 100644 index 0000000000..b375485841 --- /dev/null +++ b/gstreamer-sharp/StaticCaps.custom @@ -0,0 +1,48 @@ +[DllImport("gstreamersharpglue-0.10")] +static extern IntPtr gstsharp_gst_static_caps_get_string (IntPtr caps); + +public string String { + get { + IntPtr raw_ptr = gstsharp_gst_static_caps_get_string (Handle); + + if (raw_ptr == IntPtr.Zero) + return null; + + return GLib.Marshaller.Utf8PtrToString (raw_ptr); + } +} + +protected override void Free (IntPtr raw) { + GLib.Marshaller.Free (raw); +} + +[DllImport("gstreamersharpglue-0.10")] +static extern IntPtr gstsharp_gst_static_caps_new (string caps); + +public StaticCaps (Caps caps) { + Raw = gstsharp_gst_static_caps_new (caps.ToString ()); +} + +public StaticCaps (string caps) { + Raw = gstsharp_gst_static_caps_new (caps.ToString ()); +} + +private static StaticCaps empty = new StaticCaps ("EMPTY"); +private static StaticCaps any = new StaticCaps ("ANY"); + +public static StaticCaps Empty { + get { + return empty; + } +} + +public static StaticCaps Any { + get { + return any; + } +} + +public override string ToString () { + return String; +} + diff --git a/gstreamer-sharp/StaticPadTemplate.custom b/gstreamer-sharp/StaticPadTemplate.custom new file mode 100644 index 0000000000..76df07d5d4 --- /dev/null +++ b/gstreamer-sharp/StaticPadTemplate.custom @@ -0,0 +1,37 @@ +[DllImport("gstreamersharpglue-0.10")] +static extern IntPtr gstsharp_gst_static_pad_template_get_name_template (IntPtr handle); + +public string NameTemplate { + get { + IntPtr raw_ret = gstsharp_gst_static_pad_template_get_name_template (Handle); + + if (raw_ret == IntPtr.Zero) + return null; + + return GLib.Marshaller.Utf8PtrToString (raw_ret); + } +} + +[DllImport("gstreamersharpglue-0.10")] +static extern Gst.PadDirection gstsharp_gst_static_pad_template_get_pad_direction (IntPtr handle); +public Gst.PadDirection Direction { + get { + return gstsharp_gst_static_pad_template_get_pad_direction (Handle); + } +} + +[DllImport("gstreamersharpglue-0.10")] +static extern Gst.PadPresence gstsharp_gst_static_pad_template_get_pad_presence (IntPtr handle); +public Gst.PadPresence Presence { + get { + return gstsharp_gst_static_pad_template_get_pad_presence (Handle); + } +} + +[DllImport("gstreamersharpglue-0.10")] +static extern IntPtr gstsharp_gst_static_pad_template_new (string name_template, Gst.PadDirection direction, Gst.PadPresence presence, string caps); +public StaticPadTemplate (string name_template, Gst.PadDirection direction, Gst.PadPresence presence, Gst.Caps caps) +{ + Raw = gstsharp_gst_static_pad_template_new (name_template, direction, presence, caps.ToString ()); +} + diff --git a/gstreamer-sharp/glue/Makefile.am b/gstreamer-sharp/glue/Makefile.am index 80276a7820..2140ad2bb6 100644 --- a/gstreamer-sharp/glue/Makefile.am +++ b/gstreamer-sharp/glue/Makefile.am @@ -7,6 +7,8 @@ libgstreamersharpglue_0_10_la_SOURCES = \ message.c \ bin.c \ structure.c \ + staticcaps.c \ + staticpadtemplate.c \ gerror.c \ gobject.c diff --git a/gstreamer-sharp/glue/staticcaps.c b/gstreamer-sharp/glue/staticcaps.c new file mode 100644 index 0000000000..335b2ae255 --- /dev/null +++ b/gstreamer-sharp/glue/staticcaps.c @@ -0,0 +1,15 @@ +#include + +const gchar * +gstsharp_gst_static_caps_get_string (const GstStaticCaps *caps) { + return caps->string; +} + +GstStaticCaps * +gstsharp_gst_static_caps_new (const gchar *string) { + GstStaticCaps *caps = g_new0 (GstStaticCaps, 1); + + caps->string = g_strdup (string); + + return caps; +} diff --git a/gstreamer-sharp/glue/staticpadtemplate.c b/gstreamer-sharp/glue/staticpadtemplate.c new file mode 100644 index 0000000000..abcc3e604a --- /dev/null +++ b/gstreamer-sharp/glue/staticpadtemplate.c @@ -0,0 +1,27 @@ +#include + +const gchar * +gstsharp_gst_static_pad_template_get_name_template (const GstStaticPadTemplate *templ) { + return templ->name_template; +} + +GstPadDirection +gstsharp_gst_static_pad_template_get_direction (const GstStaticPadTemplate *templ) { + return templ->direction; +} + +GstPadPresence +gstsharp_gst_static_pad_template_get_presence (const GstStaticPadTemplate *templ) { + return templ->presence; +} + +GstStaticPadTemplate * +gstsharp_gst_static_pad_template_new (const gchar *name_template, GstPadDirection direction, GstPadPresence presence, const gchar *caps) { + GstStaticPadTemplate *ret = g_new0 (GstStaticPadTemplate, 1); + ret->name_template = g_strdup (name_template); + ret->direction = direction; + ret->presence = presence; + ret->static_caps.string = g_strdup (caps); + + return ret; +}