Commit 592a3be
feat(media/cenc): align pc2-node DRM packaging with MPEG-DASH/CENC and libav/MSE interop
End-to-end overhaul of the encrypted DASH/CENC packaging pipeline so that
third-party CENC-aware consumers (libav, dashjs/MSE) can play pc2-node
output, plus the supporting Lit/Chipotle integration prep, KID
unification, MPD generator fixes, and documentation/tooling.
Packaging (Rust + TS):
* cenc-encrypt: process_transform_init iterates every trak in moov and
wraps each sample entry in sinf/schm/tenc — audio init is no longer
left as plain mp4a while segment bytes are encrypted
* cenc-encrypt: per-codec clear-leader subsample encryption — 32 B for
AV1 (preserves OBU headers, fixes obu_forbidden_bit decoder errors),
0 B + flag=0 senc for AAC (matches bento4)
* cenc-encrypt: per-sample IV is a true global counter (seed +
sample_index as BE u64) — eliminates cross-segment IV collisions
under a shared CEK
* cenc-encrypt: updated wasm configuration and ffmpeg codec detection
hot path
* dashPackager: per-Representation init.mp4 via mp4-split split_init —
each rep declares exactly one trak, no more ghost streams
* dashPackager: pssh placed only as last child of moov; root-level
sibling rejected by Chromium MSE, in-moov-post-trak position required
for libav per-stream side-data hydration
* PSSH extraction switched from fragile marker-based scanning to full
ISO/IEC 23001-7 box-walking so diverse JSON payloads are supported
* MPEG-DASH manifest generator refined to comply with the standard
KID unification (frontend creator + server):
* hashToContentId removed — its dataToEncryptHash-derived bytes16 diverged
from the KID embedded in pssh/tenc
* on-chain bytes16 contentId now sources from the canonical pc2-node KID
via new kidToContentId helper
* .ddrm capsule kid sources from mediaEncodeResult.kid for media
* /api/storage/lit/encrypt: non-media KID is 16-byte UUID-derived
(was 32-byte randomBytes), bytes16-compatible
* drafts schema: migration 34 adds kid TEXT column so draft-resume
mints emit the correct contentId
Verification tooling:
* tools/verify-pssh-libav/verify-pssh.c — load-bearing C harness that
replicates the libav consumer path
(av_packet_side_data_get + av_encryption_init_info_get_side_data),
walks AVEncryptionInitInfo->next, supports multi-systemId accept-list
and --any / -q / -v / -vv verbosity, with Makefile + README
* tools/scripts/verify-pssh-libav.sh — ffprobe-based operator smoke test
* pc2-node/tests/media/pssh-discoverability.test.ts — synthetic placement
assertions
* pc2-node/tests/media/pssh-fixture.test.ts — real-asset fixture
asserting encv/sinf/tenc structure, pssh box layout, and v3.0 JSON
payload schema
* pc2-node/tests/media/pssh-json-extract.test.ts — coverage for the new
ISO box-walking extractor
Documentation:
* docs/core/MEDIA_DRM_PACKAGING.md — forward-looking engineering reference:
pipeline diagram, on-wire CENC contract, Elacity dDRM v3.0 JSON schema,
KID/CEK/IV roles, per-codec subsample rationale, verification tools,
failure-mode runbook, roadmap, glossary, ISO/IEC references
* docs/core/CENC_PACKAGING_COMPLIANCE.md — post-mortem covering the six
independent defects, per-layer failure analysis, root-cause cascade,
fix-by-fix table, file-by-file change list
* CHIPOTLE_V3_PROTOCOL.md §14 rewritten — most prior CENC compliance gaps
closed; remaining out-of-scope items called out (MPD ContentProtection,
browser EME CDM, saiz/saio, per-OBU AV1 subsamples)
* MEDIA-2026-04-28-DASH-MPD-COMPLIANCE cross-linked to the now-complete
init-side work and the two new core docs
* MEDIA-2026-05-18-CENC-PSSH-LIBAV-COMPLIANCE closed out (all 17 Phase
1-5 items, with inline notes for items that diverged from the original
plan)
Lit/Chipotle integration prep:
* task scaffolding for the new Lit integration
* relay bootstrap + connectivity groundwork carried forward from earlier
iterative attempts (now consolidated)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent e5280e5 commit 592a3be
56 files changed
Lines changed: 7910 additions & 957 deletions
File tree
- .cursor/tasks
- CHIPOTLE-V3-UNIVERSAL-ACTIONS
- MEDIA-2026-04-28-DASH-MPD-COMPLIANCE
- MEDIA-2026-05-18-CENC-PSSH-LIBAV-COMPLIANCE
- WASM-CEK-CUSTODY-2026-05-18
- docs/core
- plans
- packages/access/src
- contracts
- pc2-node
- crates/cenc-encrypt/src
- data
- lit-actions
- test-apps
- elacity-creator
- vendor/access
- elacity-health
- elacity-market/vendor/access
- src
- api
- services/media
- storage
- wallet-bridge
- tests/media
- fixtures
- wasm-apps/cenc-encrypt
- tools
- scripts
- verify-pssh-libav
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 156 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
Lines changed: 42 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
Lines changed: 155 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
0 commit comments