Skip to content

Latest commit

 

History

History
149 lines (117 loc) · 7.75 KB

README.md

File metadata and controls

149 lines (117 loc) · 7.75 KB

gst.wasm is a GStreamer port to WebAssembly. Its main goal is to implement the support of WebAssembly in GStreamer (and its dependencies) and bring the changes upstream. This repository is a placeholder to keep up-to-date information required on how to build, develop, and deploy GStreamer in a browser or in a node.js runtime environment until all the information is finally merged into the corresponding projects.

The stack

We use the standard libraries and tools used on GStreamer. The gray boxes are the dependencies and the green ones are new projects that will become part of mainstream GStreamer.

block-beta
  columns 3
  gst["gst-plugins-web"]:1
  space
  js["js-gstreamer-bindings"]:1
  browser["Browser/Node.js"]:3
  Emscripten:3
  GStreamer:3
  GLib Orc Cerbero
  libffi space meson
  style browser fill:#90e2f7,stroke:#4a7580;
  style gst fill:#cee741,stroke:#728024;
  style js fill:#cee741,stroke:#728024;
  style Emscripten fill:#90e2f7,stroke:#4a7580;
  style GStreamer fill:#e6e6e6,stroke:#808080;
  style GLib fill:#e6e6e6,stroke:#808080;
  style Orc fill:#e6e6e6,stroke:#808080;
  style Cerbero fill:#e6e6e6,stroke:#808080;
  style libffi fill:#e6e6e6,stroke:#808080;
  style meson fill:#e6e6e6,stroke:#808080;
Loading

Dependencies

GStreamer has plenty of dependencies, especially at the plugin level, but our goal is focused on the core ones, as shown in the gray boxes of the above diagram. All dependencies use the git-upstream-workflow meaning that all branches will be committed upstream and all features are cumulative.

GLib

We use the fork at Fluendo in the gst.wasm branch.

We forked the excellent work done by kleisauke which is also a fork of GNOME.

The current status is grouped in the next cumulative branches:

GStreamer

We use the fork at Fluendo in the gst.wasm branch.

The current status is grouped in the next cumulative branches:

  • 🔄 meson_fix_nls: Use nls option to set ENABLE_NLS (PR link)
  • wasm-main-function-pointer: Fix null function or function signature mismatch runtime errors (Branch link)
  • wasm-main-enable: Enable support for wasm (Branch link)
  • wasm-main-test: Enable unit tests for wasm (Branch link)
  • wasm-main-openal: Add emscripten support OpenAL to play audio (Branch link)
  • wasm-main-gl-support: Add emscripten OpenGL backend (Branch link)
  • wasm-main-videodec (Branch link)
  • wasm-main-webtransport (Branch link)
  • wasm-main-wip: Commits in progress (Branch link)

Cerbero

We use the fork at Fluendo in the gst.wasm branch.

The current status is grouped in the next cumulative branches:

  • 🟢 tests: Bring back tests (PR link)
  • 🟢 tests2: Update more tests. Second round (PR link)
  • 🔄 tests3: Tests update final round (PR link)
  • local_source: New type of source that allows you to build a recipe without fetching or copying sources (PR link)
  • packaging: Enable installation using pip with a git-https repository (PR link)
  • emscripten: Add support for building for wasm target with emscripten toolchain (Branch link)
  • emscripten-gl: Add OpenGL support in gst-plugins-base through new Emscripten based WebGL backend (Branch link)

Usage

Samples

We keep on sync all the samples found at samples into a public website to test them easily from any browser.

videotestsrc ball pattern

Prepare environment

To build an environment, you can use steps from CI:

poetry install
git config --global protocol.file.allow always
poetry run cerbero -c build/gst.wasm.cbc bootstrap
poetry run cerbero -c build/gst.wasm.cbc build gst.wasm

As a result, in the local directory build/gst.wasm_web_wasm32/dist/web_wasm32 you've got all the needed packages with corresponding *.pc files, which could be used to build your project based on the WASM version of GStreamer and its dependencies:

$ ls build/gst.wasm_web_wasm32/dist/web_wasm32
bin  include  lib  share

Compile samples

cd gst.wasm
meson --cross-file=emscripten-crossfile.meson _builddir

Running the samples

emrun _builddir/subprojects/videotestsrc/videotestsrc-example.html
emrun _builddir/subprojects/audiotestsrc/index.html # Press the 'play' button to hear to a sound.
emrun _builddir/subprojects/openal/openal-example.html # Click to hear to a sound.

Development

Refer to the Development guide

Coding style

Refer to the Coding Style guide

Resources

Aknowledgements

  • Special thanks to Fluendo for promoting and funding this project
  • To @kleisauke for doing the first libffi/GLib to WASM port