feat: 将 command.rs 中的 ffmpeg 相关代码抽离到 helper/ffmp.rs 中, 同时将转发的Commad 改为异步#54
Merged
Conversation
Agent-Logs-Url: https://github.com/GuoJikun/quicklook/sessions/10af0b8a-ff1c-4b78-b209-23bebe40027a Co-authored-by: GuoJikun <21582741+GuoJikun@users.noreply.github.com>
Agent-Logs-Url: https://github.com/GuoJikun/quicklook/sessions/562616bb-179e-4739-95ac-3f4f0ab6fad6 Co-authored-by: GuoJikun <21582741+GuoJikun@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
GuoJikun
May 9, 2026 03:40
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR separates Tauri command-layer concerns from the ffmpeg implementation by moving #[command]-annotated entrypoints back into command.rs, while keeping helper/ffmp.rs as a plain Rust implementation module.
Changes:
- Exposed
helper::ffmpfromhelper/mod.rs. - Refactored
helper/ffmp.rsto contain only purepub fnimplementations (notauri::commandusage). - Added
#[command]wrappers incommand.rsthat delegate tohelper::ffmp, and updatedclear_cacheto callffmp::clear_ffmpeg_cache().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src-tauri/src/helper/mod.rs | Exposes the new ffmp helper module. |
| src-tauri/src/helper/ffmp.rs | Holds ffmpeg/HLS implementation logic without Tauri command attributes. |
| src-tauri/src/command.rs | Adds Tauri #[command] wrappers delegating to helper::ffmp and updates cache clearing call site. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // 同一文件若已在转换中,直接等待播放列表就绪并返回,避免重复启动 ffmpeg。 | ||
| { | ||
| let guard = FFMPEG_PROCESS.lock().unwrap(); |
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.
The previous refactor moved ffmpeg logic into
helper/ffmp.rsbut left#[command]attributes there too, mixing Tauri command layer concerns with implementation logic.Changes
helper/ffmp.rs— Removeduse tauri::commandand all#[command]attributes; functions are now plainpub fnimplementationscommand.rs— Replacedpub use ffmp::{...}re-exports with explicit#[command]wrappers that delegate toffmp:::lib.rsand theinvoke_handlerregistration are unchanged.