Skip to content

cvcMedia: SDL3 audio out of cvcGL into a GL-free library; ari-media (media M4) - #934

Merged
transfix merged 5 commits into
masterfrom
feat/cvc-media-audio
Nov 2, 2026
Merged

transfix merged 5 commits into
masterfrom
feat/cvc-media-audio

Conversation

@transfix

Copy link
Copy Markdown
Owner

Media M4 from the design (#929, docs/roadmap/ARIADNE_MEDIA.md §5). It is independent of #931–#933 and based on master.

Why. ari is a terminal program, but SDL3's audio subsystem needs no window. The audio output lived in cvcGL, so playing sound meant linking GL, VTK and ImGui. This PR moves it into a GL-free library and adds ari-media, which plays sound in a terminal while the default ari stays lean.

cvcMedia (src/cvcMedia) is its own library and package, like cvcGL: find_package(cvcMedia) gives cvc::cvcMedia. That leaves the cvc package's single-target contract alone, and the libcvc SDK never links SDL.

  • It holds audio_output and audio_stream_player, moved with history from cvcGL. They are now cvc::media::playback, in cvc/media/playback/*.h, and add have_audio_output().
  • SDL3 is optional, and only its audio subsystem is used. Without SDL3 the output is empty, the same graceful absence cvcGL had.
  • cvcGL links cvcMedia and keeps cvc::gl::playback::* as aliases in its old headers, so media_verbs.cpp, arigl's conference mix and the tests are unchanged.
  • A standalone cvcGL build (the cvcgl recipe, -S src/cvcGL) builds cvcMedia beside itself and installs it. cvcGLConfig.cmake finds it, and the cvcgl recipe's package.files and cmake_packages now include it.
  • In a full-tree build it is built only for cvcGL or ari-media, so the libcvc recipe's package is unchanged.

ari-media is src/ari/main.cpp built with ARI_MEDIA and cvcMedia linked. ari-media info adds audio output (SDL3) yes and the playback devices; the field is in --json too. The video:/audio: widgets come in M5.

  • In-tree it is built with cvcGL or -DCVC_BUILD_ARI_MEDIA=ON.
  • New recipe cvcpkg/recipes/ari-media (linux, macos, windows): -S src/ari -DARI_WITH_MEDIA=ON. cvcMedia builds statically into the binary, so the package is bin/ari-media alone, with deps libcvc and sdl3.
  • The choice, recorded in the recipe and docs: a separate binary name rather than a second bin/ari, so the packages never collide and a launcher can prefer ari-media. A dlopen plugin was set aside as an ABI contract with libcvc's exact build on three OSes. The recipe is not wired into publish-cvcpkg yet, the same as the arigl recipes.

Verified locally (GCC 13, Release, GL deps prefix)

  • cvcmedia_audio_output (new) runs on SDL's dummy driver. It plays through the audio subsystem with SDL_WasInit(SDL_INIT_VIDEO) == 0, and /proc/self/maps shows no libGL, libEGL, libvtk, libimgui or libcvcGL.
  • ctest cvcgl_*(audio|media|mic|conference)|cvcmedia|ari_*|AriNet|AriTest passed 24/24: cvcgl_audio_output, audio_player, audio_source, media_audio, media_capture and media_play run through the aliases.
  • ldd ari-media shows libcvcMedia and libSDL3, with no VTK, GL or ImGui. ldd ari has no SDL.
  • Recipe path: after cmake --install of the tree, building -S src/ari -DARI_WITH_MEDIA=ON against that prefix produced ari-media with a static cvcMedia, linking only libcvc and SDL3.
  • A downstream find_package(cvcGL) consumer of the installed tree configures (cvcMedia re-found through cvcGLConfig), links and runs cvc::gl::playback::list_audio_playback_devices().
  • clang-format 18 is clean.

Not built locally: the Windows and macOS recipe scripts, and the wasm cvcGL build with cvcMedia, which CI's cvcGL wasm job covers.

…media M4)

cvcMedia (src/cvcMedia) is libcvc's GL-free media library, its own package
like cvcGL (find_package(cvcMedia), cvc::cvcMedia), so the cvc package's
single-target contract and the lean libcvc are untouched. It holds the SDL3
audio output and the auto-pumped stream player that were cvcGL's, now
cvc::media::playback (cvc/media/playback/*.h); SDL3 is optional and only its
audio subsystem is used. cvcGL links it and keeps the cvc::gl::playback names
as aliases, so the conference app and media verbs are unchanged; a
standalone cvcGL build (the cvcgl recipe) builds and installs it beside
itself, and the recipe ships it.

ari-media is the same ari with cvcMedia linked: sound with no window,
display, GL, VTK or ImGui (ari-media info lists the playback devices). It is
built with cvcGL or -DCVC_BUILD_ARI_MEDIA=ON in-tree, and by the new
ari-media recipe from src/ari with -DARI_WITH_MEDIA=ON, which links cvcMedia
statically, so the package is bin/ari-media alone (deps: libcvc, sdl3). The
lean ari links libcvc only, as before.

Test: cvcmedia_audio_output plays through SDL's dummy driver with the video
subsystem never initialized and no GL/VTK/ImGui/cvcGL loaded.
@transfix
transfix merged commit 24ed21d into master Nov 2, 2026
21 of 27 checks passed
@transfix
transfix deleted the feat/cvc-media-audio branch November 2, 2026 06:18
transfix added a commit that referenced this pull request Nov 2, 2026
…-media-video

Their changes are already here from their branches, so this keeps this tree
and makes the squashes ancestors, so the branch merges into master.
transfix added a commit that referenced this pull request Nov 2, 2026
…media M5, stacked on #933 + #934) (#935)

Media M5: `video:` and `audio:` widgets with poster, autoplay, loop, muted
and state-bound player keys, played natively by cvcMedia's FFmpeg + SDL3
player (`media.player`; ari-media and arigl, `--media-play`). Snapshots wait
for players whose URL a reply puts in state.
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