mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-09 14:18:11 +02:00
fix: native FLAC handling and extension API optimizations
Native FLAC handling: - Properly detect and publish native FLAC payloads inside MP4 containers - Rename to .flac extension and embed metadata instead of skipping - Fix all code paths: SAF, non-SAF, and native worker finalizer Extension API optimizations: - Enable response compression for API/search calls (faster metadata loads) - Keep downloads uncompressed for accurate progress/streaming - Add separate extensionAPITransport with compression enabled Platform bridge caching: - Cache handleURLWithExtension results (5 min TTL) - Cache customSearchWithExtension results (2 min TTL) - Prevent duplicate in-flight requests for same URL/query Dependency cleanup: - Remove unused sqflite_common_ffi and sqlite3 packages
This commit is contained in:
@@ -543,9 +543,20 @@ object NativeDownloadFinalizer {
|
||||
try {
|
||||
val codec = probePrimaryAudioCodec(localInput, shouldCancel)
|
||||
val isAlreadyNativeFlac = codec == "flac" && isNativeFlacFile(localInput)
|
||||
if (!isLosslessAudioCodec(codec) || isAlreadyNativeFlac) {
|
||||
val suffix = if (isAlreadyNativeFlac) " (native FLAC)" else ""
|
||||
Log.d(TAG, "Preserving native container; audio codec is ${codec.ifBlank { "unknown" }}$suffix")
|
||||
if (!isLosslessAudioCodec(codec)) {
|
||||
Log.d(TAG, "Preserving native container; audio codec is ${codec.ifBlank { "unknown" }}")
|
||||
return
|
||||
}
|
||||
if (isAlreadyNativeFlac) {
|
||||
Log.d(TAG, "Native FLAC payload detected; publishing as FLAC and embedding metadata")
|
||||
val nativeFlacOutput = if (localInput.lowercase(Locale.ROOT).endsWith(".flac")) {
|
||||
localInput
|
||||
} else {
|
||||
File(localInput).copyTo(File(output), overwrite = true).absolutePath
|
||||
}
|
||||
embedBasicMetadata(context, nativeFlacOutput, input, "flac")
|
||||
replaceStatePath(context, input, state, nativeFlacOutput, deleteOld = true)
|
||||
adoptedOutput = true
|
||||
return
|
||||
}
|
||||
val result = runFFmpeg(
|
||||
|
||||
Reference in New Issue
Block a user