feat: add Windows SMTC (System Media Transport Controls) support - #737
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kt286 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @kt286. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's GuideAdds Windows System Media Transport Controls (SMTC) integration, wiring WinRT media controls into PlayerEngine and main startup, while keeping existing MPRIS/DBus logic Linux-only and linking required Windows libraries. Sequence diagram for Windows SMTC initialization and playback syncsequenceDiagram
participant Main
participant Presenter
participant PlayerEngine
participant WinSMTC
Main->>WinSMTC: ensureStartMenuShortcut()
Main->>Presenter: playerEngine()
Presenter-->>Main: PlayerEngine*
Main->>PlayerEngine: setWinSMTC(hwnd)
PlayerEngine->>WinSMTC: WinSMTC(this)
PlayerEngine->>WinSMTC: initialize(hwnd)
WinSMTC-->>PlayerEngine: initialized
PlayerEngine->>PlayerEngine: resetDBusMpris(meta)
PlayerEngine->>WinSMTC: updateMetadata(title, artist, album, length, artPath)
PlayerEngine->>PlayerEngine: [playbackStatusChanged]
PlayerEngine->>WinSMTC: updatePlaybackStatus(status)
Sequence diagram for Windows SMTC button handlingsequenceDiagram
actor User
participant SystemSMTC
participant WinSMTC
participant PlayerEngine
User->>SystemSMTC: media key press
SystemSMTC-->>WinSMTC: ButtonPressedEvent
WinSMTC-->>PlayerEngine: playRequested()
PlayerEngine->>PlayerEngine: resume() / play() / pauseNow()
User->>SystemSMTC: next key
SystemSMTC-->>WinSMTC: ButtonPressedEvent
WinSMTC-->>PlayerEngine: nextRequested()
PlayerEngine->>PlayerEngine: playNextMeta(false)
User->>SystemSMTC: previous key
SystemSMTC-->>WinSMTC: ButtonPressedEvent
WinSMTC-->>PlayerEngine: previousRequested()
PlayerEngine->>PlayerEngine: playPreMeta()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
2b69612 to
c774bc5
Compare
|
TAG Bot New tag: 7.0.63 |
|
TAG Bot New tag: 7.0.64 |
c774bc5 to
ac1ebd0
Compare
|
TAG Bot New tag: 7.0.65 |
|
TAG Bot New tag: 7.0.66 |
630eb0e to
eb4023a
Compare
|
代码审查反馈(V-3031)— 建议修改 需修复(阻塞):ButtonPressed 回调未解绑,退出时存在 use-after-free 风险
建议:将 token 存为成员(如 另需关注:
整体实现思路清晰,COM/teardown 加固后即可推进。 |
535788f to
4672208
Compare
- Add Windows System Media Transport Controls (SMTC) support - Wrap MprisPlayer include and usage in Q_OS_LINUX ifdef - Use void* placeholder for non-Linux platforms to maintain ABI - Add platform guards for setMprisPlayer in presenter and main - Update tests to conditionally compile MPRIS-dependent code feat: 添加 Windows SMTC 支持并为 MPRIS 添加 Linux 条件编译 - 新增 Windows System Media Transport Controls (SMTC) 支持 - 使用 Q_OS_LINUX ifdef 将 MprisPlayer 包裹为仅 Linux 可用 - 非 Linux 平台使用 void* 占位符保持 ABI 兼容 - 为 presenter 和 main 中的 setMprisPlayer 添加平台保护 - 更新测试代码的条件编译
- Store the ButtonPressed registration token as a member and remove it in shutdown() before releasing SMTC, fixing use-after-free crash when a media key is dispatched after the app exits - Guard setWinSMTC() against double initialization to avoid leaking the old WinSMTC object and duplicate signal connections - Move engine.rootObjects() emptiness check before first access in main.cpp to avoid undefined behavior when QML loading fails - Make the SMTC play fallback actually start playback (play() falls back to forcePlay() when the current meta has no localPath) - Pair RoInitialize/RoUninitialize and CoInitializeEx/CoUninitialize, and validate DataWriter StoreAsync results fix: 加固 WinSMTC 释放流程并修复 SMTC 播放回退 - ButtonPressed 注册 token 保存为成员,shutdown() 中先解绑再释放 SMTC, 修复应用退出后系统派发媒体键导致的 use-after-free 崩溃 - setWinSMTC() 增加双重初始化保护,避免泄漏旧对象并重复 connect - main.cpp 将 engine.rootObjects() 判空上移到首次访问之前, 避免 QML 加载失败时的未定义行为 - SMTC 播放回退改为真正触发播放(当前曲目无 localPath 时 play() 内部走 forcePlay()),按“播放”必定有声音 - 配对 RoInitialize/RoUninitialize 与 CoInitializeEx/CoUninitialize, 并校验 DataWriter StoreAsync 返回值
4672208 to
6f7de6c
Compare
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Implement Windows SMTC integration so the system media overlay can display current track info and respond to play/pause/next/previous commands, similar to MPRIS on Linux.
feat: 添加 Windows SMTC(系统媒体传输控件)支持
实现 Windows SMTC 集成,使系统媒体覆盖层可以显示当前曲目信息并响应
播放/暂停/下一曲/上一曲命令,类似 Linux 上的 MPRIS。
Summary by Sourcery
Integrate Windows SMTC support so Deepin Music can appear in system media controls and respond to playback commands.
New Features:
Enhancements:
Build:
Tests: