Repository navigation
feat(video): port the buffered video encapsulation layer - #581
Merged
Merged
Conversation
Verbatim from v2.0-development src/encapsulated/encapsulatedVideo.js and its 8-test suite, with one mechanical adjustment for the package boundary: DicomMetaDictionary and isVideoTransferSyntax now come from @dcmjs-org/core instead of relative paths. buildVideoDataset shapes the Supplement 225 Video Photographic Image shell (XC modality, cine timing, the (7FE0,0003) uint64 total length as a BigInt), encapsulateVideo splits the MP4 into fragment-sized exact ArrayBuffer slices, and extractEncapsulatedVideo concatenates fragments and truncates to the declared length so the odd-fragment pad byte drops on extraction. Co-Authored-By: Claude Fable 5 <[email protected]>
The video half of v2's encapsulated index only — the PDF half (encapsulatedPdf) belongs to the media wave. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This ports the buffered video encapsulation layer — no findings live here, so it's the small one of the wave. Supplement 225 lets an MP4's H.264 stream travel inside a Video Photographic Image instance verbatim: the pixel data fragments are consecutive byte ranges of the one stream, so extraction is concatenation and the round trip is byte-identical. Three functions, mirroring the shape of
encapsulatedPdf:buildVideoDatasetmakes the naturalized dataset shell (XC modality, CineRate/FrameTime from the measured rate, the YBR_PARTIAL_420 8-bit geometry PS3.5 §8.2.6 mandates for MPEG-4 AVC syntaxes, and the (7FE0,0003) Encapsulated Pixel Data Value Total Length as a BigInt — UV is a uint64);encapsulateVideosplits the MP4 into fragment-sized exact ArrayBuffer slices (default 256 MiB, validated even 32-bit per PS3.5 §A.4); andextractEncapsulatedVideoconcatenates fragments and truncates to the declared total length, which is what lets the Part 10 writer's pad byte on an odd-length final fragment drop cleanly on extraction.On provenance:
encapsulatedVideo.jsand its 8-test suite are verbatim ports from the v2 branch, isolated in their own commit with one mechanical adjustment —DicomMetaDictionaryandisVideoTransferSyntaxnow come from@dcmjs-org/coreinstead of relative paths. The hand-written remainder is the ~30 lines of index wiring in the second commit, which exports only the video half of v2's encapsulated index; the PDF half (encapsulatedPdf) belongs to the media wave, not this package.The test suite pins the element list against the Supplement 225 reference fixture's dataset (the large-files
build_dicom_video.pyoracle), exercises fresh-UID minting and overrides, the ffmpeg-corrective error for unsupported codecs, fragment-size validation, the byte-identical round trip over an odd-length stream with a simulated writer pad byte, the declared-length-absent fallback, and the corrective rejection of a non-video dataset. Fifty tests in the package overall, all green, still no binary fixtures.🤖 Generated with Claude Code