Patched decklink plugin with synchronized capture group support#554
Merged
Patched decklink plugin with synchronized capture group support#554
Conversation
…ture-group support Adds a reproducible Docker-based build setup for patched GStreamer plugins under tools/patched-gstreamer-plugins/. The first patch exposes BMD's synchronized capture group feature as a `capture-group` property on decklinkvideosrc, letting two SDI inputs on the same physical card share a hardware time origin so audio/video are sample-aligned across ports. Build target is GStreamer 1.22.12 (forward-ABI-compatible with 1.24, 1.26+). Multi-arch (amd64/arm64) via docker buildx + QEMU. Built artifacts are distributed via GitHub release patched-plugins-v1.0-gst1.22.12. The runtime Dockerfile fetches the right architecture's .so from the release and installs it over the distro-shipped libgstdecklink.so. The strom-side block-property exposure lives in decklink.rs and will be committed separately. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a synchronized_capture: bool block property to decklink_input. When enabled, strom derives a deterministic capture group ID from the flow ID and sets it on the underlying decklinkvideosrc element via the patched plugin's capture-group property. Hashing the flow ID (rather than letting the user pick an integer) prevents the foot-gun where two flows accidentally pick the same group ID — BMD synced capture only works within a single pipeline anyway, and hash-of-flow_id is unique-per-flow by construction. If the runtime has the stock unpatched decklink plugin, the capture-group property is absent and we skip silently — no error, the block just runs without sync. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
tools/patched-gstreamer-plugins/. Multi-arch (amd64/arm64) via docker buildx + QEMU, pinned to GStreamer 1.22.12 ABI.capture-groupint property ondecklinkvideosrc. Lets multiple inputs on the same physical card share a hardware time origin so audio/video are sample-aligned across SDI ports.patched-plugins-v1.0-gst1.22.12. The runtime Dockerfile fetches the right architecture's.sofrom that release and overlays the distro-shippedlibgstdecklink.so.synchronized_capture: boolblock property todecklink_input. Strom hashes the flow ID to a deterministic capture group ID so two synchronized blocks in the same flow always share a group, and different flows can never collide. If the runtime has the stock plugin (no patch), the option is silently ignored.Why a patched plugin
Stock gst-plugins-bad doesn't expose
bmdVideoInputSynchronizeToCaptureGroup/bmdDeckLinkConfigCaptureGroupeven though every modern BMD SDK (12.2+) supports them, and the synced-capture lifecycle (one StartStreams/StopStreams call per group, not per element) doesn't match the plugin's element model. Our patch wraps the BMD calls with a refcounted leader-tracking layer so exactly one StartStreams and one StopStreams reach the driver per group, on the sameIDeckLinkInputinstance.Known BMD driver quirk
StopStreams()on an input that was enabled with the sync flag blocks for ~12 s before returning. Reproducible in BMD's own SynchronizedCapture SDK example, see forum thread 190441. The patch accepts the wait — bypassingStopStreamsviolates the documented teardown order and breaks subsequent pipeline starts with caps not-negotiated. The block property's description warns the operator about this so it isn't mistaken for a strom bug.Test plan
cd tools/patched-gstreamer-plugins && ./build.shcapture-groupproperty is exposed:GST_PLUGIN_PATH=$PWD/dist/linux_amd64 gst-inspect-1.0 decklinkvideosrc | grep capture-group.sofrom the releasedecklink_inputblocks pointing at the same physical card, both withsynchronized_captureenabled. Run a phase-cancellation pipeline (one inverted, summed in audiomixer); the result should be silent across the audible band.🤖 Generated with Claude Code