Gst-inspect-1.0 --exists doesn't evaluate true for plugin that gst-inspect-1.0 without the exists flag does

Hello,

I’ve got a slightly weird problem. I’m trying to build an application, and I want to check that certain GStreamer plugins are available at meson setup time. I thought I could use gst-inspect-1.0 --exists to find whether the plugins exist, but for some reason not every plugin that is installed on the system results in a return value of 0. However, if I list all the plugins available it appears in that list, and using gst-inspect-1.0 without the --exists flag shows the properties of the plugin just fine.

I’ve looked into how gst-inspect-1.0 works, and it seems that for the --exists flag, it relies on the gst_registry_lookup_feature command. More confusingly still, if I create a noddy application which calls that directly, it works:

int main (int argc, char *argv[]) {
  GstPluginFeature *feature;

  gst_init (&argc, &argv);

  feature = gst_registry_lookup_feature (gst_registry_get (), "quicsrc");
  if (feature == NULL) printf ("Couldn't find quicsrc!\n");
  else printf ("Found quicsrc!\n");
  return feature != NULL;
}

So I’m just really confused. Is this a bug in gst-inspect-1.0? Or is there a better way I should be doing this anyway?

Thanks,
-Sam

Just to make sure: What version are you using? (gst-inspect-1.0 --version)

Can you provide some specific examples that don’t work as you would expect?

It seems to work fine here (1.22.8) with some quick tests (checking for element factory names, not plugin names)

$ ( gst-inspect-1.0 --exists filesrc4 >/dev/null && echo yep ) || echo nope
nope
$ ( gst-inspect-1.0 --exists filesrc >/dev/null && echo yep ) || echo nope
yep
$ ( gst-inspect-1.0 --exists bin >/dev/null && echo yep ) || echo nope
yep
$ ( gst-inspect-1.0 --exists coreelements >/dev/null && echo yep ) || echo nope
nope

Hi Tim, thanks for the quick response.

I’m using a fairly up to date version from Git.

$: gst-inspect-1.0 --version
gst-inspect-1.0 version 1.23.0
GStreamer 1.23.0 (GIT)
Unknown package origin
$: ( gst-inspect-1.0 --exists filesrc4 >/dev/null && echo yep ) || echo nope
nope
$: ( gst-inspect-1.0 --exists filesrc >/dev/null && echo yep ) || echo nope
yep
$: ( gst-inspect-1.0 --exists bin >/dev/null && echo yep ) || echo nope
yep
$: ( gst-inspect-1.0 --exists coreelements >/dev/null && echo yep ) || echo nope
nope
$: ( gst-inspect-1.0 --exists h264parse >/dev/null && echo yep ) || echo nope
yep
$: ( gst-inspect-1.0 --exists quicsrc >/dev/null && echo yep ) || echo nope
nope

I should also mention that I’ve got these plugins installed in a different location to where the regular plugins live, which is then provided using the GST_PLUGIN_PATH environment variable.

As this is trying to find an element which I’ve written myself, I’m also not sure if I haven’t just missed something when creating the elements themselves, although I did use the gst-template to create their boilerplate: gst-quic-transport/elements/gstquicsrc.c at d34b9be6d4e16ea524790ebe61b5862caa22309a · bbc/gst-quic-transport · GitHub

Fascinating. I see what you mean if I try it on a plugin that requires me to set GST_PLUGIN_PATH.

Looks like a bug, although I’m not sure what or where it would be right now.

Good to know I’m not going completely crazy. If you want me to log a bug report somewhere for this, let me know where and I can fill one out.

If you could file a bug in GitLab that’d be great.

Done! gst-inspect-1.0 --exists option doesn't work with GST_PLUGIN_PATH (#3246) · Issues · GStreamer / gstreamer · GitLab

1 Like