pluginloading: add support for whitelisting based on plugin or source module name...
authorTim-Philipp Müller <tim.muller@collabora.co.uk>
Thu, 27 May 2010 11:36:10 +0000 (12:36 +0100)
committerTim-Philipp Müller <tim.muller@collabora.co.uk>
Wed, 23 Jun 2010 16:56:51 +0000 (17:56 +0100)
commit9c6b87510e854c39b4a4e53e21325bb7ce5b6693
tree625bf5f412b1289d7a66db680370870c48f2d99c
parent4a999b5e43b5cd9f6bc9b2d0615d8491cee23ec0
pluginloading: add support for whitelisting based on plugin or source module name and path

This feature is primarily intended for use in plugin modules' unit tests.

Consider the following situation: gst-plugins-good is built against an
installed GStreamer core. An older version of gst-plugins-good is also
installed in that prefix, along with random other plugin modules. Now,
when doing 'make check' in the just-built gst-plugins-good tree, we
want to only load plugins from GStreamer core, gst-plugins-base, and
gst-plugins-good, but not random other modules (we don't want any unit
tests to fail just because some module in gst-plugins-bad has a broken
plugin_init, for example). Also, we want to only load gst-plugins-good
modules from the locally-built source tree, but not any of the older
gst-plugins-good modules installed. This is usually assured by loading
the ones in the source tree first (by adding that path first to the
right environment variables), but it gets tricky when plugins are
moved, removed, merged, or renamed, or the plugin filename changes.

Note that 'make check' should really work right without doing
'make install' or uninstalling the old gst-plugins-good package (or
any other gst-plugins-foo package) first.

Enter GST_PLUGIN_LOADING_WHITELIST. This environment variable may
contain source-package@path-prefix pairs separated by the platform
search path separator (G_SEARCHPATH_SEPARATOR_S). The source package
and path prefix are separated by the '@' character. The path prefix is
entirely optional, as is the '@' separator if no path is given.

It is also possible to filter based on plugin names instead of the name
of the source-package by specifying one or more plugin names separated
by commas before the optional path prefix.

In short, the following match patterns are possible:

   plugin1,plugin2@pathprefix or
   plugin1,plugin2@* or just
   plugin1,plugin2 or
   source-package@pathprefix or
   source-package@* or just
   source-package

So for our gst-plugins-good unit test example above, we  would set the
environment variable on *nix to something like this (will likely be a
relative path in practice):
gstreamer:gst-plugins-base:gst-plugins-good@/path/to/src/gst-plugins-good

Fixes #619815 and #619717.
gst/gst_private.h
gst/gstplugin.c