Skip to content

mpv player: Android EGL fix for gg OpenGL renderer - #103

Closed
metif12 wants to merge 1 commit into
vlang:masterfrom
metif12:feat/mpv-player-egl-android
Closed

metif12 wants to merge 1 commit into
vlang:masterfrom
metif12:feat/mpv-player-egl-android

Conversation

@metif12

@metif12 metif12 commented Oct 28, 2026

Copy link
Copy Markdown
Member

Summary

examples/mpv_player/
├── main.v                 # gg window: video rect + ui2-driven controls
├── mpv_gl_loader.v        # EGL proc selection (the Android fix)
├── mpv_render_d_mpv.c.v   # libmpv bindings, only with -d mpv
├── player_state.v         # headless PlayerState + build_player_ui()
├── mpv_gl_loader_test.v   # GLX regression tests
├── player_state_test.v    # seek/volume/UI-tree tests
└── README.md              # build matrix

Call flow per frame:

on_frame
  mpv_render_context_update
  mpv_render_context_render(FBO 0, flip_y=1)
  mpv_render_context_report_swap
  draw ui2-built controls with gg

The Android-only bug: glXGetProcAddress with C #if defined(__linux__)
matches Android too (NDK defines __linux__ + __ANDROID__), where GLX
does not exist. Render context creation failed, black video with working
audio. Fix: eglGetProcAddress on Linux/Android (sokol forces EGL via
SOKOL_FORCE_EGL), GLX guarded by
#if defined(__linux__) && !defined(__ANDROID__).

Evidence

  • Before: loader returned GLX path on desktop design; C guard #if defined(__linux__) true on Android, glXGetProcAddress NULL, black video.
  • After:
    • v test examples/mpv_player — 2 passed.
    • v -os android -check, -os linux -check — pass.
    • v -enable-globals -d mpv -os android/linux -check — pass.
    • Red/green: flipped loader to buggy value, test went FAIL, restored to OK.

Merge Danger

Door: two-way

Examples only, no library code touched. Stub builds without libmpv;
real backend behind -d mpv.

Blast Radius: examples

@metif12
metif12 marked this pull request as draft October 28, 2026 10:49
@diiviocity diiviocity closed this Oct 29, 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.

2 participants