mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
typefind: pass extensions as comma-separated list in a simple string
Fix annoying gst_type_find_register() function signature. A simple string with comma-separated extensions works just as well and saves lines of code, casts, relocations and ultimately kittens.
This commit is contained in:
parent
18118218b1
commit
83002ac63e
3 changed files with 10 additions and 9 deletions
|
@ -47,8 +47,8 @@ G_DEFINE_POINTER_TYPE (GstTypeFind, gst_type_find);
|
|||
* @name: The name for registering
|
||||
* @rank: The rank (or importance) of this typefind function
|
||||
* @func: The #GstTypeFindFunction to use
|
||||
* @extensions: (transfer none) (array zero-terminated=1) (element-type utf8):
|
||||
* Optional extensions that could belong to this type
|
||||
* @extensions: (allow-none): Optional comma-separated list of extensions
|
||||
* that could belong to this type
|
||||
* @possible_caps: Optionally the caps that could be returned when typefinding
|
||||
* succeeds
|
||||
* @data: Optional user data. This user data must be available until the plugin
|
||||
|
@ -64,7 +64,7 @@ G_DEFINE_POINTER_TYPE (GstTypeFind, gst_type_find);
|
|||
*/
|
||||
gboolean
|
||||
gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
|
||||
GstTypeFindFunction func, gchar ** extensions,
|
||||
GstTypeFindFunction func, const gchar * extensions,
|
||||
GstCaps * possible_caps, gpointer data, GDestroyNotify data_notify)
|
||||
{
|
||||
GstTypeFindFactory *factory;
|
||||
|
@ -80,9 +80,12 @@ gst_type_find_register (GstPlugin * plugin, const gchar * name, guint rank,
|
|||
gst_plugin_feature_set_name (GST_PLUGIN_FEATURE_CAST (factory), name);
|
||||
gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE_CAST (factory), rank);
|
||||
|
||||
if (factory->extensions)
|
||||
if (factory->extensions) {
|
||||
g_strfreev (factory->extensions);
|
||||
factory->extensions = g_strdupv (extensions);
|
||||
factory->extensions = NULL;
|
||||
}
|
||||
if (extensions)
|
||||
factory->extensions = g_strsplit (extensions, ",", -1);
|
||||
|
||||
gst_caps_replace (&factory->caps, possible_caps);
|
||||
factory->function = func;
|
||||
|
|
|
@ -114,7 +114,7 @@ gboolean gst_type_find_register (GstPlugin * plugin,
|
|||
const gchar * name,
|
||||
guint rank,
|
||||
GstTypeFindFunction func,
|
||||
gchar ** extensions,
|
||||
const gchar * extensions,
|
||||
GstCaps * possible_caps,
|
||||
gpointer data,
|
||||
GDestroyNotify data_notify);
|
||||
|
|
|
@ -42,14 +42,12 @@ static GstStaticCaps foobar_caps = GST_STATIC_CAPS ("foo/x-bar");
|
|||
/* make sure the entire data in the buffer is available for peeking */
|
||||
GST_START_TEST (test_buffer_range)
|
||||
{
|
||||
static gchar *foobar_exts[] = { (char *) "foobar", NULL };
|
||||
|
||||
GstStructure *s;
|
||||
GstBuffer *buf;
|
||||
GstCaps *caps;
|
||||
|
||||
fail_unless (gst_type_find_register (NULL, "foo/x-bar",
|
||||
GST_RANK_PRIMARY + 50, foobar_typefind, (gchar **) foobar_exts,
|
||||
GST_RANK_PRIMARY + 50, foobar_typefind, "foobar",
|
||||
FOOBAR_CAPS, NULL, NULL));
|
||||
|
||||
buf = gst_buffer_new ();
|
||||
|
|
Loading…
Reference in a new issue