ffmpeg-v4l2-request-fourier: export ff_h264_set_mb_inspect_cb (0016 amend, PKGREL 15) #108

Merged
marfrit merged 1 commits from claude-noether/marfrit-packages:noether/h264-mb-inspect-export-symbol into main 2026-05-26 14:54:28 +00:00
Owner

Bug-fix to 0016 (originally merged in #106) so dlsym-based consumers can resolve the inspection callback symbol.

Problem

The 0016 patch declared ff_h264_set_mb_inspect_cb in h264dec.h and defined it in h264_mb.c, but didn't touch libavcodec/libavcodec.v. FFmpeg's default version script exports only av_*, avcodec_*, avpriv_*, and avsubtitle_free; everything else is hidden as LOCAL behind a * glob. Result:

$ readelf -Ws /opt/fourier/lib/libavcodec.so.62 | grep ff_h264_set_mb_inspect_cb
 20550: 000000000042a8a0    20 FUNC    LOCAL  DEFAULT   12 ff_h264_set_mb_inspect_cb
$ nm -D /opt/fourier/lib/libavcodec.so.62 | grep ff_h264_set_mb_inspect_cb
(nothing)

The static-link CLI consumer (daedalus_decode_h264, built via DAEDALUS_FFMPEG_PREFIX) was unaffected — static linking doesn't care about symbol visibility. The daedalus-v4l2 daemon shadow_decoder path (daedalus-v4l2 PR-Q3a.1, merged today) dlopens libavcodec.so.62 and resolves the callback via dlsym — that needs the symbol exported.

Observable: running the daemon with DAEDALUS_SHADOW_MODE=1 against the freshly-published release -14 still logged libavcodec lacks ff_h264_set_mb_inspect_cb (stock build, no daedalus-fourier 0016 patch) — shadow-mode unavailable. The symbol IS in the .so as LOCAL; the daemon just can't reach it.

Fix

Add ff_h264_set_mb_inspect_cb to the global list in libavcodec/libavcodec.v. Single-line addition to the 0016 patch. Mirrored across the arch/ + debian/ patch trees.

PKGREL bump 14 → 15, changelog entry added (debian side). PKGBUILD pkgrel bumped on arch side too. No behaviour change to the decode path: the callback is still opt-in via the H264Context function pointer; only consumers that have explicitly installed a callback pay the one-load-one-branch cost per MB.

Verified

  • patch -p1 --dry-run against the kwiboo b57fbbe source tree applies cleanly across all three files (h264dec.h, h264_mb.c, libavcodec.v).
  • Once CI publishes -15 and hertz installs it, nm -D /opt/fourier/lib/libavcodec.so.62 | grep ff_h264_set_mb_inspect_cb should return a T (GLOBAL TEXT) entry, and the daemon's startup log should switch from "shadow-mode unavailable" to shadow_decoder: enabled (DAEDALUS_SHADOW_MODE=1, daedalus-decoder version 0.0.1).

dejavu-check

Fixing the existing 0016 observation-hook to actually work as a dlsym intercept (the architectural shape the patch was designed for). NOT adding new per-kernel substitution. Same shape, same patch number, same intent. Just hiding/exporting plumbing.

Bug-fix to 0016 (originally merged in #106) so dlsym-based consumers can resolve the inspection callback symbol. ## Problem The 0016 patch declared `ff_h264_set_mb_inspect_cb` in `h264dec.h` and defined it in `h264_mb.c`, but didn't touch `libavcodec/libavcodec.v`. FFmpeg's default version script exports only `av_*`, `avcodec_*`, `avpriv_*`, and `avsubtitle_free`; everything else is hidden as LOCAL behind a `*` glob. Result: ``` $ readelf -Ws /opt/fourier/lib/libavcodec.so.62 | grep ff_h264_set_mb_inspect_cb 20550: 000000000042a8a0 20 FUNC LOCAL DEFAULT 12 ff_h264_set_mb_inspect_cb $ nm -D /opt/fourier/lib/libavcodec.so.62 | grep ff_h264_set_mb_inspect_cb (nothing) ``` The static-link CLI consumer (`daedalus_decode_h264`, built via `DAEDALUS_FFMPEG_PREFIX`) was unaffected — static linking doesn't care about symbol visibility. The daedalus-v4l2 daemon `shadow_decoder` path (daedalus-v4l2 PR-Q3a.1, merged today) dlopens `libavcodec.so.62` and resolves the callback via `dlsym` — that needs the symbol exported. Observable: running the daemon with `DAEDALUS_SHADOW_MODE=1` against the freshly-published release -14 still logged `libavcodec lacks ff_h264_set_mb_inspect_cb (stock build, no daedalus-fourier 0016 patch) — shadow-mode unavailable`. The symbol IS in the .so as LOCAL; the daemon just can't reach it. ## Fix Add `ff_h264_set_mb_inspect_cb` to the global list in `libavcodec/libavcodec.v`. Single-line addition to the 0016 patch. Mirrored across the `arch/` + `debian/` patch trees. PKGREL bump 14 → 15, changelog entry added (debian side). PKGBUILD pkgrel bumped on arch side too. No behaviour change to the decode path: the callback is still opt-in via the `H264Context` function pointer; only consumers that have explicitly installed a callback pay the one-load-one-branch cost per MB. ## Verified - `patch -p1 --dry-run` against the kwiboo b57fbbe source tree applies cleanly across all three files (h264dec.h, h264_mb.c, libavcodec.v). - Once CI publishes -15 and hertz installs it, `nm -D /opt/fourier/lib/libavcodec.so.62 | grep ff_h264_set_mb_inspect_cb` should return a `T` (GLOBAL TEXT) entry, and the daemon's startup log should switch from "shadow-mode unavailable" to `shadow_decoder: enabled (DAEDALUS_SHADOW_MODE=1, daedalus-decoder version 0.0.1)`. ## dejavu-check Fixing the existing 0016 observation-hook to actually work as a dlsym intercept (the architectural shape the patch was designed for). NOT adding new per-kernel substitution. Same shape, same patch number, same intent. Just hiding/exporting plumbing.
marfrit added 1 commit 2026-05-26 13:38:35 +00:00
The 0016 patch declared ff_h264_set_mb_inspect_cb in h264dec.h and
defined it in h264_mb.c, but didn't touch libavcodec/libavcodec.v.
FFmpeg's default version script exports only `av_*`, `avcodec_*`,
`avpriv_*`, and `avsubtitle_free`; everything else is hidden as LOCAL
behind a `*` glob.  Result: `nm -D libavcodec.so.62 | grep
ff_h264_set_mb_inspect_cb` returned nothing → dlsym() returned NULL.

Static-link CLI consumer (daedalus_decode_h264) was unaffected
because static linking doesn't care about symbol visibility.  The
daedalus-v4l2 daemon shadow_decoder path (PR-Q3a.1) dlopens
libavcodec.so.62 and resolves the callback via dlsym — that needs
the symbol exported.

Fix: add ff_h264_set_mb_inspect_cb to the global list in
libavcodec/libavcodec.v.  Single-line addition to the 0016 patch.
Mirrored across the arch/ + debian/ patch trees.

PKGREL bump 14 → 15, changelog entry added (debian side).  PKGBUILD
pkgrel bumped on arch side too.  No behaviour change to the decode
path: the callback is still opt-in via the H264Context function
pointer; only consumers that have explicitly installed a callback
pay the one-load-one-branch cost per MB.

dejavu-check: this is fixing the existing 0016 observation-hook to
actually work as a dlsym intercept (the architectural shape the
patch was designed for).  NOT adding new per-kernel substitution.
Same shape, same patch number, same intent.  Just hiding/exporting
plumbing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
marfrit merged commit 9b0cb71370 into main 2026-05-26 14:54:28 +00:00
marfrit deleted branch noether/h264-mb-inspect-export-symbol 2026-05-26 14:54:28 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marfrit/marfrit-packages#108