mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-02 06:31:08 +00:00
Add convenience function to register Gst.Index types with the default registry
This commit is contained in:
parent
c42ef5f916
commit
f536534214
3 changed files with 27 additions and 1 deletions
|
@ -10,3 +10,16 @@ public bool IsWritable {
|
|||
return ( ( (uint) Flags) & ( (uint) Gst.IndexFlags.Writable)) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
[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;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,8 @@ libgstreamersharpglue_0_10_la_SOURCES = \
|
|||
pad.c \
|
||||
gobject.c \
|
||||
typefind.c \
|
||||
indexentry.c
|
||||
indexentry.c \
|
||||
indexfactory.c
|
||||
|
||||
nodist_libgstreamersharpglue_0_10_la_SOURCES = generated.c
|
||||
|
||||
|
|
12
gstreamer-sharp/glue/indexfactory.c
Normal file
12
gstreamer-sharp/glue/indexfactory.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue