Migrate mediamp-ffmpeg usage from CLI bridge to structured Kotlin API (v0.1.9)#3006
Open
GeneralK1ng wants to merge 3 commits into
Open
Migrate mediamp-ffmpeg usage from CLI bridge to structured Kotlin API (v0.1.9)#3006GeneralK1ng wants to merge 3 commits into
GeneralK1ng wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades mediamp to v0.1.9 and migrates the HTTP downloader’s HLS merge flow from the legacy FFmpegKit.execute(List<String>) CLI-args bridge to the new structured MediaTranscoder().execute(MediaOperation) API, while also addressing platform build/packaging issues introduced by the dependency update.
Changes:
- Replace raw FFmpeg argument list construction with
MediaOperation.Remux+MediaTranscoderexecution inKtorHttpDownloader. - Update downloader tests to mock/validate
MediaOperationinstead of CLI args. - Bump
mediampto0.1.9and add Android/proguard packaging adjustments (META-INF native-image duplicates; JavaCPP dontwarns), plus an iOS-related import fix.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| utils/http-downloader/src/commonMain/kotlin/KtorHttpDownloader.kt | Switch HLS segment merging from CLI args to MediaOperation.Remux + MediaTranscoder. |
| utils/http-downloader/src/commonTest/kotlin/KtorHttpDownloaderTest.kt | Update test stubs/assertions to validate MediaOperation.Remux fields instead of arg lists. |
| torrent/anitorrent/src/commonMain/kotlin/session/AnitorrentDownloadSession.kt | Restore kotlin.jvm.JvmField import to fix compilation. |
| gradle/libs.versions.toml | Upgrade mediamp version to 0.1.9. |
| app/shared/proguard-rules.pro | Add -dontwarn rules for JavaCPP-referenced JVM-only classes on Android. |
| app/android/build.gradle.kts | Resolve Android packaging conflict via pickFirsts for META-INF/native-image/**. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| input = localPlaylistFile.absolutePath, | ||
| output = finalOutput.inSystem.absolutePath, | ||
| allowedExtensions = "ALL", | ||
| protocolWhitelist = "file,crypto,data", |
Comment on lines
1005
to
1007
| logger.info { | ||
| "Running FFmpeg merge for ${st.downloadId}: ffmpeg ${ffmpegArgs.joinToString(" ") { it.quoteForLog() }}" | ||
| "Running FFmpeg merge for ${st.downloadId}: $operation" | ||
| } |
Comment on lines
+443
to
+445
| val remux = lastMediaOperation as? MediaOperation.Remux | ||
| assertEquals("ALL", remux?.allowedExtensions) | ||
| assertEquals("file,crypto,data", remux?.protocolWhitelist) |
Member
|
Windows runReleaseDistribute 出现这个问题: 应该是 proguard rules 缺失? |
Member
Author
应该是缺 .dll 解包,尝试最新的构建 |
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.
What
FFmpegKit.execute(List<String>)CLI bridge with the new typedMediaTranscoder().execute(MediaOperation)API introduced in mediamp 0.1.9.0.1.8→0.1.9and switch from local composite build to the published Maven Central artifacts.JvmFieldunresolved reference) and Android packaging conflict (META-INF/native-image/**duplicates).Where
utils/http-downloader/src/commonMain/kotlin/KtorHttpDownloader.kt—mergeM3u8Segments()now constructsMediaOperation.Remuxinstead of a raw argument list;executeFfmpeg(args)→executeMediaOperation(operation).utils/http-downloader/src/commonTest/kotlin/KtorHttpDownloaderTest.kt— mock override and assertions updated to match the newMediaOperationshape.gradle/libs.versions.toml,settings.gradle.kts,local.properties— version bump and disable local composite build.app/android/build.gradle.kts— addpickFirstsforMETA-INF/native-image/**.torrent/anitorrent/src/commonMain/kotlin/session/AnitorrentDownloadSession.kt— restore missing importkotlin.jvm.JvmField.Why
FFmpegKitAPI is a thin CLI wrapper that builds and parses command-line strings internally. The newMediaTranscoderAPI provides a type-safe, structured interface that is easier to maintain, test, and extend (e.g.adding per-stream bitstream filters or custom muxer options without string manipulation).
Related
feat(ffmpeg): migrate from CLI bridge to libav*-based Kotlin API with CLI fallback