Commit 3dab455
authored
feat(pkg): compat.ffmpeg 三平台(+windows)+ 描述符瘦身 17.5k→9k 行 (#94)
* chore(ci): bump mcpp pin 0.0.99 → 0.0.100 (windows link rspfile #247, macOS build.mcpp posix_spawn #248, include_dirs_after #249)
* feat(pkg): compat.ffmpeg 3-platform + descriptor slimming (17.5k→9k lines)
Add windows-x86_64 (clang-MSVC, win64 NASM) as the third OS — mcpp v0.0.100
#247 (driver-style link rspfile) makes the ~2283-object link work on Windows.
Data/logic separation (mcpp 0.0.100 design doc §2.1-C), one descriptor now
covers 3 platforms in HALF the lines of the old 2-platform one:
- sources brace-glob compressed per dir (was 1-line-per-file, ~4300 lines back)
- 7 identical list files (codec/demuxer/muxer/parser/bsf/filter_list.c,
avconfig.h, ffversion.h) shared at neutral top-level
- config.{h,asm} + config_components.{h,asm} common/delta split: a neutral
<name>.base holds the #define lines identical across OSes, each per-OS file
#includes it + adds only its deltas (device components etc.); generator
self-checks base∪delta == original per OS
- ffmpeg source root ('*','*/libavcodec') moved to include_dirs_after
(-idirafter, mcpp#249) so libc++ <version> isn't shadowed by ffmpeg VERSION
on case-insensitive macOS (fixes the C++ module consumer)
tests/examples/ffmpeg: widen to cfg(windows); test asserts on all 3 OSes.
Generator: tools/compat-ffmpeg/gen_multiplatform.py. Parses clean on 0.0.100
xpkg parse --all-os (linux/macosx/windows).
* feat(pkg): compat.ffmpeg descriptor slimming 17.5k→13.2k (source glob-compression) + include_dirs_after
Optimize the compat.ffmpeg descriptor size (user: 一个文件几千行太夸张):
- sources brace-glob compressed per directory — PR#89's gen_mp.py had
regressed them to 1-line-per-file (~4300 lines); linux 29 / macosx 26 globs.
- ffmpeg source root ('*','*/libavcodec') → include_dirs_after (-idirafter,
mcpp#249) so libc++ <version> isn't shadowed by ffmpeg's VERSION on
case-insensitive macOS — fixes the macOS/Windows C++ module (import ffmpeg.av).
Generator: tools/compat-ffmpeg/gen_multiplatform.py (retains common/delta split
for when mcpp#251 lands — neutral generated_files + per-OS blocks then dedup the
config too, ffmpeg 3-platform → ~9k). Windows ffmpeg lands with that (its link
already works via #247). Parses clean on 0.0.100 xpkg parse --all-os.
* feat(pkg): compat.ffmpeg 3-platform + descriptor slim 17.5k→9k (fix: mcpp_generated/ key prefix)
The earlier avconfig.h-not-found failures were a generator bug of mine, NOT
mcpp: gen_multiplatform.py emitted generated_files keys WITHOUT the
mcpp_generated/ prefix, so they materialized off the -I include path. Fixed →
neutral dedup + common/delta split now materialize correctly under
mcpp_generated/ (locally verified: avconfig.h + config.base.h land there).
So the full data/logic-separation slimming lands: one descriptor, 3 platforms
(linux/macosx/windows), 9,027 lines (was 17,543 for 2). Windows ffmpeg link
works via mcpp#247. include_dirs_after (#249) fixes the macOS C++ module.
mcpp#251 was my misdiagnosis — closing it.
* fix(gen): strip src/ prefix from linux/macosx source globs (undefined avutil_version)
compress_sources kept the sources.txt 'src/' prefix (linux/macosx snapshots
carry it; windows doesn't), producing '*/src/libavcodec/...' globs that match
nothing → empty compat.ffmpeg → undefined avutil_version/avcodec_* at test link.
Strip src/ + drop the stray -Pconfig.asm artifact line. Verified: linux 2281 /
macosx 2091 / windows 2283 sources, all symbol-defining files (utils.c,
allcodecs.c, allformats.c) covered per OS.
* fix(gen): only ffmpeg root '*' on include_dirs_after; '*/libavcodec' stays -I
Windows opus/parser.c failed (ParseContext undefined) because I'd moved BOTH
'*' and '*/libavcodec' to include_dirs_after. Only '*' (the source root holding
the VERSION file that shadows libc++ <version> on case-insensitive macOS, #249)
needs -idirafter; '*/libavcodec' must stay on regular -I so ffmpeg's relative
"parser.h"-style includes resolve (windows clang-MSVC doesn't find them via
-idirafter). x86 asm include dirs also back on regular -I. macos+linux stay
green; windows now finds libavcodec/parser.h.
* fix(gen): dedup windows shared-source per-lib copies (LNK2005 ff_open)
FFmpeg's shared sources (file_open.c etc.) are compiled into each lib upstream;
the windows make-n snapshot captured file_open.c in 5 lib dirs, but mcpp builds
one lib → the per-lib copies collide (LNK2005 'ff_open already defined in
file_open.o'). linux/macosx snapshots list each shared source once and build
green. Fix: restrict any OS's shared-source basenames to the dirs the clean
(linux+macosx) reference uses — file_open.c → libavutil only; genuine distinct
same-basename files (libavcodec/4xm.c vs libavformat/4xm.c) stay (different
symbols). windows 2283→2279 sources.
* fix(gen): windows ldflags += strmiids/uuid/avicap32/shlwapi (dshow/vfwcap device link)
Windows link had unresolved DirectShow GUIDs (CLSID_*/IID_*/MEDIATYPE_* →
strmiids), VFW capCreateCaptureWindowA (→ avicap32), SHCreateStreamOnFileA (→
shlwapi) from libavdevice's dshow/vfwcap capture backends. All ffmpeg sources
COMPILE on windows (clang-MSVC); this was the last missing link libs.
* fix(gen): drop windows vfwcap device (avicap32.lib absent in toolchain SDK)
LNK1181: avicap32.lib not found — mcpp clang-MSVC SDK subset lacks it (dshow's
strmiids IS present). vfwcap = legacy VFW capture indev, niche. Drop on windows:
source excluded, &ff_vfwcap_demuxer removed from indev_list.c, CONFIG_VFWCAP_INDEV
→ 0, -lavicap32 removed. dshow/gdigrab capture kept (link clean via strmiids).1 parent 170cb11 commit 3dab455
4 files changed
Lines changed: 8788 additions & 17043 deletions
File tree
- pkgs/c
- tests/examples/ffmpeg
- tests
- tools/compat-ffmpeg
0 commit comments