Skip to content

feat: FFmpeg n8.1.2 as C++ modules — full-feature source build via mcpp (v0.0.1)#1

Merged
Sunrisepeak merged 5 commits into
mainfrom
feat/v0.0.1-full-profile
Jul 18, 2026
Merged

feat: FFmpeg n8.1.2 as C++ modules — full-feature source build via mcpp (v0.0.1)#1
Sunrisepeak merged 5 commits into
mainfrom
feat/v0.0.1-full-profile

Conversation

@Sunrisepeak

@Sunrisepeak Sunrisepeak commented Jul 17, 2026

Copy link
Copy Markdown
Member

概要

ffmpeg-m v0.0.1:FFmpeg 8.1.2 的纯 C++23 模块层C API 原名原样、用法零迁移,只是不再需要头文件:

import ffmpeg.av;   // Python `import av` 风格;或按库 import ffmpeg.avcodec;

FFmpeg 源码不 vendor:经 compat.ffmpeg index 包到达消费者(官方 tarball + CN 镜像,sha256 钉死,全源码直编 2281 TU 含 157 NASM .asm,冷构建 ≈ 21s/32 核,构建期零 configure/make/CMake)。

内容

  • 模块层:ffmpeg.av 伞模块 + 7 库模块(依赖 export import 镜像库拓扑)+ lib-root ffmpeg;生成的导出面 978 函数 / 194 结构体 / 76 枚举 / 1450 枚举常量
  • 宏面:include/ffmpeg-m/macros.h 伴随头(须在 import 之前 include);C-only 复合字面量宏给出 C++ 等价物(av_err2string 族)
  • 工具:fetch_upstream.sh(官方 tarball 钉版下载)+ gen_exports.py(头文件 → 导出面;升级 FFmpeg = 重跑 + review diff)。compat 描述符流水线(gen_config/gen_descriptor)随描述符迁往 mcpp-index tools/compat-ffmpeg/
  • 测试:API 面 + 自包含 MJPEG/Matroska 编解码往返(逐帧亮度断言);examples:probe、decode_frames;template:decode(imgui-m 式)
  • LICENSE:模块层 MIT;上游经 compat.ffmpeg 为 LGPL-2.1-or-later(零 GPL/nonfree 部件)

CI

  • linux(required):xlings→mcpp(gcc@16.1.0)+ apt nasm;经已发布 index 解析 compat.ffmpeg(无桥接),build + test + 双 example
  • release:tag v* → 复验 build+test → 校验 tag 与包版本一致 → GitHub Release(自动 notes)

关联 mcpp issue(本项目产出)

验证(本地,mcpp 0.0.95 / gcc 16.1.0)

  • 无桥接冷验证:仅凭已发布 index 解析 compat.ffmpeg → 下载官方 tarball → 全源码直编 → 运行 ✓
  • mcpp buildmcpp test ✓(2 passed)
  • examples/probe ✓(358 demuxers,h264/hevc/av1/vp9/aac/opus/flac 全 ok) examples/decode_frames

设计与实现记录:.agents/docs/2026-07-18-ffmpeg-m-{research-and-plan,implementation}.md(含拆分与精简 addendum)

- vendor FFmpeg n8.1.2 (third_party/ffmpeg, LGPL-2.1+ hermetic profile)
- gen/linux-x86_64 configure snapshot + gen/public consumer-visible avconfig.h
- mcpp builds all 2281 sources (2124 .c + 157 NASM .asm) directly, ~21s cold
- module layer: import ffmpeg.av (+ 7 per-lib modules), C API names unchanged;
  generated export surface (978 fn / 194 struct / 76 enum / 1450 enumerators)
- include/ffmpeg-m/macros.h side header (include BEFORE import) + C++
  replacements for C-only compound-literal macros (av_err2string family)
- tools/: gen_config.sh (configure→snapshot), gen_sources.py (make -n →
  source list, dual-mode pending mcpp#229), gen_exports.py (headers→exports)
- tests: API surface + self-contained MJPEG/Matroska encode→decode roundtrip
- examples: probe, decode_frames; template: decode (imgui-m style)
- CI: linux required (build+test+examples), macOS snapshot machinery
  (experimental, artifact for future gen/macos-aarch64); release workflow
  (tag → verify → GitHub Release)

Refs: mcpp-community/mcpp#226 #227 #228 #229
…w the thin module layer

- drop third_party/ffmpeg (112MB vendor) and gen/ snapshots: sources, config
  snapshot, and the full build recipe now live in the compat.ffmpeg index
  package (mcpp-index#74, official tarball + CN mirror, sha256-pinned)
- mcpp.toml: module layer only + compat.ffmpeg = "8.1.2" dependency
- tools: fetch_upstream.sh (pinned official tarball) + gen_config.sh now emits
  the index descriptor directly (gen_descriptor.py); gen_sources.py removed
- CI: temporary index bridge until mcpp-index#74 publishes; macOS job reduced
  to packaging-machinery smoke (configure + source derivation)
- verified: build + test (2 passed) + both examples against the local index
  (157 .asm.o, 3260 SIMD symbols)
…line to mcpp-index

compat.ffmpeg 8.1.2 is published (mcpp-index#74 merged, artifact live), so:
- ci: remove the temporary compat-index bridge step
- ci: drop the macOS packaging-snapshot job (packaging machinery follows the
  descriptor to mcpp-index tools/compat-ffmpeg/)
- tools: keep only fetch_upstream.sh + gen_exports.py (export-surface regen);
  gen_config.sh / gen_descriptor.py move to mcpp-index
- delete stray tracked third_party fate refs from the vendored era
@Sunrisepeak
Sunrisepeak merged commit 87c2e97 into main Jul 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant