After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 131079 - [PATCH] [api] loading a class leaves elementfactory blank
[PATCH] [api] loading a class leaves elementfactory blank
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal normal
: 0.10.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
: 147970 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-01-10 11:21 UTC by Ronald Bultje
Modified: 2006-04-11 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to get a GstElementClass ref from a factory (2.73 KB, patch)
2004-11-02 16:10 UTC, Wim Taymans
none Details | Review

Description Ronald Bultje 2004-01-10 11:21:01 UTC
GstElementClass *klass;
    GstElementFactory *factory;

    factory = gst_element_factory_find (...);
    if (!gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory))) {
      g_warning ("Failed to load plugin feature \"%s\"",
                 elements[i]);
      continue;
    }
    klass = g_type_class_ref (factory->type);

This code will lead to an elementclass that has klass->elementfactory not
filled in.
Comment 1 Thomas Vander Stichele 2004-07-06 11:47:34 UTC
Ronald,

what are you saying exactly ? This code is already somewhere in gst and thus
wrong ? This is something you'd like to be able to do in code ? What do you mean ?
Comment 2 Ronald Bultje 2004-07-06 14:04:05 UTC
It's application code to select plugins, like gst-editor does.
Comment 3 Thomas Vander Stichele 2004-07-16 13:33:27 UTC
ok, but could you be more verbose ? what's wrong with this code ? what is the
actual bug ?
Comment 4 Ronald Bultje 2004-07-16 16:03:21 UTC
Well, make a .c file and add this code right after gst_init(). Add a random
plugin into the "..." (e.g. audioconvert) and then try to access
klass->elementfactory after this piece of code in your .c file, it will be NULL.
It should be filled in like it does when you create an element.

So the bug, in case you didn't yet get it by now, is that this piece of code
loads an element's details, but the elementfactory is not filled in, while it
should be filled in. Therefore, I cannot access the information in the
elementfactory; however, I do need that information. It doesn't matter *what* I
need it for, I just need it.
Comment 5 Ronald Bultje 2004-07-20 13:06:56 UTC
*** Bug 147970 has been marked as a duplicate of this bug. ***
Comment 6 Wim Taymans 2004-11-02 15:33:26 UTC
Is a gst_element_factory_ref_element_class a good option for you, it would
basically copy the stuff from the factory into the new element class, as is
currently done in gstelementfactory.c.
Comment 7 Wim Taymans 2004-11-02 16:10:37 UTC
Created attachment 33349 [details] [review]
patch to get a GstElementClass ref from a factory

something like this?
Comment 8 Ronald Bultje 2005-01-07 12:03:00 UTC
This would solve it, but requires code adjustment. Is it possible to do this
integrated in class_init? If not, then this is fine, but it's kind of
suboptimal, I'd rather see something better integrated.
Comment 9 Andy Wingo 2005-07-15 08:29:40 UTC
Ronald, any thoughts on this?
Comment 10 Wim Taymans 2006-04-11 11:48:22 UTC
gst_plugin_feature_ensure_loaded is gone, gst_plugin_feature_load() replaces it and does the same thing. 

When the plugin is loaded and gst_element_register() is called, the klass->elementfactory is filled in correctly in CVS.

Added docs to state that the ->type field is 0 when the feature is not loaded. Added check to test behaviour.

        * gst/gstelementfactory.c: (gst_element_register),
        (gst_element_factory_create), (gst_element_factory_make):
        Some cleanups.
        Fixed a FIXME.
        Updated docs (Fixes #131079)

        * gst/gstpluginfeature.c: (gst_plugin_feature_load):
        Small cleanups.

        * tests/check/gst/gstelement.c: (GST_START_TEST),
        (gst_element_suite):
        Added testcase for elementfactory class field.