Skip to content

Example programs

Every program in examples/ builds by default (ICLFORGE_BUILD_EXAMPLES=ON) and registers as a ctest entry named example.<name>, so "the examples still work" is checked by the same command as everything else (read_adm, encode_adm, and encode_iab additionally need -DICLFORGE_BUILD_ADM=ON; decode_ac4 and ac4_content_signature need ICLFORGE_BUILD_AC4, the C programs ICLFORGE_BUILD_CAPI, and the two TrueHD ones ICLFORGE_BUILD_TRUEHD as well, all on by default). These programs are also the source the library pages excerpt from — each page's "Full program" link lands on one of them.

Encoding

Example What it shows Discussed in
encode_ac3 Encode synthesized 5.1 PCM to an AC-3 elementary stream. Encoding AC-3
encode_eac3 E-AC-3 in both shapes: FrameEncoder up to 5.1, and AccessUnitEncoder bed + dependents for 7.1.4. Encoding E-AC-3
metadata A DRC profile, heavy compression, and a measured BS.1770 dialnorm. Metadata
custom_layout A layout no named LayoutId covers, via Plan::custom_locations. Channel plans & routing
multi_source_assignment Two sources onto one stream by explicit assignment — what backs the CLI's src=/map=. Channel plans & routing

Decoding & analysis

Example What it shows Discussed in
decode_stream Scan an unknown elementary stream, then decode it with the right decoder. Decoding
decode_robustness Skip a damaged mid-stream frame and keep decoding. Decoding
decode_ac4 Decode an AC-4 stream that arrives in pieces, by block, with a television's output settings, then read its presentations and metadata. ctest hands it a committed stream. AC-4 decoding
stream_edit Where each access unit starts, a metadata rewrite that leaves the audio bit-identical, and a cut that rejoins byte for byte. Decoding
level_metering Decode and meter: per-channel peak/RMS plus the speaker-ring energy vector. Muxing & sinks
qc_report Decode, measure BS.1770-4/Tech 3342, and check named QC delivery gates. Metadata

Spatial & Atmos

Example What it shows Discussed in
spatial_objects Pan a moving mono object onto the BS.775 ring, into plain 5.1 AC-3. Spatial & Atmos objects
atmos_objects Panned objects as Atmos-in-DD+, atop a legacy-playable 5.1 bed. Spatial & Atmos objects
scripted_object_motion Objects driven by an authored ObjectScene — per-segment interpolation, and the scene saved as JSON. Spatial & Atmos objects
osc_object_control A hand-built OSC 1.0 datagram, parsed and merged onto a SceneCursor object — no socket. Spatial & Atmos objects
atmos_fallback The same programme with and without the EMDF container — the either/or 5.1-fallback tradeoff. Spatial & Atmos objects
object_signing Sign an Atmos stream's EMDF container with an operator key. Object signing
ac4_content_signature Read an AC-4 stream's content signature, and with the operator's own key and chain sign it and check the result against a trust anchor. ctest hands it a committed stream, which carries none. AC-4 content signing
station_broadcast A fully worked 115-second diegetic Atmos scene with authored flight paths. A worked scene — station broadcast

Containers

Example What it shows Discussed in
mux_mkv Wrap in Matroska, with the track header kept accurate by a bitstream scan. Muxing & sinks
mux_mp4 Wrap in MP4, with the dec3/Atmos box built from the bitstream. Muxing & sinks
mux_fmp4 Fragment into CMAF and emit HLS/DASH manifests. Muxing & sinks
mux_ts Wrap in MPEG-2 TS with the right PMT descriptor. Muxing & sinks
mux_iamf Write an IAMF temporal unit sequence and wrap it in ISOBMFF. IAMF writing
iamf_coded Carry FLAC frames in IAMF with mux_coded(), then read them back and rebuild the channels with reconstruct_channels(). IAMF writing

File I/O, ADM & IAB

Example What it shows Discussed in
wav_roundtrip Real WAV in → encode → decode → WAV out, crossing the WAV↔A/52 channel order both ways. File I/O
read_adm Open an ADM BW64 file and print the parsed graph — needs -DICLFORGE_BUILD_ADM=ON. ADM / BW64 reading
encode_adm The whole read direction end to end: parse_bw64 → adm::build → AtmosEncoder, an ADM BWF master out to a DD+ JOC elementary stream. The one example needing iclforge::ac3 and the ADM modules together — needs -DICLFORGE_BUILD_ADM=ON. ADM → Atmos bridging
read_iab Parse a bare IAB stream and inspect its frame and element graph. IAB reading
encode_iab Map an IAB master through adm::build_iab and encode it as DD+ JOC — needs -DICLFORGE_BUILD_ADM=ON. ADM → Atmos bridging

C API

Example What it shows Discussed in
capi_encode_decode Encode/decode AC-3 through iclforge_c/iclforge.h — plain C, not C++, so the build itself proves the header is C-usable. C API
capi_encode_eac3 Encode a 5.1.2 E-AC-3 access unit (a bed plus one dependent substream) through the C API and decode it back. C API
capi_decode_truehd Decode a TrueHD or MLP stream to raw 24-bit PCM through the C API. C API
capi_encode_truehd Encode a stereo tone as TrueHD through the C API and decode it back; the codec is lossless, so every sample must return. C API

Python

Not part of ICLFORGE_BUILD_EXAMPLES/ctest above — a separate, Python-only program backing Python bindings, run directly (python examples/python/encode_decode_roundtrip.py) rather than built.

Example What it shows Discussed in
encode_decode_roundtrip.py The same 5.1 encode encode_ac3.cpp does, plus decoding it straight back, through the iclforge package. Python bindings
encode_eac3.py 7.1 E-AC-3 via ac3.eac3.access_unit_config_for_layout — the named-layout convenience, no hand-built chanmap. Python bindings
trace_export.py Decode frames and export the implementation trace as CSV and JSON Lines. Python bindings