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 570233 - allow plugins caching data in the registry
allow plugins caching data in the registry
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: 0.10.24
Assigned To: Stefan Sauer (gstreamer, gtkdoc dev)
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-02 15:57 UTC by Stefan Sauer (gstreamer, gtkdoc dev)
Modified: 2009-06-07 20:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add cache_data to GstPlugin (4.33 KB, patch)
2009-06-06 20:49 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
none Details | Review

Description Stefan Sauer (gstreamer, gtkdoc dev) 2009-02-02 15:57:36 UTC
the audio resampler runs a small benchmark every time the plugin_init is called. besides from delaying this for when its actually needed, it would be nice if the element could check if the registry has this cached, if not compute it and cache it.
Comment 1 Stefan Sauer (gstreamer, gtkdoc dev) 2009-02-09 20:20:38 UTC
Other usecases could be:
* caching device properties for hardware related sinks and sources
* caching connection parameters for stream sources (for servers)

I think it would be even okay to reset the cache when core is bumped. This way we avoid accumullation of cache data)
Comment 2 Sebastian Dröge (slomo) 2009-02-10 08:26:59 UTC
Sounds like a very good idea... this should probably be stored as a key-value list/array where the keys are normal strings and the values are GValues that we serialize to strings for storing inside the registry.
Comment 3 Stefan Sauer (gstreamer, gtkdoc dev) 2009-02-10 08:40:17 UTC
You mean a GstStructure :)
Comment 4 Sebastian Dröge (slomo) 2009-02-10 09:24:25 UTC
Err... yes, a serialized GstStructure containing no pointer/boxed GValues ;)
Comment 5 Stefan Sauer (gstreamer, gtkdoc dev) 2009-02-16 09:38:51 UTC
One more place where this is handy would we sub-registries. Try this;

GST_DEBUG="ladspa:4" gst-launch ladspa-sawtooth-fa-oa ! audioconvert ! autoaudiosink

Everytime one instantiates a wrapper plugin the first time it scans the plugins once again.

Not sure if this case could be handled with a (nested) GstStructure too (should be okay).
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2009-05-24 11:08:41 UTC
It can handled simillar to uri-handler iface in registry. Instead of GstElementFactory (in the uri-handler case) we would extend GstPluginFeature to have a GstStructure *extra_data; and add _set/get functions.

Plugins would need to access or produce this data in plugin_init().

GstPluginFeature *my_feature;
GstStructure *data;

/* getting the feature from the plugin itself would be useful */
my_feature = gst_registry_lookup_feature(
  gst_registry_get_default(), "my-plugin");

data =  gst_plugin_feature_get_extra_data (my_feature);
if(!data) {
  /* we are running in registry update */
  data = gather_data(...);
  gst_plugin_feature_set_extra_data (my_feature, data);
}

/* use the cache data */
register_elements (plugin, data);
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2009-05-26 18:56:41 UTC
Inside the binary registry this is eary to be implemented using:

gchar *gst_structure_to_string (const GstStructure *structure);
GstStructure *gst_structure_from_string(const gchar *string, gchar **end);
Comment 8 Stefan Sauer (gstreamer, gtkdoc dev) 2009-06-06 20:49:12 UTC
Created attachment 136067 [details] [review]
add cache_data to GstPlugin

Do it in GstPlugin and not GstPluginFeature. This way we don'T need to lookup the feature in plugin_init, which would not work anyway (is NULL).
Comment 9 Stefan Sauer (gstreamer, gtkdoc dev) 2009-06-07 20:52:40 UTC
Same patch as before, but make the returned GStStructure const and add new API to win32/def file.

commit ed88db818b64982adcdcc29e88ad476358a0757d
Author: Stefan Kost <ensonic@users.sf.net>
Date:   Sun Jun 7 23:46:54 2009 +0300

    registry: allow plugins to cache extra data in registry. Fixes #570233
    
    Add a GstStructure to GstPlugin. Plugins can retieve it in plugin_init and
    access the cached info or build the cache and store it there.