Skip to content

Base Decoder

mosaicolabs.bridges.mcap.decoders.decoder_base

MCAPMsgDecoderBase

MCAPMsgDecoderBase()

Bases: ABC, Generic[NativeType]

Encoding-specific runtime behavior needed to decode MCAP messages into plain dicts.

Each MCAPDecoder is associated to a specification of mcap.decoder.DecoderFactory: - ProtobufDecoderFactory() (from mcap_protobuf.decoder) - JsonDecoderFactory() (user defined for jsonschema)

that are passed to McapReader (from mcap.reader), allowing to turn MCAP agnostic data to domain specific data through iter_decoded_messages(). The resulting domain specific data (Message from google.protobuf.message or bytes for jsonschema) are then turned into a Python dict using one of the MCAPMsgDecoderBase.decode().

supported_encoding classmethod

supported_encoding()

The channel.message_encoding value this decoder handles (e.g. "protobuf").

decoder_factory abstractmethod staticmethod

decoder_factory()

The mcap.decoder.DecoderFactory to register on the shared reader.

register_schema

register_schema(schema)

Optional per-schema bookkeeping needed before iteration starts. No-op by default.

decode

decode(decoded_msg)

Turns decoded_msg produced by iter_decoded_messages() of mcap.reader into a plain dictionary after checking that the passed message encoding is supported by the decoder.