diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-04-30 15:40:17 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-04-30 15:40:17 +0200 |
commit | f536534214f2cdc17f253af3e42854986393d56e (patch) | |
tree | a14d0c32b1fca5aa9e2bb82820ded98defdd85e6 | |
parent | c42ef5f916225f11bd15c8cde4f68ed06e615c34 (diff) |
Add convenience function to register Gst.Index types with the default registry
-rw-r--r-- | gstreamer-sharp/Index.custom | 13 | ||||
-rw-r--r-- | gstreamer-sharp/glue/Makefile.am | 3 | ||||
-rw-r--r-- | gstreamer-sharp/glue/indexfactory.c | 12 |
3 files changed, 27 insertions, 1 deletions
diff --git a/gstreamer-sharp/Index.custom b/gstreamer-sharp/Index.custom index 60b3529..aaaebf9 100644 --- a/gstreamer-sharp/Index.custom +++ b/gstreamer-sharp/Index.custom @@ -12 +12,14 @@ public bool IsWritable { } + +[DllImport ("gstreamersharpglue-0.10") ] +static extern void gstsharp_gst_index_factory_set_plugin (IntPtr factory, IntPtr plugin); + +public static bool Register (Gst.Plugin plugin, string name, string longdesc, GLib.GType gtype) { + Gst.IndexFactory factory = new Gst.IndexFactory (name, longdesc, gtype); + gstsharp_gst_index_factory_set_plugin (factory.Handle, (plugin != null) ? plugin.Handle : IntPtr.Zero); + + Gst.Registry.Default.AddFeature (factory); + + return true; +} + diff --git a/gstreamer-sharp/glue/Makefile.am b/gstreamer-sharp/glue/Makefile.am index c8d4a59..2a583aa 100644 --- a/gstreamer-sharp/glue/Makefile.am +++ b/gstreamer-sharp/glue/Makefile.am @@ -17,3 +17,4 @@ libgstreamersharpglue_0_10_la_SOURCES = \ typefind.c \ - indexentry.c + indexentry.c \ + indexfactory.c diff --git a/gstreamer-sharp/glue/indexfactory.c b/gstreamer-sharp/glue/indexfactory.c new file mode 100644 index 0000000..8949989 --- /dev/null +++ b/gstreamer-sharp/glue/indexfactory.c @@ -0,0 +1,12 @@ +#include <gst/gst.h> + +void +gstsharp_gst_index_factory_set_plugin (GstIndexFactory * factory, + GstPlugin * plugin) +{ + if (!plugin) + return; + + GST_PLUGIN_FEATURE (factory)->plugin_name = g_strdup (plugin->desc.name); + GST_PLUGIN_FEATURE (factory)->loaded = TRUE; +} |