mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
- Added rank to plugin features (for future use)
Original commit message from CVS: - Added rank to plugin features (for future use) - update docs in gsturi
This commit is contained in:
parent
34a0dbe98f
commit
5886cb87ab
3 changed files with 55 additions and 27 deletions
|
@ -41,11 +41,13 @@ typedef struct _GstPluginFeature GstPluginFeature;
|
||||||
typedef struct _GstPluginFeatureClass GstPluginFeatureClass;
|
typedef struct _GstPluginFeatureClass GstPluginFeatureClass;
|
||||||
|
|
||||||
struct _GstPluginFeature {
|
struct _GstPluginFeature {
|
||||||
GObject object;
|
GObject object;
|
||||||
|
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
gint rank;
|
||||||
|
|
||||||
gpointer manager;
|
/* --- private --- */
|
||||||
|
gpointer manager;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstPluginFeatureClass {
|
struct _GstPluginFeatureClass {
|
||||||
|
|
67
gst/gsturi.c
67
gst/gsturi.c
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
*
|
*
|
||||||
* gsttype.c: Media-type management functions
|
* gsturi.c: register URI handlers
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -20,13 +20,6 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* TODO:
|
|
||||||
* probably should set up a hash table for the type id's, since currently
|
|
||||||
* it's a rather pathetic linear search. Eventually there may be dozens
|
|
||||||
* of id's, but in reality there are only so many instances of lookup, so
|
|
||||||
* I'm not overly worried yet...
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
|
|
||||||
#include "gsturi.h"
|
#include "gsturi.h"
|
||||||
|
@ -43,10 +36,10 @@ static GstPluginFeatureClass *parent_class = NULL;
|
||||||
GType
|
GType
|
||||||
gst_uri_handler_get_type (void)
|
gst_uri_handler_get_type (void)
|
||||||
{
|
{
|
||||||
static GType typefactory_type = 0;
|
static GType urihandler_type = 0;
|
||||||
|
|
||||||
if (!typefactory_type) {
|
if (!urihandler_type) {
|
||||||
static const GTypeInfo typefactory_info = {
|
static const GTypeInfo urihandler_info = {
|
||||||
sizeof (GstURIHandlerClass),
|
sizeof (GstURIHandlerClass),
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -58,10 +51,10 @@ gst_uri_handler_get_type (void)
|
||||||
(GInstanceInitFunc) gst_uri_handler_init,
|
(GInstanceInitFunc) gst_uri_handler_init,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
typefactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
|
urihandler_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
|
||||||
"GstURIHandler", &typefactory_info, 0);
|
"GstURIHandler", &urihandler_info, 0);
|
||||||
}
|
}
|
||||||
return typefactory_type;
|
return urihandler_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -85,11 +78,16 @@ gst_uri_handler_init (GstURIHandler *factory)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_uri_handler_new:
|
* gst_uri_handler_new:
|
||||||
* @definition: the definition to use
|
* @name: the name of the feature
|
||||||
|
* @uri: the uri to register
|
||||||
|
* @longdesc: a description for this uri
|
||||||
|
* @element: an element that can handle the uri
|
||||||
|
* @property: the property on the element to set the uri
|
||||||
*
|
*
|
||||||
* Creata a new typefactory from the given definition.
|
* Creates a plugin feature to register an element that can
|
||||||
|
* handle the given uri on the given property.
|
||||||
*
|
*
|
||||||
* Returns: the new typefactory
|
* Returns: the new urihandler
|
||||||
*/
|
*/
|
||||||
GstURIHandler*
|
GstURIHandler*
|
||||||
gst_uri_handler_new (const gchar *name,
|
gst_uri_handler_new (const gchar *name,
|
||||||
|
@ -120,7 +118,7 @@ gst_uri_handler_new (const gchar *name,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_uri_handler_find:
|
* gst_uri_handler_find:
|
||||||
* @name: the name of the typefactory to find
|
* @name: the name of the urihandler to find
|
||||||
*
|
*
|
||||||
* Return the URIHandler with the given name.
|
* Return the URIHandler with the given name.
|
||||||
*
|
*
|
||||||
|
@ -140,6 +138,14 @@ gst_uri_handler_find (const gchar *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_uri_handler_find_by_uri:
|
||||||
|
* @uri: the uri to find a handler for
|
||||||
|
*
|
||||||
|
* Find a URIHandler for the given uri.
|
||||||
|
*
|
||||||
|
* Returns: a GstURIHandler that can handle the given uri.
|
||||||
|
*/
|
||||||
GstURIHandler*
|
GstURIHandler*
|
||||||
gst_uri_handler_find_by_uri (const gchar *uri)
|
gst_uri_handler_find_by_uri (const gchar *uri)
|
||||||
{
|
{
|
||||||
|
@ -163,18 +169,37 @@ gst_uri_handler_find_by_uri (const gchar *uri)
|
||||||
return handler;
|
return handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_uri_handler_create:
|
||||||
|
* @handler: the uri handler to use
|
||||||
|
* @name: the name of the element
|
||||||
|
*
|
||||||
|
* Create an element with the given name from the given handler.
|
||||||
|
*
|
||||||
|
* Returns: a new element associated with the handler.
|
||||||
|
*/
|
||||||
GstElement*
|
GstElement*
|
||||||
gst_uri_handler_create (GstURIHandler *factory, const gchar *name)
|
gst_uri_handler_create (GstURIHandler *handler, const gchar *name)
|
||||||
{
|
{
|
||||||
GstElement *element = NULL;
|
GstElement *element = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (factory != NULL, NULL);
|
g_return_val_if_fail (handler != NULL, NULL);
|
||||||
|
|
||||||
element = gst_element_factory_make (factory->element, name);
|
element = gst_element_factory_make (handler->element, name);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_uri_handler_make_by_uri:
|
||||||
|
* @uri: the uri
|
||||||
|
* @name: the name of the element
|
||||||
|
*
|
||||||
|
* Create an element with the given name that can handle the given
|
||||||
|
* uri. This function will also use set the uri on the element.
|
||||||
|
*
|
||||||
|
* Returns: a new element that can handle the uri.
|
||||||
|
*/
|
||||||
GstElement*
|
GstElement*
|
||||||
gst_uri_handler_make_by_uri (const gchar *uri, const gchar *name)
|
gst_uri_handler_make_by_uri (const gchar *uri, const gchar *name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
||||||
* 2000 Wim Taymans <wtay@chello.be>
|
* 2000 Wim Taymans <wtay@chello.be>
|
||||||
*
|
*
|
||||||
* gstscheduler.h: Header for default scheduler code
|
* gsturi.h: Header for uri to element mappings
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Library General Public
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
@ -43,6 +43,7 @@ typedef struct _GstURIHandlerClass GstURIHandlerClass;
|
||||||
struct _GstURIHandler {
|
struct _GstURIHandler {
|
||||||
GstPluginFeature feature;
|
GstPluginFeature feature;
|
||||||
|
|
||||||
|
/* --- public ---- */
|
||||||
gchar *uri; /* The uri that is described */
|
gchar *uri; /* The uri that is described */
|
||||||
gchar *longdesc; /* description of the uri */
|
gchar *longdesc; /* description of the uri */
|
||||||
gchar *element; /* The element that can handle this uri */
|
gchar *element; /* The element that can handle this uri */
|
||||||
|
@ -58,12 +59,12 @@ GType gst_uri_handler_get_type (void);
|
||||||
GstURIHandler* gst_uri_handler_new (const gchar *name,
|
GstURIHandler* gst_uri_handler_new (const gchar *name,
|
||||||
const gchar *uri, const gchar *longdesc,
|
const gchar *uri, const gchar *longdesc,
|
||||||
const gchar *element, gchar *property);
|
const gchar *element, gchar *property);
|
||||||
void gst_uri_handler_destroy (GstURIHandler *factory);
|
void gst_uri_handler_destroy (GstURIHandler *handler);
|
||||||
|
|
||||||
GstURIHandler* gst_uri_handler_find (const gchar *name);
|
GstURIHandler* gst_uri_handler_find (const gchar *name);
|
||||||
GstURIHandler* gst_uri_handler_find_by_uri (const gchar *uri);
|
GstURIHandler* gst_uri_handler_find_by_uri (const gchar *uri);
|
||||||
|
|
||||||
GstElement* gst_uri_handler_create (GstURIHandler *factory, const gchar *name);
|
GstElement* gst_uri_handler_create (GstURIHandler *handler, const gchar *name);
|
||||||
GstElement* gst_uri_handler_make_by_uri (const gchar *uri, const gchar *name);
|
GstElement* gst_uri_handler_make_by_uri (const gchar *uri, const gchar *name);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
Loading…
Reference in a new issue