Skip to main content

Module registry

Module registry 

Source
Expand description

In-process codec registry.

Every codec crate declares itself with one CodecInfo value — capabilities, factory functions, the container tags it claims, and (optionally) a probe function used to disambiguate genuine tag collisions. The registry stores those registrations and exposes three orthogonal lookups:

  • id-keyedmake_decoder(params) / make_encoder(params) walk the implementations registered under params.codec_id, filter by capability restrictions, and try them in priority order with init- time fallback.
  • tag-keyedresolve_tag(&ProbeContext) walks every registration whose tags contains ctx.tag, calls each probe (treating None as “returns 1.0”), and returns the id with the highest resulting confidence. First-registered wins on ties.
  • diagnosticall_implementations, all_tag_registrations.

The tag path explicitly DOES NOT short-circuit on “first claim with no probe” — every claimant is asked, so a lower-priority probed claim can out-rank a higher-priority unprobed one when the content is actually ambiguous (DIV3 XVID-with-real-MSMPEG4 payload etc.).

Structs§

CodecImplementation
Internal per-impl record held inside the registry’s id map. Kept distinct from CodecInfo so the id map stays cheap to walk during make_decoder / make_encoder lookups.
CodecInfo
A single registration: capabilities, decoder/encoder factories, optional probe, and the container tags this codec claims.
CodecRegistry