Bundling gst-plugin-rs libraries in flatpak

Hi,
My application requires gst-plugin-rs gstreamer plugins bundled into the Flatpak. I’m using the org.gnome.Sdk runtime, which does not contain those plugins by default, so I need to build and install them myself.

I can build the plugins just fine, but I am unable to install the libraries into /usr/lib/x86_64-linux-gnu/gstreamer-1.0 directory, because that directory is read-only. Installing those plugins in /app directory does not make them discoverable by gstreamer.

Is there some proper way to bundle the gstreamer plugins?

Below is the fragment of the manifest that I am using to build the plugins. generated-sources.json was generated with the flatpak-cargo-generator.py tool.

{
  "app-id": "io.github.e_rk.hscam",
  "runtime": "org.gnome.Platform",
  "runtime-version": "46",
  "sdk": "org.gnome.Sdk",
  "sdk-extensions": ["org.freedesktop.Sdk.Extension.rust-stable"],
  "command": "hscam",
  "finish-args": [
    "--share=network",
    "--filesystem=xdg-config/hscam:create",
    "--socket=wayland",
    "--socket=fallback-x11",
    "--device=dri"
  ],
  "build-options": {
    "append-path": "/usr/lib/sdk/rust-stable/bin",
    "env": {
      "CARGO_HOME": "/run/build/gst-plugin-rs/cargo"
    }
  },
  "modules": [
    {
      "name": "gst-plugin-rs",
      "buildsystem": "simple",
      "build-options": {
        "env": {
          "CARGO_HOME": "/run/build/gst-plugin-rs/cargo"
        }
      },
      "build-commands": [
        "cargo cbuild --offline --release -p gst-plugin-gtk4 --prefix=/usr --libdir lib/x86_64-linux-gnu",
        "cargo cinstall --offline --release -p gst-plugin-gtk4 --prefix=/usr --libdir lib/x86_64-linux-gnu"
      ],
      "sources": [
        {
          "type": "git",
          "url": "https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git",
          "commit": "19cb695ce0e83a636aa5781788bb1b4640a5d75a"
        },
        "generated-sources.json"
      ]
    }
  ]
}

You have to set the GST_PLUGIN_PATH or GST_PLUGIN_SYSTEM_PATH environment variables

https://github.com/search?q=org%3Aflathub+"--env%3DGST_PLUGIN_"&type=code

https://gstreamer.freedesktop.org/documentation/gstreamer/gstregistry.html?gi-language=c

My application requires gst-plugin-rs gstreamer plugins

This will be included in Freedesktop SDK 24.08, coming out next month or so and GNOME 47 or 48 runtime.

That’s exactly what I needed. Thanks.

It’s also great that those plugins will be available by default in the near future.