Feat/desktop mpv backend - #17
Merged
Merged
Conversation
…open flags on Windows
There was a problem hiding this comment.
Pull request overview
This PR replaces the desktop (JVM) VLC/vlcj media backend with an mpv (libmpv via JNA) backend, including a software-rendered video surface and updated DI/UI wiring to use the new player implementation.
Changes:
- Introduces a libmpv JNA binding (
MpvLibrary) and a handle wrapper (MpvPlayer) with an event-pump thread and mpv option/property management. - Adds a Swing
JPanelsoftware-render surface (MpvVideoSurfacePanel) using mpv’s SW render API and integrates it into playback. - Switches desktop DI and UI from
VlcPlayerAdaptertoMpvPlayerAdapter, removes vlcj dependencies, and updates module loaders accordingly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| media/media-jvm/src/main/java/com/simpmusic/media_jvm/mpv/MpvVideoSurfacePanel.kt | New Swing panel implementing mpv SW rendering into a BufferedImage. |
| media/media-jvm/src/main/java/com/simpmusic/media_jvm/mpv/MpvPlayerAdapter.kt | Ports the previous adapter logic to mpv and adds DJ/AutoMix crossfade behavior. |
| media/media-jvm/src/main/java/com/simpmusic/media_jvm/mpv/MpvPlayer.kt | New libmpv handle wrapper (options, event pump, playback control, audio filter chain). |
| media/media-jvm/src/main/java/com/simpmusic/media_jvm/mpv/MpvLibrary.kt | New JNA bindings for libmpv + helpers (render params, EDL URL building, locale handling). |
| media/media-jvm/src/main/java/com/simpmusic/media_jvm/di/DesktopPlayerModule.kt | Switches the injected desktop backend to MpvPlayerAdapter and renames the loader function. |
| media/media-jvm/build.gradle.kts | Removes vlcj dependency and adds JNA dependency for libmpv binding. |
| media/media-jvm-ui/src/main/java/com/maxrave/media_jvm_ui/ui/MediaPlayerView.kt | Updates UI to construct/use MpvPlayer and collects the mpv video surface component. |
| media/media-jvm-ui/build.gradle.kts | Removes vlcj dependency from the UI module. |
| domain/src/commonMain/kotlin/com/maxrave/domain/mediaservice/player/MediaPlayerListener.kt | Updates a comment to remove VLC-specific wording. |
| data/src/jvmMain/kotlin/com/maxrave/data/di/loader/Loader.jvm.kt | Updates loader call from loadVlcModule() to loadDesktopPlayerModule(). |
| media/media-jvm/src/main/java/com/simpmusic/media_jvm/MacOsVlcDiscoverer.kt | Removes VLC macOS native discovery strategy (backend no longer uses vlcj). |
| media/media-jvm/src/main/java/com/simpmusic/media_jvm/DefaultVlcDiscoverer.kt | Removes VLC Windows/Linux native discovery strategy (backend no longer uses vlcj). |
Comments suppressed due to low confidence (1)
media/media-jvm/src/main/java/com/simpmusic/media_jvm/mpv/MpvPlayerAdapter.kt:1724
outgoingPlayeris nullable (val outgoingPlayer = currentPlayer), but this block callsoutgoingPlayer.setRate(...)andoutgoingPlayer.setPitchScale(...)without a null-check. This will not compile and can also race ifcurrentPlayerchanges during a crossfade. Wrap the updates in alet(or otherwise makeoutgoingPlayernon-null) before calling these methods.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+237
to
+243
| val thread = renderThread | ||
| renderThread = null | ||
| try { | ||
| thread?.join(1000) | ||
| } catch (_: InterruptedException) { | ||
| Thread.currentThread().interrupt() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.