mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
update for new plugin API
Original commit message from CVS: update for new plugin API
This commit is contained in:
parent
c8f8cd37b9
commit
419ce01981
6 changed files with 134 additions and 73 deletions
|
@ -1,3 +1,12 @@
|
|||
2005-09-18 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* configure.ac:
|
||||
* gst/gst.defs:
|
||||
* gst/gst.override:
|
||||
* gst/gstmodule.c: (init_gst):
|
||||
* testsuite/test_registry.py:
|
||||
update for new plugin API
|
||||
|
||||
2005-09-18 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/gst-types.defs:
|
||||
|
|
|
@ -23,7 +23,7 @@ dnl Add parameters for aclocal
|
|||
ACLOCAL="$ACLOCAL -I common/m4 $ACLOCAL_FLAGS"
|
||||
|
||||
dnl required versions of other packages
|
||||
AC_SUBST(PYGTK_REQ, 2.6.1)
|
||||
AC_SUBST(PYGTK_REQ, 2.4.1)
|
||||
AC_SUBST(GLIB_REQ, 2.0.0)
|
||||
AC_SUBST(GTK_REQ, 2.0.0)
|
||||
AC_SUBST(GST_REQ, 0.9.0)
|
||||
|
|
60
gst/gst.defs
60
gst/gst.defs
|
@ -3782,22 +3782,6 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method get_feature_list
|
||||
(of-object "GstPlugin")
|
||||
(c-name "gst_plugin_get_feature_list")
|
||||
(return-type "GList*")
|
||||
)
|
||||
|
||||
(define-method find_feature
|
||||
(of-object "GstPlugin")
|
||||
(c-name "gst_plugin_find_feature")
|
||||
(return-type "GstPluginFeature*")
|
||||
(parameters
|
||||
'("const-gchar*" "name")
|
||||
'("GType" "type")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function plugin_check_file
|
||||
(c-name "gst_plugin_check_file")
|
||||
(return-type "gboolean")
|
||||
|
@ -3816,14 +3800,6 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method add_feature
|
||||
(of-object "GstPlugin")
|
||||
(c-name "gst_plugin_add_feature")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GstPluginFeature*" "feature")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method load
|
||||
(of-object "GstPlugin")
|
||||
|
@ -4128,6 +4104,15 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method find_plugin
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_find_plugin")
|
||||
(return-type "GstPlugin*")
|
||||
(parameters
|
||||
'("const-gchar*" "name")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method feature_filter
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_feature_filter")
|
||||
|
@ -4148,15 +4133,25 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method find_plugin
|
||||
(define-method add_feature
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_find_plugin")
|
||||
(return-type "GstPlugin*")
|
||||
(c-name "gst_registry_add_feature")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-gchar*" "name")
|
||||
'("GstPluginFeature*" "feature")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method remove_feature
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_remove_feature")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GstPluginFeature*" "feature")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define-method find_feature
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_find_feature")
|
||||
|
@ -4167,6 +4162,15 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method lookup_feature
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_lookup_feature")
|
||||
(return-type "GstPluginFeature*")
|
||||
(parameters
|
||||
'("const-char*" "name")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method lookup
|
||||
(of-object "GstRegistry")
|
||||
(c-name "gst_registry_lookup")
|
||||
|
|
|
@ -604,35 +604,7 @@ _wrap_gst_plugin_feature_tp_str(PyObject *self)
|
|||
g_free (repr);
|
||||
return ret;
|
||||
}
|
||||
%%
|
||||
override gst_plugin_get_feature_list noargs
|
||||
static PyObject *
|
||||
_wrap_gst_plugin_get_feature_list(PyGObject *self)
|
||||
{
|
||||
PyObject *ret;
|
||||
PyObject *item;
|
||||
GList *l, *features;
|
||||
|
||||
features = gst_plugin_get_feature_list (GST_PLUGIN (self->obj));
|
||||
|
||||
ret = PyList_New(0);
|
||||
|
||||
for (l = features; l; l = g_list_next(l)) {
|
||||
item = pygobject_new((GObject *) GST_PLUGIN_FEATURE(l->data));
|
||||
|
||||
if (!item) {
|
||||
Py_DECREF(ret);
|
||||
return NULL;
|
||||
}
|
||||
PyList_Append(ret, item);
|
||||
|
||||
Py_DECREF(item);
|
||||
}
|
||||
|
||||
g_list_free(features);
|
||||
|
||||
return ret;
|
||||
}
|
||||
%%
|
||||
override gst_type_find_factory_get_caps noargs
|
||||
static PyObject *
|
||||
|
@ -695,6 +667,29 @@ _wrap_gst_main_quit(PyObject *self)
|
|||
return Py_None;
|
||||
}
|
||||
|
||||
%%
|
||||
override gst_registry_get_path_list
|
||||
static PyObject *
|
||||
_wrap_gst_registry_get_path_list (PyGObject *self)
|
||||
{
|
||||
GstRegistry *registry;
|
||||
GList *l, *paths;
|
||||
PyObject *list;
|
||||
|
||||
registry = GST_REGISTRY (self->obj);
|
||||
|
||||
paths = gst_registry_get_path_list (registry);
|
||||
|
||||
list = PyList_New (0);
|
||||
for (l = paths; l; l = l->next) {
|
||||
gchar *path = (gchar *) l->data;
|
||||
PyList_Append (list, PyString_FromString(path));
|
||||
}
|
||||
g_list_free (paths);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
%%
|
||||
override gst_registry_get_plugin_list
|
||||
static PyObject *
|
||||
|
@ -718,16 +713,29 @@ _wrap_gst_registry_get_plugin_list (PyGObject *self)
|
|||
return list;
|
||||
}
|
||||
|
||||
%%
|
||||
override gst_registry_get_feature_list kwargs
|
||||
static PyObject *
|
||||
_wrap_gst_registry_get_feature_list (PyGObject *self)
|
||||
_wrap_gst_registry_get_feature_list (PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "type", NULL };
|
||||
PyObject *py_type = NULL;
|
||||
GType type;
|
||||
|
||||
GstRegistry *registry;
|
||||
GList *l, *features;
|
||||
PyObject *list;
|
||||
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
"O:GstRegistry.get_feature_list", kwlist, &py_type))
|
||||
return NULL;
|
||||
if ((type = pyg_type_from_object(py_type)) == 0)
|
||||
return NULL;
|
||||
|
||||
registry = GST_REGISTRY (self->obj);
|
||||
|
||||
features = gst_registry_get_feature_list (registry);
|
||||
features = gst_registry_get_feature_list (registry, type);
|
||||
|
||||
list = PyList_New (0);
|
||||
for (l = features; l; l = l->next) {
|
||||
|
|
|
@ -45,6 +45,22 @@ extern PyObject *PyGstExc_LinkError;
|
|||
GST_DEBUG_CATEGORY (pygst_debug); /* for bindings code */
|
||||
GST_DEBUG_CATEGORY (python_debug); /* for python code */
|
||||
|
||||
/* copied from pygtk to register GType */
|
||||
#define REGISTER_TYPE(d, type, name) \
|
||||
type.ob_type = &PyType_Type; \
|
||||
type.tp_alloc = PyType_GenericAlloc; \
|
||||
type.tp_new = PyType_GenericNew; \
|
||||
if (PyType_Ready(&type)) \
|
||||
return; \
|
||||
PyDict_SetItemString(d, name, (PyObject *)&type);
|
||||
|
||||
#define REGISTER_GTYPE(d, type, name, gtype) \
|
||||
REGISTER_TYPE(d, type, name); \
|
||||
PyDict_SetItemString(type.tp_dict, "__gtype__", \
|
||||
o=pyg_type_wrapper_new(gtype)); \
|
||||
Py_DECREF(o);
|
||||
|
||||
|
||||
/* This is a timeout that gets added to the mainloop to handle SIGINT (Ctrl-C)
|
||||
* Other signals get handled at some other point where transition from
|
||||
* C -> Python is being made.
|
||||
|
@ -148,6 +164,7 @@ init_gst (void)
|
|||
PyDict_SetItemString(d, "pygst_version", tuple);
|
||||
Py_DECREF(tuple);
|
||||
|
||||
/* clock stuff */
|
||||
PyModule_AddIntConstant(m, "SECOND", GST_SECOND);
|
||||
PyModule_AddIntConstant(m, "MSECOND", GST_MSECOND);
|
||||
PyModule_AddIntConstant(m, "NSECOND", GST_NSECOND);
|
||||
|
@ -170,6 +187,14 @@ init_gst (void)
|
|||
pygst_register_classes (d);
|
||||
pygst_add_constants (m, "GST_");
|
||||
|
||||
/* make our types available */
|
||||
PyModule_AddObject (m, "TYPE_ELEMENT_FACTORY",
|
||||
pyg_type_wrapper_new(GST_TYPE_ELEMENT_FACTORY));
|
||||
PyModule_AddObject (m, "TYPE_INDEX_FACTORY",
|
||||
pyg_type_wrapper_new(GST_TYPE_INDEX_FACTORY));
|
||||
PyModule_AddObject (m, "TYPE_TYPE_FIND_FACTORY",
|
||||
pyg_type_wrapper_new(GST_TYPE_TYPE_FIND_FACTORY));
|
||||
|
||||
/* Initialize debugging category */
|
||||
GST_DEBUG_CATEGORY_INIT (pygst_debug, "pygst", 0, "GStreamer python bindings");
|
||||
GST_DEBUG_CATEGORY_INIT (python_debug, "python", 0, "python code using gst-python");
|
||||
|
|
|
@ -35,10 +35,25 @@ class RegistryTest(unittest.TestCase):
|
|||
|
||||
def testFeatureList(self):
|
||||
registry = gst.registry_get_default()
|
||||
features = registry.get_feature_list()
|
||||
self.assertRaises(TypeError, registry.get_feature_list, "kaka")
|
||||
|
||||
features = registry.get_feature_list(gst.TYPE_ELEMENT_FACTORY)
|
||||
elements = map(lambda f: f.get_name(), features)
|
||||
self.failUnless('fakesink' in elements)
|
||||
|
||||
features = registry.get_feature_list(gst.TYPE_TYPE_FIND_FACTORY)
|
||||
typefinds = map(lambda f: f.get_name(), features)
|
||||
|
||||
features = registry.get_feature_list(gst.TYPE_INDEX_FACTORY)
|
||||
indexers = map(lambda f: f.get_name(), features)
|
||||
self.failUnless('memindex' in indexers)
|
||||
|
||||
def testGetPathList(self):
|
||||
# FIXME: this returns an empty list; probably due to core;
|
||||
# examine problem
|
||||
registry = gst.registry_get_default()
|
||||
|
||||
paths = registry.get_path_list()
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in a new issue