ncm: FLAC 解码落地(dr_flac 0.13.4 单头入库) + 缓存键=歌曲ID+音质档位

- 解码分发 decoder.c:magic(fLaC→dr_flac / 其它→minimp3);flac ≤16bit→S16、
  >16bit→S32 满幅送 audiod(AUDIO_FMT_S32),rate/ch/bits 按实际流,零 SRC 零裁剪
- song_url_auto 接受 flac(type 权威/url 扩展名兜底),降级语义不变;flac 下载限幅 1GB
- 缓存键 song_<id>_<level>.<ext>:同歌同档命中不重下,换档新条目旧档留 LRU;
  ext 前导点正名(修双点名),lookup 回退历史双点名+旧无档键温和兼容
- audio_out S32 通路(AUDIOD/ALSA/WAV)+ 流死重开按 bits 还原格式
- 验证(0 真实请求):44.1k/16 与 96k/24 自制样本宿主+qemu 帧数/时长精确、
  逐样本零误差;mp3 回归逐帧一致;player_flow_sim P1-P6(新 P6 档位键/flac ext)、
  cache_evict/cover/pagination/window/audiod_chain sim 全 PASS;mipsel 0 warning
- REPORT §19 / VENDOR_NOTES dr_flac 条目;未部署真机(留主会话)
This commit is contained in:
MeowOS committed 2026-09-01 14:14:38 +08:00
1 parent 80bc191593
commit 70aec677ce
23 files changed
+13377 -110

No files matched your search

+15
View File
@@ -142,6 +142,21 @@ static void test_cache(void) {
/* 恢复默认上限 */
ncm_cache_set_limit_gb(&c, 10);
CHECK(ncm_cache_limit_gb(&c) == 10, "limit_gb reset to 10");
/* §19 命名正名:ext 带前导点(".flac")与不带("flac")生成同一单点路径 */
char p2[NCM_CACHE_DIR_MAX + 32];
CHECKRC(ncm_cache_path(&c, "103", ".flac", p2, sizeof p2), "path with dotted ext");
CHECK(strstr(p2, "song_103.flac") != NULL && strstr(p2, "..") == NULL,
"dotted ext normalized to single dot (%s)", p2);
/* §19 温和兼容:历史双点名 song_<id>..mp3(旧版 ext 带前导点所致)lookup 可命中 */
{
char legacy[NCM_CACHE_DIR_MAX + 40];
snprintf(legacy, sizeof legacy, "%s/song_104..mp3", dir);
FILE *lf = fopen(legacy, "wb");
if (lf) { fputs("LEGACY", lf); fclose(lf); }
int lrc = ncm_cache_lookup(&c, "104", "mp3", path, sizeof path);
CHECK(lrc == NCM_OK && strstr(path, "song_104..mp3") != NULL,
"legacy double-dot name hit (rc=%d path=%s)", lrc, path);
}
}
static void test_qr(void) {
Binary file not shown.