The Pi 4's two HDMI connectors share one vc4 DRM card, and DRM master is exclusive per card -- so the old per-connector-mpv design could never light the second screen (the mirror mpv died with "Failed to acquire DRM master: Permission denied"). Replace it with a minimal X server started by the mediapi-mpv unit via xinit: X is the single DRM master, xrandr --same-as clones the first output onto every other connected HDMI, and one fullscreen mpv renders to both. Uses hwdec=v4l2m2m-copy (Pi HW decoder, ~1/3 the CPU of software) and carries audio + the app's sole IPC socket. - new scripts/mediapi-session.sh (X client: waits for connectors, mirrors, execs mpv); rewritten mediapi-mpv unit (xinit on VT7) - delete scripts/start-mpv.py and all mirror-socket/broadcast code in player.py, config.py, __init__.py -- a single mpv means one socket - install.sh installs xserver-xorg-core/xinit/x11-xserver-utils, writes /etc/X11/Xwrapper.config, adds the user to input,tty - README + troubleshooting updated Verified from a cold boot on the Pi: both pixelvalve CRTCs scan the same framebuffer; app healthy; HW decode engaged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
635 B
Python
27 lines
635 B
Python
from flask import Flask
|
|
|
|
from .auth import register_auth_gate
|
|
from .config import Config
|
|
from .player import PlayerStateManager
|
|
from .routes.api_routes import bp as api_bp
|
|
from .routes.auth_routes import bp as auth_bp
|
|
from .routes.pages import bp as pages_bp
|
|
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
app.config.from_object(Config)
|
|
|
|
app.register_blueprint(auth_bp)
|
|
app.register_blueprint(pages_bp)
|
|
app.register_blueprint(api_bp)
|
|
|
|
register_auth_gate(app)
|
|
|
|
app.player = PlayerStateManager(
|
|
app.config["MPV_SOCKET"],
|
|
app.config["VIDEO_EXTENSIONS"],
|
|
)
|
|
app.player.start()
|
|
|
|
return app
|