import 'dart:async'; import 'dart:typed_data'; import '../proto/messages.pb.dart'; /// Abstract decoder interface. Feeds raw frames in, emits envelopes out. /// /// On native, the implementation runs in an isolate and batches envelopes. /// On Web, the implementation decodes synchronously in [feed]. abstract class Decoder { /// Stream of decoded envelopes (or batches thereof, flattened to per-envelope). Stream get envelopes; /// Spin up any background machinery. No-op on the inline (Web) decoder. Future start(); /// Push a raw frame for decoding. Returns immediately. void feed(Uint8List frame); /// Tear down. Stops the isolate (on native) and closes the stream. Future dispose(); }