Skip to content

fix(webview): gate VideoView/QtMultimedia behind Qt6 so Qt5 boards build#2946

Merged
vpetersson merged 1 commit into
masterfrom
fix-qt5-webview-build-no-qaudiodevice
May 28, 2026
Merged

fix(webview): gate VideoView/QtMultimedia behind Qt6 so Qt5 boards build#2946
vpetersson merged 1 commit into
masterfrom
fix-qt5-webview-build-no-qaudiodevice

Conversation

@vpetersson
Copy link
Copy Markdown
Contributor

@vpetersson vpetersson commented May 28, 2026

Issues Fixed

Docker Image Build has been red on master since #2905 — every push fails the pi2 and pi3 matrix legs at compile time:

src/videoview.h:3:10: fatal error: QAudioDevice: No such file or directory
 #include <QAudioDevice>

This blocks cutting a release.

Description

VideoView is a Qt 6 component (QMediaPlayer + QGraphicsVideoItem, <QAudioDevice> is Qt 6.2+). Pi 2 / Pi 3 still cross-compile against the frozen Qt 5.15 toolchain pinned at WebView-v2026.04.1, so they can't see the file. PR #2905 added videoview.cpp to AnthiasViewer.pro's SOURCES unconditionally and the Qt5 builds broke.

This change wraps every reference to VideoView in a QT_VERSION_CHECK(6, 0, 0) gate:

  • AnthiasViewer.proQT += multimedia multimediawidgets and the videoview.cpp/h entries move inside greaterThan(QT_MAJOR_VERSION, 5).
  • mainwindow.{h,cpp}playVideo / stopVideo slots and the videoEnded signal, plus the constructor's view→MainWindow relay, only declared/defined on Qt 6.
  • view.{h,cpp}#include "videoview.h", the videoView member, playVideo / stopVideo / hideVideoSurface, and the resize / loadPage / loadImage call-sites only built on Qt 6.

Safe at runtime: MediaPlayerProxy.get_instance in src/anthias_viewer/media_player.py routes Pi 1/2/3 to VLCMediaPlayer, which paints straight to the framebuffer and never calls AnthiasViewer's playVideo D-Bus slot. Qt6 boards (pi4-64, pi5, x86, arm64) keep the existing MPVMediaPlayer → D-Bus → VideoView path unchanged.

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have done an end-to-end test for Raspberry Pi devices.
  • I have tested my changes for x86 devices.
  • I added a documentation for the changes I have made (when necessary).

Test plan

  • python -m tools.image_builder --service viewer --build-target pi3 builds cleanly (Qt5 cross-compile, was the failing matrix leg).
  • x86 (Qt6) viewer image builds cleanly (verified locally).
  • Docker Image Build matrix green on this branch.

🤖 Generated with Claude Code

PR #2905 added VideoView (QMediaPlayer + QGraphicsVideoItem) for
in-process video playback on Qt6 boards, but the .pro included its
source on every build. Pi 2 / Pi 3 cross-compile against Qt 5.15 and
videoview.h includes `<QAudioDevice>` (Qt 6.2+ only), so the Qt5
toolchain fails at compile time — every Docker Image Build on master
since the PR landed has died at "videoview.h:3:10: fatal error:
QAudioDevice: No such file or directory".

Wrap VideoView (.pro entry, .h/.cpp include, the playVideo/stopVideo
slots on MainWindow + View, hideVideoSurface, the videoEnded relay
signal, and the resize/loadPage/loadImage call-sites) in a
QT_VERSION_CHECK(6, 0, 0) gate so Qt5 boards skip it cleanly. Safe
at runtime: pi2/pi3 route video through VLCMediaPlayer painting
straight to the framebuffer (see MediaPlayerProxy.get_instance in
src/anthias_viewer/media_player.py) and never call the AnthiasViewer
playVideo D-Bus slot.

Verified pi3 (Qt5, linux/arm/v7) viewer image builds cleanly via
`python -m tools.image_builder --service viewer --build-target pi3`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vpetersson vpetersson requested a review from a team as a code owner May 28, 2026 06:06
@vpetersson vpetersson self-assigned this May 28, 2026
@sonarqubecloud
Copy link
Copy Markdown

@vpetersson vpetersson merged commit b9095c3 into master May 28, 2026
7 checks passed
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