Skip to content

Media over GStreamer, and what's playing over MPRIS - #18

Merged
colemancda merged 19 commits into
masterfrom
feature/media
Nov 23, 2026
Merged

colemancda merged 19 commits into
masterfrom
feature/media

Conversation

@colemancda

@colemancda colemancda commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Implements AppRuntime's media contracts on Linux: MediaPlayer.md over GStreamer, and NowPlaying.md over MPRIS. The player now draws VideoPlayer nodes.

  • LinuxMedia: AppRuntime's HostMediaPlayback runs the contract. It gets one GStreamer playbin per player (GStreamerEngine).
    • GStreamer is opened at run time, as WPE is. Without it every load fails with unavailable.
    • Pictures go to an appsink as RGBA, which holds at most one and drops older ones. Sound goes to the desktop's sound server through scaletempo, so changing the rate keeps the pitch.
    • The main loop polls the bus and the sink every 10 ms. No GStreamer thread ever calls into the host.
    • Covered: loading, play and pause, accurate seeks, rate, volume, mute, looping, the end, buffering for URLs, errors mapped to MediaError, and canPlay answered from GStreamer's registry.
  • What's playing: an MPRIS player, org.mpris.MediaPlayer2.<app id>, on the session bus, which the shell shows with its media controls and keys.
    • It shows the metadata, artwork, status, rate and position. The position is worked out when it's read.
    • Play, pause, seek and set-position go through HostMediaPlayback.remote. Next and previous go to the guest.
    • It emits PropertiesChanged on each report, and Seeked when the position jumps. The name is given up when the app stops describing a player.
    • .audio(background: true) makes canPlayInBackground true, since the desktop never sends an app to the background.
  • LinuxDBus serving: export serves an object through PureSwift/DBus's object server, with its methods and properties answered on the main loop.
    • requestName and releaseName take and give up a name; emit and emitPropertiesChanged send signals.
    • Objects and names are restored when the connection reconnects.
  • The view (HostVideoPlayer): the latest picture, fitted, filled or stretched as the node asks. Unless controls: none, it has a play/pause button, a scrubber and the time. The controls' pause is reported as the user's. HostNodeViews draws the node, because the synced NodeView has no VideoPlayer case yet.
  • LinuxFiles.configureIfNeeded(): media finds bundle and app files through HostFiles even when the app doesn't use Files.
  • The development image, CI and the README install GStreamer: its base and good plugins, and libav for H.264 and AAC.
  • Plan.md: §15 covers media and MPRIS, and §11.1 covers serving on D-Bus. Testing, Phases and Open questions move to §16–§18.

Testing: the full Linux suite passes in Docker (262 tests). The D-Bus and media suites passed two more runs.

  • Media tests run against real GStreamer, with sound going into fakesink. They play a WAV the tests write and an MJPEG AVI that GStreamer encodes.
  • The MPRIS and D-Bus serving tests run against a private dbus-daemon, with a second connection standing in for the shell.
  • VideoPlayer nodes lay out in LinuxUI's rendering test.

Not verified:

  • Nothing has played through a real sound server.
  • No real shell has shown the MPRIS player.
  • The view has been laid out but never looked at in a running app.
  • There's no interruption handling or hardware decoding yet.

@colemancda
colemancda merged commit 6ec8f30 into master Nov 23, 2026
2 checks passed
@colemancda colemancda changed the title Media over GStreamer Media over GStreamer, and what's playing over MPRIS Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant