GNOME Bugzilla – Bug 655346
Gst.ElementFactory().create("element_name") passes NULL to Gstreamer
Last modified: 2011-10-10 21:41:47 UTC
This is confirmed using newest jhbuild with 3.2 moduleset and Fedora 15 default. 1. Python script from gi.repository import Gst Gst.init(None) element = Gst.ElementFactory().create("level") print element 2. Run it using GST_DEBUG=*:3 0:00:00.000184311 8626 0x9d58f90 INFO GST_INIT gst.c:605:init_pre: Initializing GStreamer Core Library version 0.10.32 0:00:00.000306044 8626 0x9d58f90 INFO GST_INIT gst.c:606:init_pre: Using library installed in /usr/lib 0:00:00.000348578 8626 0x9d58f90 INFO GST_INIT gst.c:616:init_pre: Linux pecisk-test.vsaa.lv 2.6.38.6-26.rc1.fc15.i686 #1 SMP Mon May 9 20:43:14 UTC 2011 i686 0:00:00.000552444 8626 0x9d58f90 INFO GST_INIT gstquery.c:107:_gst_query_initialize: init queries 0:00:00.002342756 8626 0x9d58f90 INFO GST_INIT gstmessage.c:73:_gst_message_initialize: init messages 0:00:00.003328845 8626 0x9d58f90 INFO GST_PLUGIN_LOADING gstplugin.c:350:_gst_plugin_initialize: registering 0 static plugins 0:00:00.003715557 8626 0x9d58f90 INFO GST_PLUGIN_LOADING gstplugin.c:255:gst_plugin_register_static: registered static plugin "staticelements" 0:00:00.003763468 8626 0x9d58f90 INFO GST_PLUGIN_LOADING gstplugin.c:257:gst_plugin_register_static: added static plugin "staticelements", result: 1 0:00:00.004435201 8626 0x9d58f90 INFO GST_REGISTRY gstregistry.c:1599:ensure_current_registry: reading registry cache: /home/pecisk/.gstreamer-0.10/registry.i386.bin 0:00:00.029915116 8626 0x9d58f90 INFO GST_REGISTRY gstregistrybinary.c:614:gst_registry_binary_read_cache: loaded /home/pecisk/.gstreamer-0.10/registry.i386.bin in 0,025414 seconds 0:00:00.030119960 8626 0x9d58f90 INFO GST_REGISTRY gstregistry.c:1469:scan_and_update_registry: Validating plugins from registry cache: /home/pecisk/.gstreamer-0.10/registry.i386.bin 0:00:00.034866093 8626 0x9d58f90 INFO GST_REGISTRY gstregistry.c:1561:scan_and_update_registry: Registry cache has not changed 0:00:00.034907649 8626 0x9d58f90 INFO GST_REGISTRY gstregistry.c:1628:ensure_current_registry: registry reading and updating done, result = 1 0:00:00.034939915 8626 0x9d58f90 INFO GST_INIT gst.c:792:init_post: GLib runtime version: 2.28.8 0:00:00.034976582 8626 0x9d58f90 INFO GST_INIT gst.c:794:init_post: GLib headers version: 2.28.3 0:00:00.035019115 8626 0x9d58f90 INFO GST_INIT gst.c:450:gst_init_check: initialized GStreamer successfully (<unknown>:8626): GStreamer-CRITICAL **: gst_registry_find_plugin: assertion `name != NULL' failed 0:00:00.038125516 8626 0x9d58f90 WARN GST_PLUGIN_LOADING gstpluginfeature.c:128:gst_plugin_feature_load: Failed to load plugin containing feature '(null)'. 0:00:00.038174405 8626 0x9d58f90 WARN GST_ELEMENT_FACTORY gstelementfactory.c:405:gst_element_factory_create:<elementfactory468> loading plugin containing feature level returned NULL! 3. Get printed None and Warning (<unknown>:8547): GStreamer-CRITICAL **: gst_registry_find_plugin: assertion `name != NULL' failed None Expected result: PyGI passes string and returns corespondent element or NULL if there's no such element with this string as name.
> 1. Python script > from gi.repository import Gst > Gst.init(None) > element = Gst.ElementFactory().create("level") > > (<unknown>:8626): GStreamer-CRITICAL **: gst_registry_find_plugin: assertion > `name != NULL' failed I can reproduce this. However, it's really wrong usage, and it sems to me that the bug is with pygi. It should detect that this is wrong usage. The C prototype is like this: GstElement * gst_element_factory_create (GstElementFactory * factory, const gchar * name); This means that you should use it like this: >>> from gi.repository import Gst >>> Gst.init(None) [] >>> factory=Gst.ElementFactory().find("level") >>> print factory <ElementFactory object at 0x201ce10 (GstElementFactory at 0x2201480)> >>> element=factory.create("mylevel") >>> print element <__main__.GstLevel object at 0x201ce60 (GstLevel at 0x225c170)> >>> print element.get_name() mylevel which seems to work fine for me.
I wanted to add info that yes, I used it wrongly (didn't understand concept), so sorry about noise in bugzilla.
Ok, will close it then, thanks for confirming. Please clone the bug or re-open if you think it should be fixed in pygi.